Fixes/rewrites for missing sql_patches and check on admin's default access mode ...
authorRoland Häder <roland@mxchange.org>
Thu, 12 Mar 2009 19:25:24 +0000 (19:25 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 12 Mar 2009 19:25:24 +0000 (19:25 +0000)
inc/functions.php
inc/libs/admins_functions.php
inc/libs/user_functions.php
inc/modules/admin/admin-inc.php
inc/mysql-manager.php

index 9daec4f..c875a91 100644 (file)
@@ -2832,9 +2832,11 @@ function GENERATE_AID_LINK ($aid) {
        $admin = "<span class=\"admin_note\">{--ADMIN_NO_ADMIN_ASSIGNED--}</span>";
 
        // Zero? = Not assigned
-       if ($aid > 0) {
+       if (bigintval($aid) > 0) {
                // Load admin's login
                $login = GET_ADMIN_LOGIN($aid);
+
+               // Is the login valid?
                if ($login != "***") {
                        // Is the extension there?
                        if (EXT_IS_ACTIVE("admins")) {
index c0d4c13..a981f8d 100644 (file)
@@ -115,26 +115,28 @@ function ADMINS_CHECK_ACL($act, $wht) {
        } // END - if
 
        // Return value
+       //* DEBUG: */ print __FUNCTION__."[".__LINE__."]:act={$act},wht={$wht},default={$default},acl_mode={$acl_mode}<br />\n";
        return $ret;
 }
 
 // Create email link to admins's account
 function ADMINS_CREATE_EMAIL_LINK ($email, $mod="admin") {
-       if (strpos("@", $email) > 0) {
+       // Is it an email?
+       if (strpos($email, "@") !== false) {
                // Create email link
-               $result = SQL_QUERY_ESC("SELECT id
+               $result = SQL_QUERY_ESC("SELECT `id`
 FROM `{!_MYSQL_PREFIX!}_admins`
-WHERE email='%s' LIMIT 1",
+WHERE `email`='%s' LIMIT 1",
                        array($email), __FUNCTION__, __LINE__);
 
                // Is there an entry?
                if (SQL_NUMROWS($result) == 1) {
                        // Load userid
-                       list($uid) = SQL_FETCHROW($result);
+                       list($aid) = SQL_FETCHROW($result);
 
                        // Rewrite email address to contact link
-                       $email = "{!URL!}/modules.php?module=".$mod."&amp;what=user_contct&amp;uid=".bigintval($uid);
-               }
+                       $email = "{!URL!}/modules.php?module=".$mod."&amp;what=admins_contct&amp;admin=".bigintval($aid);
+               } // END - if
 
                // Free memory
                SQL_FREERESULT($result);
index 18038d7..8e913f2 100644 (file)
@@ -204,7 +204,7 @@ function USER_CREATE_EMAIL_LINK($email, $mod="admin") {
 
        $result = SQL_QUERY_ESC("SELECT userid
 FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE email='%s'".$locked." LIMIT 1",
+WHERE `email`='%s'".$locked." LIMIT 1",
         array($email), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Load userid
index 5efb6f5..f0aff19 100644 (file)
@@ -946,7 +946,7 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct
                        } // END - foreach
 
                        // Finish SQL statement
-                       $sql = substr($sql, 0, -1) . sprintf(" WHERE %s=%s AND %s='%s' LIMIT 1",
+                       $sql = substr($sql, 0, -1) . sprintf(" WHERE `%s`=%s AND `%s`='%s' LIMIT 1",
                                $idColumn,
                                bigintval($id),
                                $statusColumn,
index 111c65c..db30152 100644 (file)
@@ -1472,7 +1472,11 @@ function GET_ADMIN_DEFAULT_ACL ($aid) {
        // By default an invalid ACL value is returned
        $ret = "***";
 
-       if (isset($GLOBALS['cache_array']['admins']['def_acl'][$aid])) {
+       // Is sql_patches there and was it found in cache?
+       if (!EXT_IS_ACTIVE("sql_patches")) {
+               // Not found, which is bad, so we need to allow all
+               $ret =  "allow";
+       } elseif (isset($GLOBALS['cache_array']['admins']['def_acl'][$aid])) {
                // Use cache
                $ret = $GLOBALS['cache_array']['admins']['def_acl'][$aid];