]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/admins_functions.php
Mailer used in many places, we still need a good 'selling' title
[mailer.git] / inc / libs / admins_functions.php
index 73362ec6db4c53bdca4cf6b32d058b8036268e1e..ce02418337b0e7d99224cbcc55491c696d03d8e3 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 06/30/2003 *
- * ===============                              Last change: 11/27/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 06/30/2003 *
+ * ===================                          Last change: 11/27/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : admins_functions.php                             *
@@ -50,7 +50,7 @@ function adminsCheckAdminAcl ($action, $what) {
        // Default is deny
        $ret = false;
 
-       // Get admin's ID
+       // Get admin's id
        $adminId = getCurrentAdminId();
 
        // Get admin's defult access right
@@ -70,7 +70,7 @@ function adminsCheckAdminAcl ($action, $what) {
 
        // Shall I test for a main or sub menu? (action or what?)
        $acl_mode = 'failed';
-       if ((getExtensionVersion('cache') >= '0.1.2') && (isset($GLOBALS['cache_array']['admin_acls'])) && (count($GLOBALS['cache_array']['admin_acls']) > 0)) {
+       if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isset($GLOBALS['cache_array']['admin_acls'])) && (count($GLOBALS['cache_array']['admin_acls']) > 0)) {
                // Lookup in cache
                if ((!empty($action)) && (isset($GLOBALS['cache_array']['admin_acls']['action_menu'][$adminId])) & ($GLOBALS['cache_array']['admin_acls']['action_menu'][$adminId] == $action)) {
                        // Main menu line found
@@ -145,7 +145,7 @@ LIMIT 1",
                // Free memory
                SQL_FREERESULT($result);
        } elseif ((is_int($email)) && ($email > 0)) {
-               // Direct ID given
+               // Direct id given
                $email = "{?URL?}/modules.php?module=".$mod."&amp;what=admins_contct&amp;admin=".bigintval($email);
        }
 
@@ -156,9 +156,9 @@ LIMIT 1",
 // Change a lot admin account
 function adminsChangeAdminAccount ($postData) {
        // Begin the update
-       $cache_update = 0;
+       $cache_update = '0';
        foreach ($postData['login'] as $id => $login) {
-               // Secure ID number
+               // Secure id number
                $id = bigintval($id);
 
                // When both passwords match update admin account
@@ -170,9 +170,9 @@ function adminsChangeAdminAccount ($postData) {
                        $hash = generateHash($postData['pass1'][$id]);
 
                        // Save password when set
-                       if (!empty($postData['pass1'][$id])) $add = sprintf(", password='%s'", SQL_ESCAPE($hash));
+                       if (!empty($postData['pass1'][$id])) $add = sprintf(", `password`='%s'", SQL_ESCAPE($hash));
 
-                       // Get admin's ID
+                       // Get admin's id
                        $adminId = getCurrentAdminId();
                        $salt = substr(getAdminHash($adminId), 0, -40);
 
@@ -260,7 +260,7 @@ function adminsEditAdminAccount ($postData) {
        // Begin the edit loop
        $OUT = ''; $SW = 2;
        foreach ($postData['sel'] as $id => $selected) {
-               // Secure ID number
+               // Secure id number
                $id = bigintval($id);
 
                // Get the admin's data
@@ -305,7 +305,7 @@ function adminsDeleteAdminAccount ($postData) {
                // Delete accounts
                $OUT = ''; $SW = 2;
                foreach ($postData['sel'] as $id => $selected) {
-                       // Secure ID number
+                       // Secure id number
                        $id = bigintval($id);
 
                        // Get the admin's data
@@ -339,9 +339,9 @@ function adminsDeleteAdminAccount ($postData) {
 // Remove the given accounts
 function adminsRemoveAdminAccount ($postData) {
        // Begin removal
-       $cache_update = 0;
+       $cache_update = '0';
        foreach ($postData['sel'] as $id => $del) {
-               // Secure ID number
+               // Secure id number
                $id = bigintval($id);
 
                // Delete only when it's not your own account!
@@ -409,12 +409,12 @@ function sendAdminsEmails ($subj, $template, $content, $UID) {
        // Check which admin shall receive this mail
        $result = SQL_QUERY_ESC("SELECT `admin_id` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `admin_id` ASC",
                array($template), __FUNCTION__, __LINE__);
-       if (SQL_NUMROWS($result) == 0) {
+       if (SQL_NUMROWS($result) == '0') {
                // Create new entry (to all admins)
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_mails` (`admin_id`, `mail_template`) VALUES (0, '%s')",
                        array($template), __FUNCTION__, __LINE__);
        } else {
-               // Load admin IDs...
+               // Load admin ids...
                // @TODO This can be, somehow, rewritten
                $adminIds = array();
                while ($content = SQL_FETCHARRAY($result)) {
@@ -427,7 +427,7 @@ function sendAdminsEmails ($subj, $template, $content, $UID) {
                // Init result
                $result = false;
 
-               // "implode" IDs and query string
+               // "implode" ids and query string
                $adminId = implode(',', $adminIds);
                if ($adminId == '-1') {
                        if (isExtensionActive('events')) {
@@ -441,12 +441,12 @@ function sendAdminsEmails ($subj, $template, $content, $UID) {
                                        $UID
                                ));
                        }
-               } elseif ($adminId == 0) {
+               } elseif ($adminId == '0') {
                        // Select all email adresses
                        $result = SQL_QUERY("SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC",
                                __FUNCTION__, __LINE__);
                } else {
-                       // If Admin-ID is not "to-all" select
+                       // If Admin-Id is not "to-all" select
                        $result = SQL_QUERY_ESC("SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id` IN (%s) ORDER BY `id` ASC",
                                array($adminId), __FUNCTION__, __LINE__);
                }