. */ include("./include/include.php"); include("./include/db_bodies.php"); page_header(); $photocount=-1; if( isset($_GET['reset']) ) { // Reset session vars for this page $_SESSION['photo_start']=NULL; $_SESSION['photo_count']=NULL; $_SESSION['photo_photo']=NULL; $_SESSION['photo_size']=NULL; $_SESSION['photo_book']=NULL; } if( get_int("book")>0 AND $_GET['size']=="thumb" ) { // Reset $_SESSION['photo_photo']=0; $_SESSION['photo_start']=0; } if( get_int("book")>0 ) $_SESSION['photo_book']=get_int("book"); if( strlen(get_var("photo"))>0 ) $_SESSION['photo_photo']=get_int("photo"); if( $_SESSION['photo_photo']<1 ) $_SESSION['photo_photo']=0; if( strlen(get_var("size"))>0 ) $_SESSION['photo_size']=get_var("size"); if( $_SESSION['photo_size']!="thumb" AND $_SESSION['photo_size']!="normal" AND $_SESSION['photo_size']!="big" ) $_SESSION['photo_size']="thumb"; // Get count if( get_int("count")>0 ) $_SESSION['photo_count']=get_int("count"); if( !isset($_SESSION['photo_count']) ) $_SESSION['photo_count']=$MAXPHOTOVIEW; // Get start if( strlen(get_var("start"))>0 ) $_SESSION['photo_start']=get_int("start"); if( !isset($_SESSION['photo_start']) ) $_SESSION['photo_start']=0; // Limit $mysql_limit="LIMIT ".$_SESSION['photo_count']." OFFSET ".$_SESSION['photo_start']; // Show back button if info available if( isset($_SESSION['book_select']) ) { echoln("Back to events
");
}
// Get info about book, but only when we show all pics
$query="SELECT `book`.`photocount` AS `photocount`, `book`.`title` AS `title`, `book`.`comment` AS `comment`,
`event`.`bodycode` AS `bodycode`, `event`.`bodycode2` AS `bodycode2`, `event`.`title` AS `eventtitle`,
`event`.`topic` AS `topic`, `event`.`projectname` AS `projectname`, `event`.`location` AS `location`,
`event`.`datestart` AS `datestart`, `event`.`dateend` AS `dateend`, `event`.`eventtype` AS `eventtype`,
`event`.`area` AS `area`, `event`.`eventrating` AS `eventrating`, `event`.`documentid` AS `documentid`,
`event`.`eventcode` AS `eventcode`, `user`.`name` AS `owner`, `user`.`bodycode` AS `ownerbodycode`
FROM `book`, `event`, `user`
WHERE `book`.`eventcode`=`event`.`eventcode` AND `book`.`uid`=`user`.`uid` AND
`book`.`id`=".addslashes($_SESSION['photo_book']);
if( @mysql_num_rows( $res=doquery($query) )==1 ) {
$row=mysql_fetch_array($res);
$photocount=$row['photocount'];
if( $_SESSION['photo_photo']==0 ) {
echoln("Event: ".$row['eventtitle']." From ".get_date($row['datestart'])." until ".get_date($row['dateend'])."");
if( strlen($el=get_eventlink($row['eventcode'], $row['documentid']))>0 ) echoln("   ".$el."info");
echoln("
Organized by: ".$db_bodies[ $row['bodycode'] ]['bodyname']);
if( strlen($row['bodycode2'])>0 ) echoln(" & ".$db_bodies[ $row['bodycode2'] ]['bodyname']);
if( strlen($row['topic'])>0 ) echoln("
Topic: ".$row['topic']);
if( strlen($row['projectname'])>0 ) echoln("
Part of project: ".$row['projectname']);
if( strlen($row['location'])>0 ) echoln("
Location: ".$row['location']);
if( strlen($row['eventtype'])>0 ) echoln("
Event type: ".$row['eventtype']);
if( strlen($row['area'])>0 ) echoln("
Area: ".$row['area']);
if( strlen($row['eventrating'])>0 ) echoln("
Rating: ".$row['eventrating']);
echoln("
Photos by: ".$row['owner']." (".$db_bodies[ $row['ownerbodycode'] ]['bodyname'].")"); echoln("
Book: ".$row['title']." (".$row['photocount']." photos)");
if( strlen($row['comment'])>3 ) echoln("
Comment: ".$row['comment']);
if( $_SESSION['photo_size']=="thumb" ) {
echoln("
All pictures on one page in normal size.");
echoln("
All pictures on one page in big size.");
}
}
}
// Previous-next button
if( $_SESSION['photo_photo']>0 ) {
//One photo per time
$butprevnext ="
"; if( $_SESSION['photo_photo']>1 ) { $butprevnext.=""; $butprevnext.=""; } $butprevnext.=" "; if( $_SESSION['photo_photo']<$photocount ) { $butprevnext.=""; $butprevnext.=""; } $butprevnext.=" "; $butprevnext.=""; $butprevnext.=""; }elseif( $photocount>$_SESSION['photo_count'] ) { //List (several photos on one page, more than one page in total) $butprevnext ="
"; if( $_SESSION['photo_start']>0 ) { $butprevnext.=""; $butprevnext.=""; } $butprevnext.=" "; if( ($_SESSION['photo_start']+$_SESSION['photo_count'])<=($photocount-1) ) { $butprevnext.=""; $butprevnext.=""; } }else { //List (several photos on one page, one page in total) $butprevnext =""; } echoln($butprevnext); $query="SELECT `id`, `nr`, `height_".addslashes($_SESSION['photo_size'])."` AS `height`, `width_".addslashes($_SESSION['photo_size'])."` AS `width`, `height_normal`, `width_normal`, `comment`, `date_add` FROM `photo` WHERE `book_id`=".addslashes($_SESSION['photo_book']); if( $_SESSION['photo_photo']>0 ) $query.=" AND `nr`=".addslashes($_SESSION['photo_photo']); $query.=" ORDER BY `nr` "; if( $_SESSION['photo_photo']==0 ) $query.=$mysql_limit; if( @mysql_num_rows( $res=doquery($query) )>0 ) { echoln("
No photos found
"); debug($query); } echoln($butprevnext); page_footer(); ?>