Poprawki w PHP i ścieżki do katalogu
git-svn-id: https://svn.pioder.pl/sg-svn@13 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8
This commit is contained in:
@@ -1,33 +1,35 @@
|
||||
<?php
|
||||
require_once('init.php'); #init stuff
|
||||
$id=(isset($_GET['id']))?intval($_GET['id']):1; #check which photo 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>Podgląd zdjęcia nr <?=$id?></title>
|
||||
<link type="text/css" href="style.css" rel="stylesheet" />
|
||||
<script type="text/javascript">
|
||||
<!-- <[CDATA[ -->
|
||||
path='http://<?=$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI'])?>';
|
||||
<!-- ]]> -->
|
||||
</script>
|
||||
<script type="text/javascript" src="script.js"></script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div id="display">
|
||||
<?php
|
||||
/**
|
||||
* @package Galeria Suczawa 2009
|
||||
* @file display.php
|
||||
* @version $Id$
|
||||
**/
|
||||
require_once('./init.php'); #init stuff
|
||||
|
||||
$id=(isset($_GET['id'])) ? intval($_GET['id']) : 1; #check which photo should be loaded
|
||||
|
||||
NaglowekXHTML();
|
||||
?>
|
||||
|
||||
<!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>Podgląd zdjęcia nr <?=$id?></title>
|
||||
<link type="text/css" href="style.css" rel="stylesheet" />
|
||||
<script type="text/javascript">
|
||||
<!-- <[CDATA[ -->
|
||||
path='http://<?=$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI'])?>';
|
||||
<!-- ]]> -->
|
||||
</script>
|
||||
<script type="text/javascript" src="script.js"></script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div id="display">
|
||||
<?
|
||||
if (!$result = $DB->query('SELECT * FROM photos WHERE id=\'$i\''))
|
||||
$sql = "SELECT * FROM `photos` WHERE id='$id'";
|
||||
if (!$result = $DB->query($sql))
|
||||
{
|
||||
showError('MySQL error');
|
||||
showError('Nie mozna pobrac informacji o zdjeciu!');
|
||||
}
|
||||
|
||||
if ($result->num_rows == 0)
|
||||
@@ -45,61 +47,62 @@ else
|
||||
|
||||
$row['author'] = ($row['author']=='') ? 'Autor nieznany' : $row['author'];
|
||||
$row['description'] = ($row['description']=='') ? 'Brak opisu' : $row['description'];
|
||||
}?>
|
||||
<div id="current">
|
||||
<a href="<?=htmlspecialchars($row['photo_name'])?>"><img id="curr_image" height="300px" alt="Zdjęcie" src="<?=htmlspecialchars($row['photo_name'])?>" /></a>
|
||||
<br/>
|
||||
<b>Autor: </b><a id="author"><?=htmlspecialchars($row['author'])?></a><br />
|
||||
<b>Opis: </b><a id="description"><?=nl2br(htmlspecialchars($row['description']))?></a>
|
||||
</div>
|
||||
<?
|
||||
$prev = $DB->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
|
||||
?>
|
||||
<div id="prev">
|
||||
<a onclick="javascript:prev()">
|
||||
<img id="prev_image" height="100px" alt="<?=$prev['id']?>" src="<?=$prev['thumb_name']?>" /><br/>
|
||||
</a>
|
||||
<a onclick="javascript:prev()">Poprzednie zdjęcie</a>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<div id="prev" style="display: none">
|
||||
<a onclick="javascript:prev()">
|
||||
<img id="prev_image" height="100px" alt="" src="" /><br/>
|
||||
</a>
|
||||
<a onclick="javascript:prev()">Poprzednie zdjęcie</a>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
$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
|
||||
?>
|
||||
<div id="next">
|
||||
<a onclick="javascript:next()">
|
||||
<img id="next_image" height="100px" alt="<?=$next['id']?>" src="<?=$next['thumb_name']?>" /><br/>
|
||||
</a>
|
||||
<a onclick="javascript:next()">Następne zdjęcie</a>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<div id="next" style="display: none">
|
||||
<a onclick="javascript:next()">
|
||||
<img id="next_image" height="100px" alt="" src="" /><br/>
|
||||
</a>
|
||||
<a onclick="javascript:next()">Następne zdjęcie</a>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
?>
|
||||
<div id="current">
|
||||
<a href="images/upload/<?=htmlspecialchars($row['photo_name'])?>"><img id="curr_image" height="300px" alt="ZdjÄ_cie" src="images/upload/<?=htmlspecialchars($row['photo_name'])?>" /></a>
|
||||
<br/>
|
||||
<b>Autor: </b><a id="author"><?=htmlspecialchars($row['author'])?></a><br />
|
||||
<b>Opis: </b><a id="description"><?=nl2br(htmlspecialchars($row['description']))?></a>
|
||||
</div>
|
||||
<?
|
||||
$prev = $DB->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
|
||||
?>
|
||||
<div id="prev">
|
||||
<a onclick="javascript:prev()">
|
||||
<img id="prev_image" height="100px" alt="<?=$prev['id']?>" src="images/upload/<?=$prev['thumb_name']?>" /><br/>
|
||||
</a>
|
||||
<a onclick="javascript:prev()">Poprzednie zdjęcie</a>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<div id="prev" style="display: none">
|
||||
<a onclick="javascript:prev()">
|
||||
<img id="prev_image" height="100px" alt="" src="" /><br/>
|
||||
</a>
|
||||
<a onclick="javascript:prev()">Poprzednie zdjęcie</a>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
$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
|
||||
?>
|
||||
<div id="next">
|
||||
<a onclick="javascript:next()">
|
||||
<img id="next_image" height="100px" alt="<?=$next['id']?>" src="images/upload/<?=$next['thumb_name']?>" /><br/>
|
||||
</a>
|
||||
<a onclick="javascript:next()">Następne zdjęcie</a>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<div id="next" style="display: none">
|
||||
<a onclick="javascript:next()">
|
||||
<img id="next_image" height="100px" alt="" src="" /><br/>
|
||||
</a>
|
||||
<a onclick="javascript:next()">Następne zdjęcie</a>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user