]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/admin-inc.php
Some language strings rewritten to use getMessage()
[mailer.git] / inc / modules / admin / admin-inc.php
index bdb9dedaf6c4ed86e8a64b269737850f92662f81..151cc2e5782948550f506d848f7086f574049fd2 100644 (file)
@@ -45,11 +45,11 @@ if (!defined('__SECURITY')) {
 // Register an administrator account
 function REGISTER_ADMIN ($user, $md5, $email) {
        // Login does already exist
-       $ret = "already";
+       $ret = 'already';
 
        // Lookup the admin
        $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
-       array($user), __FUNCTION__, __LINE__);
+               array($user), __FUNCTION__, __LINE__);
 
        // Is the entry there?
        if (SQL_NUMROWS($result) == 0) {
@@ -95,8 +95,8 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) {
                $add = runFilterChain('sql_admin_extra_data');
 
                // Get password from DB
-               $result = SQL_QUERY_ESC("SELECT password".$add." FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
-               array($aid), __FUNCTION__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT `password`" . $add . " FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
+                       array($aid), __FUNCTION__, __LINE__);
 
                // Entry found?
                if (SQL_NUMROWS($result) == 1) {
@@ -111,7 +111,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) {
                SQL_FREERESULT($result);
        }
 
-       //* DEBUG: */ echo "*".$data['password'].'/'.md5($password).'/'.$ret."<br />";
+       //* DEBUG: */ OUTPUT_HTML("*".$data['password'].'/'.md5($password).'/'.$ret."<br />");
        if ((isset($data['password'])) && (strlen($data['password']) == 32) && ($data['password'] == md5($password))) {
                // Generate new hash
                $data['password'] = generateHash($password);
@@ -131,7 +131,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) {
        $salt = __SALT;
 
        // Check if password is same
-       //* DEBUG: */ echo "*".$ret.','.$data['password'].','.$password.','.$salt."*<br >\n";
+       //* DEBUG: */ OUTPUT_HTML("*".$ret.','.$data['password'].','.$password.','.$salt."*<br />");
        if (($ret == 'pass') && ($data['password'] == generateHash($password, $salt)) && ((!empty($salt))) || ($data['password'] == $password)) {
                // Re-hash the plain passord with new random salt
                $data['password'] = generateHash($password);
@@ -195,42 +195,41 @@ function LOGIN_ADMIN ($adminLogin, $passHash) {
        if ((GET_EXT_VERSION('admins') >= '0.7.0') && ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == ''))) {
                // Reset counter on out-dated sql_patches version
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET login_failures=0,last_failure='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1",
-               array($adminLogin), __FUNCTION__, __LINE__);
+                       array($adminLogin), __FUNCTION__, __LINE__);
 
                // Rebuild cache
                rebuildCacheFiles('admins', 'admin');
        } // END - if
 
        // Now set all session variables and return the result
-       return (
-       (
-       setSession('admin_md5', generatePassString($passHash))
+       return ((
+               setSession('admin_md5', generatePassString($passHash))
        ) && (
-       setSession('admin_login', $adminLogin)
+               setSession('admin_login', $adminLogin)
        ) && (
-       setSession('admin_last', time())
+               setSession('admin_last', time())
        ) && (
-       setSession('admin_to', bigintval(REQUEST_POST('timeout')))
-       )
-       );
+               setSession('admin_to', bigintval(REQUEST_POST('timeout')))
+       ));
 }
 
 // Only be executed on cookie checking
 function CHECK_ADMIN_COOKIES ($admin_login, $password) {
        // By default no admin cookies are found
-       $ret = '404'; $pass = '';
+       $ret  = '404';
+       $pass = '';
 
        // Get hash
        $pass = GET_ADMIN_HASH(GET_ADMIN_ID($admin_login));
        if ($pass != '-1') $ret = 'pass';
 
-       //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):".generatePassString($pass).'('.strlen($pass).")/".$password.'('.strlen($password).")<br />\n";
+       //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):".generatePassString($pass).'('.strlen($pass).")/".$password.'('.strlen($password).")<br />");
 
        // Check if password matches
        if (($ret == 'pass') && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass)))) {
                // Passwords matches!
                $ret = 'done';
-       }
+       } // END - if
 
        // Return result
        return $ret;
@@ -239,7 +238,7 @@ function CHECK_ADMIN_COOKIES ($admin_login, $password) {
 //
 function ADMIN_DO_ACTION ($wht) {
        global $DATA;
-       //* DEBUG: */ echo __LINE__."*".$wht.'/'.getModule().'/'.getAction().'/'.getWhat()."*<br />\n";
+       //* DEBUG: */ OUTPUT_HTML(__LINE__."*".$wht.'/'.getModule().'/'.getAction().'/'.getWhat()."*<br />");
 
        // Remove any spaces from variable
        if (empty($wht)) {
@@ -356,7 +355,7 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) {
                                        $GLOBALS['menu']['description'][$menu] = $descr;
                                }
                                $OUT .= "<li class=\"admin_menu\">
-               <div class=\"nobr\"><strong>&middot;</strong>&nbsp;";
+<div class=\"nobr\"><strong>&middot;</strong>&nbsp;";
 
                                if (($menu == $act) && (empty($wht))) {
                                        $OUT .= "<strong>";
@@ -689,19 +688,19 @@ function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default = '') {
 }
 
 // Creates a user-profile link for the admin. This function can also be used for many other purposes
-function generateUserProfileLink ($uid, $title = '', $wht="list_user") {
+function generateUserProfileLink ($uid, $title = '', $wht = 'list_user') {
        if (($title == '') && ($title != '0')) {
                // Set userid as title
                $title = $uid;
        } // END - if
 
-       if (($title == '0') && ($wht == "list_refs")) {
+       if (($title == '0') && ($wht == 'list_refs')) {
                // Return title again
                return $title;
        } // END - if
 
-       //* DEBUG: */ echo "a:".$title."<br />";
        // Return link
+       //* DEBUG: */ OUTPUT_HTML("a:".$title."<br />");
        return "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".$wht."&amp;uid=".$uid."\" title=\"{--ADMIN_USER_PROFILE_TITLE--}\">".$title."</a>";
 }
 
@@ -886,13 +885,11 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct
                // "Walk" through all entries
                foreach ($IDs as $id => $sel) {
                        // Construct SQL query
-                       $sql = sprintf("UPDATE `{!_MYSQL_PREFIX!}_%s` SET",
-                       SQL_ESCAPE($table)
-                       );
+                       $sql = sprintf("UPDATE `{!_MYSQL_PREFIX!}_%s` SET", SQL_ESCAPE($table));
 
                        // Load data of entry
                        $result = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_%s` WHERE %s=%s LIMIT 1",
-                       array($table, $idColumn, $id), __FUNCTION__, __LINE__);
+                               array($table, $idColumn, $id), __FUNCTION__, __LINE__);
 
                        // Fetch the data
                        $content = SQL_FETCHARRAY($result);
@@ -901,9 +898,9 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct
                        SQL_FREERESULT($result);
 
                        // Add all status entries (e.g. status column last_updated or so)
-                       $newStatus = "UNKNOWN";
-                       $oldStatus = "UNKNOWN";
-                       $statusColumn = "unknown";
+                       $newStatus = 'UNKNOWN';
+                       $oldStatus = 'UNKNOWN';
+                       $statusColumn = 'unknown';
                        foreach ($statusArray as $column => $statusInfo) {
                                // Does the entry exist?
                                if ((isset($content[$column])) && (isset($statusInfo[$content[$column]]))) {
@@ -911,7 +908,7 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct
                                        $sql .= sprintf(" %s='%s',", SQL_ESCAPE($column), SQL_ESCAPE($statusInfo[$content[$column]]));
 
                                        // Remember status
-                                       if ($statusColumn == "unknown") {
+                                       if ($statusColumn == 'unknown') {
                                                // Always (!!!) change status column first!
                                                $oldStatus = $content[$column];
                                                $newStatus = $statusInfo[$oldStatus];