diff --git a/appdbStats.php b/appdbStats.php
index 60657ab..228ba09 100644
--- a/appdbStats.php
+++ b/appdbStats.php
@@ -74,7 +74,7 @@ echo "\n\n";
/* Display the number of images */
echo "
\n";
echo " | Screenshots: | \n";
-echo " ".appData::objectGetEntriesCount(false)." | \n";
+echo " ".appData::objectGetEntriesCount("false", "screenshot")." | \n";
echo "
\n\n";
echo "\n\n";
diff --git a/include/appData.php b/include/appData.php
index 0518c91..9a00d76 100644
--- a/include/appData.php
+++ b/include/appData.php
@@ -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)
diff --git a/include/screenshot.php b/include/screenshot.php
index 051f415..3783085 100644
--- a/include/screenshot.php
+++ b/include/screenshot.php
@@ -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)
diff --git a/viewScreenshots.php b/viewScreenshots.php
index a5b11cb..8626c9a 100644
--- a/viewScreenshots.php
+++ b/viewScreenshots.php
@@ -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 "";
echo "";
/* 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 "\n";
while ($oRow = mysql_fetch_object($Ids))