]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/admins_functions.php
New function handleMailId introduced, you need to delete inc/cache/extensions.cache...
[mailer.git] / inc / libs / admins_functions.php
index e0424383fbfd88db20236932c865e1ce6a130017..b613105fa409c312379ffcf39ec120d603cdec30 100644 (file)
@@ -166,7 +166,7 @@ function adminsChangeAdminAccount ($postData, $element = '') {
                if ((!empty($element)) && (isset($postData[$element]))) {
                        // Save this setting
                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `%s`='%s' WHERE `id`=%s LIMIT 1",
-                               array($element, $postData[$element][$id], $id), __FILE__, __LINE__);
+                               array($element, $postData[$element][$id], $id), __FUNCTION__, __LINE__);
 
                        // Admin account saved
                        $message = getMessage('ADMIN_ACCOUNT_SAVED');
@@ -212,7 +212,7 @@ function adminsChangeAdminAccount ($postData, $element = '') {
                                        SQL_QUERY_ESC("UPDATE
        `{?_MYSQL_PREFIX?}_admins`
 SET
-       `login`='%s'".$add.",
+       `login`='%s'" . $add . ",
        `email`='%s',
        `default_acl`='%s',
        `la_mode`='%s'
@@ -231,7 +231,7 @@ LIMIT 1",
                                        SQL_QUERY_ESC("UPDATE
        `{?_MYSQL_PREFIX?}_admins`
 SET
-       `login`='%s'".$add.",
+       `login`='%s'" . $add . ",
        `email`='%s',
        `la_mode`='%s'
 WHERE
@@ -420,7 +420,7 @@ function adminsListAdminAccounts() {
 }
 
 // Sends out mail to all administrators
-// IMPORTANT: Please use SEND_ADMIN_NOTIFCATION() for now!
+// IMPORTANT: Please use sendAdminNotification() instead of calling this function directly
 function sendAdminsEmails ($subj, $template, $content, $userid) {
        // Trim template name
        $template = trim($template);
@@ -463,7 +463,7 @@ function sendAdminsEmails ($subj, $template, $content, $userid) {
                                        $userid
                                ));
                        }
-               } elseif ($adminId == '0') {
+               } elseif (($adminId == '0') || (empty($adminId))) {
                        // Select all email adresses
                        $result = SQL_QUERY("SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC",
                                __FUNCTION__, __LINE__);
@@ -561,7 +561,7 @@ function getAminsExpertWarning () {
 function getAdminLoginFailures ($adminLogin) {
        // Admin login should not be empty
        if (empty($adminLogin)) {
-               debug_report_bug('adminLogin is empty.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'adminLogin is empty.');
        } // END - if
 
        // By default no admin is found
@@ -597,7 +597,7 @@ function getAdminLoginFailures ($adminLogin) {
 function getAdminLastFailure ($adminLogin) {
        // Admin login should not be empty
        if (empty($adminLogin)) {
-               debug_report_bug('adminLogin is empty.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'adminLogin is empty.');
        } // END - if
 
        // By default no admin is found
@@ -636,10 +636,10 @@ function getAdminLastFailure ($adminLogin) {
 // Filter for adding extra data to the query
 function FILTER_ADD_EXTRA_SQL_DATA ($add = '') {
        // Is the admins extension updated? (should be!)
-       if (getExtensionVersion('admins') >= '0.3.0') $add .= ', `default_acl` AS def_acl';
-       if (getExtensionVersion('admins') >= '0.6.7') $add .= ', `la_mode`';
-       if (getExtensionVersion('admins') >= '0.7.2') $add .= ', `login_failures`, UNIX_TIMESTAMP(`last_failure`) AS last_failure';
-       if (getExtensionVersion('admins') >= '0.7.3') $add .= ', `expert_settings`, `expert_warning`';
+       if (isExtensionInstalledAndNewer('admins', '0.3.0')) $add .= ', `default_acl` AS def_acl';
+       if (isExtensionInstalledAndNewer('admins', '0.6.7')) $add .= ', `la_mode`';
+       if (isExtensionInstalledAndNewer('admins', '0.7.2')) $add .= ', `login_failures`, UNIX_TIMESTAMP(`last_failure`) AS last_failure';
+       if (isExtensionInstalledAndNewer('admins', '0.7.3')) $add .= ', `expert_settings`, `expert_warning`';
 
        // Return it
        return $add;
@@ -648,8 +648,8 @@ function FILTER_ADD_EXTRA_SQL_DATA ($add = '') {
 // Reset the login failures
 function FILTER_RESET_ADMINS_LOGIN_FAILURES ($data) {
        // Store it in session
-       setSession('mxchange_admin_failures'    , getAdminLoginFailures($data['login']));
-       setSession('mxchange_admin_last_failure', getAdminLastFailure($data['login']));
+       setSession('mailer_admin_failures'    , getAdminLoginFailures($data['login']));
+       setSession('mailer_admin_last_failure', getAdminLastFailure($data['login']));
 
        // Prepare update data
        $postData['login'][getCurrentAdminId()]          = $data['login'];