require 'auth.inc'; if(!hasPermission('e_photobook')) include ('403.inc'); unset($photobook); $photobookId = 0; if (!empty($_GET['photobookId']) && intval($_GET['photobookId'])) $photobookId = intval($_GET['photobookId']); elseif(!empty($_SESSION['photobook']) && intval($_SESSION['photobook'])) $photobookId = intval($_SESSION['photobook']['id']); if($photobookId) { $res = safe_query("SELECT id,text,title,sort FROM photobook WHERE id=$photobookId"); if(mysql_num_rows($res)) { $photobook = mysql_fetch_array($res); $_SESSION['photobook'] = $photobook; } } if (!isset($photobook)) { header("Location: ./"); exit(); } if(isset($_GET['deletID'])) { $id = intval($_GET['deletID']); if ($id) { $res = safe_query("SELECT image FROM photo WHERE id = $id"); if(list($image) = mysql_fetch_array($res)) { if(deleteImages($image)) { safe_delete("DELETE FROM photo WHERE id = $id"); safe_update("UPDATE photobook SET sort = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', sort, ','), ',$id,', ',')) WHERE id = ".$photobook['id']); unset($sort[$id]); } } } } $view = 'list'; if(isset($_GET['view'])&&$_GET['view']=='gallery') { $view = 'gallery'; setcookie('view','list',3600*24*365,'/'); } else if(isset($_COOKIE['view'])&&$_COOKIE['view']=='gallery') $view = 'gallery'; $sort = explode(",",$photobook['sort']); if (isset($_SESSION['photo'])) unset($_SESSION['photo']); $res = safe_query("SELECT id,image,text,title FROM photo WHERE photobookId=".$photobook['id']); $photos = Array(); while($a=mysql_fetch_array($res)) $photos[$a['image']] = $a; $sphotos = array(); foreach($sort as $s) if (isset($photos[$s])) $sphotos[] = $photos[$s]; require 'header.inc'; include '../nav.inc'; ?>
Naam: | = $photobook['title'] ?> |
---|---|
Beschrijving: | = nl2br($photobook['text']) ?> |