@@ -340,7 +340,8 @@ discard block |
||
340 | 340 | * @param string $string |
341 | 341 | * @return string |
342 | 342 | */ |
343 | -function save_user_quoted_printable($string) { |
|
343 | +function save_user_quoted_printable($string) |
|
344 | +{ |
|
344 | 345 | $crlf = "\n"; |
345 | 346 | $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
346 | 347 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
@@ -359,7 +360,8 @@ discard block |
||
359 | 360 | * @param string $pwd |
360 | 361 | * @param string $ufn |
361 | 362 | */ |
362 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
363 | +function sendMailMessage($email, $uid, $pwd, $ufn) |
|
364 | +{ |
|
363 | 365 | global $modx, $_lang, $websignupemail_message; |
364 | 366 | global $emailsubject, $emailsender; |
365 | 367 | global $site_name, $site_url; |
@@ -387,7 +389,8 @@ discard block |
||
387 | 389 | } |
388 | 390 | |
389 | 391 | // Save User Settings |
390 | -function saveUserSettings($id) { |
|
392 | +function saveUserSettings($id) |
|
393 | +{ |
|
391 | 394 | global $modx; |
392 | 395 | $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
393 | 396 | |
@@ -416,7 +419,8 @@ discard block |
||
416 | 419 | } |
417 | 420 | |
418 | 421 | // Web alert - sends an alert to web browser |
419 | -function webAlertAndQuit($msg) { |
|
422 | +function webAlertAndQuit($msg) |
|
423 | +{ |
|
420 | 424 | global $id, $modx; |
421 | 425 | $mode = $_POST['mode']; |
422 | 426 | $modx->manager->saveFormValues($mode); |
@@ -424,7 +428,8 @@ discard block |
||
424 | 428 | } |
425 | 429 | |
426 | 430 | // Generate password |
427 | -function generate_password($length = 10) { |
|
431 | +function generate_password($length = 10) |
|
432 | +{ |
|
428 | 433 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
429 | 434 | $ps_len = strlen($allowable_characters); |
430 | 435 | mt_srand((double) microtime() * 1000000); |
@@ -435,7 +440,8 @@ discard block |
||
435 | 440 | return $pass; |
436 | 441 | } |
437 | 442 | |
438 | -function sanitize($str = '', $safecount = 0) { |
|
443 | +function sanitize($str = '', $safecount = 0) |
|
444 | +{ |
|
439 | 445 | global $modx; |
440 | 446 | $safecount++; |
441 | 447 | if(1000 < $safecount) { |
@@ -1,13 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
3 | 4 | /** |
4 | 5 | * @return string |
5 | 6 | */ |
6 | - public function getDP() { |
|
7 | + public function getDP() |
|
8 | + { |
|
7 | 9 | global $modx; |
8 | 10 | |
9 | 11 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
10 | - if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
12 | + if(!isset($modx->config['lang_code'])) { |
|
13 | + $modx->config['lang_code'] = $this->getLangCode(); |
|
14 | + } |
|
11 | 15 | $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
12 | 16 | return $modx->mergeSettingsContent($load_script); |
13 | 17 | } |
@@ -15,13 +19,18 @@ discard block |
||
15 | 19 | /** |
16 | 20 | * @return string |
17 | 21 | */ |
18 | - public function getLangCode() { |
|
22 | + public function getLangCode() |
|
23 | + { |
|
19 | 24 | global $modx, $modx_lang_attribute; |
20 | 25 | |
21 | - if(!$modx_lang_attribute) return 'en'; |
|
26 | + if(!$modx_lang_attribute) { |
|
27 | + return 'en'; |
|
28 | + } |
|
22 | 29 | |
23 | 30 | $lc = $modx_lang_attribute; |
24 | - if($lc === 'uk') return 'ru'; |
|
31 | + if($lc === 'uk') { |
|
32 | + return 'ru'; |
|
33 | + } |
|
25 | 34 | $dp_path = str_replace('\\','/',dirname(__FILE__)); |
26 | 35 | |
27 | 36 | return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en'; |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | /** |
7 | 7 | * @return string |
8 | 8 | */ |
9 | -function genEvoSessionName() |
|
10 | -{ |
|
9 | +function genEvoSessionName() |
|
10 | +{ |
|
11 | 11 | $_ = crc32(__FILE__); |
12 | 12 | $_ = sprintf('%u', $_); |
13 | 13 | |
@@ -17,10 +17,12 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @return void |
19 | 19 | */ |
20 | -function startCMSSession() |
|
21 | -{ |
|
20 | +function startCMSSession() |
|
21 | +{ |
|
22 | 22 | global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain; |
23 | - if(MODX_CLI) return; |
|
23 | + if(MODX_CLI) { |
|
24 | + return; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | session_name($site_sessionname); |
26 | 28 | removeInvalidCmsSessionIds($site_sessionname); |
@@ -31,14 +33,14 @@ discard block |
||
31 | 33 | session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
32 | 34 | session_start(); |
33 | 35 | $key = "modx.mgr.session.cookie.lifetime"; |
34 | - if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
36 | + if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
35 | 37 | $cookieLifetime = (int)$_SESSION[$key]; |
36 | - if ($cookieLifetime) { |
|
38 | + if ($cookieLifetime) { |
|
37 | 39 | $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
38 | 40 | } |
39 | 41 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
40 | 42 | } |
41 | - if (!isset($_SESSION['modx.session.created.time'])) { |
|
43 | + if (!isset($_SESSION['modx.session.created.time'])) { |
|
42 | 44 | $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME']; |
43 | 45 | } |
44 | 46 | } |
@@ -48,9 +50,9 @@ discard block |
||
48 | 50 | * @param $session_name |
49 | 51 | * @return void |
50 | 52 | */ |
51 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
52 | -{ |
|
53 | - if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
53 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
54 | +{ |
|
55 | + if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
54 | 56 | unset($storage[$session_name]); |
55 | 57 | } |
56 | 58 | } |
@@ -59,9 +61,11 @@ discard block |
||
59 | 61 | * @param $session_name |
60 | 62 | * @return void |
61 | 63 | */ |
62 | -function removeInvalidCmsSessionIds($session_name) |
|
63 | -{ |
|
64 | - if(MODX_CLI) return; |
|
64 | +function removeInvalidCmsSessionIds($session_name) |
|
65 | +{ |
|
66 | + if(MODX_CLI) { |
|
67 | + return; |
|
68 | + } |
|
65 | 69 | // session ids is invalid iff it is empty string |
66 | 70 | // storage priorioty can see in PHP source ext/session/session.c |
67 | 71 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |