/** * Function: album() - lists images in an album * * @access public * @var integer $albumID - ID of album to display */ function album($albumID) { global $db, $title, $config, $start; /* Get the album name */ $result =& $db->query('SELECT * FROM ' . TP . 'albums WHERE albumID = ' . $albumID); if (DB::isError($result)) { die($result->getMessage()); } $line =& $result->fetchRow(DB_FETCHMODE_OBJECT); $albumTitle = stripslashes($line->albumName); $result =& $db->query('SELECT * FROM ' . TP . 'images WHERE albumID = ' . $albumID); if (DB::isError($result)) { die($result->getMessage()); } $numImages = $result->numRows(); /* Get the images in the album */ $result =& $db->query('SELECT * FROM ' . TP . 'images WHERE albumID = ' . $albumID . ' LIMIT ' . $start . ',' . $config['imagesPP']); if (DB::isError($result)) { die($result->getMessage()); } $albumImages = $result->numRows(); /* If we have images, get their information */ if ($albumImages > 0) { $i = 1; while ($line =& $result->fetchRow(DB_FETCHMODE_OBJECT)) { $image[$i][0] = '?album=' . $albumID . '&image=' . $line->imageID; $image[$i][1] = stripslashes($line->imageName); if ($config['enableCache'] == 1) { $image[$i][2] = getImage($line->albumID, $line->imageFilename, $line->imageName, 100, 'cache'); } else { $image[$i][2] = getImage($line->albumID, $line->imageFilename, $line->imageName, 100, 'dynamic'); } $image[$i][3] = stripslashes($line->imageDesc); $image[$i][4] = $line->imageCreated; $image[$i][5] = $line->imageModified; $image[$i][6] = $line->imageViews; if ($config['allowComment'] == 1) { /* Get number of comments for each image */ $rslt =& $db->query('SELECT COUNT(*) AS count FROM ' . TP . 'comments WHERE imageID = ' . $line->imageID); if (DB::isError($rslt)) { die($rslt->getMessage()); } $ln =& $rslt->fetchRow(DB_FETCHMODE_OBJECT); $image[$i][7] = $ln->count > 1 ? $ln->count . ' comments' : ($ln->count == 1 ? $ln->count . ' comment' : 'No comments'); } $i++; } $image[1][9] = crumb('index', $albumTitle, ''); if ($numImages > $config['imagesPP']) { $image[1][8] = makePagination('album', $albumID); } else { $image[1][8] = 'Page 1 of 1'; } /* otherwise, we have no images */ } else { $image = 'There are no images in this album yet!'; } return $image; }
$albID = array_keys($albums); while ($line =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { if ($albID[$i] == $line['albumID']) { if (!$echoed) { echo "\t" . '<tr><td colspan="5" style="font-weight: bold; background: #999; color: #FFF;">' . $albums[$i + 1] . '</td></tr>'; $echoed = TRUE; } else { $i++; } } else { $echoed = FALSE; } $bg = $bg == ' style="background: #CCC;"' ? '' : ' style="background: #CCC;"'; echo "\t" . '<tr><td class="adminTD"' . $bg . '><a href="index.php?s=images&a=edit&image=' . $line['imageID'] . '"><img src="icons/editimage.png" alt="Edit" title="Edit" /></a></td><td class="adminTD"' . $bg . '><a href="index.php?s=images&a=delete&image=' . $line['imageID'] . '"><img src="icons/deleteimage.png" alt="Delete" title="Delete" /></a></td><td class="adminTD"' . $bg . '><a href="index.php?s=images&a=move&image=' . $line['imageID'] . '"><img src="icons/moveimage.png" alt="Move" title="Move" /></a></td><td' . $bg . '><a href="javascript:picture(\'' . $config['snapsURL'] . $config['albumsPath'] . $line['albumID'] . '/' . $line['imageFilename'] . '\');">' . $line['imageFilename'] . '</a></td><td' . $bg . '>' . $line['imageName'] . '</tr>' . "\n\t\t\t\t"; } echo "\t" . '<tr><td class="adminTD" colspan="5" style="text-align: right;">' . makePagination($start) . '</td></tr>'; } else { /* No images defined */ echo '<tr><td colspan="5" class="adminTD">There are no images.</td></tr><tr>'; } ?> </table> <br /><span style="padding: 5px; font-weight: bold;"><a href="index.php?s=images&a=new"><img style="vertical-align: bottom;" src="icons/newimage.png" alt="New Image" title="New Image" /></a> Add New Image</span> <?php } else { /* Otherwise, handle the action */ switch ($_GET['a']) { case 'edit': /* If the form has not been submitted */ if (empty($_POST['submit'])) { /* Get the image's information and display the form to edit */
echo "selected"; } ?> >desc</option> <option <?php if (isset($_GET['ordtype']) && $_GET['ordtype'] == "asc") { echo "selected"; } ?> >asc</option> </select> </label> </form> <div class="pagination"> Page: <?php echo $from / $perpage + 1; ?> of <?php echo ceil($response['hits']['total'] / $perpage); ?> - viewing <?php echo count($hits); ?> . <?php echo makePagination($response, $from, $perpage, $current_page); ?> </div> <div class="clear"></div> </div>