Add the page and sidebar entry for a 'Browse newest applications' page

This commit is contained in:
Alexander Nicolaysen Sørnes
2006-11-27 03:14:57 +00:00
committed by WineHQ
parent 4586465b09
commit 79a5e062dd
3 changed files with 77 additions and 3 deletions

69
browse_newest_apps.php Normal file
View File

@@ -0,0 +1,69 @@
<?php
/**
* Browse newest versions
*
*/
require("path.php");
require(BASE."include/incl.php");
require(BASE."include/filter.php");
// set default value
if(empty($aClean['iNumVersions']) || $aClean['iNumVersions'] > 200 || $aClean['iNumVersions'] < 0)
$aClean['iNumVersions'] = 25;
apidb_header("Browse Newest Applications");
/* selector for how many versions to view */
echo "<form method=\"post\" name=\"sMessage\" action=\"".$_SERVER['PHP_SELF']."\">";
echo "<b>How many versions to display:</b>";
echo "<select name='iNumVersions'>";
$numVersionsArray = array(25, 50, 100, 200);
foreach($numVersionsArray as $i => $value)
{
if($numVersionsArray[$i] == $aClean['iNumVersions'])
echo "<option selected=\"selected\">$numVersionsArray[$i]</option>";
else
echo "<option>$numVersionsArray[$i]</option>";
}
echo "</select>";
echo ' <input type="submit" value="Refresh" />';
echo '</form>';
echo '<br />';
/* Query the database for the n newest versions */
$hResult = query_parameters("SELECT appId, appName, description, submitTime FROM appFamily WHERE
queued = 'false' ORDER BY appId DESC LIMIT ?",
$aClean['iNumVersions']);
if($hResult)
{
echo html_frame_start("", "90%", '', 0);
echo html_table_begin("width=\"100%\" align=\"center\"");
echo "<tr class=\"color4\">\n";
echo "<td><font color=\"white\">Submission Date</font></td>\n";
echo "<td><font color=\"white\">Application</font></td>\n";
echo "<td><font color=\"white\">Description</font></td></td>\n";
$c = 1;
while($row = mysql_fetch_object($hResult))
{
$bgcolor = ($c % 2) ? "color0" : "color1";
$link = "<a href=\"appview.php?iAppId=$row->appId\"> $row->appName </a>";
echo "<tr class=\"$bgcolor\">";
echo "<td width=\"20%\">".print_short_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."</td>\n";
echo "<td>$link </td>\n";
echo "<td>$row->description </td></tr>\n";
$c++;
}
echo html_table_end();
echo html_frame_end();
}
apidb_footer();
?>

View File

@@ -23,6 +23,7 @@ function global_sidebar_menu() {
$g->add("AppDB Home", BASE); $g->add("AppDB Home", BASE);
$g->add("Screenshots", BASE."viewScreenshots.php"); $g->add("Screenshots", BASE."viewScreenshots.php");
$g->add("Browse Apps", BASE."appbrowse.php"); $g->add("Browse Apps", BASE."appbrowse.php");
$g->add("Browse Newest Apps", BASE."browse_newest_apps.php");
$g->add("Browse Apps by Rating", BASE."browse_by_rating.php"); $g->add("Browse Apps by Rating", BASE."browse_by_rating.php");
$g->add("Top 25", BASE."votestats.php"); $g->add("Top 25", BASE."votestats.php");
$g->add("Submit Application", BASE."appsubmit.php?sSub=view&sAppType=application"); $g->add("Submit Application", BASE."appsubmit.php?sSub=view&sAppType=application");

View File

@@ -63,14 +63,18 @@ function values($arr)
} }
/* // print the month, day, year, hour, minute, second
* format date
*/
function print_date($sTimestamp) function print_date($sTimestamp)
{ {
return date("F d Y H:i:s", $sTimestamp); return date("F d Y H:i:s", $sTimestamp);
} }
// print the month, day and year
function print_short_date($sTimestamp)
{
return date("F d Y", $sTimestamp);
}
function mysqltimestamp_to_unixtimestamp($sTimestamp) function mysqltimestamp_to_unixtimestamp($sTimestamp)
{ {
$d = substr($sTimestamp,6,2); // day $d = substr($sTimestamp,6,2); // day