PluginProbe
The WP Remote WordPress Plugin / trunk
The WP Remote WordPress Plugin vtrunk
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
← All changes | account.php +10 -2 5.72trunk View file →
@@ -16,8 +16,12 @@
16 16 $this->secret = $secret;
17 17 }
18 18
19 19 public static function find($settings, $public) {
20 + if (!is_string($public)) {
21 + return null;
22 + }
23 +
20 24 $accounts = self::allAccounts($settings);
21 25 if (array_key_exists($public, $accounts) && isset($accounts[$public]['secret'])) {
22 26 $secret = $accounts[$public]['secret'];
23 27 }
@@ -42,14 +46,18 @@
42 46
43 47 $str = "";
44 48 $size = strlen($chars);
45 49 for( $i = 0; $i < $length; $i++ ) {
46 - $str .= $chars[rand(0, $size - 1)];
50 + $str .= $chars[random_int(0, $size - 1)];
47 51 }
48 52 return $str;
49 53 }
50 54
51 55 public static function sanitizeKey($key) {
56 + if (!is_string($key)) {
57 + return '';
58 + }
59 +
52 60 return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key);
53 61 }
54 62
55 63 public static function apiPublicAccount($settings) {
@@ -236,5 +244,5 @@
236 244 $accounts = self::allAccounts($settings);
237 245 return array_key_exists($pubkey, $accounts);
238 246 }
239 247 }
240 -endif;
248 +endif;