@@ -7,53 +7,53 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser{ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @param array $config [action, tabs, toArray] |
14 | 14 | * @param array $data |
15 | 15 | * @return string |
16 | 16 | */ |
17 | - public function output($config = array(), $data = array()) { |
|
17 | + public function output($config = array(), $data = array()){ |
|
18 | 18 | global $modx; |
19 | 19 | |
20 | 20 | $output = ''; |
21 | 21 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
22 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
22 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
23 | 23 | |
24 | - if($action) { |
|
24 | + if ($action) { |
|
25 | 25 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
26 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
27 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
28 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
26 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
27 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
28 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
29 | 29 | ORDER BY t1.tab ASC, t1.rank ASC'); |
30 | 30 | |
31 | - if($modx->db->getRecordCount($sql)) { |
|
31 | + if ($modx->db->getRecordCount($sql)) { |
|
32 | 32 | $tabs = array(); |
33 | - while($row = $modx->db->getRow($sql)) { |
|
34 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
33 | + while ($row = $modx->db->getRow($sql)) { |
|
34 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
35 | 35 | $row['value'] = $data[$row['name']]; |
36 | 36 | } |
37 | 37 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
38 | 38 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
39 | 39 | } |
40 | 40 | |
41 | - if(!empty($config['toArray'])) { |
|
41 | + if (!empty($config['toArray'])) { |
|
42 | 42 | $output = $tabs; |
43 | 43 | } else { |
44 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
44 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
45 | 45 | $output .= ' |
46 | 46 | <script type="text/javascript"> |
47 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
47 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
48 | 48 | </script>'; |
49 | 49 | |
50 | - foreach($tabs as $idTab => $tab) { |
|
51 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
50 | + foreach ($tabs as $idTab => $tab) { |
|
51 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
52 | 52 | $output .= ' |
53 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
54 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
53 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
54 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
55 | 55 | unset($tab['category_name']); |
56 | - foreach($tab as $item) { |
|
56 | + foreach ($tab as $item) { |
|
57 | 57 | $output .= $item; |
58 | 58 | } |
59 | 59 | $output .= '</div>'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param array $data |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - private function render($data) { |
|
73 | + private function render($data){ |
|
74 | 74 | global $modx, $_lang, $_country_lang; |
75 | 75 | |
76 | 76 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $output = ''; |
81 | 81 | $output .= '<div class="form-group row">'; |
82 | 82 | |
83 | - switch($data['type']) { |
|
83 | + switch ($data['type']) { |
|
84 | 84 | |
85 | 85 | case 'text': |
86 | 86 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
115 | 115 | $output .= '<div class="col-sm-7">'; |
116 | 116 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
117 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | 118 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
119 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
120 | - foreach($_country_lang as $key => $value) { |
|
121 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
119 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
120 | + foreach ($_country_lang as $key => $value) { |
|
121 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
122 | 122 | } |
123 | 123 | } else { |
124 | - if($data['elements']) { |
|
124 | + if ($data['elements']) { |
|
125 | 125 | $elements = explode('||', $data['elements']); |
126 | - foreach($elements as $key => $value) { |
|
126 | + foreach ($elements as $key => $value) { |
|
127 | 127 | $value = explode('==', $value); |
128 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
140 | 140 | $output .= '<div class="col-sm-7">'; |
141 | 141 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
142 | - if($data['elements']) { |
|
142 | + if ($data['elements']) { |
|
143 | 143 | $elements = explode('||', $data['elements']); |
144 | - foreach($elements as $key => $value) { |
|
144 | + foreach ($elements as $key => $value) { |
|
145 | 145 | $value = explode('==', $value); |
146 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | $output .= $data['content']; |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
156 | 156 | $output .= '<div class="col-sm-7">'; |
157 | 157 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
158 | - if($data['elements']) { |
|
158 | + if ($data['elements']) { |
|
159 | 159 | $elements = explode('||', $data['elements']); |
160 | - foreach($elements as $key => $value) { |
|
160 | + foreach ($elements as $key => $value) { |
|
161 | 161 | $value = explode('==', $value); |
162 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | $output .= $data['content']; |
@@ -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 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param string $itemid |
140 | 140 | * @return string |
141 | 141 | */ |
142 | -function getAction($actionId, $itemid='') { |
|
142 | +function getAction($actionId, $itemid = ''){ |
|
143 | 143 | global $action_list; |
144 | 144 | |
145 | 145 | $ret = sprintf($action_list[$actionId], $itemid); |
@@ -71,11 +71,11 @@ |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($context === 'common') { |
74 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
74 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
75 | 75 | } else { |
76 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
76 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
77 | 77 | } |
78 | - include_once($lang_path . 'english.inc.php'); |
|
78 | + include_once($lang_path.'english.inc.php'); |
|
79 | 79 | $manager_language = $modx->config['manager_language']; |
80 | 80 | if (is_file("{$lang_path}{$manager_language}.inc.php")) { |
81 | 81 | include_once("{$lang_path}{$manager_language}.inc.php"); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | } |
12 | 12 | |
13 | 13 | global $sanitize_seed; |
14 | -$sanitize_seed = 'sanitize_seed_' . base_convert(md5(__FILE__), 16, 36); |
|
14 | +$sanitize_seed = 'sanitize_seed_'.base_convert(md5(__FILE__), 16, 36); |
|
15 | 15 | |
16 | 16 | // sanitize array |
17 | 17 | if (!function_exists('modx_sanitize_gpc')) { |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | $action = "", |
37 | 37 | $itemid = "", |
38 | 38 | $itemname = "" |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | global $modx; |
41 | 41 | $this->entry['msg'] = $msg; // writes testmessage to the object |
42 | - $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
43 | 43 | |
44 | 44 | // User Credentials |
45 | 45 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
46 | 46 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
47 | 47 | |
48 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
48 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
49 | 49 | if ($this->entry['itemId'] == 0) { |
50 | 50 | $this->entry['itemId'] = "-"; |
51 | 51 | } // to stop items having id 0 |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
94 | 94 | $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
95 | 95 | if (!$insert_id) { |
96 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError()); |
|
96 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
|
97 | 97 | } else { |
98 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
99 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
98 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
99 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
100 | 100 | if (($insert_id % $trim) === 0) { |
101 | 101 | $modx->rotate_log('manager_log', $limit, $trim); |
102 | 102 | } |
@@ -11,12 +11,12 @@ |
||
11 | 11 | |
12 | 12 | $out = false; |
13 | 13 | $class = 'DBAPI'; |
14 | -if( ! class_exists($class)){ |
|
15 | - include_once MODX_MANAGER_PATH . 'includes/extenders/dbapi.' . $database_type . '.class.inc.php'; |
|
14 | +if (!class_exists($class)) { |
|
15 | + include_once MODX_MANAGER_PATH.'includes/extenders/dbapi.'.$database_type.'.class.inc.php'; |
|
16 | 16 | } |
17 | 17 | |
18 | -if(class_exists($class)){ |
|
19 | - $this->db= new $class; |
|
18 | +if (class_exists($class)) { |
|
19 | + $this->db = new $class; |
|
20 | 20 | $out = true; |
21 | 21 | } |
22 | 22 |
@@ -144,33 +144,33 @@ discard block |
||
144 | 144 | $algorithm = 'UNCRYPT'; |
145 | 145 | } |
146 | 146 | |
147 | - $salt = md5($password . $seed); |
|
147 | + $salt = md5($password.$seed); |
|
148 | 148 | |
149 | 149 | switch ($algorithm) { |
150 | 150 | case 'BLOWFISH_Y': |
151 | - $salt = '$2y$07$' . substr($salt, 0, 22); |
|
151 | + $salt = '$2y$07$'.substr($salt, 0, 22); |
|
152 | 152 | break; |
153 | 153 | case 'BLOWFISH_A': |
154 | - $salt = '$2a$07$' . substr($salt, 0, 22); |
|
154 | + $salt = '$2a$07$'.substr($salt, 0, 22); |
|
155 | 155 | break; |
156 | 156 | case 'SHA512': |
157 | - $salt = '$6$' . substr($salt, 0, 16); |
|
157 | + $salt = '$6$'.substr($salt, 0, 16); |
|
158 | 158 | break; |
159 | 159 | case 'SHA256': |
160 | - $salt = '$5$' . substr($salt, 0, 16); |
|
160 | + $salt = '$5$'.substr($salt, 0, 16); |
|
161 | 161 | break; |
162 | 162 | case 'MD5': |
163 | - $salt = '$1$' . substr($salt, 0, 8); |
|
163 | + $salt = '$1$'.substr($salt, 0, 8); |
|
164 | 164 | break; |
165 | 165 | } |
166 | 166 | |
167 | 167 | if ($algorithm !== 'UNCRYPT') { |
168 | - $password = sha1($password) . crypt($password, $salt); |
|
168 | + $password = sha1($password).crypt($password, $salt); |
|
169 | 169 | } else { |
170 | - $password = sha1($salt . $password); |
|
170 | + $password = sha1($salt.$password); |
|
171 | 171 | } |
172 | 172 | |
173 | - $result = strtolower($algorithm) . '>' . md5($salt . $password) . substr(md5($salt), 0, 8); |
|
173 | + $result = strtolower($algorithm).'>'.md5($salt.$password).substr(md5($salt), 0, 8); |
|
174 | 174 | |
175 | 175 | return $result; |
176 | 176 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $check_files = explode("\n", $check_files); |
253 | 253 | foreach ($check_files as $file) { |
254 | 254 | $file = trim($file); |
255 | - $file = MODX_BASE_PATH . $file; |
|
255 | + $file = MODX_BASE_PATH.$file; |
|
256 | 256 | if (!is_file($file)) { |
257 | 257 | continue; |
258 | 258 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $checksum = unserialize($checksum); |
276 | 276 | foreach ($check_files as $file) { |
277 | 277 | $file = trim($file); |
278 | - $filePath = MODX_BASE_PATH . $file; |
|
278 | + $filePath = MODX_BASE_PATH.$file; |
|
279 | 279 | if (!is_file($filePath)) { |
280 | 280 | continue; |
281 | 281 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | global $modx; |
296 | 296 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
297 | - $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->db->escape($checksum) . "')"; |
|
297 | + $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','".$modx->db->escape($checksum)."')"; |
|
298 | 298 | $modx->db->query($sql); |
299 | 299 | } |
300 | 300 | |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | foreach ($settings as $key => $val) { |
372 | 372 | $f = array(); |
373 | 373 | $f['user'] = $_SESSION['mgrInternalKey']; |
374 | - $f['setting_name'] = '_LAST_' . $key; |
|
374 | + $f['setting_name'] = '_LAST_'.$key; |
|
375 | 375 | $f['setting_value'] = $val; |
376 | 376 | $f = $modx->db->escape($f); |
377 | - $f = "(`" . implode("`, `", array_keys($f)) . "`) VALUES('" . implode("', '", array_values($f)) . "')"; |
|
377 | + $f = "(`".implode("`, `", array_keys($f))."`) VALUES('".implode("', '", array_values($f))."')"; |
|
378 | 378 | $f .= " ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)"; |
379 | 379 | $modx->db->insert($f, $modx->getFullTableName('user_settings')); |
380 | 380 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | return true; |
10 | 10 | } |
11 | 11 | |
12 | -if (!include_once(MODX_MANAGER_PATH . 'includes/extenders/phpcompat.class.inc.php')) { |
|
12 | +if (!include_once(MODX_MANAGER_PATH.'includes/extenders/phpcompat.class.inc.php')) { |
|
13 | 13 | return false; |
14 | 14 | } else { |
15 | 15 | $this->phpcompat = new PHPCOMPAT; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * Time: 14:24 |
6 | 6 | */ |
7 | 7 | |
8 | -if (include_once(MODX_MANAGER_PATH . 'includes/extenders/export.class.inc.php')) { |
|
8 | +if (include_once(MODX_MANAGER_PATH.'includes/extenders/export.class.inc.php')) { |
|
9 | 9 | $this->export = new EXPORT_SITE; |
10 | 10 | |
11 | 11 | return true; |