Fixes/rewrites for missing sql_patches and check on admin's default access mode ...
[mailer.git] / inc / libs / admins_functions.php
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);