// // 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. // // ------------------------------------------------------------------------- // session_start(); include("include/init.inc.php"); auth_needed(); /************************************************************************** * Local functions definition **************************************************************************/ /** * albumselect() * * return the HTML code for a listbox with name $id that contains the list * of all albums (except the one we want to move pictures from) * * @param string $lb_id the name of the listbox * @return the HTML code **/ function albumselect($lb_id="album") { global $CONFIG, $id; static $select = ""; if ($select == ""){ $result = mysql_query("SELECT * FROM $CONFIG[TABLE_ALBUMS] ORDER BY date ASC"); while ($row = mysql_fetch_array($result)) { if ($row['aid'] != $id) $select .= "\n"; } } return "\n"; } /** * makeheader() * * Return HTML code for the header of the table with all images * * @param $album the title of the album * @param $lbid the name of the listbox with all albums * @return the HTML code **/ function makeheader($album, $lbid) { return "\n". "Move pictures of "$album" into ".albumselect($lbid)."\n"; } /** * picrow() * * return the HTML code for a row to be displayed for an image * the row contains a checkbox, the image name, a thumbnail * * @param $picfile the full path of the file that contains the picture * @param $picid the name of the check box * @return the HTML code **/ function picrow($picfile, $picid) { global $CONFIG; $picname = $CONFIG[fullpath].$picfile; $thumbfile = dirname($picfile)."/".$CONFIG['thumb_pfx'].basename($picfile); $fullimagesize = getImageSize($picname); $winsizeX = ($fullimagesize[0] + 40); $winsizeY = ($fullimagesize[1] + 40); return "\n". "". "". "\n". "". "". basename($picfile)."". "\n". "". "". "
\n". "
". "\n". "\n"; } /** * listPicInAlbum() * * Output an HTML table with all pictures in the selected album * * @param $aid the album id * @param $pic_array an array where the key is the id of the picture and the value the filename * @return **/ function listPicInAlbum($aid, &$pic_array) { global $CONFIG; echo makeheader(get_album_name($aid) ,"aid" ); $result = mysql_query("SELECT * FROM $CONFIG[TABLE_PICTURES] WHERE aid='$aid'"); while ($row = mysql_fetch_array($result)) { $pic_id_str=sprintf("i%04d", $row['pid']); $pic_file = "$row[filepath]$row[filename]"; echo picrow($pic_file, $pic_id_str); $pic_array[$pic_id_str]=$row['filename']; } } /************************************************************************** * Main code **************************************************************************/ if ($move){ pageheader("Move pictures"); starttable("100%"); ?>

Moving pictures

Picture Result $filename){ if ($$piccode == 1){ $pic_id = intval(substr($piccode, 1, 4)); if (mysql_query("UPDATE $CONFIG[TABLE_PICTURES] SET aid='$aid' WHERE pid='$pic_id'")) $status = "
"; else $status = "
"; echo "\n"; echo "$filename\n"; echo "$status\n"; echo "\n"; $count++; } } if (!$count){ echo "\n"; echo "
There was no picture to move...

\n"; echo "\n"; } session_unregister('pic_array'); session_destroy(); echo "\n"; echo "
\n"; echo "
BACK
\n"; echo "
\n"; echo "\n"; endtable(); pagefooter("100%"); } else { pageheader("Move pictures"); starttable("100%"); ?>
">

Move selected pictures to another album