X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=51c43c1bd8c5711f5b9432a49487ee80cb21bca3;hb=427719103e37ed2e27803b833dc5db5841e4dec9;hp=f391b42a8c16bf03071cd51cab8f69b7ebaa0276;hpb=811c2a74188a97591fb05ed1dd3d1929b8bc23aa;p=mailer.git diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index f391b42a8c..51c43c1bd8 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -67,11 +67,11 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) $data = array(); // Is the cache valid? - if (!empty($cacheArray['admins']['aid'][$admin_login])) { + if (!empty($cacheArray['admins']['password'][$admin_login])) { // Get password from cache $data['password'] = $cacheArray['admins']['password'][$admin_login]; $ret = "pass"; - $_CONFIG['cache_hits']++; + if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } // Include more admins data? if (GET_EXT_VERSION("admins") >= "0.7.0") { @@ -79,7 +79,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) $data['login_failtures'] = $cacheArray['admins']['login_failtures'][$admin_login]; $data['last_failture'] = $cacheArray['admins']['last_failture'][$admin_login]; } // END - if - } elseif (GET_EXT_VERSION("cache") == "") { + } elseif (!EXT_IS_ACTIVE("cache")) { $ADD = ""; if (GET_EXT_VERSION("admins") >= "0.7.0") { // Load them here @@ -122,7 +122,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) // Check if password is same //* DEBUG: */ echo "*".$ret.",".$data['password'].",".$password.",".$salt."*
\n"; - if (($ret == "pass") && ($data['password'] == generateHash($password, $salt)) && (!empty($salt))) { + 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); @@ -216,7 +216,7 @@ function CHECK_ADMIN_COOKIES ($admin_login, $password) { $pass = GET_ADMIN_HASH($admin_login); if ($pass != "-1") $ret = "pass"; - //* DEBUG: */ echo __FUNCTION__.":".generatePassString($pass)."(".strlen($pass).")/".$password."(".strlen($password).")
\n"; + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):".generatePassString($pass)."(".strlen($pass).")/".$password."(".strlen($password).")
\n"; // Check if password matches if (($ret == "pass") && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass)))) { @@ -232,6 +232,7 @@ function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) { // Initialize some variables $done = false; $seek++; + $next=-1; $found = false; // Is the file there and read-/write-able? @@ -256,7 +257,7 @@ function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) { if (strpos($line, $search) > -1) { $next = 0; $found = true; } if ($next > -1) { - if ($next == $seek) { + if ($next === $seek) { $next = -1; $line = $prefix . $DATA . $suffix."\n"; } else { @@ -298,24 +299,20 @@ function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) { } // -function ADMIN_DO_ACTION($wht) -{ +function ADMIN_DO_ACTION($wht) { global $menuDesription, $menuTitle, $_CONFIG, $cacheArray, $DATA, $DEPTH; + //* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*
\n"; - if (EXT_IS_ACTIVE("cache")) - { + if (EXT_IS_ACTIVE("cache")) { // Include cache instance global $cacheInstance; } // Remove any spaces from variable - if (empty($wht)) - { + if (empty($wht)) { // Default admin action is the overview page $wht = "overview"; - } - else - { + } else { // Compile out some chars $wht = COMPILE_CODE($wht, false, false, false); } @@ -340,29 +337,21 @@ function ADMIN_DO_ACTION($wht) LOAD_TEMPLATE("admin_main_header"); // Check if action/what pair is valid - $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admin_menu + $result_action = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND ((what='%s' AND what != 'overview') OR ((what='' OR what IS NULL) AND '%s'='overview')) LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { - // Free memory - SQL_FREERESULT($result); + if (SQL_NUMROWS($result_action) == 1) { // Is valid but does the inlcude file exists? $INC = sprintf("%sinc/modules/admin/action-%s.php", PATH, $act); - if ((FILE_READABLE($INC)) && (VALIDATE_MENU_ACTION("admin", $act, $wht)) && (__ACL_ALLOW == true)) - { + if ((FILE_READABLE($INC)) && (VALIDATE_MENU_ACTION("admin", $act, $wht)) && (__ACL_ALLOW == true)) { // Ok, we finally load the admin action module include($INC); - } - elseif (__ACL_ALLOW == false) - { + } elseif (__ACL_ALLOW == false) { // Access denied LOAD_TEMPLATE("admin_menu_failed", false, ADMINS_ACCESS_DENIED); ADD_FATAL(ADMINS_ACCESS_DENIED); - } - else - { + } else { // Include file not found! :-( LOAD_TEMPLATE("admin_menu_failed", false, ADMIN_404_ACTION); ADD_FATAL(ADMIN_404_ACTION_1.$act.ADMIN_404_ACTION_2); @@ -373,6 +362,9 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); ADD_FATAL(ADMIN_INVALID_ACTION_1.$act."/".$wht.ADMIN_INVALID_ACTION_2); } + // Free memory + SQL_FREERESULT($result_action); + // Tableset footer LOAD_TEMPLATE("admin_main_footer"); } @@ -654,7 +646,7 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con // Translate the value? (comma to dot!) if ((is_array($translateComma)) && (in_array($id, $translateComma))) { // Then do it here... :) - $val = str_replace(",", ".", $val); + $val = REVERT_COMMA($val); } // END - if // Shall we add numbers or strings? @@ -779,7 +771,7 @@ function ADMIN_CHECK_MENU_MODE() { if (isset($cacheArray['admins']['la_mode'][get_session('admin_login')])) { // Load from cache $ADMIN = $cacheArray['admins']['la_mode'][get_session('admin_login')]; - $_CONFIG['cache_hits']++; + if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } } elseif (GET_EXT_VERSION("admins") >= "0.6.7") { // Load from database when version of "admins" is enough $result = SQL_QUERY_ESC("SELECT la_mode FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1", @@ -855,8 +847,7 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="") // Is the raw userid set? if ($_POST['uid_raw'][$id] > 0) { // Generate subject - $eval = "\$subjectLine = MEMBER_".$subject."_".strtoupper($table)."_SUBJECT;"; - eval($eval); + $subjectLine = constant('MEMBER_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT'); // Load email template if (!empty($subjectPart)) { @@ -870,8 +861,7 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="") } // END - if // Generate subject - $eval = "\$subjectLine = ADMIN_".$subject."_".strtoupper($table)."_SUBJECT;"; - eval($eval); + $subjectLine = constant('ADMIN_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT'); // Send admin notification out if (!empty($subjectPart)) {