This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
qemudb/viewScreenshots.php
Chris Morgan 6119246b51 Replace direct mysql_xxx() calls with query_xxx() calls. Replace calls to mysql_insert_id()
with calls specific to the appdb or bugzilla database. Fixes a bug where a call to
mysql_insert_id() can potentially retrieve an id from either the bugzilla or appdb database,
depending on whichever database was last opened by mysql_connect().
2007-08-03 23:27:25 +00:00

96 lines
2.9 KiB
PHP

<?php
/************************************************************/
/* Page for managing all of the screenshots in the AppDB */
/* Without having go into each application version to do so */
/************************************************************/
require("path.php");
require(BASE."include/incl.php");
require_once(BASE."include/screenshot.php");
require_once(BASE."include/application.php");
apidb_header("View Screenshots");
echo "<div class='default_container'>\n";
/* display a range of 10 pages */
$pageRange = 10;
$ItemsPerPage = isset($aClean['iItemsPerPage']) ? $aClean['iItemsPerPage'] : 6;
$currentPage = isset($aClean['iPage']) ? $aClean['iPage'] : 1;
$ItemsPerPage = min($ItemsPerPage,100);
$totalPages = ceil(appData::objectGetEntriesCount("false", false,
"screenshot")/$ItemsPerPage);
$currentPage = min($currentPage,$totalPages);
$offset = (($currentPage-1) * $ItemsPerPage);
/* display page selection links */
echo "<center>";
echo "<b>Page $currentPage of $totalPages</b><br />";
display_page_range($currentPage, $pageRange, $totalPages,
$_SERVER['PHP_SELF']."?iItemsPerPage=".$ItemsPerPage);
echo "<br />";
echo "<br />";
/* display the option to choose how many screenshots per-page to display */
echo '<form method="get" name="message" action="'.$_SERVER['PHP_SELF'].'">';
echo '<b>Number of Screenshots per page:</b>';
echo "&nbsp<select name='iItemsPerPage'>";
$ItemsPerPageArray = array(6, 9, 12, 15, 18, 21, 24);
foreach($ItemsPerPageArray as $i => $value)
{
if($ItemsPerPageArray[$i] == $ItemsPerPage)
echo "<option value='$ItemsPerPageArray[$i]' SELECTED>$ItemsPerPageArray[$i]";
else
echo "<option value='$ItemsPerPageArray[$i]'>$ItemsPerPageArray[$i]";
}
echo "</select>";
echo "<input type=hidden name=iPage value=$currentPage>";
echo "&nbsp<input type=submit value='Refresh'>";
echo "</form>";
echo "</center>";
/* query for all of the Screenshots in assending order */
$Ids = appData::objectGetEntries(false, false, $ItemsPerPage, $offset, "screenshot");
$c = 1;
echo "<div align=center><table><tr>\n";
while ($oRow = query_fetch_object($Ids))
{
// display thumbnail
$oVersion = new version($oRow->versionId);
$oApp = new Application($oVersion->iAppId);
$oScreenshot = new Screenshot($oRow->id);
$img = $oScreenshot->get_thumbnail_img();
echo "<td align=center>\n";
echo $img;
echo "<div align=center>". substr($oRow->description,0,20). "\n";
echo "<br />[".$oApp->objectMakeLink()."]";
echo "<br />[".$oVersion->objectMakeLink()."]";
echo "</div></td>\n";
// end row if counter of 3
if ($c % 3 == 0) echo "</tr><tr>\n";
$c++;
}
echo "</tr></table></div><br />\n";
/* display page selection links */
echo "<center>";
display_page_range($currentPage, $pageRange, $totalPages,
$_SERVER['PHP_SELF']."?iItemsPerPage=".$ItemsPerPage);
echo "</center>";
echo "</div>\n";
apidb_footer();
?>