Nowa wersja webmasterska
git-svn-id: https://svn.pioder.pl/sg-svn@12 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8
This commit is contained in:
@@ -1,26 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Galeria Suczawa 2009
|
||||
* @file ask.php
|
||||
* @version $Id$
|
||||
* @author chp1994 <chp1994@gmail.com>
|
||||
* @link http://suczawa.ath.cx/
|
||||
**/
|
||||
|
||||
$i=intval($_GET['name']);
|
||||
require('./init.php');
|
||||
if ($i == 0)
|
||||
<?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\''))
|
||||
{
|
||||
blad('Zdjecie nie istnieje!');
|
||||
}
|
||||
$sql = "SELECT * FROM `photos` WHERE `id`='$i'";
|
||||
if (!$result = $DB->query($sql))
|
||||
{
|
||||
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 '<?xml version="1.0" encoding="utf-8"?>';
|
||||
?>
|
||||
|
||||
<data>
|
||||
<name><?=$row['id']?>: <?=basename($row['photo_name'])?></name>
|
||||
<desc xmlns="http://www.w3.org/1999/xhtml"><p><?=$row['description']?></p></desc>
|
||||
<src><?=$row['photo_name']?></src>
|
||||
<author><?= $row['author']; ?></author>
|
||||
<?if($i==$lastid){?><last /><? } ?>
|
||||
<?if($i==$firstid){?><first /><? } ?>
|
||||
</data>
|
||||
}
|
||||
?>
|
||||
<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