- Poprawiono interpretowanie pierwszego i ostatniego zdjęcia

- Zmieniono stronnicowanie
- Dodano buttony oraz przykładowe zdjęcia do testów skryptu
- Prowadzono 2 nowe pliki: functions.php - z funkcjami oraz config.php - konfiguracją
- Wprowadzono mniej ważne poprawki

git-svn-id: https://svn.pioder.pl/sg-svn@7 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8
This commit is contained in:
pioder
2009-06-16 11:52:07 +00:00
parent 239589a41d
commit 04fdaa4ab6
31 changed files with 623 additions and 329 deletions

View File

@@ -1,20 +1,52 @@
<?php
$i=intval($_GET['name'])+1;
require('init.php');
$result = mysql_query('SELECT * FROM photos WHERE id='.$i);
$row = mysql_fetch_assoc($result);
if(!row) die('Error');
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==$count){?><last /><? } ?>
<?if($i==0){?><first /><? } ?>
</data>
<?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)
{
blad('Zdjecie nie istnieje!');
}
$sql = "SELECT * FROM `photos` WHERE `id`='$i'";
if (!$result = $DB->query($sql))
{
blad('Nie mozna pobrac informacji o zdjeciu!');
}
#sprawdź, czy zdjęcie istnieje
$cnt = $result->num_rows;
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'];
}
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>