<?php
							 | 
						|
								/** 
							 | 
						|
								* @package	Galeria Suczawa 2009 
							 | 
						|
								* @file		ask.php
							 | 
						|
								* @version	$Id$
							 | 
						|
								* @author	chp1994 <[email protected]>
							 | 
						|
								* @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>
							 |