diff --git a/admin/adminAppDataQueue.php b/admin/adminAppDataQueue.php index 99ef94b..4a7711f 100644 --- a/admin/adminAppDataQueue.php +++ b/admin/adminAppDataQueue.php @@ -106,10 +106,10 @@ if (!$aClean['iId']) echo '',"\n"; //data - if($obj_row->type == "image") + if($obj_row->type == "screenshot") { $oScreenshot = new Screenshot($obj_row->id); - echo 'Submited image',"\n"; + echo 'Submited screenshot',"\n"; echo ''; $imgSRC = ''; // generate random tag for popup window @@ -152,7 +152,7 @@ if (!$aClean['iId']) $statusMessage = ""; $goodtogo = 0; - if($obj_row->type == "image") + if($obj_row->type == "screenshot") { $oScreenshot = new Screenshot($obj_row->id); $oScreenshot->unQueue(); @@ -186,7 +186,7 @@ if (!$aClean['iId']) util_redirect_and_exit(apidb_fullurl("admin/adminAppDataQueue.php")); } elseif ($aClean['sReject']) { - if($obj_row->type == "image") + if($obj_row->type == "screenshot") { $oScreenshot = new Screenshot($obj_row->id); $oScreenshot->delete(); diff --git a/admin/adminScreenshots.php b/admin/adminScreenshots.php index 55b71ee..b0b78d4 100644 --- a/admin/adminScreenshots.php +++ b/admin/adminScreenshots.php @@ -35,7 +35,7 @@ apidb_header("Screenshots"); // regenerate all screenshots if($aClean['sRegenerate']) { - $sQuery = "SELECT id FROM appData WHERE type = 'image'"; + $sQuery = "SELECT id FROM appData WHERE type = 'screenshot'"; $hResult = query_parameters($sQuery); while($oRow = mysql_fetch_object($hResult)) { @@ -64,7 +64,7 @@ if($aClean['iPage']) $currentPage = $aClean['iPage']; $ItemsPerPage = min($ItemsPerPage,100); -$totalPages = ceil(getNumberOfImages()/$ItemsPerPage); +$totalPages = ceil(appData::objectGetEntriesCount("all", "screenshot")/$ItemsPerPage); $currentPage = min($currentPage,$totalPages); $offset = (($currentPage-1) * $ItemsPerPage); @@ -100,7 +100,7 @@ echo ""; /* query for all of the Screenshots in assending order */ $Ids = query_parameters("SELECT * from appData - WHERE type = 'image' + WHERE type = 'screenshot' ORDER BY id ASC LIMIT ?, ?", $offset, $ItemsPerPage); $c = 1; echo "
\n"; diff --git a/include/screenshot.php b/include/screenshot.php index a25aadd..9fc9c60 100644 --- a/include/screenshot.php +++ b/include/screenshot.php @@ -36,7 +36,7 @@ class Screenshot { FROM appData, appVersion WHERE appData.versionId = appVersion.versionId AND id = '?' - AND type = 'image'", $iScreenshotId); + AND type = 'screenshot'", $iScreenshotId); if($hResult) { $oRow = mysql_fetch_object($hResult); @@ -73,7 +73,7 @@ class Screenshot { $hResult = query_parameters("INSERT INTO appData (versionId, type, description, queued, submitterId) ". "VALUES('?', '?', '?', '?', '?')", - $iVersionId, "image", $sDescription, $this->bQueued?"true":"false", + $iVersionId, "screenshot", $sDescription, $this->bQueued?"true":"false", $_SESSION['current']->iUserId); if($hResult) { @@ -190,7 +190,7 @@ class Screenshot { */ function setDescription($sDescription) { - if($hResult = query_parameters("UPDATE id SET description = '?' WHERE id = '?' AND type = 'image'", + if($hResult = query_parameters("UPDATE id SET description = '?' WHERE id = '?' AND type = 'screenshot'", $sDescription, $this->iScreenshotId)) $this->sDescription = $sDescription; } @@ -392,7 +392,7 @@ class Screenshot { FROM appData, appVersion WHERE appData.versionId = appVersion.versionId AND appVersion.appId = '?' - AND type = 'image' + AND type = 'screenshot' AND appData.queued = 'false' ORDER BY rand", $iAppId); } else if ($iVersionId) // we want a random screenshot for this version @@ -400,7 +400,7 @@ class Screenshot { $hResult = query_parameters("SELECT id, description, RAND() AS rand FROM appData WHERE versionId = '?' - AND type = 'image' + AND type = 'screenshot' AND queued = 'false' ORDER BY rand", $iVersionId); } @@ -457,7 +457,7 @@ class Screenshot { $hResult = query_parameters("SELECT appData.*, appVersion.appId as appId FROM appData, appVersion WHERE appVersion.versionId = appData.versionId - AND type = 'image' + AND type = 'screenshot' AND appVersion.appId = '?' AND appData.queued = '?'", $iAppId, $bQueued); } @@ -469,7 +469,7 @@ class Screenshot { $hResult = query_parameters("SELECT appData.*, appVersion.appId as appId FROM appData, appVersion WHERE appVersion.versionId = appData.versionId - AND type = 'image' + AND type = 'screenshot' AND appData.versionId = '?' AND appData.queued = '?'", $iVersionId, $bQueued); } else diff --git a/include/util.php b/include/util.php index 1729458..9419928 100644 --- a/include/util.php +++ b/include/util.php @@ -221,14 +221,6 @@ function getNumberOfAppFamilies() return $oRow->num_appfamilies; } -/* Get the number of images in the database */ -function getNumberOfImages() -{ - $hResult = query_parameters("SELECT count(*) as num_images FROM appData WHERE type='image';"); - $oRow = mysql_fetch_object($hResult); - return $oRow->num_images; -} - /* Get the number of queued bug links in the database */ function getNumberOfQueuedBugLinks() {