diff --git a/robocze/ask.php b/robocze/ask.php index b2d97ca..88bfeb7 100644 --- a/robocze/ask.php +++ b/robocze/ask.php @@ -1,26 +1,18 @@ - -* @link http://suczawa.ath.cx/ -**/ - -$i=intval($_GET['name']); -require('./init.php'); -if ($i == 0) -{ - blad('Zdjecie nie istnieje!'); -} -$sql = "SELECT * FROM `photos` WHERE `id`='$i'"; -if (!$result = $DB->query($sql)) +'; +?> + + +query('SELECT * FROM photos WHERE id=\'$i\'')) { - blad('Nie mozna pobrac informacji o zdjeciu!'); + showError('MySQL error'); } -#sprawdź, czy zdjęcie istnieje -$cnt = $result->num_rows; if ($result->num_rows == 0) { $row = array( @@ -36,17 +28,24 @@ else $row['author'] = ($row['author']=='') ? 'Autor nieznany' : $row['author']; $row['description'] = ($row['description']=='') ? 'Brak opisu' : $row['description']; -} - -header('Content-Type: text/xml'); -echo ''; -?> - - - : -

- - - - -
+} +?> + + + + +query('SELECT COUNT(id) FROM photos WHERE id<'.$id)->fetch_row(); #check if there are some previous photos + $prev=$prev[0]; + if($prev>0) { + $prev=$DB->query('SELECT * FROM photos WHERE id<'.$id.' ORDER BY id DESC LIMIT 1;')->fetch_assoc(); #if yes, get the previous photo's data + echo ''; #and send it + } + $next = $DB->query('SELECT COUNT(id) FROM photos WHERE id>'.$id)->fetch_row(); #check if there are some next photos + $next=$next[0]; + if($next>0) { + $next=$DB->query('SELECT * FROM photos WHERE id>'.$id.' ORDER BY id ASC LIMIT 1;')->fetch_assoc(); #if yes, get the next photo's data + echo ''; #and send it + } +?> +
diff --git a/robocze/config.php b/robocze/config.php index 8599acb..73f5325 100644 --- a/robocze/config.php +++ b/robocze/config.php @@ -1,17 +1,7 @@ - -* @link http://suczawa.ath.cx/ -**/ - -define('DB_HOST','localhost'); -define('DB_USER','root'); -define('DB_PASS',''); -define('DB_NAME','galeria'); - -//liczba zdjęć na stronę -$per_page=3; -?> + diff --git a/robocze/display.php b/robocze/display.php new file mode 100644 index 0000000..d2d8d77 --- /dev/null +++ b/robocze/display.php @@ -0,0 +1,105 @@ + 0 || + strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || + strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false; + header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround + echo ''; +?> + + + + + Podgląd zdjęcia nr <?=$id?> + + + + + +
+query('SELECT * FROM photos WHERE id=\'$i\'')) +{ + showError('MySQL error'); +} + +if ($result->num_rows == 0) +{ + $row = array( + 'author' => '--', + 'description' => 'Zdjęcie usunięte', + 'photo_name' => 'no_image.png', + 'id' => $i + ); +} +else +{ + $row = $result->fetch_assoc(); + + $row['author'] = ($row['author']=='') ? 'Autor nieznany' : $row['author']; + $row['description'] = ($row['description']=='') ? 'Brak opisu' : $row['description']; +}?> +
+ Zdjęcie +
+ Autor:
+ Opis: +
+query('SELECT COUNT(id) FROM photos WHERE id<'.$id)->fetch_row(); #check if there are some previous photos +$prev=$prev[0]; +if($prev>0) { +$prev=$DB->query('SELECT * FROM photos WHERE id<'.$id.' ORDER BY id DESC LIMIT 1;')->fetch_assoc(); #if yes, get the previous photo's data +?> + + + +query('SELECT COUNT(id) FROM photos WHERE id>'.$id)->fetch_row(); #check if there are some next photos +$next=$next[0]; +if($next>0) { +$next=$DB->query('SELECT * FROM photos WHERE id>'.$id.' ORDER BY id ASC LIMIT 1;')->fetch_assoc(); #if yes, get the next photo's data +?> + + + + +
+ + diff --git a/robocze/download.php b/robocze/download.php new file mode 100644 index 0000000..3605ec8 --- /dev/null +++ b/robocze/download.php @@ -0,0 +1,48 @@ + 0 || + strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || + strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false; + header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround + echo ''; +?> + + + + + Download + + + +
+ Logo strony +
+ +
+ +
+ + diff --git a/robocze/functions.php b/robocze/functions.php index 5b4952e..d59e50b 100644 --- a/robocze/functions.php +++ b/robocze/functions.php @@ -1,67 +1,5 @@ - -* @link http://suczawa.ath.cx/ -**/ - -#wyświetl błąd -function blad($msg) -{ - die(' -

Blad Galerii Zdjec Suczawa 2009!

- '.$msg.''); -} - -function GenerujListeStron() -{ - global $cnt; - global $page; - $content = ''; - - if ($page>1) - { - $content .= '<<'; - $content .= '  < '; - } - - #wygeneruj strony - for ($i=1;$i<=$cnt;$i++) - { - if ($i==$page) - { - if ($i == $cnt) - { - $content .= ''.$i.''; - } - else - { - $content .= ''.$i.''.' | '; - } - } - else - { - if ($i == $cnt) - { - $content .= ''.$i.' '; - } - else - { - $content .= ''.$i.' | '; - } - } - } - #dodaj linka "+1 strona" oraz do ostatniej - if ($page<$cnt) - { - $content .= '>'; - $content .= '  >>'; - } - - #dodaj linka do ostatniej strony - echo $content; -} - -?> + diff --git a/robocze/gallery.php b/robocze/gallery.php index 199040c..1cdabe0 100644 --- a/robocze/gallery.php +++ b/robocze/gallery.php @@ -1,88 +1,75 @@ + 0 || + strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || + strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false; + header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround + echo ''; +?> + + + + + Galeria zdjęć + + + + +
+ Logo strony +
+
-* @link http://suczawa.ath.cx/ -**/ - -$page= (isset($_GET['page'])) ? intval($_GET['page']) : 0; - -$xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i', -$_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 || -strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || -strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false; -header('Content-Type: '.($xhtml ? 'application/xhtml+x' : 'text/ht').'ml; charset="utf-8"'); - -require('./init.php'); - -echo ''; - -?> - - - - - Galeria Suczawa 2009 - - - - - -
-
- - query($sql)) - { - blad('Nie mozna pobrac zdjec uzytkownikow!'); - } - - for($i=$page*$per_page; $row = $result->fetch_assoc(); $i++) - { - echo ''; - if($i%3==2 && $i!=$count-1) echo ''; - - } - while($i%3) { - $i++; - echo ''; - } - ?> - -
'.$row['photo_name'].'
 
-
-
-
Strony: - -
-
-
-
-
-

-
- Poprzedni - Zdjecie - Nastepny -
-
-
Autor:
- Zamknij -
-
-
-
- Valid XHTML 1.1 - Poprawny CSS! -
-
- - + if (!$result = $DB->query('SELECT * FROM photos LIMIT '.(($page-1)*PERPAGE).' , '.PERPAGE)) { + showError('MySQL error'); + } + while($row = $result->fetch_assoc() ){ +?> +
+ + Zdjęcie: <?=$row['photo_name']?> + +
+ +
+query('SELECT COUNT(id) AS count FROM photos')) { + showError('MySQL error'); + } + $row = $result->fetch_assoc(); + $count = $row['count']; + $pcount=ceil($result[0]/PERPAGE); +?> +
Strony: + << < | '; + for($i=1; $i<$page; $i++) { + echo ''.$i.' | '; + } + echo $page.' | '; + for($i=$page+1; $i<=$pcount; $i++) { + echo ''.$i.' | '; + } + if($page==$pcount) + echo '> >>'; + else + echo '> >>'; + ?> +
+
+ +
+ + diff --git a/robocze/images/download.png b/robocze/images/download.png new file mode 100644 index 0000000..94a2ea5 Binary files /dev/null and b/robocze/images/download.png differ diff --git a/robocze/images/forum.png b/robocze/images/forum.png new file mode 100644 index 0000000..ce3e828 Binary files /dev/null and b/robocze/images/forum.png differ diff --git a/robocze/images/galeria.png b/robocze/images/galeria.png new file mode 100644 index 0000000..d89e169 Binary files /dev/null and b/robocze/images/galeria.png differ diff --git a/robocze/images/hasło.png b/robocze/images/hasło.png new file mode 100644 index 0000000..3a6f958 Binary files /dev/null and b/robocze/images/hasło.png differ diff --git a/robocze/images/linki.png b/robocze/images/linki.png new file mode 100644 index 0000000..5366cef Binary files /dev/null and b/robocze/images/linki.png differ diff --git a/robocze/images/logo.png b/robocze/images/logo.png new file mode 100644 index 0000000..b786bf9 Binary files /dev/null and b/robocze/images/logo.png differ diff --git a/robocze/index.php b/robocze/index.php new file mode 100644 index 0000000..914c510 --- /dev/null +++ b/robocze/index.php @@ -0,0 +1,34 @@ + 0 || + strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || + strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false; + header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround + echo ''; +?> + + + + + Strona główna + + + +
+ Logo strony +
+ +
+ +
+ + diff --git a/robocze/init.php b/robocze/init.php index 0de3fba..c9344ed 100644 --- a/robocze/init.php +++ b/robocze/init.php @@ -1,105 +1,12 @@ - -* @link http://suczawa.ath.cx/ -**/ - -#dołącz plik konfiguracyjny oraz funkcje -require('./config.php'); -require('./functions.php'); - -#sprawdź, czy jest wyłączone register globals oraz magic quotes? -if (ini_get('register_globals') == 1) -{ - ini_set('register_globals', '0'); - if (ini_get('register_globals') == 1) - { - blad('Could not disable register_globals.'); - } -} - -if (get_magic_quotes_gpc()) -{ - blad('Prosze wylaczyc magic_quotes_gpc w php.ini!'); -} - -#połącz z bazą danych -$DB = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); - -#sprawdź pomyślność połączenia -if ($DB->connect_error) -{ - blad('Could not connect do database server ('.$DB->connect_errno.')'.$DB->connect_error); -} -if (!$DB->query("SET NAMES 'utf8'")) -{ - blad('Could not set character to UTF-8'); -} - -#pobierz id pierwszego zdjęcia -$sql = "SELECT `id` FROM `photos` ORDER BY `id` LIMIT 1"; -if (!$result = $DB->query($sql)) -{ - blad('Nie mozna odczytac id pierwszego zdjecia!'); -} - -$row = $result->fetch_assoc(); -$firstid = $row['id']; -$result->free; //zwolnij pamięć -unset($row); - -#pobierz id ostatniego zdjęcia -$sql = "SELECT `id` FROM `photos` ORDER BY `id` DESC LIMIT 1"; -if (!$result = $DB->query($sql)) -{ - blad('Nie mozna odczytac id ostatniego zdjecia!'); -} - -$row = $result->fetch_assoc(); -$lastid = $row['id']; - -$result->free; //zwolnij pamięć -unset($row); - -#pobierz liczbę zdjęć w galerii -$sql = "SELECT COUNT(`id`) AS `count` FROM `photos`"; - -if (!$result = $DB->query($sql)) -{ - blad('Nie mozna odczytac liczby zdjec!'); -} -$row = $result->fetch_assoc(); -$count = $row['count']; - -$result->free; //zwolnij pamięć - -// -//wygeneruj strone -// -if (isset($_GET['page'])&&($_GET['page']!=1)) -{ - if (!is_numeric($_GET['page'])) - { - die('Hacking attempt'); - } - $value = ($_GET['page']-1)*$per_page; - $limit = 'LIMIT '.$value . ', '.$per_page; - $page = $_GET['page']; -} -else -{ - $limit = 'LIMIT 0, '.$per_page; - $page=1; -} -$cnt = ceil($count / $per_page); -if(isset($_GET['page']) && ($_GET['page']>$cnt)) -{ - blad('Podana strona nie istnieje!'); -} -// -//koniec generowania stron -// -?> +connect_error) { #check if there were any errors connecting + showError('Could not connect do database server ('.$DB->connect_errno.'): '.$DB->connect_error); +} +if (!$DB->query("SET NAMES 'utf8'")) { #use utf-8 + showError('Could not set character to UTF-8'); +} +?> diff --git a/robocze/script.js b/robocze/script.js index a5eb48a..71c77f1 100644 --- a/robocze/script.js +++ b/robocze/script.js @@ -1,118 +1,103 @@ -var ajax; -var disp; -var disp_img; -var disp_info; -var disp_name; -var disp_author, disp_a; -var curr, last, first; - -function init() { - initAjax(); - disp=document.getElementById("disp"); - disp_a=document.getElementById("disp_a"); - disp_name=document.getElementById("disp_name"); - disp_author=document.getElementById("disp_author"); - disp_img=document.getElementById("disp_img"); - disp_info=document.getElementById("disp_info"); - - if (!document.importNode) { - document.importNode = function(node, allChildren) { - switch (node.nodeType) { - case 1: - var newNode = document.createElement(node.nodeName); - /*if (node.attributes && node.attributes.length > 0) - for (var i = 0; il = node.attributes.length; i < il) - newNode.setAttribute(node.attributes[i].nodeName, node.getAttribute(node.attributes[i++].nodeName));*/ - //alert("Attr done"); - if (allChildren && node.childNodes && node.childNodes.length > 0) { - il=node.childNodes.length; - for (var i = 0; i < il; i++) - newNode.appendChild(document.importNode(node.childNodes[i], allChildren)); - } - return newNode; - break; - default: - return document.createTextNode(node.nodeValue); - break; - } - }; - } - - if(!disp_name.firstChild) - disp_name.appendChild(document.createTextNode(' ')); - - if(!disp_author.firstChild) - disp_author.appendChild(document.createTextNode(' ')); - -} - -function initAjax() { - try { - if (window.XMLHttpRequest) { - ajax = new XMLHttpRequest(); - ajax.overrideMimeType('text/xml'); - } - else if (window.ActiveXObject) - ajax = new ActiveXObject('Microsoft.XMLHTTP'); - else throw 'AJAX Error'; - } - catch (e) { - return false; - } - if (!ajax) { - alert('AJAX Error'); - return false; - } - return true; -} - - -function response() { - if (ajax.readyState != 4 || ajax.status != 200) - return; - - var xml = ajax.responseXML; - while(disp_info.hasChildNodes()) disp_info.removeChild(disp_info.firstChild); - elemXML=xml.getElementsByTagName("desc")[0]; - if(document.importNode) children=document.importNode(elemXML, true).childNodes; - else children=elemXML.childNodes; - for(i=0; i0) { + document.getElementById("next_image").src=xml.getElementsByTagName("next")[0].getAttribute("thumb"); + nextid=xml.getElementsByTagName("next")[0].getAttribute("id"); + document.getElementById("next_image").alt=nextid; + document.getElementById("next").style.display="block"; + } + else { + document.getElementById("next").style.display="none"; + nextid=-1; + } + + if(xml.getElementsByTagName("prev").length>0) { + document.getElementById("prev_image").src=xml.getElementsByTagName("prev")[0].getAttribute("thumb"); + previd=xml.getElementsByTagName("prev")[0].getAttribute("id"); + document.getElementById("prev_image").alt=previd; + document.getElementById("prev").style.display="block"; + } + else { + document.getElementById("prev").style.display="none"; + previd=-1; + } +} + +function previewImage(el) { + if(el==-1) return 0; + ajax.onreadystatechange = response; + ajax.open('GET', path+ '/ask.php?id=' + el, true); + ajax.send(null); +} + +function prev() { + previewImage(previd); +} + +function next() { + previewImage(nextid); +} diff --git a/robocze/style.css b/robocze/style.css index 89307a2..5934f25 100644 --- a/robocze/style.css +++ b/robocze/style.css @@ -1,110 +1,138 @@ -body { - background-color: black; - text-align: center; -} -a { - text-decoration: none; -} -a:hover { - text-decoration: underline; -} -#page { - margin: auto; - width: 700px; -} -.image_outer_black { - width: 190px; - height: 120px; - padding: 7px; - margin: 5px; - display: inline-block; - text-align: center; -} -.image_outer { - width: 190px; - height: 120px; - padding: 7px; - margin: 5px; - background-color: gray; - display: inline-block; - text-align: center; - cursor: pointer; -} -.image_outer:hover { - background-color: #F0F0F0; -} -.image { - max-width: 200px; - max-height: 120px; - -} -#images_outer { - text-align: center; -} -#images { - margin:auto; -} -#disp { - width: 80%; - background-color: gray; - border: solid 1px black; - margin-left: auto; - margin-right: auto; - position: fixed; - top: 10%; - left: 10%; - display:none; - text-align: center; - padding: 2px; - font-size: 8pt; -} - -#disp_close { - cursor: pointer; -} - -#disp_close:hover { - text-decoration: underline; -} - - -#disp_a, #disp_a img { - border: none; -} - -#disp_prev, #disp_next { - margin-bottom: 15%; -} - -#disp_img { - text-align: center; - margin:auto; - max-height: 300px; - max-width: 80%; - height: 300px; -} - -#disp_info { - clear: both; -} - -#icons { - padding: 0px; - margin: 0px; - text-align: center; -} - -#icons a, #icons img { - padding: 0px; - margin: 0px; - text-decoration: none; - border: none; -} -#pages { - color: white; - text-align: left; - margin-left: 40px; -} -#pages a, #pages a:link, #pages a:hover, #pages a:visited { - color: white; -} +html, body { + min-height:100%; + margin: 0px; + padding: 0px; + background-color: #515151; + text-align: center; + color: white; +} +#page, #display { + font-family: sans-serif; + font-size: 8.5pt; + margin: 0 auto; + width: 800px; + height: auto !important; + height: 100%; + min-height: 100%; + background-color: #353535; + position: relative; +} +#page { + text-align: left; + height: 100%; + min-height: 100%; +} +#display { + padding-top: 26px; +} +.image_outer { + display: inline-block; + _display: inline; + background-color: #515151; + padding: 13px; + margin: 10px; + height: 100px; + width: 150px; + _width: 180px; + text-align: center; +} +.image_outer:hover { + background-color: #989898; +} +.image_outer img { + border: none; +} +.image { + max-height: 100px; + max-width: 150px; +} +#curr_image { + max-width: 500px; + max-height: 300px; +} +#prev, #next { + padding: 20px; + cursor: pointer; +} +#prev { + float: left; +} +#next { + float: right; +} +a:link, a:visited { + color: white; + text-decoration: none; +} +a:hover { + color: white; + text-decoration: underline; +} +a img { + border: none; +} +#prev_image, #next_image { + border: none; +} +#pages { + margin: 5px; + color: #898989; +} +#pages a:link, #pages a:visited { + color: #4c88cb; + text-decoration: none; +} +#pages a:hover { + color: #4c88cb; + text-decoration: underline; +} +#content { + padding-bottom: 60px; +} +#footer { + font-size: 7pt; + color: gray; + text-align: center; + width: 800px; + position: absolute; + bottom: 0; + border-top: 2px solid #4c88cb; + padding-top: 20px; +} +#copyright { + color: #4c88cb; + text-decoration: none; +} +#links { + padding-top: 10px; +} +#links a:link, #links a:visited { + text-decoration: none; + font-size: 8pt; + color: #898989; +} +#links a:hover { + text-decoration: underline; + font-size: 8pt; + color: #898989; +} +#dlinks { + text-align: center; +} +#dlinks_inner { + width: 756px; + text-align: left; + margin: auto; +} +#dlinks_inner img { + margin: 16px 0px 3px 0px; +} +.dframe { + background-color: #2f2f2f; + border: 1px solid #292828; + margin: 17px 8px 3px 8px; + font-size: small; +} +#dlinks a img { + margin: 16px 0px 16px 0px; +}