\n". " \n". " \n". " \n". " // // http://www.chezgreg.net/coppermine/ // // ------------------------------------------------------------------------- // // Based on PHPhotoalbum by Henning Střverud // // http://www.stoverud.com/PHPhotoalbum/ // // ------------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // ------------------------------------------------------------------------- // include("include/init.inc.php"); include("include/exif.inc.php"); include("include/smilies.inc.php"); /************************************************************************** * Local functions definition **************************************************************************/ function album_query() { global $CONFIG, $album, $USER; switch (isset($USER['sort']) ? $USER['sort'] : $CONFIG['default_sort_order']){ case 'na': $sort_order="filename asc"; break; case 'nd': $sort_order="filename desc"; break; case 'dd': $sort_order="pid desc"; break; case 'da': $sort_order="pid asc"; break; default: $sort_order="pid asc"; break; } return db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} where aid='$album' ORDER BY $sort_order"); } function topn_query() { global $CONFIG; return db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} ORDER BY hits DESC LIMIT 0,{$CONFIG['number_in_toplist']}"); } function lastup_query() { global $CONFIG; return db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} ORDER BY pid DESC LIMIT 0,{$CONFIG['number_in_toplist']}"); } function lasthits_query() { global $CONFIG; return db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} ORDER BY mtime DESC LIMIT 0,{$CONFIG['number_in_toplist']}"); } function lastcom_query() { global $CONFIG; return db_query("SELECT {$CONFIG['TABLE_PICTURES']}.pid as pid FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_COMMENTS']} WHERE {$CONFIG['TABLE_COMMENTS']}.pid={$CONFIG['TABLE_PICTURES']}.pid GROUP BY pid ORDER BY msg_date DESC LIMIT 0,{$CONFIG['number_in_toplist']}"); } function show_picturemenu($id) { echo <<
DELETE THIS PICTURE
EOT; } // Prints the image-navigation menu function imgnavmenu($width, $pid, $picture_query) { global $CONFIG, $PHP_SELF; global $album, $row ; $result = db_query("SELECT * from {$CONFIG['TABLE_PICTURES']} where pid='$pid'"); $row = mysql_fetch_array($result); $navresult = $picture_query(); $count = mysql_num_rows($navresult); // Makes an array with all valid pids. $nav_array = array(); $i = 1; while ($row2 = mysql_fetch_array($navresult)) { $nav_array[$i] = $row2['pid']; if ($nav_array[$i] == $pid) $curimpos = $i; $i++; } $page = ceil($curimpos / ($CONFIG['thumbrows'] * $CONFIG['thumbcols'])); if ($album == "") $album = $row['aid']; $back_l = "\"Return"; if ($curimpos > 1) { $prev = $nav_array[$curimpos-1]; $prev_l = "\"See"; } else { $prev_l = "

"; } if ($curimpos < $count) { $next = $nav_array[$curimpos + 1]; $next_l = "\"See"; } else { $next_l = "

"; } if ($CONFIG['enable_ecards']){ $ecards_link_target="ecard.php?album=$album&pid=$pid"; $ecards_link_title="Send an e-card"; } else { $ecards_link_target="javascript:alert('Sorry but e-cards are disabled');"; $ecards_link_title="Sorry but e-cards are disabled"; } starttable(); echo << EOT; endtable(); } // Displays a picture function show_picture($pid) { global $CONFIG; global $album, $row; if ($album != "lasthits") add_hit($pid); // Hit counter $picname = $CONFIG['fullpath'].$row['filepath'].$row['filename']; $n_picname = $CONFIG['fullpath'].$row['filepath'].$CONFIG['normal_pfx'] .$row['filename']; if (file_exists($n_picname)) { $picturename = $n_picname; } else { $picturename = $picname; } $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['picture_width']); if ($image_size['reduced']) { $winsizeX = $row['pwidth'] + 16; $winsizeY = $row['pheight'] + 16; echo ""; echo "\"Click
"; echo "
\n"; } else { echo "
\n"; } } // Print picture information function picinfo() { global $CONFIG; global $album, $row; $album_name = get_album_name($row['aid']); echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $path_to_pic = "$CONFIG[fullpath]$row[filepath]$row[filename]"; if ($CONFIG['read_exif_data']){ if ($exif = exif_parse_file($path_to_pic)) exif_save_to_cache($exif, $path_to_pic); } else { $exif = exif_load_from_cache($path_to_pic); } if ($exif){ if ($exif['Camera']) echo " \n"; if ($exif['DateTaken']) echo " \n"; if ($exif['Aperture']) echo " \n"; if ($exif['ExposureTime']) echo " \n"; if ($exif['FocalLength']) echo " \n"; if ($exif['Comment']) echo " \n"; } } function show_commentsmenu($cid, $pid) { global $AUTHORIZED; echo <<EOT; if ($AUTHORIZED) echo <<EOT; } function show_comment_edit_box(&$row) { echo <<
Picture information
Filename: $row[filename]
Album: $album_name
Filesize: ".($row['filesize'] > 10240 ? ($row['filesize'] >> 10)." Kbytes" : $row['filesize']." bytes")."
Dimensions: $row[pwidth] x $row[pheight] pixels
Displayed: $row[hits] " . plural($row[hits], "time") . "
Camera: ".$exif['Camera']."
Date taken: ".$exif['DateTaken']."
Aperture: ".$exif['Aperture']."
Exposure time: ".$exif['ExposureTime']."
Focal length: ".$exif['FocalLength']."
Comment: ".$exif['Comment']."
EOT; generate_smilies("f{$row['msg_id']}", 'msg_body'); } function display_comment(&$row, $pid) { global $CONFIG, $USER, $PHP_SELF, $AUTHORIZED; echo " \n". " \n"; } // Displays comments for a specific picture function showcomments($pid, $skip=0) { global $CONFIG, $USER, $name, $row; global $PHP_SELF, $AUTHORIZED; $result = db_query("SELECT msg_id, msg_author, msg_body, DATE_FORMAT(msg_date, \"%Y-%m-%d %H:%i\") as msg_date, author_id FROM $CONFIG[TABLE_COMMENTS] where pid=$pid and msg_id!=$skip ORDER BY msg_date ASC"); while ($row = mysql_fetch_array($result)) { display_comment($row, $pid); } if ($CONFIG['allow_user_comments'] || $AUTHORIZED){ ?>
\n". " \n". " \n". " \n". " \n". "
" . stripslashes($row["msg_author"]) . "" . " "; if ($AUTHORIZED || $USER['ID'] == $row['author_id']){ show_commentsmenu($row['msg_id'], $pid); } echo " [" . $row["msg_date"] . "]
\n". "
\n". "
\n"; echo nl2br(process_smilies(make_clickable(stripslashes($row["msg_body"])))); echo "
\n". "
\n"; if ($AUTHORIZED || $USER['ID'] == $row['author_id']){ show_comment_edit_box($row); } echo "
\n". "
Add your comment
">

\n"; } else { $result = db_query("SELECT * from {$CONFIG['TABLE_PICTURES']} where pid='$pid'"); $row = mysql_fetch_array($result); $picname = $CONFIG['fullpath'].$row['filepath'].$row['filename']; $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; echo "
\n"; } ?>
'."\n"; $result = db_query("SELECT msg_id, msg_author, msg_body, DATE_FORMAT(msg_date, \"%Y-%m-%d %H:%i\") as msg_date, author_id FROM $CONFIG[TABLE_COMMENTS] where msg_id={$row['caption']}"); if ($caption = mysql_fetch_array($result)) { display_comment($caption, $pid); } endtable(); if (!isset($picinfo)) $picinfo = 'none'; echo "
\n"; starttable(); picinfo(); endtable(); echo "
\n"; starttable(); showcomments($pid, $row['caption']); endtable(); pagefooter(); } ?>







'."\n"; echo ''; echo "
"; show_picture($pid); if($AUTHORIZED){ show_picturemenu($pid); } echo "
"; echo '