Lines 1-124
Link Here
|
1 |
--- lib/functions.php.orig 2012-10-01 06:54:14 UTC |
|
|
2 |
+++ lib/functions.php |
3 |
@@ -51,7 +51,7 @@ if (file_exists(LIBDIR.'functions.custom |
4 |
/** |
5 |
* Loads class definition |
6 |
*/ |
7 |
-function __autoload($className) { |
8 |
+function pla_autoloader($className) { |
9 |
if (file_exists(HOOKSDIR."classes/$className.php")) |
10 |
require_once(HOOKSDIR."classes/$className.php"); |
11 |
elseif (file_exists(LIBDIR."$className.php")) |
12 |
@@ -65,6 +65,7 @@ function __autoload($className) { |
13 |
__METHOD__,_('Called to load a class that cant be found'),$className), |
14 |
'type'=>'error')); |
15 |
} |
16 |
+spl_autoload_register('pla_autoloader'); |
17 |
|
18 |
/** |
19 |
* Strips all slashes from the specified array in place (pass by ref). |
20 |
@@ -745,6 +746,7 @@ function blowfish_encrypt($data,$secret= |
21 |
if (! trim($secret)) |
22 |
return $data; |
23 |
|
24 |
+/* |
25 |
if (function_exists('mcrypt_module_open') && ! empty($data)) { |
26 |
$td = mcrypt_module_open(MCRYPT_BLOWFISH,'',MCRYPT_MODE_ECB,''); |
27 |
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_DEV_URANDOM); |
28 |
@@ -754,6 +756,7 @@ function blowfish_encrypt($data,$secret= |
29 |
|
30 |
return $encrypted_data; |
31 |
} |
32 |
+*/ |
33 |
|
34 |
if (file_exists(LIBDIR.'blowfish.php')) |
35 |
require_once LIBDIR.'blowfish.php'; |
36 |
@@ -801,6 +804,7 @@ function blowfish_decrypt($encdata,$secr |
37 |
if (! trim($secret)) |
38 |
return $encdata; |
39 |
|
40 |
+/* |
41 |
if (function_exists('mcrypt_module_open') && ! empty($encdata)) { |
42 |
$td = mcrypt_module_open(MCRYPT_BLOWFISH,'',MCRYPT_MODE_ECB,''); |
43 |
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_DEV_URANDOM); |
44 |
@@ -810,6 +814,7 @@ function blowfish_decrypt($encdata,$secr |
45 |
|
46 |
return $decrypted_data; |
47 |
} |
48 |
+*/ |
49 |
|
50 |
if (file_exists(LIBDIR.'blowfish.php')) |
51 |
require_once LIBDIR.'blowfish.php'; |
52 |
@@ -1080,7 +1085,7 @@ function masort(&$data,$sortby,$rev=0) { |
53 |
|
54 |
$code .= 'return $c;'; |
55 |
|
56 |
- $CACHE[$sortby] = create_function('$a, $b',$code); |
57 |
+ $CACHE[$sortby] = function($a, $b) { global $code; return $code; }; |
58 |
} |
59 |
|
60 |
uasort($data,$CACHE[$sortby]); |
61 |
@@ -2127,7 +2132,7 @@ function password_types() { |
62 |
* crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512, or clear. |
63 |
* @return string The hashed password. |
64 |
*/ |
65 |
-function password_hash($password_clear,$enc_type) { |
66 |
+function password_hash_custom($password_clear,$enc_type) { |
67 |
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) |
68 |
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); |
69 |
|
70 |
@@ -2318,7 +2323,7 @@ function password_check($cryptedpassword |
71 |
|
72 |
# SHA crypted passwords |
73 |
case 'sha': |
74 |
- if (strcasecmp(password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0) |
75 |
+ if (strcasecmp(password_hash_custom($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0) |
76 |
return true; |
77 |
else |
78 |
return false; |
79 |
@@ -2327,7 +2332,7 @@ function password_check($cryptedpassword |
80 |
|
81 |
# MD5 crypted passwords |
82 |
case 'md5': |
83 |
- if( strcasecmp(password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0) |
84 |
+ if( strcasecmp(password_hash_custom($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0) |
85 |
return true; |
86 |
else |
87 |
return false; |
88 |
@@ -2392,7 +2397,7 @@ function password_check($cryptedpassword |
89 |
|
90 |
# SHA512 crypted passwords |
91 |
case 'sha512': |
92 |
- if (strcasecmp(password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0) |
93 |
+ if (strcasecmp(password_hash_custom($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0) |
94 |
return true; |
95 |
else |
96 |
return false; |
97 |
@@ -2564,13 +2569,24 @@ function dn_unescape($dn) { |
98 |
if (is_array($dn)) { |
99 |
$a = array(); |
100 |
|
101 |
- foreach ($dn as $key => $rdn) |
102 |
- $a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn); |
103 |
+ foreach ($dn as $key => $rdn) { |
104 |
+ $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', |
105 |
+ function ($m) { |
106 |
+ return ''.chr(hexdec('\\1')).''; |
107 |
+ }, |
108 |
+ $rdn |
109 |
+ ); |
110 |
+ } |
111 |
|
112 |
return $a; |
113 |
|
114 |
} else { |
115 |
- return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn); |
116 |
+ return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', |
117 |
+ function ($m) { |
118 |
+ return ''.chr(hexdec('\\1')).''; |
119 |
+ }, |
120 |
+ $dn |
121 |
+ ); |
122 |
} |
123 |
} |
124 |
|