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,14 +1,16 @@
|
||||
<?php
|
||||
require_once('init.php'); #init stuff
|
||||
$id=(isset($_GET['id']))?intval($_GET['id']):0; #check which photo's info should be send
|
||||
|
||||
header('Content-Type: text/xml; charset="utf-8"');
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>';
|
||||
?>
|
||||
|
||||
<display id="<?=$id?>">
|
||||
<?
|
||||
if (!$result = $DB->query('SELECT * FROM photos WHERE id=\'$i\''))
|
||||
<?php
|
||||
require_once('./init.php'); #init stuff
|
||||
$id = (isset($_GET['id'])) ? intval($_GET['id']) : 0; #check which photo's info should be send
|
||||
|
||||
header('Content-Type: text/xml; charset="utf-8"');
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>';
|
||||
?>
|
||||
|
||||
<display id="<?=$id?>">
|
||||
<?
|
||||
|
||||
$sql = "SELECT * FROM `photos` WHERE `id`='$id'";
|
||||
if (!$result = $DB->query($sql))
|
||||
{
|
||||
showError('MySQL error');
|
||||
}
|
||||
@@ -28,24 +30,24 @@ else
|
||||
|
||||
$row['author'] = ($row['author']=='') ? 'Autor nieznany' : $row['author'];
|
||||
$row['description'] = ($row['description']=='') ? 'Brak opisu' : $row['description'];
|
||||
}
|
||||
?>
|
||||
<current id="<?=htmlspecialchars($row['id'])?>" src="<?=htmlspecialchars($row['photo_name'])?>">
|
||||
<desc><?=nl2br(htmlspecialchars($row['description']))?></desc>
|
||||
<author><?=htmlspecialchars($row['author'])?></author>
|
||||
</current>
|
||||
<?
|
||||
$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
|
||||
echo '<prev thumb="'.$prev['thumb_name'].'" id="'.$prev['id'].'" />'; #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 '<next thumb="'.$next['thumb_name'].'" id="'.$next['id'].'" />'; #and send it
|
||||
}
|
||||
?>
|
||||
</display>
|
||||
}
|
||||
?>
|
||||
<current id="<?=htmlspecialchars($row['id'])?>" src="<?=htmlspecialchars($row['photo_name'])?>">
|
||||
<desc><?=nl2br(htmlspecialchars($row['description']))?></desc>
|
||||
<author><?=htmlspecialchars($row['author'])?></author>
|
||||
</current>
|
||||
<?
|
||||
$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
|
||||
echo '<prev thumb="'.$prev['thumb_name'].'" id="'.$prev['id'].'" />'; #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 '<next thumb="'.$next['thumb_name'].'" id="'.$next['id'].'" />'; #and send it
|
||||
}
|
||||
?>
|
||||
</display>
|
||||
|
||||
Reference in New Issue
Block a user