Nowa wersja webmasterska

git-svn-id: https://svn.pioder.pl/sg-svn@12 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8
This commit is contained in:
chp1994
2009-06-23 12:57:21 +00:00
parent 5aa0c7da6e
commit 6de08b68b4
16 changed files with 557 additions and 536 deletions

View File

@@ -1,88 +1,75 @@
<?php
require_once('init.php'); #init stuff
$page=(isset($_GET['page']))?intval($_GET['page']):1; #check which page should be loaded
$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"'); #IE doesn't support application/xhtml+xml - workaround
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<title>Galeria zdjęć</title>
<link type="text/css" href="style.css" rel="stylesheet" />
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div id="page">
<img src="images/logo.png" width="800px" alt="Logo strony" />
<div id="content">
<div id="images">
<?php
/**
* @package Galeria Suczawa 2009
* @file gallery.php
* @version $Id$
* @author chp1994 <chp1994@gmail.com>
* @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 '<?xml version="1.0" encoding="utf-8"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<title>Galeria Suczawa 2009</title>
<link type="text/css" href="style.css" rel="stylesheet" />
<script type="text/javascript">
sciezka = 'http://' + '<?= $_SERVER['HTTP_HOST']; ?>' + '/sg/robocze/';
</script>
<script type="text/javascript" src="script.js"><!-- AJAX Library by chp1994(c) //--></script>
</head>
<body onload="javascipt:init()">
<div id="page">
<div id="images_outer">
<table id="images"><tr>
<?php
//$sql = "SELECT * FROM `photos` LIMIT ".($page*$per_page).", $per_page";
$sql = "SELECT * FROM `photos` $limit";
if (!$result = $DB->query($sql))
{
blad('Nie mozna pobrac zdjec uzytkownikow!');
}
for($i=$page*$per_page; $row = $result->fetch_assoc(); $i++)
{
echo '<td class="image_outer" onclick="javascript:previewImage('.($row['id']).')"><img alt="'.$row['photo_name'].'" src="images/upload/'.$row['thumb_name'].'" class="image" /></td>';
if($i%3==2 && $i!=$count-1) echo '</tr><tr>';
}
while($i%3) {
$i++;
echo '<td class="image_outer_black">&nbsp;</td>';
}
?>
</tr>
</table>
</div>
<div id="pages_outer">
<div id="pages">Strony:
<?php
GenerujListeStron();
?>
</div>
</div>
<div id="disp">
<div id="disp_middle">
<div id="disp_inner">
<div><h3 id="disp_name"> </h3></div>
<div id="disp_top">
<img id="disp_prev" src="images/prev.png" onclick="javascript:prev()" alt="Poprzedni"></img>
<a id="disp_a" href=""><img id="disp_img" src="" alt="Zdjecie" /></a>
<img id="disp_next" src="images/next.png" onclick="javascript:next()" alt="Nastepny"></img>
</div>
<div id="disp_info"></div>
<div><b>Autor:</b> <a id="disp_author"> </a></div>
<a id="disp_close" onclick="javascript:closeDisp()">Zamknij</a>
</div>
</div>
</div>
<div id="icons">
<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img width="88px" height="31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Poprawny CSS!" /></a>
</div>
</div>
</body>
</html>
if (!$result = $DB->query('SELECT * FROM photos LIMIT '.(($page-1)*PERPAGE).' , '.PERPAGE)) {
showError('MySQL error');
}
while($row = $result->fetch_assoc() ){
?>
<div class="image_outer">
<a target="blank" href="display.php?id=<?=$row['id']?>">
<img class="image" height="100px" alt="Zdjęcie: <?=$row['photo_name']?>" src="<?=$row['thumb_name']?>" id="image_<?=$row['id']?>" />
</a>
</div>
<?
}
?>
</div>
<?
if (!$result = $DB->query('SELECT COUNT(id) AS count FROM photos')) {
showError('MySQL error');
}
$row = $result->fetch_assoc();
$count = $row['count'];
$pcount=ceil($result[0]/PERPAGE);
?>
<div id="pages">Strony:
<?if($page==1)
echo'&lt;&lt;&#160;&lt;&#160;|&#160;';
else
echo '<a href="gallery.php?page=1">&lt;&lt;</a>&#160;<a href="gallery.php?page='.($page-1).'">&lt;</a>&#160;|&#160;';
for($i=1; $i<$page; $i++) {
echo '<a href="gallery.php?page='.$i.'">'.$i.'</a>&#160;|&#160;';
}
echo $page.'&#160;|&#160;';
for($i=$page+1; $i<=$pcount; $i++) {
echo '<a href="gallery.php?page='.$i.'">'.$i.'</a>&#160;|&#160;';
}
if($page==$pcount)
echo '&gt;&#160;&gt;&gt;';
else
echo '<a href="gallery.php?page='.($page+1).'">&gt;</a>&#160;<a href="gallery.php?page='.$pcount.'">&gt;&gt;</a>';
?>
</div>
</div>
<div id="footer">
<a id="copyright">Copyright © 2009 ...</a><br />
<div id="links">
<a href="index.php">Strona główna</a> | <a href="gallery.php">Fotogaleria</a> | <a href="download.php">Download</a> | <a href="http://suczawa.ath.cx">Forum</a>
</div>
</div>
</div>
</body>
</html>