فهرست منبع

'trim' was not working as expected and admins file was usable on for one admin without
whitespace. specific to 1.5.1cvs and 1.4.5cvs

tokul 20 سال پیش
والد
کامیت
f76caa99e9
1فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 12 3
      plugins/administrator/auth.php

+ 12 - 3
plugins/administrator/auth.php

@@ -32,11 +32,11 @@ function adm_check_user() {
         $auth = FALSE;
     } else if (file_exists(SM_PATH . 'plugins/administrator/admins')) {
         $auths = file(SM_PATH . 'plugins/administrator/admins');
-        array_walk($auths, 'trim');
+        array_walk($auths, 'adm_array_trim');
         $auth = in_array($username, $auths);
     } else if (file_exists(SM_PATH . 'config/admins')) {
         $auths = file(SM_PATH . 'config/admins');
-        array_walk($auths, 'trim');
+        array_walk($auths, 'adm_array_trim');
         $auth = in_array($username, $auths);
     } else if (($adm_id = fileowner(SM_PATH . 'config/config.php')) &&
                function_exists('posix_getpwuid')) {
@@ -49,4 +49,13 @@ function adm_check_user() {
     return ($auth);
 }
 
-?>
+/**
+ * Removes whitespace from array values
+ * @param string $value array value that has to be trimmed
+ * @param string $key array key
+ * @since 1.5.1
+ */
+function adm_array_trim(&$value,$key) {
+    $value=trim($value);
+}
+?>