appdb/ ./appdbStats.php ./viewScreenshots.php ...
WineHQ
wineowner at wine.codeweavers.com
Mon Mar 12 19:13:51 CDT 2007
ChangeSet ID: 30958
CVSROOT: /opt/cvs-commit
Module name: appdb
Changes by: wineowner at winehq.org 2007/03/12 19:13:51
Modified files:
. : appdbStats.php viewScreenshots.php
include : appData.php screenshot.php
Log message:
Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Fix screenshot counting and browsing. Make sure to specify the 'screenshot' tpe and use
appData functions for both counting and listing on the screenshots page, ensuring consistent
results.
Patch: http://cvs.winehq.org/patch.py?id=30958
Old revision New revision Changes Path
1.13 1.14 +1 -1 appdb/appdbStats.php
1.9 1.10 +2 -8 appdb/viewScreenshots.php
1.6 1.7 +29 -6 appdb/include/appData.php
1.56 1.57 +2 -2 appdb/include/screenshot.php
Index: appdb/appdbStats.php
diff -u -p appdb/appdbStats.php:1.13 appdb/appdbStats.php:1.14
--- appdb/appdbStats.php:1.13 13 Mar 2007 0:13:51 -0000
+++ appdb/appdbStats.php 13 Mar 2007 0:13:51 -0000
@@ -74,7 +74,7 @@ echo "</tr>\n\n";
/* Display the number of images */
echo "<tr class=color4>\n";
echo " <td>Screenshots:</td>\n";
-echo " <td>".appData::objectGetEntriesCount(false)."</td>\n";
+echo " <td>".appData::objectGetEntriesCount("false", "screenshot")."</td>\n";
echo "</tr>\n\n";
echo "</table>\n\n";
Index: appdb/viewScreenshots.php
diff -u -p appdb/viewScreenshots.php:1.9 appdb/viewScreenshots.php:1.10
--- appdb/viewScreenshots.php:1.9 13 Mar 2007 0:13:51 -0000
+++ appdb/viewScreenshots.php 13 Mar 2007 0:13:51 -0000
@@ -22,7 +22,7 @@ if($aClean['iPage'])
$currentPage = $aClean['iPage'];
$ItemsPerPage = min($ItemsPerPage,100);
-$totalPages = ceil(appData::objectGetEntriesCount(false)/$ItemsPerPage);
+$totalPages = ceil(appData::objectGetEntriesCount("false", "screenshot")/$ItemsPerPage);
$currentPage = min($currentPage,$totalPages);
$offset = (($currentPage-1) * $ItemsPerPage);
@@ -57,13 +57,7 @@ echo "</form>";
echo "</center>";
/* query for all of the Screenshots in assending order */
-$Ids = query_parameters("SELECT * from appData
- WHERE
- type = 'screenshot'
- AND
- queued = 'false'
- ORDER BY id ASC LIMIT ?, ?",
- $offset, $ItemsPerPage);
+$Ids = appData::objectGetEntries(false, $ItemsPerPage, $offset, "screenshot");
$c = 1;
echo "<div align=center><table><tr>\n";
while ($oRow = mysql_fetch_object($Ids))
Index: appdb/include/appData.php
diff -u -p appdb/include/appData.php:1.6 appdb/include/appData.php:1.7
--- appdb/include/appData.php:1.6 13 Mar 2007 0:13:51 -0000
+++ appdb/include/appData.php 13 Mar 2007 0:13:51 -0000
@@ -108,8 +108,8 @@ class appData
if(($sQueued == "true" || $sQueued == "all") &&
!$_SESSION['current']->hasPriv("admin"))
{
- $sQuery = "SELECT COUNT(DISTINCT id) as count FROM appData, appMaintainers,
- appVersion, appFamily WHERE
+ $sQuery = "SELECT COUNT(DISTINCT appData.id) as count FROM appData,
+ appMaintainers, appVersion, appFamily WHERE
appFamily.appId = appVersion.appId
AND
appMaintainers.userId = '?'
@@ -159,7 +159,7 @@ class appData
}
} else
{
- $sQuery = "SELECT COUNT(DISTINCT id) as count FROM appData,
+ $sQuery = "SELECT COUNT(DISTINCT appData.id) as count FROM appData,
appFamily, appVersion WHERE
appFamily.appId = appVersion.appId
AND
@@ -209,7 +209,7 @@ class appData
echo html_tr($aCells, $sClass);
}
- function objectGetEntries($bQueued, $sType)
+ function objectGetEntries($bQueued, $iRows = 0, $iStart = 0, $sType)
{
if($bQueued && !appData::canEdit($sType))
return FALSE;
@@ -259,8 +259,20 @@ class appData
appData.queued = '?'
AND
appData.type = '?'";
- $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
+ if(!$iRows && !$iStarts)
+ {
+ $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
$bQueued ? "true" : "false", $sType);
+ } else
+ {
+ if(!$iRows)
+ $iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
+ $sType);
+ $sQuery .= " LIMIT ?,?";
+ $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
+ $bQueued ? "true" : "false", $sType,
+ $iStart, $iRows);
+ }
} else
{
$sQuery = "SELECT DISTINCT appData.* FROM appData, appFamily, appVersion
@@ -280,7 +292,18 @@ class appData
appData.queued = '?'
AND
appData.type = '?'";
- $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType);
+ if(!$iRows && !$iStart)
+ {
+ $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType);
+ } else
+ {
+ if(!$iRows)
+ $iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
+ $sType);
+ $sQuery .= " LIMIT ?,?";
+ $hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
+ $iStart, $iRows);
+ }
}
if(!$hResult)
Index: appdb/include/screenshot.php
diff -u -p appdb/include/screenshot.php:1.56 appdb/include/screenshot.php:1.57
--- appdb/include/screenshot.php:1.56 13 Mar 2007 0:13:51 -0000
+++ appdb/include/screenshot.php 13 Mar 2007 0:13:51 -0000
@@ -509,9 +509,9 @@ class Screenshot {
return $shImg;
}
- function objectGetEntries($bQueued)
+ function objectGetEntries($bQueued, $iRows = 0, $iStart = 0)
{
- return appData::objectGetEntries($bQueued, "screenshot");
+ return appData::objectGetEntries($bQueued, $iRows, $iStart, "screenshot");
}
function objectOutputHeader($sClass)
More information about the wine-cvs
mailing list