@@ -51,6 +51,9 @@ |
||
51 | 51 | return $this->getContent($this->getUrl($qrtext, $size)); |
52 | 52 | } |
53 | 53 | |
54 | + /** |
|
55 | + * @param string $value |
|
56 | + */ |
|
54 | 57 | private function decodeColor($value) |
55 | 58 | { |
56 | 59 | return vsprintf('%d-%d-%d', sscanf($value, "%02x%02x%02x")); |
@@ -59,13 +59,13 @@ |
||
59 | 59 | public function getUrl($qrtext, $size) |
60 | 60 | { |
61 | 61 | return 'https://api.qrserver.com/v1/create-qr-code/' |
62 | - . '?size=' . $size . 'x' . $size |
|
63 | - . '&ecc=' . strtoupper($this->errorcorrectionlevel) |
|
64 | - . '&margin=' . $this->margin |
|
65 | - . '&qzone=' . $this->qzone |
|
66 | - . '&bgcolor=' . $this->decodeColor($this->bgcolor) |
|
67 | - . '&color=' . $this->decodeColor($this->color) |
|
68 | - . '&format=' . strtolower($this->format) |
|
69 | - . '&data=' . rawurlencode($qrtext); |
|
62 | + . '?size='.$size.'x'.$size |
|
63 | + . '&ecc='.strtoupper($this->errorcorrectionlevel) |
|
64 | + . '&margin='.$this->margin |
|
65 | + . '&qzone='.$this->qzone |
|
66 | + . '&bgcolor='.$this->decodeColor($this->bgcolor) |
|
67 | + . '&color='.$this->decodeColor($this->color) |
|
68 | + . '&format='.strtolower($this->format) |
|
69 | + . '&data='.rawurlencode($qrtext); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -14,8 +14,9 @@ |
||
14 | 14 | |
15 | 15 | function __construct($verifyssl = false, $errorcorrectionlevel = 'L', $margin = 4, $qzone = 1, $bgcolor = 'ffffff', $color = '000000', $format = 'png') |
16 | 16 | { |
17 | - if (!is_bool($verifyssl)) |
|
18 | - throw new QRException('VerifySSL must be bool'); |
|
17 | + if (!is_bool($verifyssl)) { |
|
18 | + throw new QRException('VerifySSL must be bool'); |
|
19 | + } |
|
19 | 20 | |
20 | 21 | $this->verifyssl = $verifyssl; |
21 | 22 |
@@ -32,16 +32,16 @@ |
||
32 | 32 | { |
33 | 33 | switch (strtolower($this->format)) |
34 | 34 | { |
35 | - case 'png': |
|
35 | + case 'png': |
|
36 | 36 | return 'image/png'; |
37 | - case 'gif': |
|
37 | + case 'gif': |
|
38 | 38 | return 'image/gif'; |
39 | - case 'jpg': |
|
40 | - case 'jpeg': |
|
39 | + case 'jpg': |
|
40 | + case 'jpeg': |
|
41 | 41 | return 'image/jpeg'; |
42 | - case 'svg': |
|
42 | + case 'svg': |
|
43 | 43 | return 'image/svg+xml'; |
44 | - case 'eps': |
|
44 | + case 'eps': |
|
45 | 45 | return 'application/postscript'; |
46 | 46 | } |
47 | 47 | throw new \QRException(sprintf('Unknown MIME-type: %s', $this->format)); |
@@ -139,6 +139,7 @@ |
||
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Get data-uri of QRCode |
142 | + * @param string $label |
|
142 | 143 | */ |
143 | 144 | public function getQRCodeImageAsDataUri($label, $secret, $size = 200) |
144 | 145 | { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $algorithm = strtolower(trim($algorithm)); |
38 | 38 | if (!in_array($algorithm, self::$_supportedalgos)) |
39 | - throw new TwoFactorAuthException('Unsupported algorithm: ' . $algorithm); |
|
39 | + throw new TwoFactorAuthException('Unsupported algorithm: '.$algorithm); |
|
40 | 40 | $this->algorithm = $algorithm; |
41 | 41 | $this->qrcodeprovider = $qrcodeprovider; |
42 | 42 | $this->rngprovider = $rngprovider; |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | public function createSecret($bits = 80, $requirecryptosecure = true) |
53 | 53 | { |
54 | 54 | $secret = ''; |
55 | - $bytes = ceil($bits / 5); //We use 5 bits of each byte (since we have a 32-character 'alphabet' / BASE32) |
|
55 | + $bytes = ceil($bits / 5); //We use 5 bits of each byte (since we have a 32-character 'alphabet' / BASE32) |
|
56 | 56 | $rngprovider = $this->getRngprovider(); |
57 | 57 | if ($requirecryptosecure && !$rngprovider->isCryptographicallySecure()) |
58 | 58 | throw new TwoFactorAuthException('RNG provider is not cryptographically secure'); |
59 | 59 | $rnd = $rngprovider->getRandomBytes($bytes); |
60 | 60 | for ($i = 0; $i < $bytes; $i++) |
61 | - $secret .= self::$_base32[ord($rnd[$i]) & 31]; //Mask out left 3 bits for 0-31 values |
|
61 | + $secret .= self::$_base32[ord($rnd[$i]) & 31]; //Mask out left 3 bits for 0-31 values |
|
62 | 62 | return $secret; |
63 | 63 | } |
64 | 64 | |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | { |
70 | 70 | $secretkey = $this->base32Decode($secret); |
71 | 71 | |
72 | - $timestamp = "\0\0\0\0" . pack('N*', $this->getTimeSlice($this->getTime($time))); // Pack time into binary string |
|
73 | - $hashhmac = hash_hmac($this->algorithm, $timestamp, $secretkey, true); // Hash it with users secret key |
|
74 | - $hashpart = substr($hashhmac, ord(substr($hashhmac, -1)) & 0x0F, 4); // Use last nibble of result as index/offset and grab 4 bytes of the result |
|
75 | - $value = unpack('N', $hashpart); // Unpack binary value |
|
76 | - $value = $value[1] & 0x7FFFFFFF; // Drop MSB, keep only 31 bits |
|
72 | + $timestamp = "\0\0\0\0".pack('N*', $this->getTimeSlice($this->getTime($time))); // Pack time into binary string |
|
73 | + $hashhmac = hash_hmac($this->algorithm, $timestamp, $secretkey, true); // Hash it with users secret key |
|
74 | + $hashpart = substr($hashhmac, ord(substr($hashhmac, -1)) & 0x0F, 4); // Use last nibble of result as index/offset and grab 4 bytes of the result |
|
75 | + $value = unpack('N', $hashpart); // Unpack binary value |
|
76 | + $value = $value[1] & 0x7FFFFFFF; // Drop MSB, keep only 31 bits |
|
77 | 77 | |
78 | 78 | return str_pad($value % pow(10, $this->digits), $this->digits, '0', STR_PAD_LEFT); |
79 | 79 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | for ($i = -$discrepancy; $i <= $discrepancy; $i++) |
91 | 91 | $result |= $this->codeEquals($this->getCode($secret, $timetamp + ($i * $this->period)), $code); |
92 | 92 | |
93 | - return (bool)$result; |
|
93 | + return (bool) $result; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | // In general, it's not possible to prevent length leaks. So it's OK to leak the length. The important part is that |
104 | 104 | // we don't leak information about the difference of the two strings. |
105 | - if (strlen($safe)===strlen($user)) { |
|
105 | + if (strlen($safe) === strlen($user)) { |
|
106 | 106 | $result = 0; |
107 | 107 | for ($i = 0; $i < strlen($safe); $i++) |
108 | 108 | $result |= (ord($safe[$i]) ^ ord($user[$i])); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | private function getTimeSlice($time = null, $offset = 0) |
163 | 163 | { |
164 | - return (int)floor($time / $this->period) + ($offset * $this->period); |
|
164 | + return (int) floor($time / $this->period) + ($offset * $this->period); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function getQRText($label, $secret) |
171 | 171 | { |
172 | - return 'otpauth://totp/' . rawurlencode($label) |
|
173 | - . '?secret=' . rawurlencode($secret) |
|
174 | - . '&issuer=' . rawurlencode($this->issuer) |
|
175 | - . '&period=' . intval($this->period) |
|
176 | - . '&algorithm=' . rawurlencode(strtoupper($this->algorithm)) |
|
177 | - . '&digits=' . intval($this->digits); |
|
172 | + return 'otpauth://totp/'.rawurlencode($label) |
|
173 | + . '?secret='.rawurlencode($secret) |
|
174 | + . '&issuer='.rawurlencode($this->issuer) |
|
175 | + . '&period='.intval($this->period) |
|
176 | + . '&algorithm='.rawurlencode(strtoupper($this->algorithm)) |
|
177 | + . '&digits='.intval($this->digits); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | private function base32Decode($value) |
181 | 181 | { |
182 | - if (strlen($value)==0) return ''; |
|
182 | + if (strlen($value) == 0) return ''; |
|
183 | 183 | |
184 | 184 | if (preg_match('/[^'.preg_quote(self::$_base32dict).']/', $value) !== 0) |
185 | 185 | throw new TwoFactorAuthException('Invalid base32 string'); |
@@ -26,17 +26,20 @@ discard block |
||
26 | 26 | function __construct($issuer = null, $digits = 6, $period = 30, $algorithm = 'sha1', IQRCodeProvider $qrcodeprovider = null, IRNGProvider $rngprovider = null, ITimeProvider $timeprovider = null) |
27 | 27 | { |
28 | 28 | $this->issuer = $issuer; |
29 | - if (!is_int($digits) || $digits <= 0) |
|
30 | - throw new TwoFactorAuthException('Digits must be int > 0'); |
|
29 | + if (!is_int($digits) || $digits <= 0) { |
|
30 | + throw new TwoFactorAuthException('Digits must be int > 0'); |
|
31 | + } |
|
31 | 32 | $this->digits = $digits; |
32 | 33 | |
33 | - if (!is_int($period) || $period <= 0) |
|
34 | - throw new TwoFactorAuthException('Period must be int > 0'); |
|
34 | + if (!is_int($period) || $period <= 0) { |
|
35 | + throw new TwoFactorAuthException('Period must be int > 0'); |
|
36 | + } |
|
35 | 37 | $this->period = $period; |
36 | 38 | |
37 | 39 | $algorithm = strtolower(trim($algorithm)); |
38 | - if (!in_array($algorithm, self::$_supportedalgos)) |
|
39 | - throw new TwoFactorAuthException('Unsupported algorithm: ' . $algorithm); |
|
40 | + if (!in_array($algorithm, self::$_supportedalgos)) { |
|
41 | + throw new TwoFactorAuthException('Unsupported algorithm: ' . $algorithm); |
|
42 | + } |
|
40 | 43 | $this->algorithm = $algorithm; |
41 | 44 | $this->qrcodeprovider = $qrcodeprovider; |
42 | 45 | $this->rngprovider = $rngprovider; |
@@ -54,11 +57,14 @@ discard block |
||
54 | 57 | $secret = ''; |
55 | 58 | $bytes = ceil($bits / 5); //We use 5 bits of each byte (since we have a 32-character 'alphabet' / BASE32) |
56 | 59 | $rngprovider = $this->getRngprovider(); |
57 | - if ($requirecryptosecure && !$rngprovider->isCryptographicallySecure()) |
|
58 | - throw new TwoFactorAuthException('RNG provider is not cryptographically secure'); |
|
60 | + if ($requirecryptosecure && !$rngprovider->isCryptographicallySecure()) { |
|
61 | + throw new TwoFactorAuthException('RNG provider is not cryptographically secure'); |
|
62 | + } |
|
59 | 63 | $rnd = $rngprovider->getRandomBytes($bytes); |
60 | - for ($i = 0; $i < $bytes; $i++) |
|
61 | - $secret .= self::$_base32[ord($rnd[$i]) & 31]; //Mask out left 3 bits for 0-31 values |
|
64 | + for ($i = 0; $i < $bytes; $i++) { |
|
65 | + $secret .= self::$_base32[ord($rnd[$i]) & 31]; |
|
66 | + } |
|
67 | + //Mask out left 3 bits for 0-31 values |
|
62 | 68 | return $secret; |
63 | 69 | } |
64 | 70 | |
@@ -87,8 +93,9 @@ discard block |
||
87 | 93 | $timetamp = $this->getTime($time); |
88 | 94 | |
89 | 95 | // To keep safe from timing-attachs we iterate *all* possible codes even though we already may have verified a code is correct |
90 | - for ($i = -$discrepancy; $i <= $discrepancy; $i++) |
|
91 | - $result |= $this->codeEquals($this->getCode($secret, $timetamp + ($i * $this->period)), $code); |
|
96 | + for ($i = -$discrepancy; $i <= $discrepancy; $i++) { |
|
97 | + $result |= $this->codeEquals($this->getCode($secret, $timetamp + ($i * $this->period)), $code); |
|
98 | + } |
|
92 | 99 | |
93 | 100 | return (bool)$result; |
94 | 101 | } |
@@ -104,8 +111,9 @@ discard block |
||
104 | 111 | // we don't leak information about the difference of the two strings. |
105 | 112 | if (strlen($safe)===strlen($user)) { |
106 | 113 | $result = 0; |
107 | - for ($i = 0; $i < strlen($safe); $i++) |
|
108 | - $result |= (ord($safe[$i]) ^ ord($user[$i])); |
|
114 | + for ($i = 0; $i < strlen($safe); $i++) { |
|
115 | + $result |= (ord($safe[$i]) ^ ord($user[$i])); |
|
116 | + } |
|
109 | 117 | return $result === 0; |
110 | 118 | } |
111 | 119 | return false; |
@@ -116,8 +124,9 @@ discard block |
||
116 | 124 | */ |
117 | 125 | public function getQRCodeImageAsDataUri($label, $secret, $size = 200) |
118 | 126 | { |
119 | - if (!is_int($size) || $size <= 0) |
|
120 | - throw new TwoFactorAuthException('Size must be int > 0'); |
|
127 | + if (!is_int($size) || $size <= 0) { |
|
128 | + throw new TwoFactorAuthException('Size must be int > 0'); |
|
129 | + } |
|
121 | 130 | |
122 | 131 | $qrcodeprovider = $this->getQrCodeProvider(); |
123 | 132 | return 'data:' |
@@ -131,26 +140,30 @@ discard block |
||
131 | 140 | */ |
132 | 141 | public function ensureCorrectTime(array $timeproviders = null, $leniency = 5) |
133 | 142 | { |
134 | - if ($timeproviders != null && !is_array($timeproviders)) |
|
135 | - throw new TwoFactorAuthException('No timeproviders specified'); |
|
143 | + if ($timeproviders != null && !is_array($timeproviders)) { |
|
144 | + throw new TwoFactorAuthException('No timeproviders specified'); |
|
145 | + } |
|
136 | 146 | |
137 | - if ($timeproviders == null) |
|
138 | - $timeproviders = array( |
|
147 | + if ($timeproviders == null) { |
|
148 | + $timeproviders = array( |
|
139 | 149 | new Providers\Time\ConvertUnixTimeDotComTimeProvider(), |
140 | 150 | new Providers\Time\HttpTimeProvider() |
141 | 151 | ); |
152 | + } |
|
142 | 153 | |
143 | 154 | // Get default time provider |
144 | 155 | $timeprovider = $this->getTimeProvider(); |
145 | 156 | |
146 | 157 | // Iterate specified time providers |
147 | 158 | foreach ($timeproviders as $t) { |
148 | - if (!($t instanceof ITimeProvider)) |
|
149 | - throw new TwoFactorAuthException('Object does not implement ITimeProvider'); |
|
159 | + if (!($t instanceof ITimeProvider)) { |
|
160 | + throw new TwoFactorAuthException('Object does not implement ITimeProvider'); |
|
161 | + } |
|
150 | 162 | |
151 | 163 | // Get time from default time provider and compare to specific time provider and throw if time difference is more than specified number of seconds leniency |
152 | - if (abs($timeprovider->getTime() - $t->getTime()) > $leniency) |
|
153 | - throw new TwoFactorAuthException(sprintf('Time for timeprovider is off by more than %d seconds when compared to %s', $leniency, get_class($t))); |
|
164 | + if (abs($timeprovider->getTime() - $t->getTime()) > $leniency) { |
|
165 | + throw new TwoFactorAuthException(sprintf('Time for timeprovider is off by more than %d seconds when compared to %s', $leniency, get_class($t))); |
|
166 | + } |
|
154 | 167 | } |
155 | 168 | } |
156 | 169 | |
@@ -179,23 +192,28 @@ discard block |
||
179 | 192 | |
180 | 193 | private function base32Decode($value) |
181 | 194 | { |
182 | - if (strlen($value)==0) return ''; |
|
195 | + if (strlen($value)==0) { |
|
196 | + return ''; |
|
197 | + } |
|
183 | 198 | |
184 | - if (preg_match('/[^'.preg_quote(self::$_base32dict).']/', $value) !== 0) |
|
185 | - throw new TwoFactorAuthException('Invalid base32 string'); |
|
199 | + if (preg_match('/[^'.preg_quote(self::$_base32dict).']/', $value) !== 0) { |
|
200 | + throw new TwoFactorAuthException('Invalid base32 string'); |
|
201 | + } |
|
186 | 202 | |
187 | 203 | $buffer = ''; |
188 | 204 | foreach (str_split($value) as $char) |
189 | 205 | { |
190 | - if ($char !== '=') |
|
191 | - $buffer .= str_pad(decbin(self::$_base32lookup[$char]), 5, 0, STR_PAD_LEFT); |
|
206 | + if ($char !== '=') { |
|
207 | + $buffer .= str_pad(decbin(self::$_base32lookup[$char]), 5, 0, STR_PAD_LEFT); |
|
208 | + } |
|
192 | 209 | } |
193 | 210 | $length = strlen($buffer); |
194 | 211 | $blocks = trim(chunk_split(substr($buffer, 0, $length - ($length % 8)), 8, ' ')); |
195 | 212 | |
196 | 213 | $output = ''; |
197 | - foreach (explode(' ', $blocks) as $block) |
|
198 | - $output .= chr(bindec(str_pad($block, 8, 0, STR_PAD_RIGHT))); |
|
214 | + foreach (explode(' ', $blocks) as $block) { |
|
215 | + $output .= chr(bindec(str_pad($block, 8, 0, STR_PAD_RIGHT))); |
|
216 | + } |
|
199 | 217 | return $output; |
200 | 218 | } |
201 | 219 |
@@ -200,7 +200,7 @@ |
||
200 | 200 | * Connect to a POP3 server. |
201 | 201 | * @access public |
202 | 202 | * @param string $host |
203 | - * @param integer|boolean $port |
|
203 | + * @param integer $port |
|
204 | 204 | * @param integer $tval |
205 | 205 | * @return boolean |
206 | 206 | */ |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | if (false === $port) { |
170 | 170 | $this->port = $this->POP3_PORT; |
171 | 171 | } else { |
172 | - $this->port = (integer)$port; |
|
172 | + $this->port = (integer) $port; |
|
173 | 173 | } |
174 | 174 | // If no timeout value provided, use default |
175 | 175 | if (false === $timeout) { |
176 | 176 | $this->tval = $this->POP3_TIMEOUT; |
177 | 177 | } else { |
178 | - $this->tval = (integer)$timeout; |
|
178 | + $this->tval = (integer) $timeout; |
|
179 | 179 | } |
180 | 180 | $this->do_debug = $debug_level; |
181 | 181 | $this->username = $username; |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | // Send the Username |
279 | - $this->sendString("USER $username" . self::CRLF); |
|
279 | + $this->sendString("USER $username".self::CRLF); |
|
280 | 280 | $pop3_response = $this->getResponse(); |
281 | 281 | if ($this->checkResponse($pop3_response)) { |
282 | 282 | // Send the Password |
283 | - $this->sendString("PASS $password" . self::CRLF); |
|
283 | + $this->sendString("PASS $password".self::CRLF); |
|
284 | 284 | $pop3_response = $this->getResponse(); |
285 | 285 | if ($this->checkResponse($pop3_response)) { |
286 | 286 | return true; |
@@ -44,11 +44,11 @@ |
||
44 | 44 | public function getUrl($qrtext, $size) |
45 | 45 | { |
46 | 46 | return 'http://qrickit.com/api/qr' |
47 | - . '?qrsize=' . $size |
|
48 | - . '&e=' . strtolower($this->errorcorrectionlevel) |
|
49 | - . '&bgdcolor=' . $this->bgcolor |
|
50 | - . '&fgdcolor=' . $this->color |
|
51 | - . '&t=' . strtolower($this->format) |
|
52 | - . '&d=' . rawurlencode($qrtext); |
|
47 | + . '?qrsize='.$size |
|
48 | + . '&e='.strtolower($this->errorcorrectionlevel) |
|
49 | + . '&bgdcolor='.$this->bgcolor |
|
50 | + . '&fgdcolor='.$this->color |
|
51 | + . '&t='.strtolower($this->format) |
|
52 | + . '&d='.rawurlencode($qrtext); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -27,11 +27,11 @@ |
||
27 | 27 | { |
28 | 28 | switch (strtolower($this->format)) |
29 | 29 | { |
30 | - case 'p': |
|
30 | + case 'p': |
|
31 | 31 | return 'image/png'; |
32 | - case 'g': |
|
32 | + case 'g': |
|
33 | 33 | return 'image/gif'; |
34 | - case 'j': |
|
34 | + case 'j': |
|
35 | 35 | return 'image/jpeg'; |
36 | 36 | } |
37 | 37 | throw new \QRException(sprintf('Unknown MIME-type: %s', $this->format)); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | class CSRNGProvider implements IRNGProvider |
7 | 7 | { |
8 | 8 | public function getRandomBytes($bytecount) { |
9 | - return random_bytes($bytecount); // PHP7+ |
|
9 | + return random_bytes($bytecount); // PHP7+ |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | public function isCryptographicallySecure() { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | $PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.'; |
20 | 20 | $PHPMAILER_LANG['provide_address'] = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.'; |
21 | 21 | $PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية ' . |
22 | - 'فشل في الارسال لكل من : '; |
|
22 | + 'فشل في الارسال لكل من : '; |
|
23 | 23 | $PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: '; |
24 | 24 | $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.'; |
25 | 25 | $PHPMAILER_LANG['smtp_error'] = 'خطأ على مستوى الخادم SMTP: '; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $PHPMAILER_LANG['invalid_address'] = 'الإرسال غير ممكن لأن عنوان البريد الإلكتروني غير صالح: '; |
19 | 19 | $PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.'; |
20 | 20 | $PHPMAILER_LANG['provide_address'] = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.'; |
21 | -$PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية ' . |
|
21 | +$PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية '. |
|
22 | 22 | 'فشل في الارسال لكل من : '; |
23 | 23 | $PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: '; |
24 | 24 | $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.'; |
@@ -56,7 +56,7 @@ |
||
56 | 56 | } elseif (substr_count($val, '$pre = ') > 0) { |
57 | 57 | $_SESSION['pre'] = getSettingValue($val); |
58 | 58 | } elseif (substr_count($val, "define('SECUREPATH',") > 0) { |
59 | - $_SESSION['sk_file'] = substr($val, 23, strpos($val, ');')-24)."/sk.php"; |
|
59 | + $_SESSION['sk_file'] = substr($val, 23, strpos($val, ');') - 24)."/sk.php"; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
@@ -92,7 +92,7 @@ |
||
92 | 92 | |
93 | 93 | // Do clean |
94 | 94 | unlink($settings['bck_script_path'].'/'.$bck_filename.'.sql'); |
95 | - rename ( |
|
95 | + rename( |
|
96 | 96 | $settings['bck_script_path'].'/'.$bck_filename.'.encrypted.sql', |
97 | 97 | $settings['bck_script_path'].'/'.$bck_filename.'.sql' |
98 | 98 | ); |
@@ -227,21 +227,21 @@ discard block |
||
227 | 227 | break; |
228 | 228 | case 'html': |
229 | 229 | //Cleans up output a bit for a better looking, HTML-safe output |
230 | - echo gmdate('Y-m-d H:i:s') . ' ' . htmlentities( |
|
230 | + echo gmdate('Y-m-d H:i:s').' '.htmlentities( |
|
231 | 231 | preg_replace('/[\r\n]+/', '', $str), |
232 | 232 | ENT_QUOTES, |
233 | 233 | 'UTF-8' |
234 | - ) . "<br>\n"; |
|
234 | + )."<br>\n"; |
|
235 | 235 | break; |
236 | 236 | case 'echo': |
237 | 237 | default: |
238 | 238 | //Normalize line breaks |
239 | 239 | $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); |
240 | - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( |
|
240 | + echo gmdate('Y-m-d H:i:s')."\t".str_replace( |
|
241 | 241 | "\n", |
242 | 242 | "\n \t ", |
243 | 243 | trim($str) |
244 | - ) . "\n"; |
|
244 | + )."\n"; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | // Connect to the SMTP server |
277 | 277 | $this->edebug( |
278 | - "Connection: opening to $host:$port, timeout=$timeout, options=" . |
|
278 | + "Connection: opening to $host:$port, timeout=$timeout, options=". |
|
279 | 279 | var_export($options, true), |
280 | 280 | self::DEBUG_CONNECTION |
281 | 281 | ); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $socket_context = stream_context_create($options); |
286 | 286 | set_error_handler(array($this, 'errorHandler')); |
287 | 287 | $this->smtp_conn = stream_socket_client( |
288 | - $host . ":" . $port, |
|
288 | + $host.":".$port, |
|
289 | 289 | $errno, |
290 | 290 | $errstr, |
291 | 291 | $timeout, |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $errstr |
318 | 318 | ); |
319 | 319 | $this->edebug( |
320 | - 'SMTP ERROR: ' . $this->error['error'] |
|
320 | + 'SMTP ERROR: '.$this->error['error'] |
|
321 | 321 | . ": $errstr ($errno)", |
322 | 322 | self::DEBUG_CLIENT |
323 | 323 | ); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | // Get any announcement |
338 | 338 | $announce = $this->get_lines(); |
339 | - $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER); |
|
339 | + $this->edebug('SERVER -> CLIENT: '.$announce, self::DEBUG_SERVER); |
|
340 | 340 | return true; |
341 | 341 | } |
342 | 342 | |
@@ -406,9 +406,9 @@ discard block |
||
406 | 406 | return false; |
407 | 407 | } |
408 | 408 | |
409 | - self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL); |
|
409 | + self::edebug('Auth method requested: '.($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL); |
|
410 | 410 | self::edebug( |
411 | - 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']), |
|
411 | + 'Auth methods available on the server: '.implode(',', $this->server_caps['AUTH']), |
|
412 | 412 | self::DEBUG_LOWLEVEL |
413 | 413 | ); |
414 | 414 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $this->setError('No supported authentication methods found'); |
424 | 424 | return false; |
425 | 425 | } |
426 | - self::edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL); |
|
426 | + self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | if (!in_array($authtype, $this->server_caps['AUTH'])) { |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | // Send encoded username and password |
443 | 443 | if (!$this->sendCommand( |
444 | 444 | 'User & Password', |
445 | - base64_encode("\0" . $username . "\0" . $password), |
|
445 | + base64_encode("\0".$username."\0".$password), |
|
446 | 446 | 235 |
447 | 447 | ) |
448 | 448 | ) { |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $oauth = $OAuth->getOauth64(); |
471 | 471 | |
472 | 472 | // Start authentication |
473 | - if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { |
|
473 | + if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 '.$oauth, 235)) { |
|
474 | 474 | return false; |
475 | 475 | } |
476 | 476 | break; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | |
502 | 502 | if (!$this->sendCommand( |
503 | 503 | 'AUTH NTLM', |
504 | - 'AUTH NTLM ' . base64_encode($msg1), |
|
504 | + 'AUTH NTLM '.base64_encode($msg1), |
|
505 | 505 | 334 |
506 | 506 | ) |
507 | 507 | ) { |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $challenge = base64_decode(substr($this->last_reply, 4)); |
534 | 534 | |
535 | 535 | // Build the response |
536 | - $response = $username . ' ' . $this->hmac($challenge, $password); |
|
536 | + $response = $username.' '.$this->hmac($challenge, $password); |
|
537 | 537 | |
538 | 538 | // send encoded credentials |
539 | 539 | return $this->sendCommand('Username', base64_encode($response), 235); |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $k_ipad = $key ^ $ipad; |
578 | 578 | $k_opad = $key ^ $opad; |
579 | 579 | |
580 | - return md5($k_opad . pack('H*', md5($k_ipad . $data))); |
|
580 | + return md5($k_opad.pack('H*', md5($k_ipad.$data))); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | } |
690 | 690 | //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1 |
691 | 691 | if ($in_headers) { |
692 | - $line = "\t" . $line; |
|
692 | + $line = "\t".$line; |
|
693 | 693 | } |
694 | 694 | } |
695 | 695 | $lines_out[] = $line; |
@@ -698,9 +698,9 @@ discard block |
||
698 | 698 | foreach ($lines_out as $line_out) { |
699 | 699 | //RFC2821 section 4.5.2 |
700 | 700 | if (!empty($line_out) and $line_out[0] == '.') { |
701 | - $line_out = '.' . $line_out; |
|
701 | + $line_out = '.'.$line_out; |
|
702 | 702 | } |
703 | - $this->client_send($line_out . self::CRLF); |
|
703 | + $this->client_send($line_out.self::CRLF); |
|
704 | 704 | } |
705 | 705 | } |
706 | 706 | |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | public function hello($host = '') |
728 | 728 | { |
729 | 729 | //Try extended hello first (RFC 2821) |
730 | - return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host)); |
|
730 | + return (boolean) ($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host)); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | /** |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | */ |
742 | 742 | protected function sendHello($hello, $host) |
743 | 743 | { |
744 | - $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250); |
|
744 | + $noerror = $this->sendCommand($hello, $hello.' '.$host, 250); |
|
745 | 745 | $this->helo_rply = $this->last_reply; |
746 | 746 | if ($noerror) { |
747 | 747 | $this->parseHelloFields($hello); |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $useVerp = ($this->do_verp ? ' XVERP' : ''); |
810 | 810 | return $this->sendCommand( |
811 | 811 | 'MAIL FROM', |
812 | - 'MAIL FROM:<' . $from . '>' . $useVerp, |
|
812 | + 'MAIL FROM:<'.$from.'>'.$useVerp, |
|
813 | 813 | 250 |
814 | 814 | ); |
815 | 815 | } |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | { |
847 | 847 | return $this->sendCommand( |
848 | 848 | 'RCPT TO', |
849 | - 'RCPT TO:<' . $address . '>', |
|
849 | + 'RCPT TO:<'.$address.'>', |
|
850 | 850 | array(250, 251) |
851 | 851 | ); |
852 | 852 | } |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | $this->setError("Command '$command' contained line breaks"); |
883 | 883 | return false; |
884 | 884 | } |
885 | - $this->client_send($commandstring . self::CRLF); |
|
885 | + $this->client_send($commandstring.self::CRLF); |
|
886 | 886 | |
887 | 887 | $this->last_reply = $this->get_lines(); |
888 | 888 | // Fetch SMTP code and possible error code explanation |
@@ -892,8 +892,8 @@ discard block |
||
892 | 892 | $code_ex = (count($matches) > 2 ? $matches[2] : null); |
893 | 893 | // Cut off error code from each response line |
894 | 894 | $detail = preg_replace( |
895 | - "/{$code}[ -]" . |
|
896 | - ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . "/m", |
|
895 | + "/{$code}[ -]". |
|
896 | + ($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m", |
|
897 | 897 | '', |
898 | 898 | $this->last_reply |
899 | 899 | ); |
@@ -904,9 +904,9 @@ discard block |
||
904 | 904 | $detail = substr($this->last_reply, 4); |
905 | 905 | } |
906 | 906 | |
907 | - $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER); |
|
907 | + $this->edebug('SERVER -> CLIENT: '.$this->last_reply, self::DEBUG_SERVER); |
|
908 | 908 | |
909 | - if (!in_array($code, (array)$expect)) { |
|
909 | + if (!in_array($code, (array) $expect)) { |
|
910 | 910 | $this->setError( |
911 | 911 | "$command command failed", |
912 | 912 | $detail, |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | $code_ex |
915 | 915 | ); |
916 | 916 | $this->edebug( |
917 | - 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply, |
|
917 | + 'SMTP ERROR: '.$this->error['error'].': '.$this->last_reply, |
|
918 | 918 | self::DEBUG_CLIENT |
919 | 919 | ); |
920 | 920 | return false; |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | public function turn() |
977 | 977 | { |
978 | 978 | $this->setError('The SMTP TURN command is not implemented'); |
979 | - $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT); |
|
979 | + $this->edebug('SMTP NOTICE: '.$this->error['error'], self::DEBUG_CLIENT); |
|
980 | 980 | return false; |
981 | 981 | } |
982 | 982 | |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | $info = stream_get_meta_data($this->smtp_conn); |
1103 | 1103 | if ($info['timed_out']) { |
1104 | 1104 | $this->edebug( |
1105 | - 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)', |
|
1105 | + 'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)', |
|
1106 | 1106 | self::DEBUG_LOWLEVEL |
1107 | 1107 | ); |
1108 | 1108 | break; |
@@ -1110,8 +1110,8 @@ discard block |
||
1110 | 1110 | // Now check if reads took too long |
1111 | 1111 | if ($endtime and time() > $endtime) { |
1112 | 1112 | $this->edebug( |
1113 | - 'SMTP -> get_lines(): timelimit reached (' . |
|
1114 | - $this->Timelimit . ' sec)', |
|
1113 | + 'SMTP -> get_lines(): timelimit reached ('. |
|
1114 | + $this->Timelimit.' sec)', |
|
1115 | 1115 | self::DEBUG_LOWLEVEL |
1116 | 1116 | ); |
1117 | 1117 | break; |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | $errmsg |
1226 | 1226 | ); |
1227 | 1227 | $this->edebug( |
1228 | - $notice . ' Error #' . $errno . ': ' . $errmsg . " [$errfile line $errline]", |
|
1228 | + $notice.' Error #'.$errno.': '.$errmsg." [$errfile line $errline]", |
|
1229 | 1229 | self::DEBUG_CONNECTION |
1230 | 1230 | ); |
1231 | 1231 | } |