@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $MODX_SITE_HOSTNAMES = MODX_SITE_HOSTNAMES; // Fix for PHP 5.4 |
3 | - if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) { |
|
3 | + if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) { |
|
4 | 4 | $valid_hostnames = $_SERVER['HTTP_HOST']; |
5 | - } else { |
|
5 | + } else { |
|
6 | 6 | $valid_hostnames = $MODX_SITE_HOSTNAMES; |
7 | 7 | } |
8 | 8 | ?> |
@@ -157,7 +157,9 @@ discard block |
||
157 | 157 | <th><?php echo $_lang['pwd_hash_algo_title'] ?><br><small>[(pwd_hash_algo)]</small></th> |
158 | 158 | <td> |
159 | 159 | <?php |
160 | -if(empty($pwd_hash_algo)) $phm['sel']['UNCRYPT'] = 1; |
|
160 | +if(empty($pwd_hash_algo)) { |
|
161 | + $phm['sel']['UNCRYPT'] = 1; |
|
162 | +} |
|
161 | 163 | $phm['e']['BLOWFISH_Y'] = $modx->manager->checkHashAlgorithm('BLOWFISH_Y') ? 0:1; |
162 | 164 | $phm['e']['BLOWFISH_A'] = $modx->manager->checkHashAlgorithm('BLOWFISH_A') ? 0:1; |
163 | 165 | $phm['e']['SHA512'] = $modx->manager->checkHashAlgorithm('SHA512') ? 0:1; |
@@ -186,7 +188,9 @@ discard block |
||
186 | 188 | ?> |
187 | 189 | <?php |
188 | 190 | $gdAvailable = extension_loaded('gd'); |
189 | -if(!$gdAvailable) $use_captcha = 0; |
|
191 | +if(!$gdAvailable) { |
|
192 | + $use_captcha = 0; |
|
193 | +} |
|
190 | 194 | ?> |
191 | 195 | <tr> |
192 | 196 | <td nowrap class="warning"><?php echo $_lang['captcha_title'] ?><br><small>[(use_captcha)]</small></td> |
@@ -226,7 +230,9 @@ discard block |
||
226 | 230 | <?php |
227 | 231 | // invoke OnMiscSettingsRender event |
228 | 232 | $evtOut = $modx->invokeEvent('OnSecuritySettingsRender'); |
229 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
233 | + if(is_array($evtOut)) { |
|
234 | + echo implode("",$evtOut); |
|
235 | + } |
|
230 | 236 | ?> |
231 | 237 | </td> |
232 | 238 | </tr> |
@@ -113,7 +113,9 @@ |
||
113 | 113 | <?php |
114 | 114 | // invoke OnMiscSettingsRender event |
115 | 115 | $evtOut = $modx->invokeEvent('OnFileManagerSettingsRender'); |
116 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
116 | + if(is_array($evtOut)) { |
|
117 | + echo implode("",$evtOut); |
|
118 | + } |
|
117 | 119 | ?> |
118 | 120 | </td> |
119 | 121 | </tr> |
@@ -9,39 +9,27 @@ discard block |
||
9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
10 | 10 | unset($_POST); |
11 | 11 | |
12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
13 | -{ |
|
12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
14 | 13 | $htaccess = $modx->config['base_path'] . '.htaccess'; |
15 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
16 | 15 | $dir = '/' . trim($modx->config['base_url'],'/'); |
17 | - if(is_file($htaccess)) |
|
18 | - { |
|
16 | + if(is_file($htaccess)) { |
|
19 | 17 | $_ = file_get_contents($htaccess); |
20 | - if(strpos($_,'RewriteBase')===false) |
|
21 | - { |
|
18 | + if(strpos($_,'RewriteBase')===false) { |
|
22 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
23 | - } |
|
24 | - elseif(is_writable($htaccess)) |
|
25 | - { |
|
20 | + } elseif(is_writable($htaccess)) { |
|
26 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
27 | - if(!@file_put_contents($htaccess,$_)) |
|
28 | - { |
|
22 | + if(!@file_put_contents($htaccess,$_)) { |
|
29 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
30 | 24 | } |
31 | 25 | } |
32 | - } |
|
33 | - elseif(is_file($sample_htaccess)) |
|
34 | - { |
|
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
36 | - { |
|
26 | + } elseif(is_file($sample_htaccess)) { |
|
27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
37 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
38 | - } |
|
39 | - elseif($modx->config['base_url']!=='/') |
|
40 | - { |
|
29 | + } elseif($modx->config['base_url']!=='/') { |
|
41 | 30 | $_ = file_get_contents($htaccess); |
42 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
43 | - if(!@file_put_contents($htaccess,$_)) |
|
44 | - { |
|
32 | + if(!@file_put_contents($htaccess,$_)) { |
|
45 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
46 | 34 | } |
47 | 35 | } |
@@ -73,7 +61,7 @@ discard block |
||
73 | 61 | $v = htmlspecialchars($v); |
74 | 62 | break; |
75 | 63 | case 'settings_version':{ |
76 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
64 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
77 | 65 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
78 | 66 | $v = $modx->getVersionData('version'); |
79 | 67 | } |
@@ -134,7 +122,9 @@ discard block |
||
134 | 122 | |
135 | 123 | $modx->config[$k] = $v; |
136 | 124 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
125 | + if(!empty($k)) { |
|
126 | + $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
127 | + } |
|
138 | 128 | } |
139 | 129 | |
140 | 130 | // Run a single query to save all the values |
@@ -148,8 +138,11 @@ discard block |
||
148 | 138 | $oldtemplate = (int)$data['old_template']; |
149 | 139 | $tbl = $modx->getFullTableName('site_content'); |
150 | 140 | $reset = $data['reset_template']; |
151 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
141 | + if($reset==1) { |
|
142 | + $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
143 | + } else if($reset==2) { |
|
144 | + $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
145 | + } |
|
153 | 146 | } |
154 | 147 | |
155 | 148 | // empty cache |
@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | // get user settings |
40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'"); |
41 | 41 | $usersettings = array(); |
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
42 | + while($row = $modx->db->getRow($rs)) { |
|
43 | + $usersettings[$row['setting_name']] = $row['setting_value']; |
|
44 | + } |
|
43 | 45 | // manually extract so that user display settings are not overwritten |
44 | 46 | foreach($usersettings as $k => $v) { |
45 | 47 | if($k != 'manager_language' && $k != 'manager_theme') { |
@@ -763,13 +765,16 @@ discard block |
||
763 | 765 | |
764 | 766 | $groupsarray = array(); |
765 | 767 | |
766 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
768 | + if($modx->manager->action == '12') { |
|
769 | +// only do this bit if the user is being edited |
|
767 | 770 | $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'"); |
768 | 771 | $groupsarray = $modx->db->getColumn('user_group', $rs); |
769 | 772 | } |
770 | 773 | // retain selected doc groups between post |
771 | 774 | if(is_array($_POST['user_groups'])) { |
772 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
775 | + foreach($_POST['user_groups'] as $n => $v) { |
|
776 | + $groupsarray[] = $v; |
|
777 | + } |
|
773 | 778 | } |
774 | 779 | ?> |
775 | 780 | <div class="tab-page" id="tabAccess"> |
@@ -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 /> |
4 | 4 | Please use the EVO Content Manager instead of accessing this file directly."); |
5 | 5 | } |
@@ -10,26 +10,26 @@ discard block |
||
10 | 10 | $modx_textdir = isset($modx_textdir) ? $modx_textdir : null; |
11 | 11 | $onManagerMainFrameHeaderHTMLBlock = is_array($evtOut) ? implode("\n", $evtOut) : ''; |
12 | 12 | $textdir = $modx_textdir === 'rtl' ? 'rtl' : 'ltr'; |
13 | -if (!isset($modx->config['mgr_jquery_path'])) { |
|
13 | +if (!isset($modx->config['mgr_jquery_path'])) { |
|
14 | 14 | $modx->config['mgr_jquery_path'] = 'media/script/jquery/jquery.min.js'; |
15 | 15 | } |
16 | -if (!isset($modx->config['mgr_date_picker_path'])) { |
|
16 | +if (!isset($modx->config['mgr_date_picker_path'])) { |
|
17 | 17 | $modx->config['mgr_date_picker_path'] = 'media/script/air-datepicker/datepicker.inc.php'; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $body_class = ''; |
21 | 21 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness'); |
22 | -if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
|
22 | +if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
|
23 | 23 | $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
24 | -} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
|
24 | +} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
|
25 | 25 | $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
26 | 26 | } |
27 | 27 | |
28 | 28 | $css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime; |
29 | 29 | |
30 | -if ($modx->config['manager_theme'] == 'default') { |
|
30 | +if ($modx->config['manager_theme'] == 'default') { |
|
31 | 31 | if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') |
32 | - && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
32 | + && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
33 | 33 | $files = array( |
34 | 34 | 'bootstrap' => MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css', |
35 | 35 | 'font-awesome' => MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css', |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'source' => 'manager', |
49 | 49 | 'theme' => $modx->config['manager_theme'] |
50 | 50 | )); |
51 | - switch (true) { |
|
51 | + switch (true) { |
|
52 | 52 | case empty($evtOut): |
53 | 53 | case is_array($evtOut) && count($evtOut) === 0: |
54 | 54 | break; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $css |
67 | 67 | ); |
68 | 68 | } |
69 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
69 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
70 | 70 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
71 | 71 | } |
72 | 72 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | <script src="media/script/main.js"></script> |
125 | 125 | <script> |
126 | 126 | <?php |
127 | - if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
|
127 | + if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
|
128 | 128 | echo 'doRefresh(' . $_REQUEST['r'] . ");\n"; |
129 | 129 | } |
130 | 130 | ?> |
@@ -182,16 +182,18 @@ discard block |
||
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | -switch($installMode){ |
|
185 | +switch($installMode) { |
|
186 | 186 | case 0: |
187 | 187 | case 2: |
188 | 188 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
189 | 189 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
190 | 190 | $_POST['database_connection_charset'] = $database_charset; |
191 | - if(!empty($_POST['databaseloginpassword'])) |
|
192 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
193 | - if(!empty($_POST['databaseloginname'])) |
|
194 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
191 | + if(!empty($_POST['databaseloginpassword'])) { |
|
192 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
193 | + } |
|
194 | + if(!empty($_POST['databaseloginname'])) { |
|
195 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
196 | + } |
|
195 | 197 | break; |
196 | 198 | case 1: |
197 | 199 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
@@ -205,7 +207,9 @@ discard block |
||
205 | 207 | } |
206 | 208 | } |
207 | 209 | } |
208 | - if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
210 | + if (empty ($database_collation)) { |
|
211 | + $database_collation = 'utf8_general_ci'; |
|
212 | + } |
|
209 | 213 | |
210 | 214 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
211 | 215 | if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
@@ -214,7 +218,9 @@ discard block |
||
214 | 218 | |
215 | 219 | if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
216 | 220 | $database_connection_method = 'SET CHARACTER SET'; |
217 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
221 | + if (function_exists('mysqli_set_charset')) { |
|
222 | + mysqli_set_charset($conn, $database_connection_charset); |
|
223 | + } |
|
218 | 224 | } |
219 | 225 | if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
220 | 226 | $database_connection_method = 'SET NAMES'; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) { |
3 | 3 | include_once(dirname(__FILE__)."/../assets/cache/siteManager.php"); |
4 | -}else{ |
|
4 | +} else { |
|
5 | 5 | define('MGR_DIR', 'manager'); |
6 | 6 | } |
7 | 7 | define('MODX_CLI', false); |
@@ -59,13 +59,15 @@ discard block |
||
59 | 59 | |
60 | 60 | // get base path and url |
61 | 61 | $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); |
62 | -if (count($a) > 1) |
|
62 | +if (count($a) > 1) { |
|
63 | 63 | array_pop($a); |
64 | +} |
|
64 | 65 | $url = implode("install", $a); |
65 | 66 | reset($a); |
66 | 67 | $a = explode("install", str_replace("\\", "/", realpath(dirname(__FILE__)))); |
67 | -if (count($a) > 1) |
|
68 | +if (count($a) > 1) { |
|
68 | 69 | array_pop($a); |
70 | +} |
|
69 | 71 | $pth = implode("install", $a); |
70 | 72 | unset ($a); |
71 | 73 | $base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
@@ -86,7 +88,9 @@ discard block |
||
86 | 88 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
87 | 89 | $create = true; |
88 | 90 | } else { |
89 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
91 | + if (function_exists('mysqli_set_charset')) { |
|
92 | + mysqli_set_charset($conn, $database_charset); |
|
93 | + } |
|
90 | 94 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
91 | 95 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
92 | 96 | } |
@@ -133,7 +137,8 @@ discard block |
||
133 | 137 | * @param string $propertyString |
134 | 138 | * @return array |
135 | 139 | */ |
136 | - function parseProperties($propertyString) { |
|
140 | + function parseProperties($propertyString) |
|
141 | + { |
|
137 | 142 | $parameter= array (); |
138 | 143 | if (!empty ($propertyString)) { |
139 | 144 | $tmpParams= explode("&", $propertyString); |
@@ -142,11 +147,14 @@ discard block |
||
142 | 147 | if (strpos($tmpParams[$x], '=', 0)) { |
143 | 148 | $pTmp= explode("=", $tmpParams[$x]); |
144 | 149 | $pvTmp= explode(";", trim($pTmp[1])); |
145 | - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
|
146 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
150 | + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { |
|
151 | + $parameter[trim($pTmp[0])]= $pvTmp[3]; |
|
152 | + } |
|
153 | + //list default |
|
147 | 154 | else |
148 | - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
|
149 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
155 | + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { |
|
156 | + $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
157 | + } |
|
150 | 158 | } |
151 | 159 | } |
152 | 160 | } |
@@ -217,7 +225,7 @@ discard block |
||
217 | 225 | // custom or not |
218 | 226 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
219 | 227 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
220 | -}else{ |
|
228 | +} else { |
|
221 | 229 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
222 | 230 | } |
223 | 231 | |
@@ -353,7 +361,9 @@ discard block |
||
353 | 361 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
354 | 362 | return; |
355 | 363 | } |
356 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
364 | + if(!is_null($save_sql_id_as)) { |
|
365 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
366 | + } |
|
357 | 367 | echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
358 | 368 | } |
359 | 369 | } |
@@ -447,9 +457,9 @@ discard block |
||
447 | 457 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
448 | 458 | $filecontent = $moduleChunk[2]; |
449 | 459 | |
450 | - if (!file_exists($filecontent)) |
|
451 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
452 | - else { |
|
460 | + if (!file_exists($filecontent)) { |
|
461 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
462 | + } else { |
|
453 | 463 | |
454 | 464 | // Create the category if it does not already exist |
455 | 465 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -501,9 +511,9 @@ discard block |
||
501 | 511 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
502 | 512 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
503 | 513 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
504 | - if (!file_exists($filecontent)) |
|
505 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
506 | - else { |
|
514 | + if (!file_exists($filecontent)) { |
|
515 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
516 | + } else { |
|
507 | 517 | |
508 | 518 | // Create the category if it does not already exist |
509 | 519 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -553,9 +563,9 @@ discard block |
||
553 | 563 | // parse comma-separated legacy names and prepare them for sql IN clause |
554 | 564 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
555 | 565 | } |
556 | - if (!file_exists($filecontent)) |
|
557 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
558 | - else { |
|
566 | + if (!file_exists($filecontent)) { |
|
567 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
568 | + } else { |
|
559 | 569 | |
560 | 570 | // disable legacy versions based on legacy_names provided |
561 | 571 | if(!empty($leg_names)) { |
@@ -574,7 +584,7 @@ discard block |
||
574 | 584 | $insert = true; |
575 | 585 | while($row = mysqli_fetch_assoc($rs)) { |
576 | 586 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
577 | - if($row['description'] == $desc){ |
|
587 | + if($row['description'] == $desc) { |
|
578 | 588 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
579 | 589 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
580 | 590 | return; |
@@ -632,9 +642,9 @@ discard block |
||
632 | 642 | $filecontent = $moduleSnippet[2]; |
633 | 643 | $properties = $moduleSnippet[3]; |
634 | 644 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
635 | - if (!file_exists($filecontent)) |
|
636 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
637 | - else { |
|
645 | + if (!file_exists($filecontent)) { |
|
646 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
647 | + } else { |
|
638 | 648 | |
639 | 649 | // Create the category if it does not already exist |
640 | 650 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -742,13 +752,16 @@ discard block |
||
742 | 752 | } |
743 | 753 | |
744 | 754 | // call back function |
745 | -if ($callBackFnc != "") |
|
755 | +if ($callBackFnc != "") { |
|
746 | 756 | $callBackFnc ($sqlParser); |
757 | +} |
|
747 | 758 | |
748 | 759 | // Setup the MODX API -- needed for the cache processor |
749 | 760 | define('MODX_API_MODE', true); |
750 | 761 | define('MODX_BASE_PATH', $base_path); |
751 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
762 | +if (!defined('MODX_MANAGER_PATH')) { |
|
763 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
764 | +} |
|
752 | 765 | $database_type = 'mysqli'; |
753 | 766 | // initiate a new document parser |
754 | 767 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |
@@ -793,11 +806,12 @@ discard block |
||
793 | 806 | * @param string $old |
794 | 807 | * @return string |
795 | 808 | */ |
796 | -function propUpdate($new,$old){ |
|
809 | +function propUpdate($new,$old) |
|
810 | +{ |
|
797 | 811 | $newArr = parseProperties($new); |
798 | 812 | $oldArr = parseProperties($old); |
799 | - foreach ($oldArr as $k => $v){ |
|
800 | - if (isset($v['0']['options'])){ |
|
813 | + foreach ($oldArr as $k => $v) { |
|
814 | + if (isset($v['0']['options'])) { |
|
801 | 815 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
802 | 816 | } |
803 | 817 | } |
@@ -812,12 +826,17 @@ discard block |
||
812 | 826 | * @param bool|mixed $json |
813 | 827 | * @return string |
814 | 828 | */ |
815 | -function parseProperties($propertyString, $json=false) { |
|
829 | +function parseProperties($propertyString, $json=false) |
|
830 | +{ |
|
816 | 831 | $propertyString = str_replace('{}', '', $propertyString ); |
817 | 832 | $propertyString = str_replace('} {', ',', $propertyString ); |
818 | 833 | |
819 | - if(empty($propertyString)) return array(); |
|
820 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
834 | + if(empty($propertyString)) { |
|
835 | + return array(); |
|
836 | + } |
|
837 | + if($propertyString=='{}' || $propertyString=='[]') { |
|
838 | + return array(); |
|
839 | + } |
|
821 | 840 | |
822 | 841 | $jsonFormat = isJson($propertyString, true); |
823 | 842 | $property = array(); |
@@ -859,7 +878,7 @@ discard block |
||
859 | 878 | |
860 | 879 | } |
861 | 880 | // new json-format |
862 | - } else if(!empty($jsonFormat)){ |
|
881 | + } else if(!empty($jsonFormat)) { |
|
863 | 882 | $property = $jsonFormat; |
864 | 883 | } |
865 | 884 | if ($json) { |
@@ -874,7 +893,8 @@ discard block |
||
874 | 893 | * @param bool $returnData |
875 | 894 | * @return bool|mixed |
876 | 895 | */ |
877 | -function isJson($string, $returnData=false) { |
|
896 | +function isJson($string, $returnData=false) |
|
897 | +{ |
|
878 | 898 | $data = json_decode($string, true); |
879 | 899 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
880 | 900 | } |
@@ -884,7 +904,8 @@ discard block |
||
884 | 904 | * @param SqlParser $sqlParser |
885 | 905 | * @return int |
886 | 906 | */ |
887 | -function getCreateDbCategory($category, $sqlParser) { |
|
907 | +function getCreateDbCategory($category, $sqlParser) |
|
908 | +{ |
|
888 | 909 | $dbase = $sqlParser->dbname; |
889 | 910 | $dbase = '`' . trim($dbase,'`') . '`'; |
890 | 911 | $table_prefix = $sqlParser->prefix; |
@@ -912,7 +933,8 @@ discard block |
||
912 | 933 | * @param string $type |
913 | 934 | * @return string |
914 | 935 | */ |
915 | -function removeDocblock($code, $type) { |
|
936 | +function removeDocblock($code, $type) |
|
937 | +{ |
|
916 | 938 | |
917 | 939 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
918 | 940 | |
@@ -933,8 +955,9 @@ discard block |
||
933 | 955 | default: |
934 | 956 | return $cleaned; |
935 | 957 | }; |
936 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
937 | - return $cleaned; |
|
958 | + if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') { |
|
959 | + return $cleaned; |
|
960 | + } |
|
938 | 961 | |
939 | 962 | // fileBinding not found - return code incl docblock |
940 | 963 | return $code; |
@@ -5,7 +5,8 @@ |
||
5 | 5 | * @deprecated EvolutionCMS\Legacy\ErrorHandler |
6 | 6 | * @todo could be unnecessary |
7 | 7 | */ |
8 | -class errorHandler extends EvolutionCMS\Legacy\ErrorHandler { |
|
8 | +class errorHandler extends EvolutionCMS\Legacy\ErrorHandler |
|
9 | +{ |
|
9 | 10 | public function include_lang($context = 'common') |
10 | 11 | { |
11 | 12 | parent::includeLang($context); |
@@ -3,4 +3,6 @@ |
||
3 | 3 | /** |
4 | 4 | * @deprecated use EvolutionCMS\Legacy\LogHandler |
5 | 5 | */ |
6 | -class logHandler extends EvolutionCMS\Legacy\LogHandler{} |
|
6 | +class logHandler extends EvolutionCMS\Legacy\LogHandler |
|
7 | +{ |
|
8 | +} |