@@ -10,9 +10,13 @@ |
||
10 | 10 | $userid = $_REQUEST['user']; |
11 | 11 | $groupid = $_REQUEST['group']; |
12 | 12 | $subject = $modx->db->escape($_REQUEST['messagesubject']); |
13 | -if($subject=="") $subject="(no subject)"; |
|
13 | +if($subject=="") { |
|
14 | + $subject="(no subject)"; |
|
15 | +} |
|
14 | 16 | $message = $modx->db->escape($_REQUEST['messagebody']); |
15 | -if($message=="") $message="(no message)"; |
|
17 | +if($message=="") { |
|
18 | + $message="(no message)"; |
|
19 | +} |
|
16 | 20 | $postdate = time(); |
17 | 21 | |
18 | 22 | if($sendto=='u') { |
@@ -119,7 +119,7 @@ |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | // secure manager documents - flag as private |
122 | -if($updategroupaccess==true){ |
|
122 | +if($updategroupaccess==true) { |
|
123 | 123 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
124 | 124 | secureMgrDocument(); |
125 | 125 |
@@ -61,9 +61,13 @@ discard block |
||
61 | 61 | $mgr_dir = substr($self_dir,strrpos($self_dir,'/')+1); |
62 | 62 | $base_path = str_replace($mgr_dir . '/index.php','',$self); |
63 | 63 | $site_mgr_path = $base_path . 'assets/cache/siteManager.php'; |
64 | -if(is_file($site_mgr_path)) include_once($site_mgr_path); |
|
64 | +if(is_file($site_mgr_path)) { |
|
65 | + include_once($site_mgr_path); |
|
66 | +} |
|
65 | 67 | $site_hostnames_path = $base_path . 'assets/cache/siteHostnames.php'; |
66 | -if(is_file($site_hostnames_path)) include_once($site_hostnames_path); |
|
68 | +if(is_file($site_hostnames_path)) { |
|
69 | + include_once($site_hostnames_path); |
|
70 | +} |
|
67 | 71 | if(!defined('MGR_DIR') || MGR_DIR!==$mgr_dir) { |
68 | 72 | $src = "<?php\n"; |
69 | 73 | $src .= "define('MGR_DIR', '{$mgr_dir}');\n"; |
@@ -117,9 +121,15 @@ discard block |
||
117 | 121 | $incPath = str_replace("\\","/",dirname(__FILE__)."/includes/"); // Mod by Raymond |
118 | 122 | set_include_path(get_include_path() . PATH_SEPARATOR . $incPath); |
119 | 123 | |
120 | -if (!defined('ENT_COMPAT')) define('ENT_COMPAT', 2); |
|
121 | -if (!defined('ENT_NOQUOTES')) define('ENT_NOQUOTES', 0); |
|
122 | -if (!defined('ENT_QUOTES')) define('ENT_QUOTES', 3); |
|
124 | +if (!defined('ENT_COMPAT')) { |
|
125 | + define('ENT_COMPAT', 2); |
|
126 | +} |
|
127 | +if (!defined('ENT_NOQUOTES')) { |
|
128 | + define('ENT_NOQUOTES', 0); |
|
129 | +} |
|
130 | +if (!defined('ENT_QUOTES')) { |
|
131 | + define('ENT_QUOTES', 3); |
|
132 | +} |
|
123 | 133 | |
124 | 134 | // set the document_root :| |
125 | 135 | if(!isset($_SERVER['DOCUMENT_ROOT']) || empty($_SERVER['DOCUMENT_ROOT'])) { |
@@ -182,10 +192,11 @@ discard block |
||
182 | 192 | |
183 | 193 | $s = array('[+MGR_DIR+]'); |
184 | 194 | $r = array(MGR_DIR); |
185 | -foreach($_lang as $k=>$v) |
|
186 | -{ |
|
187 | - if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v); |
|
188 | -} |
|
195 | +foreach($_lang as $k=>$v) { |
|
196 | + if(strpos($v,'[+')!==false) { |
|
197 | + $_lang[$k] = str_replace($s, $r, $v); |
|
198 | + } |
|
199 | + } |
|
189 | 200 | |
190 | 201 | // send the charset header |
191 | 202 | header('Content-Type: text/html; charset='.$modx_manager_charset); |
@@ -198,7 +209,7 @@ discard block |
||
198 | 209 | include_once "accesscontrol.inc.php"; |
199 | 210 | |
200 | 211 | // double check the session |
201 | -if(!isset($_SESSION['mgrValidated'])){ |
|
212 | +if(!isset($_SESSION['mgrValidated'])) { |
|
202 | 213 | echo "Not Logged In!"; |
203 | 214 | exit; |
204 | 215 | } |
@@ -215,7 +226,9 @@ discard block |
||
215 | 226 | } |
216 | 227 | |
217 | 228 | // Initialize System Alert Message Queque |
218 | -if (!isset($_SESSION['SystemAlertMsgQueque'])) $_SESSION['SystemAlertMsgQueque'] = array(); |
|
229 | +if (!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
230 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
231 | +} |
|
219 | 232 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
220 | 233 | |
221 | 234 | // first we check to see if this is a frameset request |
@@ -223,7 +236,7 @@ discard block |
||
223 | 236 | // this looks to be a top-level frameset request, so let's serve up a frameset |
224 | 237 | if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) { |
225 | 238 | include_once "media/style/".$manager_theme."/frames/1.php"; |
226 | - }else{ |
|
239 | + } else { |
|
227 | 240 | include_once "frames/1.php"; |
228 | 241 | } |
229 | 242 | exit; |
@@ -231,10 +244,15 @@ discard block |
||
231 | 244 | |
232 | 245 | // OK, let's retrieve the action directive from the request |
233 | 246 | $option = array('min_range'=>1,'max_range'=>2000); |
234 | -if(isset($_GET['a']) && isset($_POST['a'])) $modx->webAlertAndQuit($_lang['error_double_action']); |
|
235 | -elseif(isset($_GET['a'])) $action = filter_input(INPUT_GET, 'a',FILTER_VALIDATE_INT,$option); |
|
236 | -elseif(isset($_POST['a'])) $action = filter_input(INPUT_POST,'a',FILTER_VALIDATE_INT,$option); |
|
237 | -else $action = null; |
|
247 | +if(isset($_GET['a']) && isset($_POST['a'])) { |
|
248 | + $modx->webAlertAndQuit($_lang['error_double_action']); |
|
249 | +} elseif(isset($_GET['a'])) { |
|
250 | + $action = filter_input(INPUT_GET, 'a',FILTER_VALIDATE_INT,$option); |
|
251 | +} elseif(isset($_POST['a'])) { |
|
252 | + $action = filter_input(INPUT_POST,'a',FILTER_VALIDATE_INT,$option); |
|
253 | +} else { |
|
254 | + $action = null; |
|
255 | +} |
|
238 | 256 | |
239 | 257 | if (isset($_POST['updateMsgCount']) && $modx->hasPermission('messages')) { |
240 | 258 | include_once 'messageCount.inc.php'; |
@@ -264,11 +282,12 @@ discard block |
||
264 | 282 | $modx->invokeEvent("OnManagerPageInit", array("action" => $action)); |
265 | 283 | |
266 | 284 | // return element filepath |
267 | -function includeFileProcessor ($filepath,$manager_theme) { |
|
285 | +function includeFileProcessor ($filepath,$manager_theme) |
|
286 | +{ |
|
268 | 287 | $element = ""; |
269 | 288 | if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) { |
270 | 289 | $element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath; |
271 | - }else{ |
|
290 | + } else { |
|
272 | 291 | $element = $filepath; |
273 | 292 | } |
274 | 293 | return $element; |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | -if(is_array($evtOut)) { |
|
8 | +if(is_array($evtOut)) { |
|
9 | 9 | echo implode("\n", $evtOut); |
10 | 10 | } |
11 | 11 | ?> |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <?php |
55 | 55 | // invoke OnManagerTreePrerender event |
56 | 56 | $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->db->escape($_REQUEST)); |
57 | - if(is_array($evtOut)) { |
|
57 | + if(is_array($evtOut)) { |
|
58 | 58 | echo implode("\n", $evtOut); |
59 | 59 | } |
60 | 60 | ?> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <?php |
67 | 67 | // invoke OnManagerTreeRender event |
68 | 68 | $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->db->escape($_REQUEST)); |
69 | - if(is_array($evtOut)) { |
|
69 | + if(is_array($evtOut)) { |
|
70 | 70 | echo implode("\n", $evtOut); |
71 | 71 | } |
72 | 72 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | header("X-XSS-Protection: 0"); |
@@ -11,22 +11,22 @@ discard block |
||
11 | 11 | |
12 | 12 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; |
13 | 13 | |
14 | -if (!isset($modx->config['manager_menu_height'])) { |
|
14 | +if (!isset($modx->config['manager_menu_height'])) { |
|
15 | 15 | $modx->config['manager_menu_height'] = 2.2; // rem |
16 | 16 | } |
17 | 17 | |
18 | -if (!isset($modx->config['manager_tree_width'])) { |
|
18 | +if (!isset($modx->config['manager_tree_width'])) { |
|
19 | 19 | $modx->config['manager_tree_width'] = 20; // rem |
20 | 20 | } |
21 | 21 | |
22 | -if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) { |
|
22 | +if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) { |
|
23 | 23 | $initMainframeAction = $_SESSION['onLoginForwardToAction']; |
24 | 24 | unset($_SESSION['onLoginForwardToAction']); |
25 | -} else { |
|
25 | +} else { |
|
26 | 26 | $initMainframeAction = 2; // welcome.static |
27 | 27 | } |
28 | 28 | |
29 | -if (!isset($_SESSION['tree_show_only_folders'])) { |
|
29 | +if (!isset($_SESSION['tree_show_only_folders'])) { |
|
30 | 30 | $_SESSION['tree_show_only_folders'] = 0; |
31 | 31 | } |
32 | 32 | |
@@ -35,21 +35,21 @@ discard block |
||
35 | 35 | $tree_width = $modx->config['manager_tree_width']; |
36 | 36 | $tree_min_width = 0; |
37 | 37 | |
38 | -if (isset($_COOKIE['MODX_widthSideBar'])) { |
|
38 | +if (isset($_COOKIE['MODX_widthSideBar'])) { |
|
39 | 39 | $MODX_widthSideBar = $_COOKIE['MODX_widthSideBar']; |
40 | -} else { |
|
40 | +} else { |
|
41 | 41 | $MODX_widthSideBar = $tree_width; |
42 | 42 | } |
43 | 43 | |
44 | -if (!$MODX_widthSideBar) { |
|
44 | +if (!$MODX_widthSideBar) { |
|
45 | 45 | $body_class .= 'sidebar-closed'; |
46 | 46 | } |
47 | 47 | |
48 | -if (isset($_COOKIE['MODX_themeColor'])) { |
|
48 | +if (isset($_COOKIE['MODX_themeColor'])) { |
|
49 | 49 | $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
50 | 50 | } |
51 | 51 | |
52 | -if (isset($modx->pluginCache['ElementsInTree'])) { |
|
52 | +if (isset($modx->pluginCache['ElementsInTree'])) { |
|
53 | 53 | $body_class .= ' ElementsInTree'; |
54 | 54 | } |
55 | 55 | |
@@ -65,19 +65,19 @@ discard block |
||
65 | 65 | 'type8' => $_lang["lock_element_type_8"] |
66 | 66 | ); |
67 | 67 | |
68 | -foreach ($unlockTranslations as $key => $value) { |
|
68 | +foreach ($unlockTranslations as $key => $value) { |
|
69 | 69 | $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
70 | 70 | } |
71 | 71 | |
72 | 72 | $user = $modx->getUserInfo($modx->getLoginUserID()); |
73 | -if ($user['which_browser'] == 'default') { |
|
73 | +if ($user['which_browser'] == 'default') { |
|
74 | 74 | $user['which_browser'] = $modx->config['which_browser']; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
78 | 78 | |
79 | -if ($modx->config['manager_theme'] == 'default') { |
|
80 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
79 | +if ($modx->config['manager_theme'] == 'default') { |
|
80 | + if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
81 | 81 | require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
82 | 82 | $minifier = new Formatter\CSSMinify(); |
83 | 83 | $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $css = $minifier->minify(); |
95 | 95 | file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
96 | 96 | } |
97 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
97 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
98 | 98 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
99 | 99 | } |
100 | 100 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | <?php |
249 | 249 | // invoke OnManagerTopPrerender event |
250 | 250 | $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST); |
251 | - if (is_array($evtOut)) { |
|
251 | + if (is_array($evtOut)) { |
|
252 | 252 | echo implode("\n", $evtOut); |
253 | 253 | } |
254 | 254 | ?> |
@@ -419,9 +419,12 @@ discard block |
||
419 | 419 | <div id="evo-tab-page-home" class="evo-tab-page show"> |
420 | 420 | <iframe id="mainframe" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
421 | 421 | </div> |
422 | - <?php else: ?> |
|
422 | + <?php else { |
|
423 | + : ?> |
|
423 | 424 | <iframe id="mainframe" name="main" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
424 | - <?php endif; ?> |
|
425 | + <?php endif; |
|
426 | +} |
|
427 | +?> |
|
425 | 428 | <div id="mainloader"></div> |
426 | 429 | </div> |
427 | 430 | <div id="resizer"></div> |
@@ -434,11 +437,11 @@ discard block |
||
434 | 437 | 'tree_sortdir', |
435 | 438 | 'tree_nodename' |
436 | 439 | ); |
437 | - foreach ($sortParams as $param) { |
|
438 | - if (isset($_REQUEST[$param])) { |
|
440 | + foreach ($sortParams as $param) { |
|
441 | + if (isset($_REQUEST[$param])) { |
|
439 | 442 | $modx->manager->saveLastUserSetting($param, $_REQUEST[$param]); |
440 | 443 | $_SESSION[$param] = $_REQUEST[$param]; |
441 | - } else if (!isset($_SESSION[$param])) { |
|
444 | + } else if (!isset($_SESSION[$param])) { |
|
442 | 445 | $_SESSION[$param] = $modx->manager->getLastUserSetting($param); |
443 | 446 | } |
444 | 447 | } |
@@ -518,9 +521,9 @@ discard block |
||
518 | 521 | </div> |
519 | 522 | |
520 | 523 | <?php |
521 | - function constructLink($action, $img, $text, $allowed) |
|
522 | - { |
|
523 | - if ($allowed == 1) { |
|
524 | + function constructLink($action, $img, $text, $allowed) |
|
525 | + { |
|
526 | + if ($allowed == 1) { |
|
524 | 527 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action); |
525 | 528 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text); |
526 | 529 | } |
@@ -625,7 +628,7 @@ discard block |
||
625 | 628 | ?> |
626 | 629 | |
627 | 630 | </div> |
628 | -<?php if ($modx->config['show_picker'] != "0") { |
|
631 | +<?php if ($modx->config['show_picker'] != "0") { |
|
629 | 632 | include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php'); |
630 | 633 | } ?> |
631 | 634 | </body> |
@@ -3,7 +3,8 @@ discard block |
||
3 | 3 | // MySQL Dump Parser |
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | -class SqlParser { |
|
6 | +class SqlParser |
|
7 | +{ |
|
7 | 8 | public $host; |
8 | 9 | public $dbname; |
9 | 10 | public $prefix; |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | public $ignoreDuplicateErrors; |
29 | 30 | public $autoTemplateLogic; |
30 | 31 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | + public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') |
|
33 | + { |
|
32 | 34 | $this->host = $host; |
33 | 35 | $this->dbname = $db; |
34 | 36 | $this->prefix = $prefix; |
@@ -44,10 +46,13 @@ discard block |
||
44 | 46 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 47 | } |
46 | 48 | |
47 | - public function connect() { |
|
49 | + public function connect() |
|
50 | + { |
|
48 | 51 | $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
49 | 52 | mysqli_select_db($this->conn, $this->dbname); |
50 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
53 | + if (function_exists('mysqli_set_charset')) { |
|
54 | + mysqli_set_charset($this->conn, $this->connection_charset); |
|
55 | + } |
|
51 | 56 | |
52 | 57 | $this->dbVersion = 3.23; // assume version 3.23 |
53 | 58 | if(function_exists("mysqli_get_server_info")) { |
@@ -59,7 +64,8 @@ discard block |
||
59 | 64 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
60 | 65 | } |
61 | 66 | |
62 | - public function process($filename) { |
|
67 | + public function process($filename) |
|
68 | + { |
|
63 | 69 | global $custom_placeholders; |
64 | 70 | |
65 | 71 | // check to make sure file exists |
@@ -114,7 +120,9 @@ discard block |
||
114 | 120 | foreach($sql_array as $sql_entry) { |
115 | 121 | $sql_do = trim($sql_entry, "\r\n; "); |
116 | 122 | |
117 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
123 | + if (preg_match('/^\#/', $sql_do)) { |
|
124 | + continue; |
|
125 | + } |
|
118 | 126 | |
119 | 127 | // strip out comments and \n for mysql 3.x |
120 | 128 | if ($this->dbVersion <4.0) { |
@@ -125,11 +133,15 @@ discard block |
||
125 | 133 | |
126 | 134 | |
127 | 135 | $num = $num + 1; |
128 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
136 | + if ($sql_do) { |
|
137 | + mysqli_query($this->conn, $sql_do); |
|
138 | + } |
|
129 | 139 | if(mysqli_error($this->conn)) { |
130 | 140 | // Ignore duplicate and drop errors - Raymond |
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
141 | + if ($this->ignoreDuplicateErrors) { |
|
142 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) { |
|
143 | + continue; |
|
144 | + } |
|
133 | 145 | } |
134 | 146 | // End Ignore duplicate |
135 | 147 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -138,7 +150,8 @@ discard block |
||
138 | 150 | } |
139 | 151 | } |
140 | 152 | |
141 | - public function close() { |
|
153 | + public function close() |
|
154 | + { |
|
142 | 155 | mysqli_close($this->conn); |
143 | 156 | } |
144 | 157 | } |
@@ -597,7 +597,9 @@ |
||
597 | 597 | $insertdump = $lf; |
598 | 598 | $insertdump .= "INSERT INTO `{$tblval}` VALUES ("; |
599 | 599 | $arr = $this->object2Array($row); |
600 | - if( ! is_array($arr)) $arr = array(); |
|
600 | + if( ! is_array($arr)) { |
|
601 | + $arr = array(); |
|
602 | + } |
|
601 | 603 | foreach ($arr as $key => $value) { |
602 | 604 | if (is_null($value)) { |
603 | 605 | $value = 'NULL'; |
@@ -101,7 +101,8 @@ discard block |
||
101 | 101 | </div> |
102 | 102 | |
103 | 103 | <?php |
104 | -function run() { |
|
104 | +function run() |
|
105 | +{ |
|
105 | 106 | global $modx, $_lang; |
106 | 107 | |
107 | 108 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -162,7 +163,8 @@ discard block |
||
162 | 163 | return $output; |
163 | 164 | } |
164 | 165 | |
165 | -function importFiles($parent, $filedir, $files, $mode) { |
|
166 | +function importFiles($parent, $filedir, $files, $mode) |
|
167 | +{ |
|
166 | 168 | global $modx; |
167 | 169 | global $_lang, $allowedfiles; |
168 | 170 | global $search_default, $cache_default, $publish_default; |
@@ -303,7 +305,8 @@ discard block |
||
303 | 305 | } |
304 | 306 | } |
305 | 307 | |
306 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
308 | +function getFiles($directory, $listing = array(), $count = 0) |
|
309 | +{ |
|
307 | 310 | global $_lang; |
308 | 311 | global $filesfound; |
309 | 312 | $dummy = $count; |
@@ -327,7 +330,8 @@ discard block |
||
327 | 330 | return ($listing); |
328 | 331 | } |
329 | 332 | |
330 | -function getFileContent($filepath) { |
|
333 | +function getFileContent($filepath) |
|
334 | +{ |
|
331 | 335 | global $_lang; |
332 | 336 | // get the file |
333 | 337 | if(!$buffer = file_get_contents($filepath)) { |
@@ -337,7 +341,8 @@ discard block |
||
337 | 341 | } |
338 | 342 | } |
339 | 343 | |
340 | -function pop_index($array) { |
|
344 | +function pop_index($array) |
|
345 | +{ |
|
341 | 346 | $new_array = array(); |
342 | 347 | foreach($array as $k => $v) { |
343 | 348 | if($v !== 'index.html' && $v !== 'index.htm') { |
@@ -354,7 +359,8 @@ discard block |
||
354 | 359 | return $new_array; |
355 | 360 | } |
356 | 361 | |
357 | -function treatContent($src, $filename, $alias) { |
|
362 | +function treatContent($src, $filename, $alias) |
|
363 | +{ |
|
358 | 364 | global $modx; |
359 | 365 | |
360 | 366 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
@@ -395,7 +401,8 @@ discard block |
||
395 | 401 | ); |
396 | 402 | } |
397 | 403 | |
398 | -function convertLink() { |
|
404 | +function convertLink() |
|
405 | +{ |
|
399 | 406 | global $modx; |
400 | 407 | $tbl_site_content = $modx->getFullTableName('site_content'); |
401 | 408 |
@@ -4,12 +4,13 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @return array of keys from a language file |
6 | 6 | */ |
7 | -function get_lang_keys($filename) { |
|
7 | +function get_lang_keys($filename) |
|
8 | +{ |
|
8 | 9 | $file = MODX_MANAGER_PATH.'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
9 | - if(is_file($file) && is_readable($file)) { |
|
10 | + if(is_file($file) && is_readable($file)) { |
|
10 | 11 | include($file); |
11 | 12 | $out = isset($_lang) ? array_keys($_lang) : array(); |
12 | - } else { |
|
13 | + } else { |
|
13 | 14 | $out = array(); |
14 | 15 | } |
15 | 16 | |
@@ -20,11 +21,12 @@ discard block |
||
20 | 21 | * |
21 | 22 | * @return array of languages that define the key in their file |
22 | 23 | */ |
23 | -function get_langs_by_key($key) { |
|
24 | +function get_langs_by_key($key) |
|
25 | +{ |
|
24 | 26 | global $lang_keys; |
25 | 27 | $lang_return = array(); |
26 | - foreach($lang_keys as $lang=>$keys) { |
|
27 | - if(in_array($key, $keys)) { |
|
28 | + foreach($lang_keys as $lang=>$keys) { |
|
29 | + if(in_array($key, $keys)) { |
|
28 | 30 | $lang_return[] = $lang; |
29 | 31 | } |
30 | 32 | } |
@@ -40,23 +42,24 @@ discard block |
||
40 | 42 | * @param string $selected_lang specify language to select in option list, default none |
41 | 43 | * @return string html option list |
42 | 44 | */ |
43 | -function get_lang_options($key = '', $selected_lang=null) { |
|
45 | +function get_lang_options($key = '', $selected_lang=null) |
|
46 | +{ |
|
44 | 47 | global $lang_keys, $_lang; |
45 | 48 | $lang_options = ''; |
46 | - if( ! empty($key)) { |
|
49 | + if( ! empty($key)) { |
|
47 | 50 | $languages = get_langs_by_key($key); |
48 | 51 | sort($languages); |
49 | 52 | $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
50 | 53 | |
51 | - foreach($languages as $language_name) { |
|
54 | + foreach($languages as $language_name) { |
|
52 | 55 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
53 | 56 | $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
54 | 57 | } |
55 | 58 | return $lang_options; |
56 | - } else { |
|
59 | + } else { |
|
57 | 60 | $languages = array_keys($lang_keys); |
58 | 61 | sort($languages); |
59 | - foreach($languages as $language_name) { |
|
62 | + foreach($languages as $language_name) { |
|
60 | 63 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
61 | 64 | $sel = $language_name == $selected_lang ? ' selected="selected"' : ''; |
62 | 65 | $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
@@ -65,31 +68,42 @@ discard block |
||
65 | 68 | } |
66 | 69 | } |
67 | 70 | |
68 | -function form_radio($name,$value,$add='',$disabled=false) { |
|
71 | +function form_radio($name,$value,$add='',$disabled=false) |
|
72 | +{ |
|
69 | 73 | global ${$name}; |
70 | 74 | $var = ${$name}; |
71 | 75 | $checked = ($var==$value) ? ' checked="checked"' : ''; |
72 | - if($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
73 | - if($add) $add = ' ' . $add; |
|
76 | + if($disabled) { |
|
77 | + $disabled = ' disabled'; |
|
78 | + } else { |
|
79 | + $disabled = ''; |
|
80 | + } |
|
81 | + if($add) { |
|
82 | + $add = ' ' . $add; |
|
83 | + } |
|
74 | 84 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add); |
75 | 85 | } |
76 | 86 | |
77 | -function wrap_label($str='',$object) { |
|
87 | +function wrap_label($str='',$object) |
|
88 | +{ |
|
78 | 89 | return "<label>{$object}\n{$str}</label>"; |
79 | 90 | } |
80 | 91 | |
81 | -function parseText($tpl='', $ph=array()) { |
|
82 | - if(empty($ph) || empty($tpl)) return $tpl; |
|
92 | +function parseText($tpl='', $ph=array()) |
|
93 | +{ |
|
94 | + if(empty($ph) || empty($tpl)) { |
|
95 | + return $tpl; |
|
96 | + } |
|
83 | 97 | |
84 | - foreach($ph as $k=>$v) |
|
85 | - { |
|
98 | + foreach($ph as $k=>$v) { |
|
86 | 99 | $k = "[+{$k}+]"; |
87 | 100 | $tpl = str_replace($k, $v, $tpl); |
88 | 101 | } |
89 | 102 | return $tpl; |
90 | 103 | } |
91 | 104 | |
92 | -function showHide($cond=true) { |
|
105 | +function showHide($cond=true) |
|
106 | +{ |
|
93 | 107 | global $displayStyle; |
94 | 108 | $showHide = $cond ? $displayStyle : 'none'; |
95 | 109 | return sprintf('style="display:%s"', $showHide); |