ChangeSet ID: 31077 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2007/04/21 14:44:10
Modified files: include : appData.php screenshot.php user.php
Log message: Alexander Nicolaysen Sørnes alex@thehandofagony.com Remove user::deleteAppData() and replace it with an appData function
Patch: http://cvs.winehq.org/patch.py?id=31077
Old revision New revision Changes Path 1.15 1.16 +15 -0 appdb/include/appData.php 1.64 1.65 +3 -3 appdb/include/screenshot.php 1.90 1.91 +0 -17 appdb/include/user.php
Index: appdb/include/appData.php diff -u -p appdb/include/appData.php:1.15 appdb/include/appData.php:1.16 --- appdb/include/appData.php:1.15 21 Apr 2007 19:44:10 -0000 +++ appdb/include/appData.php 21 Apr 2007 19:44:10 -0000 @@ -37,6 +37,21 @@ class appData } }
+ function delete() + { + if(!$this->canEdit()) + return FALSE; + + $sQuery = "DELETE FROM appData WHERE id = '?'"; + + $hResult = query_parameters($sQuery, $this->iId); + + if(!$hResult) + return FALSE; + + return $hResult; + } + function listSubmittedBy($iUserId, $bQueued = true) { $hResult = query_parameters("SELECT * FROM appData WHERE Index: appdb/include/screenshot.php diff -u -p appdb/include/screenshot.php:1.64 appdb/include/screenshot.php:1.65 --- appdb/include/screenshot.php:1.64 21 Apr 2007 19:44:10 -0000 +++ appdb/include/screenshot.php 21 Apr 2007 19:44:10 -0000 @@ -128,9 +128,9 @@ class Screenshot { */ function delete($bSilent=false) { - /* the user object should delete the app data entry */ - /* we can perform better permissions checking there */ - if($_SESSION['current']->deleteAppData($this->iScreenshotId)) + /* appData has a universal function for removing database entries */ + $oAppData = new appData($this->iScreenshotId); + if($oAppData->delete()) { /* make sure the screenshot and thumbnail is loaded */ /* up before we try to delete them */ Index: appdb/include/user.php diff -u -p appdb/include/user.php:1.90 appdb/include/user.php:1.91 --- appdb/include/user.php:1.90 21 Apr 2007 19:44:10 -0000 +++ appdb/include/user.php 21 Apr 2007 19:44:10 -0000 @@ -316,23 +316,6 @@ class User { return ($this->isLoggedIn() && $this->getPref("send_email","yes")=="yes"); }
- - /** - * Delete appData - */ - function deleteAppData($iAppDataId) - { - if(!$_SESSION['current']->canDeleteAppDataId($iAppDataId)) - return false; - - $hResult = query_parameters("DELETE from appData where id = '?' LIMIT 1", - $iAppDataId); - if($hResult) - return true; - - return false; - } - function getAppRejectQueueQuery($queryAppFamily) { /* escape input as we can't easily use query_parameters() */