appdb/include application.php url.php

WineHQ wineowner at wine.codeweavers.com
Mon Apr 16 17:59:48 CDT 2007


ChangeSet ID:	31043
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/04/16 17:59:48

Modified files:
	include        : application.php url.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Fix url::canEdit() to not call undefined functions

Patch: http://cvs.winehq.org/patch.py?id=31043

Old revision  New revision  Changes     Path
 1.101         1.102         +2 -0       appdb/include/application.php
 1.15          1.16          +9 -8       appdb/include/url.php

Index: appdb/include/application.php
diff -u -p appdb/include/application.php:1.101 appdb/include/application.php:1.102
--- appdb/include/application.php:1.101	16 Apr 2007 22:59:48 -0000
+++ appdb/include/application.php	16 Apr 2007 22:59:48 -0000
@@ -903,6 +903,8 @@ class Application {
     {
         if($_SESSION['current']->hasPriv("admin"))
             return TRUE;
+        else if($this)
+            return maintainer::isUserSuperMaintainer($_SESSION['current'], $this->iAppId);
         else
             return FALSE;
     }
Index: appdb/include/url.php
diff -u -p appdb/include/url.php:1.15 appdb/include/url.php:1.16
--- appdb/include/url.php:1.15	16 Apr 2007 22:59:48 -0000
+++ appdb/include/url.php	16 Apr 2007 22:59:48 -0000
@@ -453,17 +453,18 @@ class Url {
 
     function canEdit($iVersionId, $iAppId = NULL)
     {
-        $oUser = new User($_SESSION['current']->iUserId);
-
-        if($oUser->hasPriv("admin") || ($iVersionId &&
-            maintainer::isUserMaintainer($oUser, $iVersionId)) || ($iAppId &&
-            maintainer::isSuperMaintainer($oUser, $iAppId)))
-        {
+        if($_SESSION['current']->hasPriv("admin"))
             return TRUE;
-        } else
+        else if($iVersionId)
         {
+            $oVersion = new version($iVersionId);
+            return $oVersion->canEdit();
+        } else if($iAppId)
+        {
+            $oApp = new application($iAppId);
+            return $oApp->canEdit();
+        } else
             return FALSE;
-        }
     }
 
     /* Display links for a given version/application */



More information about the wine-cvs mailing list