@@ -1,46 +1,46 @@ 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 | -if(!$modx->hasPermission('settings')) { |
|
5 | +if (!$modx->hasPermission('settings')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | $data = $_POST; |
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) |
|
12 | +if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false) |
|
13 | 13 | { |
14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | - if(is_file($htaccess)) |
|
14 | + $htaccess = $modx->config['base_path'].'.htaccess'; |
|
15 | + $sample_htaccess = $modx->config['base_path'].'ht.access'; |
|
16 | + $dir = '/'.trim($modx->config['base_url'], '/'); |
|
17 | + if (is_file($htaccess)) |
|
18 | 18 | { |
19 | 19 | $_ = file_get_contents($htaccess); |
20 | - if(strpos($_,'RewriteBase')===false) |
|
20 | + if (strpos($_, 'RewriteBase') === false) |
|
21 | 21 | { |
22 | 22 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
23 | 23 | } |
24 | - elseif(is_writable($htaccess)) |
|
24 | + elseif (is_writable($htaccess)) |
|
25 | 25 | { |
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | - if(!@file_put_contents($htaccess,$_)) |
|
26 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
27 | + if (!@file_put_contents($htaccess, $_)) |
|
28 | 28 | { |
29 | 29 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
33 | - elseif(is_file($sample_htaccess)) |
|
33 | + elseif (is_file($sample_htaccess)) |
|
34 | 34 | { |
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
35 | + if (!@rename($sample_htaccess, $htaccess)) |
|
36 | 36 | { |
37 | 37 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
38 | 38 | } |
39 | - elseif($modx->config['base_url']!=='/') |
|
39 | + elseif ($modx->config['base_url'] !== '/') |
|
40 | 40 | { |
41 | 41 | $_ = file_get_contents($htaccess); |
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | - if(!@file_put_contents($htaccess,$_)) |
|
42 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
43 | + if (!@file_put_contents($htaccess, $_)) |
|
44 | 44 | { |
45 | 45 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
46 | 46 | } |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | -if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
52 | - unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css'); |
|
51 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
52 | + unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css'); |
|
53 | 53 | } |
54 | 54 | |
55 | -$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']); |
|
56 | -$data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
|
55 | +$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']); |
|
56 | +$data['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']); |
|
57 | 57 | |
58 | 58 | if (isset($data) && count($data) > 0) { |
59 | - if(isset($data['manager_language'])) { |
|
60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | - if(is_file($lang_path)) { |
|
59 | + if (isset($data['manager_language'])) { |
|
60 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php'; |
|
61 | + if (is_file($lang_path)) { |
|
62 | 62 | include($lang_path); |
63 | 63 | global $modx_lang_attribute; |
64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | } |
67 | 67 | $savethese = array(); |
68 | 68 | $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']); |
69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
69 | + $data['mail_check_timeperiod'] = (int) $data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | 70 | foreach ($data as $k => $v) { |
71 | 71 | switch ($k) { |
72 | 72 | case 'site_name': |
73 | 73 | $v = htmlspecialchars($v); |
74 | 74 | break; |
75 | 75 | case 'settings_version':{ |
76 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
77 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
76 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
77 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
78 | 78 | $v = $modx->getVersionData('version'); |
79 | 79 | } |
80 | 80 | break; |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | case 'rb_base_url': |
96 | 96 | case 'filemanager_path': |
97 | 97 | $v = trim($v); |
98 | - $v = rtrim($v,'/') . '/'; |
|
98 | + $v = rtrim($v, '/').'/'; |
|
99 | 99 | break; |
100 | 100 | case 'manager_language': |
101 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
102 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
101 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
102 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
103 | 103 | $langFileDir = dirname($langFile); |
104 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
104 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
105 | 105 | $v = 'english'; |
106 | 106 | } |
107 | 107 | break; |
108 | 108 | case 'smtppw': |
109 | 109 | if ($v !== '********************' && $v !== '') { |
110 | 110 | $v = trim($v); |
111 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | - $v = str_replace('=','%',$v); |
|
111 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | + $v = str_replace('=', '%', $v); |
|
113 | 113 | } elseif ($v === '********************') { |
114 | 114 | $k = ''; |
115 | 115 | } |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | $v = str_replace(array(' ,', ', '), ',', $v); |
119 | 119 | if ($v !== ',') { |
120 | 120 | $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
121 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
121 | + $configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n"; |
|
122 | + @file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString); |
|
123 | 123 | } |
124 | 124 | $k = ''; |
125 | 125 | break; |
126 | 126 | case 'session_timeout': |
127 | 127 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
128 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
128 | + $v = (int) $v < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
129 | 129 | break; |
130 | 130 | default: |
131 | 131 | break; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $modx->config[$k] = $v; |
136 | 136 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
137 | + if (!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Run a single query to save all the values |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | |
145 | 145 | // Reset Template Pages |
146 | 146 | if (isset($data['reset_template'])) { |
147 | - $newtemplate = (int)$data['default_template']; |
|
148 | - $oldtemplate = (int)$data['old_template']; |
|
147 | + $newtemplate = (int) $data['default_template']; |
|
148 | + $oldtemplate = (int) $data['old_template']; |
|
149 | 149 | $tbl = $modx->getFullTableName('site_content'); |
150 | 150 | $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}'"); |
|
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}'"); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // empty cache |
156 | 156 | $modx->clearCache('full'); |
157 | 157 | } |
158 | -$header="Location: index.php?a=7&r=10"; |
|
158 | +$header = "Location: index.php?a=7&r=10"; |
|
159 | 159 | header($header); |
@@ -1,16 +1,16 @@ 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 | -switch($modx->manager->action) { |
|
6 | +switch ($modx->manager->action) { |
|
7 | 7 | case 12: |
8 | - if(!$modx->hasPermission('edit_user')) { |
|
8 | + if (!$modx->hasPermission('edit_user')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 11: |
13 | - if(!$modx->hasPermission('new_user')) { |
|
13 | + if (!$modx->hasPermission('new_user')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,20 +18,20 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$user = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | // check to see the snippet editor isn't locked |
24 | -$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
|
25 | -if($username = $modx->db->getValue($rs)) { |
|
24 | +$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
25 | +if ($username = $modx->db->getValue($rs)) { |
|
26 | 26 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
27 | 27 | } |
28 | 28 | // end check for lock |
29 | 29 | |
30 | -if($modx->manager->action == '12') { |
|
30 | +if ($modx->manager->action == '12') { |
|
31 | 31 | // get user attribute |
32 | 32 | $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
33 | 33 | $userdata = $modx->db->getRow($rs); |
34 | - if(!$userdata) { |
|
34 | + if (!$userdata) { |
|
35 | 35 | $modx->webAlertAndQuit("No user returned!"); |
36 | 36 | } |
37 | 37 | |
@@ -39,10 +39,10 @@ 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)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | 43 | // manually extract so that user display settings are not overwritten |
44 | - foreach($usersettings as $k => $v) { |
|
45 | - if($k != 'manager_language' && $k != 'manager_theme') { |
|
44 | + foreach ($usersettings as $k => $v) { |
|
45 | + if ($k != 'manager_language' && $k != 'manager_theme') { |
|
46 | 46 | ${$k} = $v; |
47 | 47 | } |
48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | // get user name |
51 | 51 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'"); |
52 | 52 | $usernamedata = $modx->db->getRow($rs); |
53 | - if(!$usernamedata) { |
|
53 | + if (!$usernamedata) { |
|
54 | 54 | $modx->webAlertAndQuit("No user returned while getting username!"); |
55 | 55 | } |
56 | 56 | $_SESSION['itemname'] = $usernamedata['username']; |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // avoid doubling htmlspecialchars (already encoded in DB) |
65 | -foreach($userdata as $key => $val) { |
|
65 | +foreach ($userdata as $key => $val) { |
|
66 | 66 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
67 | 67 | }; |
68 | 68 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
69 | 69 | |
70 | 70 | // restore saved form |
71 | 71 | $formRestored = false; |
72 | -if($modx->manager->hasFormValues()) { |
|
72 | +if ($modx->manager->hasFormValues()) { |
|
73 | 73 | $modx->manager->loadFormValues(); |
74 | 74 | // restore post values |
75 | 75 | $userdata = array_merge($userdata, $_POST); |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | // include the country list language file |
85 | 85 | $_country_lang = array(); |
86 | 86 | include_once "lang/country/english_country.inc.php"; |
87 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
88 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
87 | +if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) { |
|
88 | + include_once "lang/country/".$manager_language."_country.inc.php"; |
|
89 | 89 | } |
90 | 90 | asort($_country_lang); |
91 | 91 | |
92 | 92 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
93 | -if($which_browser == 'default') { |
|
93 | +if ($which_browser == 'default') { |
|
94 | 94 | $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
95 | 95 | } |
96 | 96 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | document.userform.save.click(); |
183 | 183 | }, |
184 | 184 | delete: function() { |
185 | - <?php if($_GET['id'] == $modx->getLoginUserID()) { ?> |
|
185 | + <?php if ($_GET['id'] == $modx->getLoginUserID()) { ?> |
|
186 | 186 | alert("<?php echo $_lang['alert_delete_self']; ?>"); |
187 | 187 | <?php } else { ?> |
188 | 188 | if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
206 | 206 | "id" => $user |
207 | 207 | )); |
208 | - if(is_array($evtOut)) { |
|
208 | + if (is_array($evtOut)) { |
|
209 | 209 | echo implode("", $evtOut); |
210 | 210 | } |
211 | 211 | ?> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
215 | 215 | |
216 | 216 | <h1> |
217 | - <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?> |
|
217 | + <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?> |
|
218 | 218 | </h1> |
219 | 219 | |
220 | 220 | <?php echo $_style['actionbuttons']['dynamic']['user'] ?> |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | <table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser"> |
233 | 233 | <tr> |
234 | 234 | <td colspan="3"><span id="blocked" class="warning"> |
235 | - <?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?> |
|
235 | + <?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?> |
|
236 | 236 | <?php echo $_lang['user_is_blocked']; ?> |
237 | 237 | <?php } ?> |
238 | 238 | </span> |
239 | 239 | <br /></td> |
240 | 240 | </tr> |
241 | - <?php if(!empty($userdata['id'])) { ?> |
|
241 | + <?php if (!empty($userdata['id'])) { ?> |
|
242 | 242 | <tr id="showname" style="display: <?php echo ($modx->manager->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> "> |
243 | 243 | <td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i> <b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span> |
244 | 244 | <input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" /> |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | <td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td> |
252 | 252 | </tr> |
253 | 253 | <tr> |
254 | - <th><?php echo $modx->manager->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th> |
|
254 | + <th><?php echo $modx->manager->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th> |
|
255 | 255 | <td> </td> |
256 | 256 | <td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "11" ? " checked disabled" : ""; ?>> |
257 | 257 | <input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" /> |
@@ -305,8 +305,8 @@ discard block |
||
305 | 305 | ?> |
306 | 306 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
307 | 307 | <?php |
308 | - while($row = $modx->db->getRow($rs)) { |
|
309 | - if($modx->manager->action == '11') { |
|
308 | + while ($row = $modx->db->getRow($rs)) { |
|
309 | + if ($modx->manager->action == '11') { |
|
310 | 310 | $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
311 | 311 | } else { |
312 | 312 | $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
361 | 361 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
362 | 362 | <?php |
363 | - foreach($_country_lang as $key => $country) { |
|
364 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
363 | + foreach ($_country_lang as $key => $country) { |
|
364 | + echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>"; |
|
365 | 365 | } |
366 | 366 | ?> |
367 | 367 | </select></td> |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | <td> </td> |
388 | 388 | <td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars($userdata['comment']); ?></textarea></td> |
389 | 389 | </tr> |
390 | - <?php if($modx->manager->action == '12') { ?> |
|
390 | + <?php if ($modx->manager->action == '12') { ?> |
|
391 | 391 | <tr> |
392 | 392 | <th><?php echo $_lang['user_logincount']; ?>:</th> |
393 | 393 | <td> </td> |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | </tr> |
425 | 425 | <?php } ?> |
426 | 426 | </table> |
427 | - <?php if($_GET['id'] == $modx->getLoginUserID()) { ?> |
|
427 | + <?php if ($_GET['id'] == $modx->getLoginUserID()) { ?> |
|
428 | 428 | <p><?php echo $_lang['user_edit_self_msg']; ?></p> |
429 | 429 | <?php } ?> |
430 | 430 | </div> |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | <?php |
442 | 442 | $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
443 | 443 | $dir = dir("includes/lang"); |
444 | - while($file = $dir->read()) { |
|
445 | - if(strpos($file, ".inc.php") > 0) { |
|
444 | + while ($file = $dir->read()) { |
|
445 | + if (strpos($file, ".inc.php") > 0) { |
|
446 | 446 | $endpos = strpos($file, "."); |
447 | 447 | $languagename = substr($file, 0, $endpos); |
448 | 448 | $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
@@ -529,17 +529,17 @@ discard block |
||
529 | 529 | <option value=""></option> |
530 | 530 | <?php |
531 | 531 | $dir = dir("media/style/"); |
532 | - while($file = $dir->read()) { |
|
533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
532 | + while ($file = $dir->read()) { |
|
533 | + if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
534 | 534 | $themename = $file; |
535 | - if($themename === 'common') { |
|
535 | + if ($themename === 'common') { |
|
536 | 536 | continue; |
537 | 537 | } |
538 | - $attr = 'value="' . $themename . '" '; |
|
539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
538 | + $attr = 'value="'.$themename.'" '; |
|
539 | + if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
540 | 540 | $attr .= 'selected="selected" '; |
541 | 541 | } |
542 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
542 | + echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n"; |
|
543 | 543 | } |
544 | 544 | } |
545 | 545 | $dir->close(); |
@@ -580,12 +580,12 @@ discard block |
||
580 | 580 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
581 | 581 | <?php |
582 | 582 | $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
583 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
584 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
583 | + echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n"; |
|
584 | + foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
585 | 585 | $dir = str_replace('\\', '/', $dir); |
586 | 586 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
587 | 587 | $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
588 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
588 | + echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n"; |
|
589 | 589 | } |
590 | 590 | ?> |
591 | 591 | </select></td> |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | </tr> |
613 | 613 | <tr> |
614 | 614 | <td> </td> |
615 | - <td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td> |
|
615 | + <td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td> |
|
616 | 616 | </tr> |
617 | 617 | <tr> |
618 | 618 | <th><?php echo $_lang["uploadable_media_title"] ?></th> |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | </tr> |
625 | 625 | <tr> |
626 | 626 | <td> </td> |
627 | - <td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td> |
|
627 | + <td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td> |
|
628 | 628 | </tr> |
629 | 629 | <tr> |
630 | 630 | <th><?php echo $_lang["uploadable_flash_title"] ?></th> |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | </tr> |
637 | 637 | <tr> |
638 | 638 | <td> </td> |
639 | - <td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td> |
|
639 | + <td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td> |
|
640 | 640 | </tr> |
641 | 641 | <tr> |
642 | 642 | <th><?php echo $_lang["uploadable_files_title"] ?></th> |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | </tr> |
649 | 649 | <tr> |
650 | 650 | <td> </td> |
651 | - <td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td> |
|
651 | + <td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td> |
|
652 | 652 | </tr> |
653 | 653 | <tr class='row2'> |
654 | 654 | <th><?php echo $_lang["upload_maxsize_title"] ?></th> |
@@ -667,11 +667,11 @@ discard block |
||
667 | 667 | $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
668 | 668 | // invoke OnRichTextEditorRegister event |
669 | 669 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
670 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
671 | - if(is_array($evtOut)) { |
|
672 | - for($i = 0; $i < count($evtOut); $i++) { |
|
670 | + echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n"; |
|
671 | + if (is_array($evtOut)) { |
|
672 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
673 | 673 | $editor = $evtOut[$i]; |
674 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
674 | + echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n"; |
|
675 | 675 | } |
676 | 676 | } |
677 | 677 | ?> |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | <?php |
710 | 710 | // invoke OnInterfaceSettingsRender event |
711 | 711 | $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
712 | - if(is_array($evtOut)) { |
|
712 | + if (is_array($evtOut)) { |
|
713 | 713 | echo implode("", $evtOut); |
714 | 714 | } |
715 | 715 | ?> |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | function BrowseServer() { |
737 | 737 | var w = screen.width * 0.7; |
738 | 738 | var h = screen.height * 0.7; |
739 | - OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h); |
|
739 | + OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | function SetUrl(url, width, height, alt) { |
@@ -759,17 +759,17 @@ discard block |
||
759 | 759 | </tr> |
760 | 760 | </table> |
761 | 761 | </div> |
762 | - <?php if($use_udperms == 1) { |
|
762 | + <?php if ($use_udperms == 1) { |
|
763 | 763 | |
764 | 764 | $groupsarray = array(); |
765 | 765 | |
766 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
766 | + if ($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
767 | 767 | $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'"); |
768 | 768 | $groupsarray = $modx->db->getColumn('user_group', $rs); |
769 | 769 | } |
770 | 770 | // retain selected doc groups between post |
771 | - if(is_array($_POST['user_groups'])) { |
|
772 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
771 | + if (is_array($_POST['user_groups'])) { |
|
772 | + foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
773 | 773 | } |
774 | 774 | ?> |
775 | 775 | <div class="tab-page" id="tabAccess"> |
@@ -778,8 +778,8 @@ discard block |
||
778 | 778 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
779 | 779 | <?php |
780 | 780 | $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name'); |
781 | - while($row = $modx->db->getRow($rs)) { |
|
782 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
781 | + while ($row = $modx->db->getRow($rs)) { |
|
782 | + echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />"; |
|
783 | 783 | } |
784 | 784 | } |
785 | 785 | ?> |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
793 | 793 | "id" => $user |
794 | 794 | )); |
795 | - if(is_array($evtOut)) { |
|
795 | + if (is_array($evtOut)) { |
|
796 | 796 | echo implode("", $evtOut); |
797 | 797 | } |
798 | 798 | ?> |
@@ -20,28 +20,28 @@ discard block |
||
20 | 20 | $body_class = ''; |
21 | 21 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness'); |
22 | 22 | if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
23 | - $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
|
23 | + $body_class .= ' '.$theme_modes[$_COOKIE['MODX_themeMode']]; |
|
24 | 24 | } elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
25 | - $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
|
25 | + $body_class .= ' '.$theme_modes[$modx->config['manager_theme_mode']]; |
|
26 | 26 | } |
27 | 27 | |
28 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime; |
|
28 | +$css = 'media/style/'.$modx->config['manager_theme'].'/style.css?v='.$lastInstallTime; |
|
29 | 29 | |
30 | 30 | if ($modx->config['manager_theme'] == 'default') { |
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')) { |
|
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')) { |
|
33 | 33 | $files = array( |
34 | - 'bootstrap' => MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css', |
|
35 | - 'font-awesome' => MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css', |
|
36 | - 'fonts' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css', |
|
37 | - 'forms' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css', |
|
38 | - 'mainmenu' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css', |
|
39 | - 'tree' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css', |
|
40 | - 'custom' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css', |
|
41 | - 'tabpane' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css', |
|
42 | - 'contextmenu' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css', |
|
43 | - 'index' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css', |
|
44 | - 'main' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css' |
|
34 | + 'bootstrap' => MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css', |
|
35 | + 'font-awesome' => MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css', |
|
36 | + 'fonts' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css', |
|
37 | + 'forms' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css', |
|
38 | + 'mainmenu' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css', |
|
39 | + 'tree' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css', |
|
40 | + 'custom' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css', |
|
41 | + 'tabpane' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css', |
|
42 | + 'contextmenu' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css', |
|
43 | + 'index' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css', |
|
44 | + 'main' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css' |
|
45 | 45 | ); |
46 | 46 | $evtOut = $modx->invokeEvent('OnBeforeMinifyCss', array( |
47 | 47 | 'files' => $files, |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | default: |
59 | 59 | $modx->webAlertAndQuit(sprintf($_lang['invalid_event_response'], 'OnBeforeMinifyManagerCss')); |
60 | 60 | } |
61 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
61 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
62 | 62 | $minifier = new Formatter\CSSMinify($files); |
63 | 63 | $css = $minifier->minify(); |
64 | 64 | file_put_contents( |
65 | - MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', |
|
65 | + MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', |
|
66 | 66 | $css |
67 | 67 | ); |
68 | 68 | } |
69 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
70 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
69 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
70 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <meta http-equiv="X-UA-Compatible" content="IE=edge"/> |
83 | 83 | <link rel="stylesheet" type="text/css" href="<?= $css ?>"/> |
84 | 84 | <script type="text/javascript" src="media/script/tabpane.js"></script> |
85 | - <?= sprintf('<script type="text/javascript" src="%s"></script>' . "\n", $modx->config['mgr_jquery_path']) ?> |
|
85 | + <?= sprintf('<script type="text/javascript" src="%s"></script>'."\n", $modx->config['mgr_jquery_path']) ?> |
|
86 | 86 | <?php if ($modx->config['show_picker'] != "0") { ?> |
87 | 87 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/color.switcher.js" |
88 | 88 | type="text/javascript"></script> |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | <?php } ?> |
96 | 96 | |
97 | 97 | <!-- OnManagerMainFrameHeaderHTMLBlock --> |
98 | - <?= $onManagerMainFrameHeaderHTMLBlock . "\n" ?> |
|
98 | + <?= $onManagerMainFrameHeaderHTMLBlock."\n" ?> |
|
99 | 99 | |
100 | 100 | <script type="text/javascript"> |
101 | 101 | if (!evo) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | <script> |
126 | 126 | <?php |
127 | 127 | if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
128 | - echo 'doRefresh(' . $_REQUEST['r'] . ");\n"; |
|
128 | + echo 'doRefresh('.$_REQUEST['r'].");\n"; |
|
129 | 129 | } |
130 | 130 | ?> |
131 | 131 | </script> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
2 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
3 | 3 | |
4 | -if( ! function_exists('getTemplates')) { |
|
4 | +if (!function_exists('getTemplates')) { |
|
5 | 5 | /** |
6 | 6 | * @param array $presets |
7 | 7 | * @return string |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | $_[] = parse($tpl, $ph); |
26 | 26 | $i++; |
27 | 27 | } |
28 | - return (0 < count($_)) ? '<h3>[%templates%]</h3>' . implode("\n", $_) : ''; |
|
28 | + return (0 < count($_)) ? '<h3>[%templates%]</h3>'.implode("\n", $_) : ''; |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -if( ! function_exists('getTVs')) { |
|
32 | +if (!function_exists('getTVs')) { |
|
33 | 33 | /** |
34 | 34 | * @param array $presets |
35 | 35 | * @return string |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $_[] = parse($tpl, $ph); |
55 | 55 | $i++; |
56 | 56 | } |
57 | - return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : ''; |
|
57 | + return (0 < count($_)) ? '<h3>[%tvs%]</h3>'.implode("\n", $_) : ''; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | -if( ! function_exists('getChunks')) { |
|
61 | +if (!function_exists('getChunks')) { |
|
62 | 62 | /** |
63 | 63 | * display chunks |
64 | 64 | * |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | $_[] = parse($tpl, $ph); |
85 | 85 | $i++; |
86 | 86 | } |
87 | - return (0 < count($_)) ? '<h3>[%chunks%]</h3>' . implode("\n", $_) : ''; |
|
87 | + return (0 < count($_)) ? '<h3>[%chunks%]</h3>'.implode("\n", $_) : ''; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -if( ! function_exists('getModules')) { |
|
91 | +if (!function_exists('getModules')) { |
|
92 | 92 | /** |
93 | 93 | * display modules |
94 | 94 | * |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $_[] = parse($tpl, $ph); |
115 | 115 | $i++; |
116 | 116 | } |
117 | - return (0 < count($_)) ? '<h3>[%modules%]</h3>' . implode("\n", $_) : ''; |
|
117 | + return (0 < count($_)) ? '<h3>[%modules%]</h3>'.implode("\n", $_) : ''; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | -if( ! function_exists('getPlugins')) { |
|
121 | +if (!function_exists('getPlugins')) { |
|
122 | 122 | /** |
123 | 123 | * display plugins |
124 | 124 | * |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $_[] = parse($tpl, $ph); |
149 | 149 | $i++; |
150 | 150 | } |
151 | - return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : ''; |
|
151 | + return (0 < count($_)) ? '<h3>[%plugins%]</h3>'.implode("\n", $_) : ''; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | -if( ! function_exists('getSnippets')) { |
|
155 | +if (!function_exists('getSnippets')) { |
|
156 | 156 | /** |
157 | 157 | * display snippets |
158 | 158 | * |
@@ -178,23 +178,23 @@ discard block |
||
178 | 178 | $_[] = parse($tpl, $ph); |
179 | 179 | $i++; |
180 | 180 | } |
181 | - return (0 < count($_)) ? '<h3>[%snippets%]</h3>' . implode("\n", $_) : ''; |
|
181 | + return (0 < count($_)) ? '<h3>[%snippets%]</h3>'.implode("\n", $_) : ''; |
|
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'])) |
|
191 | + if (!empty($_POST['databaseloginpassword'])) |
|
192 | 192 | $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
193 | - if(!empty($_POST['databaseloginname'])) |
|
193 | + if (!empty($_POST['databaseloginname'])) |
|
194 | 194 | $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
195 | 195 | break; |
196 | 196 | case 1: |
197 | - include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
197 | + include $base_path.MGR_DIR.'/includes/config.inc.php'; |
|
198 | 198 | if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
199 | 199 | if (@ mysqli_query($conn, "USE {$dbase}")) { |
200 | 200 | if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : ''; |
250 | 250 | |
251 | 251 | # load setup information file |
252 | -include($base_path . 'install/setup.info.php'); |
|
252 | +include($base_path.'install/setup.info.php'); |
|
253 | 253 | $ph['templates'] = getTemplates($moduleTemplates); |
254 | 254 | $ph['tvs'] = getTVs($moduleTVs); |
255 | 255 | $ph['chunks'] = getChunks($moduleChunks); |
@@ -259,6 +259,6 @@ discard block |
||
259 | 259 | |
260 | 260 | $ph['action'] = ($installMode == 1) ? 'mode' : 'connection'; |
261 | 261 | |
262 | -$tpl = file_get_contents($base_path . 'install/actions/tpl_options.html'); |
|
263 | -$content = parse($tpl,$ph); |
|
264 | -echo parse($content,$_lang,'[%','%]'); |
|
262 | +$tpl = file_get_contents($base_path.'install/actions/tpl_options.html'); |
|
263 | +$content = parse($tpl, $ph); |
|
264 | +echo parse($content, $_lang, '[%', '%]'); |
@@ -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); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | echo "<p>{$_lang['setup_database']}</p>\n"; |
31 | 31 | |
32 | -$installMode= (int)$_POST['installmode']; |
|
32 | +$installMode = (int) $_POST['installmode']; |
|
33 | 33 | $installData = $_POST['installdata'] == "1" ? 1 : 0; |
34 | 34 | |
35 | 35 | //if ($installMode == 1) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
44 | 44 | $database_connection_charset = $_POST['database_connection_charset']; |
45 | 45 | $database_connection_method = $_POST['database_connection_method']; |
46 | -$dbase = "`" . $_POST['database_name'] . "`"; |
|
46 | +$dbase = "`".$_POST['database_name']."`"; |
|
47 | 47 | $table_prefix = $_POST['tableprefix']; |
48 | 48 | $adminname = $_POST['cmsadmin']; |
49 | 49 | $adminemail = $_POST['cmsadminemail']; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | // set session name variable |
56 | 56 | if (!isset ($site_sessionname)) { |
57 | - $site_sessionname = 'SN' . uniqid(''); |
|
57 | + $site_sessionname = 'SN'.uniqid(''); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // get base path and url |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | array_pop($a); |
69 | 69 | $pth = implode("install", $a); |
70 | 70 | unset ($a); |
71 | -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
|
72 | -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); |
|
71 | +$base_url = $url.(substr($url, -1) != "/" ? "/" : ""); |
|
72 | +$base_path = $pth.(substr($pth, -1) != "/" ? "/" : ""); |
|
73 | 73 | |
74 | 74 | // connect to the database |
75 | -echo "<p>". $_lang['setup_database_create_connection']; |
|
75 | +echo "<p>".$_lang['setup_database_create_connection']; |
|
76 | 76 | if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) { |
77 | 77 | echo '<span class="notok">'.$_lang["setup_database_create_connection_failed"]."</span></p><p>".$_lang['setup_database_create_connection_failed_note']."</p>"; |
78 | 78 | return; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // select database |
84 | -echo "<p>".$_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: "; |
|
84 | +echo "<p>".$_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: "; |
|
85 | 85 | if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) { |
86 | 86 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
87 | 87 | $create = true; |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | |
94 | 94 | // try to create the database |
95 | 95 | if ($create) { |
96 | - echo "<p>".$_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: "; |
|
96 | + echo "<p>".$_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: "; |
|
97 | 97 | // if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) { |
98 | - if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
98 | + if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
99 | 99 | echo '<span class="notok">'.$_lang['setup_database_creation_failed']."</span>".$_lang['setup_database_creation_failed_note']."</p>"; |
100 | 100 | $errors += 1; |
101 | 101 | ?> |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | |
115 | 115 | // check table prefix |
116 | 116 | if ($installMode == 0) { |
117 | - echo "<p>" . $_lang['checking_table_prefix'] . $table_prefix . "`: "; |
|
118 | - if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
119 | - echo '<span class="notok">' . $_lang['failed'] . "</span>" . $_lang['table_prefix_already_inuse'] . "</p>"; |
|
117 | + echo "<p>".$_lang['checking_table_prefix'].$table_prefix."`: "; |
|
118 | + if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
119 | + echo '<span class="notok">'.$_lang['failed']."</span>".$_lang['table_prefix_already_inuse']."</p>"; |
|
120 | 120 | $errors += 1; |
121 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . "</p>"; |
|
121 | + echo "<p>".$_lang['table_prefix_already_inuse_note']."</p>"; |
|
122 | 122 | return; |
123 | 123 | } else { |
124 | 124 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | -if(!function_exists('parseProperties')) { |
|
128 | +if (!function_exists('parseProperties')) { |
|
129 | 129 | /** |
130 | 130 | * parses a resource property string and returns the result as an array |
131 | 131 | * duplicate of method in documentParser class |
@@ -133,20 +133,20 @@ discard block |
||
133 | 133 | * @param string $propertyString |
134 | 134 | * @return array |
135 | 135 | */ |
136 | - function parseProperties($propertyString) { |
|
137 | - $parameter= array (); |
|
136 | + function parseProperties($propertyString){ |
|
137 | + $parameter = array(); |
|
138 | 138 | if (!empty ($propertyString)) { |
139 | - $tmpParams= explode("&", $propertyString); |
|
139 | + $tmpParams = explode("&", $propertyString); |
|
140 | 140 | $countParams = count($tmpParams); |
141 | - for ($x= 0; $x < $countParams; $x++) { |
|
141 | + for ($x = 0; $x < $countParams; $x++) { |
|
142 | 142 | if (strpos($tmpParams[$x], '=', 0)) { |
143 | - $pTmp= explode("=", $tmpParams[$x]); |
|
144 | - $pvTmp= explode(";", trim($pTmp[1])); |
|
143 | + $pTmp = explode("=", $tmpParams[$x]); |
|
144 | + $pvTmp = explode(";", trim($pTmp[1])); |
|
145 | 145 | if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
146 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
146 | + $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default |
|
147 | 147 | else |
148 | 148 | if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
149 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
149 | + $parameter[trim($pTmp[0])] = $pvTmp[2]; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | } |
@@ -157,20 +157,20 @@ discard block |
||
157 | 157 | // check status of Inherit Parent Template plugin |
158 | 158 | $auto_template_logic = 'parent'; |
159 | 159 | if ($installMode != 0) { |
160 | - $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"); |
|
160 | + $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"); |
|
161 | 161 | $row = mysqli_fetch_row($rs); |
162 | - if(!$row) { |
|
162 | + if (!$row) { |
|
163 | 163 | // not installed |
164 | 164 | $auto_template_logic = 'system'; |
165 | 165 | } else { |
166 | - if($row[1] == 1) { |
|
166 | + if ($row[1] == 1) { |
|
167 | 167 | // installed but disabled |
168 | 168 | $auto_template_logic = 'system'; |
169 | 169 | } else { |
170 | 170 | // installed, enabled .. see how it's configured |
171 | 171 | $properties = parseProperties($row[0]); |
172 | - if(isset($properties['inheritTemplate'])) { |
|
173 | - if($properties['inheritTemplate'] == 'From First Sibling') { |
|
172 | + if (isset($properties['inheritTemplate'])) { |
|
173 | + if ($properties['inheritTemplate'] == 'From First Sibling') { |
|
174 | 174 | $auto_template_logic = 'sibling'; |
175 | 175 | } |
176 | 176 | } |
@@ -194,20 +194,20 @@ discard block |
||
194 | 194 | $sqlParser->connect(); |
195 | 195 | |
196 | 196 | // install/update database |
197 | -echo "<p>" . $_lang['setup_database_creating_tables']; |
|
197 | +echo "<p>".$_lang['setup_database_creating_tables']; |
|
198 | 198 | if ($moduleSQLBaseFile) { |
199 | 199 | $sqlParser->process($moduleSQLBaseFile); |
200 | 200 | // display database results |
201 | 201 | if ($sqlParser->installFailed == true) { |
202 | 202 | $errors += 1; |
203 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
204 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
205 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
203 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
204 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
205 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
206 | 206 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
207 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
207 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
208 | 208 | } |
209 | 209 | echo "</p>"; |
210 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
210 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
211 | 211 | return; |
212 | 212 | } else { |
213 | 213 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | // custom or not |
218 | 218 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
219 | 219 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
220 | -}else{ |
|
220 | +} else { |
|
221 | 221 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
222 | 222 | } |
223 | 223 | |
224 | 224 | // write the config.inc.php file if new installation |
225 | -echo "<p>" . $_lang['writing_config_file']; |
|
225 | +echo "<p>".$_lang['writing_config_file']; |
|
226 | 226 | |
227 | 227 | $confph = array(); |
228 | 228 | $confph['database_server'] = $database_server; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $chmodSuccess = @chmod($filename, 0404); |
255 | 255 | |
256 | 256 | if ($configFileFailed == true) { |
257 | - echo '<span class="notok">' . $_lang['failed'] . "</span></p>"; |
|
257 | + echo '<span class="notok">'.$_lang['failed']."</span></p>"; |
|
258 | 258 | $errors += 1; |
259 | 259 | ?> |
260 | 260 | <p><?php echo $_lang['cant_write_config_file']?><span class="mono"><?php echo MGR_DIR; ?>/includes/config.inc.php</span></p> |
@@ -271,35 +271,35 @@ discard block |
||
271 | 271 | // generate new site_id and set manager theme to default |
272 | 272 | if ($installMode == 0) { |
273 | 273 | $siteid = uniqid(''); |
274 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
274 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
275 | 275 | } else { |
276 | 276 | // update site_id if missing |
277 | - $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); |
|
277 | + $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"); |
|
278 | 278 | if ($ds) { |
279 | 279 | $r = mysqli_fetch_assoc($ds); |
280 | 280 | $siteid = $r['setting_value']; |
281 | 281 | if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') { |
282 | 282 | $siteid = uniqid(''); |
283 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
283 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | 288 | // Reset database for installation of demo-site |
289 | 289 | if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) { |
290 | - echo "<p>" . $_lang['resetting_database']; |
|
290 | + echo "<p>".$_lang['resetting_database']; |
|
291 | 291 | $sqlParser->process($moduleSQLResetFile); |
292 | 292 | // display database results |
293 | 293 | if ($sqlParser->installFailed == true) { |
294 | 294 | $errors += 1; |
295 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
296 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
297 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
295 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
296 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
297 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
298 | 298 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
299 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
299 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
300 | 300 | } |
301 | 301 | echo "</p>"; |
302 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
302 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
303 | 303 | return; |
304 | 304 | } else { |
305 | 305 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | |
309 | 309 | // Install Templates |
310 | 310 | if (isset ($_POST['template']) || $installData) { |
311 | - echo "<h3>" . $_lang['templates'] . ":</h3> "; |
|
311 | + echo "<h3>".$_lang['templates'].":</h3> "; |
|
312 | 312 | $selTemplates = $_POST['template']; |
313 | 313 | foreach ($moduleTemplates as $k=>$moduleTemplate) { |
314 | 314 | $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; |
315 | - if($installSample || in_array($k, $selTemplates)) { |
|
315 | + if ($installSample || in_array($k, $selTemplates)) { |
|
316 | 316 | $name = mysqli_real_escape_string($conn, $moduleTemplate[0]); |
317 | 317 | $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]); |
318 | 318 | $category = mysqli_real_escape_string($conn, $moduleTemplate[4]); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $filecontent = $moduleTemplate[3]; |
321 | 321 | $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site |
322 | 322 | if (!file_exists($filecontent)) { |
323 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
323 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
324 | 324 | } else { |
325 | 325 | // Create the category if it does not already exist |
326 | 326 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -330,31 +330,31 @@ discard block |
||
330 | 330 | $template = mysqli_real_escape_string($conn, $template); |
331 | 331 | |
332 | 332 | // See if the template already exists |
333 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
|
333 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"); |
|
334 | 334 | |
335 | 335 | if (mysqli_num_rows($rs)) { |
336 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
336 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
337 | 337 | $errors += 1; |
338 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
338 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
339 | 339 | return; |
340 | 340 | } |
341 | - if(!is_null($save_sql_id_as)) { |
|
341 | + if (!is_null($save_sql_id_as)) { |
|
342 | 342 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
343 | - if(!$sql_id) { |
|
344 | - $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
343 | + if (!$sql_id) { |
|
344 | + $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
345 | 345 | $sql_id = $idQuery['id']; |
346 | 346 | } |
347 | 347 | $custom_placeholders[$save_sql_id_as] = $sql_id; |
348 | 348 | } |
349 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
349 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
350 | 350 | } else { |
351 | - if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
351 | + if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
352 | 352 | $errors += 1; |
353 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
353 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
354 | 354 | return; |
355 | 355 | } |
356 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
357 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
356 | + if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
357 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | |
364 | 364 | // Install Template Variables |
365 | 365 | if (isset ($_POST['tv']) || $installData) { |
366 | - echo "<h3>" . $_lang['tvs'] . ":</h3> "; |
|
366 | + echo "<h3>".$_lang['tvs'].":</h3> "; |
|
367 | 367 | $selTVs = $_POST['tv']; |
368 | 368 | foreach ($moduleTVs as $k=>$moduleTV) { |
369 | 369 | $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; |
370 | - if($installSample || in_array($k, $selTVs)) { |
|
370 | + if ($installSample || in_array($k, $selTVs)) { |
|
371 | 371 | $name = mysqli_real_escape_string($conn, $moduleTV[0]); |
372 | 372 | $caption = mysqli_real_escape_string($conn, $moduleTV[1]); |
373 | 373 | $desc = mysqli_real_escape_string($conn, $moduleTV[2]); |
@@ -385,25 +385,25 @@ discard block |
||
385 | 385 | // Create the category if it does not already exist |
386 | 386 | $category = getCreateDbCategory($category, $sqlParser); |
387 | 387 | |
388 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"); |
|
388 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"); |
|
389 | 389 | if (mysqli_num_rows($rs)) { |
390 | 390 | $insert = true; |
391 | - while($row = mysqli_fetch_assoc($rs)) { |
|
392 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
393 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
391 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
392 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
393 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
394 | 394 | return; |
395 | 395 | } |
396 | 396 | $insert = false; |
397 | 397 | } |
398 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
398 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
399 | 399 | } else { |
400 | 400 | //$q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM $dbase.`" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
401 | - $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
401 | + $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
402 | 402 | if (!mysqli_query($sqlParser->conn, $q)) { |
403 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
403 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
404 | 404 | return; |
405 | 405 | } |
406 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
406 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | // add template assignments |
@@ -412,10 +412,10 @@ discard block |
||
412 | 412 | if (count($assignments) > 0) { |
413 | 413 | |
414 | 414 | // remove existing tv -> template assignments |
415 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
415 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
416 | 416 | $row = mysqli_fetch_assoc($ds); |
417 | 417 | $id = $row["id"]; |
418 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
418 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''); |
|
419 | 419 | |
420 | 420 | // add tv -> template assignments |
421 | 421 | foreach ($assignments as $assignment) { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | if ($ds && $ts) { |
425 | 425 | $tRow = mysqli_fetch_assoc($ts); |
426 | 426 | $templateId = $tRow['id']; |
427 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
427 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | } |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | |
435 | 435 | // Install Chunks |
436 | 436 | if (isset ($_POST['chunk']) || $installData) { |
437 | - echo "<h3>" . $_lang['chunks'] . ":</h3> "; |
|
437 | + echo "<h3>".$_lang['chunks'].":</h3> "; |
|
438 | 438 | $selChunks = $_POST['chunk']; |
439 | 439 | foreach ($moduleChunks as $k=>$moduleChunk) { |
440 | 440 | $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; |
441 | 441 | $count_new_name = 0; |
442 | - if($installSample || in_array($k, $selChunks)) { |
|
442 | + if ($installSample || in_array($k, $selChunks)) { |
|
443 | 443 | |
444 | 444 | $name = mysqli_real_escape_string($conn, $moduleChunk[0]); |
445 | 445 | $desc = mysqli_real_escape_string($conn, $moduleChunk[1]); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $filecontent = $moduleChunk[2]; |
449 | 449 | |
450 | 450 | if (!file_exists($filecontent)) |
451 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
451 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
452 | 452 | else { |
453 | 453 | |
454 | 454 | // Create the category if it does not already exist |
@@ -456,31 +456,31 @@ discard block |
||
456 | 456 | |
457 | 457 | $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); |
458 | 458 | $chunk = mysqli_real_escape_string($conn, $chunk); |
459 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); |
|
459 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"); |
|
460 | 460 | $count_original_name = mysqli_num_rows($rs); |
461 | - if($overwrite == 'false') { |
|
462 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
463 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); |
|
461 | + if ($overwrite == 'false') { |
|
462 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
463 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"); |
|
464 | 464 | $count_new_name = mysqli_num_rows($rs); |
465 | 465 | } |
466 | 466 | $update = $count_original_name > 0 && $overwrite == 'true'; |
467 | 467 | if ($update) { |
468 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
468 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
469 | 469 | $errors += 1; |
470 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
470 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
471 | 471 | return; |
472 | 472 | } |
473 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
474 | - } elseif($count_new_name == 0) { |
|
475 | - if($count_original_name > 0 && $overwrite == 'false') { |
|
473 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
474 | + } elseif ($count_new_name == 0) { |
|
475 | + if ($count_original_name > 0 && $overwrite == 'false') { |
|
476 | 476 | $name = $newname; |
477 | 477 | } |
478 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
478 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
479 | 479 | $errors += 1; |
480 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
480 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
481 | 481 | return; |
482 | 482 | } |
483 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
483 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | } |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | |
490 | 490 | // Install Modules |
491 | 491 | if (isset ($_POST['module']) || $installData) { |
492 | - echo "<h3>" . $_lang['modules'] . ":</h3> "; |
|
492 | + echo "<h3>".$_lang['modules'].":</h3> "; |
|
493 | 493 | $selModules = $_POST['module']; |
494 | 494 | foreach ($moduleModules as $k=>$moduleModule) { |
495 | 495 | $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; |
496 | - if($installSample || in_array($k, $selModules)) { |
|
496 | + if ($installSample || in_array($k, $selModules)) { |
|
497 | 497 | $name = mysqli_real_escape_string($conn, $moduleModule[0]); |
498 | 498 | $desc = mysqli_real_escape_string($conn, $moduleModule[1]); |
499 | 499 | $filecontent = $moduleModule[2]; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
503 | 503 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
504 | 504 | if (!file_exists($filecontent)) |
505 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
505 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
506 | 506 | else { |
507 | 507 | |
508 | 508 | // Create the category if it does not already exist |
@@ -511,22 +511,22 @@ discard block |
||
511 | 511 | $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
512 | 512 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
513 | 513 | $module = mysqli_real_escape_string($conn, $module); |
514 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
514 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
515 | 515 | if (mysqli_num_rows($rs)) { |
516 | 516 | $row = mysqli_fetch_assoc($rs); |
517 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
518 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
519 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
517 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
518 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
519 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
520 | 520 | return; |
521 | 521 | } |
522 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
522 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
523 | 523 | } else { |
524 | 524 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
525 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
526 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
525 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
526 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
527 | 527 | return; |
528 | 528 | } |
529 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
529 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | } |
@@ -535,11 +535,11 @@ discard block |
||
535 | 535 | |
536 | 536 | // Install Plugins |
537 | 537 | if (isset ($_POST['plugin']) || $installData) { |
538 | - echo "<h3>" . $_lang['plugins'] . ":</h3> "; |
|
538 | + echo "<h3>".$_lang['plugins'].":</h3> "; |
|
539 | 539 | $selPlugs = $_POST['plugin']; |
540 | 540 | foreach ($modulePlugins as $k=>$modulePlugin) { |
541 | 541 | $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; |
542 | - if($installSample || in_array($k, $selPlugs)) { |
|
542 | + if ($installSample || in_array($k, $selPlugs)) { |
|
543 | 543 | $name = mysqli_real_escape_string($conn, $modulePlugin[0]); |
544 | 544 | $desc = mysqli_real_escape_string($conn, $modulePlugin[1]); |
545 | 545 | $filecontent = $modulePlugin[2]; |
@@ -549,17 +549,17 @@ discard block |
||
549 | 549 | $category = mysqli_real_escape_string($conn, $modulePlugin[6]); |
550 | 550 | $leg_names = ''; |
551 | 551 | $disabled = $modulePlugin[9]; |
552 | - if(array_key_exists(7, $modulePlugin)) { |
|
552 | + if (array_key_exists(7, $modulePlugin)) { |
|
553 | 553 | // parse comma-separated legacy names and prepare them for sql IN clause |
554 | - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
|
554 | + $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'"; |
|
555 | 555 | } |
556 | 556 | if (!file_exists($filecontent)) |
557 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
557 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
558 | 558 | else { |
559 | 559 | |
560 | 560 | // disable legacy versions based on legacy_names provided |
561 | - if(!empty($leg_names)) { |
|
562 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
561 | + if (!empty($leg_names)) { |
|
562 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
563 | 563 | $rs = mysqli_query($sqlParser->conn, $update_query); |
564 | 564 | } |
565 | 565 | |
@@ -569,50 +569,50 @@ discard block |
||
569 | 569 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
570 | 570 | $plugin = removeDocblock($plugin, 'plugin'); |
571 | 571 | $plugin = mysqli_real_escape_string($conn, $plugin); |
572 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"); |
|
572 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"); |
|
573 | 573 | if (mysqli_num_rows($rs)) { |
574 | 574 | $insert = true; |
575 | - while($row = mysqli_fetch_assoc($rs)) { |
|
576 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
577 | - if($row['description'] == $desc){ |
|
578 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
579 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
575 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
576 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
577 | + if ($row['description'] == $desc) { |
|
578 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
579 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
580 | 580 | return; |
581 | 581 | } |
582 | 582 | $insert = false; |
583 | 583 | } else { |
584 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
584 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
585 | 585 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
586 | 586 | return; |
587 | 587 | } |
588 | 588 | } |
589 | 589 | } |
590 | - if($insert === true) { |
|
591 | - $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
592 | - if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
590 | + if ($insert === true) { |
|
591 | + $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
592 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
593 | 593 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
594 | 594 | return; |
595 | 595 | } |
596 | 596 | } |
597 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
597 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
598 | 598 | } else { |
599 | 599 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
600 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
601 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
600 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
601 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
602 | 602 | return; |
603 | 603 | } |
604 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
604 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
605 | 605 | } |
606 | 606 | // add system events |
607 | 607 | if (count($events) > 0) { |
608 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
608 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
609 | 609 | if ($ds) { |
610 | 610 | $row = mysqli_fetch_assoc($ds); |
611 | 611 | $id = $row["id"]; |
612 | 612 | // remove existing events |
613 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\''); |
|
613 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\''); |
|
614 | 614 | // add new events |
615 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')"); |
|
615 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')"); |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | } |
@@ -622,18 +622,18 @@ discard block |
||
622 | 622 | |
623 | 623 | // Install Snippets |
624 | 624 | if (isset ($_POST['snippet']) || $installData) { |
625 | - echo "<h3>" . $_lang['snippets'] . ":</h3> "; |
|
625 | + echo "<h3>".$_lang['snippets'].":</h3> "; |
|
626 | 626 | $selSnips = $_POST['snippet']; |
627 | 627 | foreach ($moduleSnippets as $k=>$moduleSnippet) { |
628 | 628 | $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; |
629 | - if($installSample || in_array($k, $selSnips)) { |
|
629 | + if ($installSample || in_array($k, $selSnips)) { |
|
630 | 630 | $name = mysqli_real_escape_string($conn, $moduleSnippet[0]); |
631 | 631 | $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]); |
632 | 632 | $filecontent = $moduleSnippet[2]; |
633 | 633 | $properties = $moduleSnippet[3]; |
634 | 634 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
635 | 635 | if (!file_exists($filecontent)) |
636 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
636 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
637 | 637 | else { |
638 | 638 | |
639 | 639 | // Create the category if it does not already exist |
@@ -642,22 +642,22 @@ discard block |
||
642 | 642 | $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
643 | 643 | $snippet = removeDocblock($snippet, 'snippet'); |
644 | 644 | $snippet = mysqli_real_escape_string($conn, $snippet); |
645 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
645 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
646 | 646 | if (mysqli_num_rows($rs)) { |
647 | 647 | $row = mysqli_fetch_assoc($rs); |
648 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
649 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
650 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
648 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
649 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
650 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
651 | 651 | return; |
652 | 652 | } |
653 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
653 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
654 | 654 | } else { |
655 | 655 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
656 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
657 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
656 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
657 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
658 | 658 | return; |
659 | 659 | } |
660 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
660 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | } |
@@ -666,24 +666,24 @@ discard block |
||
666 | 666 | |
667 | 667 | // Install demo-site |
668 | 668 | if ($installData && $moduleSQLDataFile) { |
669 | - echo "<p>" . $_lang['installing_demo_site']; |
|
669 | + echo "<p>".$_lang['installing_demo_site']; |
|
670 | 670 | $sqlParser->process($moduleSQLDataFile); |
671 | 671 | // display database results |
672 | 672 | if ($sqlParser->installFailed == true) { |
673 | 673 | $errors += 1; |
674 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
675 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
676 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
674 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
675 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
676 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
677 | 677 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
678 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
678 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
679 | 679 | } |
680 | 680 | echo "</p>"; |
681 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
681 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
682 | 682 | return; |
683 | 683 | } else { |
684 | 684 | $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); |
685 | 685 | $rs = mysqli_query($sqlParser->conn, $sql); |
686 | - if(mysqli_num_rows($rs)) { |
|
686 | + if (mysqli_num_rows($rs)) { |
|
687 | 687 | $row = mysqli_fetch_assoc($rs); |
688 | 688 | $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']); |
689 | 689 | mysqli_query($sqlParser->conn, $sql); |
@@ -694,9 +694,9 @@ discard block |
||
694 | 694 | |
695 | 695 | // Install Dependencies |
696 | 696 | foreach ($moduleDependencies as $dependency) { |
697 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
697 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'); |
|
698 | 698 | if (!$ds) { |
699 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
699 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
700 | 700 | return; |
701 | 701 | } else { |
702 | 702 | $row = mysqli_fetch_assoc($ds); |
@@ -704,37 +704,37 @@ discard block |
||
704 | 704 | $moduleGuid = $row["guid"]; |
705 | 705 | } |
706 | 706 | // get extra id |
707 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
707 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'); |
|
708 | 708 | if (!$ds) { |
709 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
709 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
710 | 710 | return; |
711 | 711 | } else { |
712 | 712 | $row = mysqli_fetch_assoc($ds); |
713 | 713 | $extraId = $row["id"]; |
714 | 714 | } |
715 | 715 | // setup extra as module dependency |
716 | - $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
716 | + $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1'); |
|
717 | 717 | if (!$ds) { |
718 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
718 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
719 | 719 | return; |
720 | 720 | } else { |
721 | 721 | if (mysqli_num_rows($ds) === 0) { |
722 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
723 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
722 | + mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'); |
|
723 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_create'].'</span></p>'; |
|
724 | 724 | } else { |
725 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
726 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
725 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']); |
|
726 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_update'].'</span></p>'; |
|
727 | 727 | } |
728 | 728 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
729 | 729 | // set extra guid for plugins and snippets |
730 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
730 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'); |
|
731 | 731 | if (!$ds) { |
732 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
732 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
733 | 733 | return; |
734 | 734 | } else { |
735 | 735 | if (mysqli_num_rows($ds) != 0) { |
736 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
737 | - echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
736 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId); |
|
737 | + echo '<p> '.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>'; |
|
738 | 738 | } |
739 | 739 | } |
740 | 740 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | // call back function |
745 | 745 | if ($callBackFnc != "") |
746 | - $callBackFnc ($sqlParser); |
|
746 | + $callBackFnc($sqlParser); |
|
747 | 747 | |
748 | 748 | // Setup the MODX API -- needed for the cache processor |
749 | 749 | define('MODX_API_MODE', true); |
@@ -778,12 +778,12 @@ discard block |
||
778 | 778 | } |
779 | 779 | |
780 | 780 | // setup completed! |
781 | -echo "<p><b>" . $_lang['installation_successful'] . "</b></p>"; |
|
782 | -echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>"; |
|
781 | +echo "<p><b>".$_lang['installation_successful']."</b></p>"; |
|
782 | +echo "<p>".$_lang['to_log_into_content_manager']."</p>"; |
|
783 | 783 | if ($installMode == 0) { |
784 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['installation_note'] . "</p>"; |
|
784 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['installation_note']."</p>"; |
|
785 | 785 | } else { |
786 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['upgrade_note'] . "</p>"; |
|
786 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['upgrade_note']."</p>"; |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | /** |
@@ -793,11 +793,11 @@ discard block |
||
793 | 793 | * @param string $old |
794 | 794 | * @return string |
795 | 795 | */ |
796 | -function propUpdate($new,$old){ |
|
796 | +function propUpdate($new, $old){ |
|
797 | 797 | $newArr = parseProperties($new); |
798 | 798 | $oldArr = parseProperties($old); |
799 | - foreach ($oldArr as $k => $v){ |
|
800 | - if (isset($v['0']['options'])){ |
|
799 | + foreach ($oldArr as $k => $v) { |
|
800 | + if (isset($v['0']['options'])) { |
|
801 | 801 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
802 | 802 | } |
803 | 803 | } |
@@ -812,30 +812,30 @@ discard block |
||
812 | 812 | * @param bool|mixed $json |
813 | 813 | * @return string |
814 | 814 | */ |
815 | -function parseProperties($propertyString, $json=false) { |
|
816 | - $propertyString = str_replace('{}', '', $propertyString ); |
|
817 | - $propertyString = str_replace('} {', ',', $propertyString ); |
|
815 | +function parseProperties($propertyString, $json = false){ |
|
816 | + $propertyString = str_replace('{}', '', $propertyString); |
|
817 | + $propertyString = str_replace('} {', ',', $propertyString); |
|
818 | 818 | |
819 | - if(empty($propertyString)) return array(); |
|
820 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
819 | + if (empty($propertyString)) return array(); |
|
820 | + if ($propertyString == '{}' || $propertyString == '[]') return array(); |
|
821 | 821 | |
822 | 822 | $jsonFormat = isJson($propertyString, true); |
823 | 823 | $property = array(); |
824 | 824 | // old format |
825 | - if ( $jsonFormat === false) { |
|
826 | - $props= explode('&', $propertyString); |
|
825 | + if ($jsonFormat === false) { |
|
826 | + $props = explode('&', $propertyString); |
|
827 | 827 | foreach ($props as $prop) { |
828 | 828 | $prop = trim($prop); |
829 | - if($prop === '') { |
|
829 | + if ($prop === '') { |
|
830 | 830 | continue; |
831 | 831 | } |
832 | 832 | |
833 | 833 | $arr = explode(';', $prop); |
834 | - if( ! is_array($arr)) { |
|
834 | + if (!is_array($arr)) { |
|
835 | 835 | $arr = array(); |
836 | 836 | } |
837 | 837 | $key = explode('=', isset($arr[0]) ? $arr[0] : ''); |
838 | - if( ! is_array($key) || empty($key[0])) { |
|
838 | + if (!is_array($key) || empty($key[0])) { |
|
839 | 839 | continue; |
840 | 840 | } |
841 | 841 | |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | |
860 | 860 | } |
861 | 861 | // new json-format |
862 | - } else if(!empty($jsonFormat)){ |
|
862 | + } else if (!empty($jsonFormat)) { |
|
863 | 863 | $property = $jsonFormat; |
864 | 864 | } |
865 | 865 | if ($json) { |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @param bool $returnData |
875 | 875 | * @return bool|mixed |
876 | 876 | */ |
877 | -function isJson($string, $returnData=false) { |
|
877 | +function isJson($string, $returnData = false){ |
|
878 | 878 | $data = json_decode($string, true); |
879 | 879 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
880 | 880 | } |
@@ -884,20 +884,20 @@ discard block |
||
884 | 884 | * @param SqlParser $sqlParser |
885 | 885 | * @return int |
886 | 886 | */ |
887 | -function getCreateDbCategory($category, $sqlParser) { |
|
887 | +function getCreateDbCategory($category, $sqlParser){ |
|
888 | 888 | $dbase = $sqlParser->dbname; |
889 | - $dbase = '`' . trim($dbase,'`') . '`'; |
|
889 | + $dbase = '`'.trim($dbase, '`').'`'; |
|
890 | 890 | $table_prefix = $sqlParser->prefix; |
891 | 891 | $category_id = 0; |
892 | - if(!empty($category)) { |
|
892 | + if (!empty($category)) { |
|
893 | 893 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
894 | 894 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
895 | - if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
895 | + if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
896 | 896 | $category_id = $row['id']; |
897 | 897 | } else { |
898 | 898 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
899 | 899 | $rs = mysqli_query($sqlParser->conn, $q); |
900 | - if($rs) { |
|
900 | + if ($rs) { |
|
901 | 901 | $category_id = mysqli_insert_id($sqlParser->conn); |
902 | 902 | } |
903 | 903 | } |
@@ -912,12 +912,12 @@ discard block |
||
912 | 912 | * @param string $type |
913 | 913 | * @return string |
914 | 914 | */ |
915 | -function removeDocblock($code, $type) { |
|
915 | +function removeDocblock($code, $type){ |
|
916 | 916 | |
917 | 917 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
918 | 918 | |
919 | 919 | // Procedure taken from plugin.filesource.php |
920 | - switch($type) { |
|
920 | + switch ($type) { |
|
921 | 921 | case 'snippet': |
922 | 922 | $elm_name = 'snippets'; |
923 | 923 | $include = 'return require'; |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | default: |
934 | 934 | return $cleaned; |
935 | 935 | }; |
936 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
936 | + if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
937 | 937 | return $cleaned; |
938 | 938 | |
939 | 939 | // fileBinding not found - return code incl docblock |
@@ -1,8 +1,8 @@ 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 | -if(!$modx->hasPermission('edit_user')) { |
|
5 | +if (!$modx->hasPermission('edit_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $modx->manager->initPageViewState(); |
11 | 11 | |
12 | 12 | // get and save search string |
13 | -if($_REQUEST['op'] == 'reset') { |
|
13 | +if ($_REQUEST['op'] == 'reset') { |
|
14 | 14 | $query = ''; |
15 | 15 | $_PAGE['vs']['search'] = ''; |
16 | 16 | } else { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | // context menu |
28 | -include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php"; |
|
28 | +include_once MODX_MANAGER_PATH."includes/controls/contextmenu.php"; |
|
29 | 29 | $cm = new ContextMenu("cntxm", 150); |
30 | 30 | $cm->addItem($_lang["edit"], "js:menuAction(1)", $_style["actions_edit"], (!$modx->hasPermission('edit_user') ? 1 : 0)); |
31 | 31 | $cm->addItem($_lang["delete"], "js:menuAction(2)", $_style["actions_delete"], (!$modx->hasPermission('delete_user') ? 1 : 0)); |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | <div class="table-responsive"> |
122 | 122 | <?php |
123 | 123 | $where = ""; |
124 | - if(!$modx->hasPermission('save_role')) { |
|
125 | - $where .= (empty($where) ? "" : " AND ") . "mua.role != 1"; |
|
124 | + if (!$modx->hasPermission('save_role')) { |
|
125 | + $where .= (empty($where) ? "" : " AND ")."mua.role != 1"; |
|
126 | 126 | } |
127 | - if(!empty($sqlQuery)) { |
|
128 | - $where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))"; |
|
127 | + if (!empty($sqlQuery)) { |
|
128 | + $where .= (empty($where) ? "" : " AND ")."((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))"; |
|
129 | 129 | } |
130 | - $ds = $modx->db->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getFullTableName('manager_users') . " AS mu |
|
131 | - INNER JOIN " . $modx->getFullTableName('user_attributes') . " AS mua ON mua.internalKey=mu.id |
|
132 | - LEFT JOIN " . $modx->getFullTableName('user_roles') . " AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC'); |
|
133 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
130 | + $ds = $modx->db->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getFullTableName('manager_users')." AS mu |
|
131 | + INNER JOIN " . $modx->getFullTableName('user_attributes')." AS mua ON mua.internalKey=mu.id |
|
132 | + LEFT JOIN " . $modx->getFullTableName('user_roles')." AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC'); |
|
133 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
134 | 134 | $grd = new DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items |
135 | 135 | $grd->noRecordMsg = $_lang["no_records_found"]; |
136 | 136 | $grd->cssClass = "table data"; |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | $grd->colWidths = "1%,,,,,1%,1%,1%"; |
152 | 152 | $grd->colAligns = "center,,,,,right' nowrap='nowrap,right,center"; |
153 | 153 | $grd->colTypes = implode('||', array( |
154 | - 'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>', |
|
155 | - 'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>', |
|
154 | + 'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="'.$_lang['click_to_context'].'"><i class="'.$_style['icons_user'].'"></i></a>', |
|
155 | + 'template:<a href="index.php?a=12&id=[+id+]" title="'.$_lang['click_to_edit_title'].'">[+value+]</a>', |
|
156 | 156 | 'template:[+fullname+]', |
157 | 157 | 'template:[+role+]', |
158 | 158 | 'template:[+email+]', |
159 | - 'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M', |
|
159 | + 'date: '.$modx->toDateFormat('[+thislogin+]', 'formatOnly').' %H:%M', |
|
160 | 160 | 'template:[+logincount+]', |
161 | 161 | 'template:[+blocked+]' |
162 | 162 | )); |
163 | - if($listmode == '1') { |
|
163 | + if ($listmode == '1') { |
|
164 | 164 | $grd->pageSize = 0; |
165 | 165 | } |
166 | - if($_REQUEST['op'] == 'reset') { |
|
166 | + if ($_REQUEST['op'] == 'reset') { |
|
167 | 167 | $grd->pageNumber = 1; |
168 | 168 | } |
169 | 169 | // render grid |
@@ -1,8 +1,8 @@ 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 | -if(!$modx->hasPermission('edit_web_user')) { |
|
5 | +if (!$modx->hasPermission('edit_web_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $modx->manager->initPageViewState(); |
11 | 11 | |
12 | 12 | // get and save search string |
13 | -if($_REQUEST['op'] == 'reset') { |
|
13 | +if ($_REQUEST['op'] == 'reset') { |
|
14 | 14 | $query = ''; |
15 | 15 | $_PAGE['vs']['search'] = ''; |
16 | 16 | } else { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | // context menu |
28 | -include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php"; |
|
28 | +include_once MODX_MANAGER_PATH."includes/controls/contextmenu.php"; |
|
29 | 29 | $cm = new ContextMenu("cntxm", 150); |
30 | 30 | $cm->addItem($_lang["edit"], "js:menuAction(1)", $_style["actions_edit"], (!$modx->hasPermission('edit_user') ? 1 : 0)); |
31 | 31 | $cm->addItem($_lang["delete"], "js:menuAction(2)", $_style["actions_delete"], (!$modx->hasPermission('delete_user') ? 1 : 0)); |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | <div class="row"> |
121 | 121 | <div class="table-responsive"> |
122 | 122 | <?php |
123 | - $ds = $modx->db->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getFullTableName("web_users") . " wu |
|
124 | - INNER JOIN " . $modx->getFullTableName("web_user_attributes") . " wua ON wua.internalKey=wu.id", ($sqlQuery ? "(wu.username LIKE '{$sqlQuery}%') OR (wua.fullname LIKE '%{$sqlQuery}%') OR (wua.email LIKE '%{$sqlQuery}%')" : ""), 'username'); |
|
125 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
123 | + $ds = $modx->db->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getFullTableName("web_users")." wu |
|
124 | + INNER JOIN " . $modx->getFullTableName("web_user_attributes")." wua ON wua.internalKey=wu.id", ($sqlQuery ? "(wu.username LIKE '{$sqlQuery}%') OR (wua.fullname LIKE '%{$sqlQuery}%') OR (wua.email LIKE '%{$sqlQuery}%')" : ""), 'username'); |
|
125 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
126 | 126 | $grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
127 | 127 | $grd->noRecordMsg = $_lang["no_records_found"]; |
128 | 128 | $grd->cssClass = "table data"; |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | $grd->itemClass = "tableItem"; |
131 | 131 | $grd->altItemClass = "tableAltItem"; |
132 | 132 | $grd->fields = "id,username,fullname,email,lastlogin,logincount,blocked"; |
133 | - $grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["user_full_name"] . " ," . $_lang["email"] . " ," . $_lang["user_prevlogin"] . " ," . $_lang["user_logincount"] . " ," . $_lang["user_block"]; |
|
133 | + $grd->columns = $_lang["icon"]." ,".$_lang["name"]." ,".$_lang["user_full_name"]." ,".$_lang["email"]." ,".$_lang["user_prevlogin"]." ,".$_lang["user_logincount"]." ,".$_lang["user_block"]; |
|
134 | 134 | $grd->colWidths = "1%,,,,1%,1%,1%"; |
135 | 135 | $grd->colAligns = "center,,,,right' nowrap='nowrap,right,center"; |
136 | - $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='" . $_style["icons_user"] . "'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='" . $_lang["click_to_edit_title"] . "'>[+value+]</a>||template:[+fullname+]||template:[+email+]||date: " . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . |
|
136 | + $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='".$_lang["click_to_context"]."'><i class='".$_style["icons_user"]."'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='".$_lang["click_to_edit_title"]."'>[+value+]</a>||template:[+fullname+]||template:[+email+]||date: ".$modx->toDateFormat('[+thislogin+]', 'formatOnly'). |
|
137 | 137 | " %H:%M"; |
138 | - if($listmode == '1') { |
|
138 | + if ($listmode == '1') { |
|
139 | 139 | $grd->pageSize = 0; |
140 | 140 | } |
141 | - if($_REQUEST['op'] == 'reset') { |
|
141 | + if ($_REQUEST['op'] == 'reset') { |
|
142 | 142 | $grd->pageNumber = 1; |
143 | 143 | } |
144 | 144 | // render grid |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | $self = 'install/cli-install.php'; |
8 | -$path = dirname(__FILE__) . '/'; |
|
9 | -$base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
|
8 | +$path = dirname(__FILE__).'/'; |
|
9 | +$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__)); |
|
10 | 10 | define('MODX_API_MODE', true); |
11 | 11 | define('MODX_BASE_PATH', $base_path); |
12 | 12 | define('MODX_SITE_URL', '/'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | if (is_file($base_path."assets/cache/siteManager.php")) { |
20 | 20 | include_once($base_path."assets/cache/siteManager.php"); |
21 | 21 | } |
22 | -if(!defined('MGR_DIR') && is_dir($base_path."manager")) { |
|
22 | +if (!defined('MGR_DIR') && is_dir($base_path."manager")) { |
|
23 | 23 | define('MGR_DIR', 'manager'); |
24 | 24 | } |
25 | 25 | |
@@ -33,43 +33,43 @@ discard block |
||
33 | 33 | $moduleSQLDataFile = $path."setup.data.sql"; |
34 | 34 | $moduleSQLResetFile = $path."setup.data.reset.sql"; |
35 | 35 | |
36 | -$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content |
|
37 | -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content |
|
38 | -$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties |
|
39 | -$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid |
|
40 | -$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid |
|
41 | -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties |
|
42 | -$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties |
|
36 | +$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content |
|
37 | +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content |
|
38 | +$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties |
|
39 | +$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid |
|
40 | +$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid |
|
41 | +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties |
|
42 | +$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties |
|
43 | 43 | $moduleDependencies = array(); // module depedencies - array : module, table, column, type, name |
44 | -$errors= 0; |
|
44 | +$errors = 0; |
|
45 | 45 | |
46 | 46 | |
47 | -$installMode= 0; |
|
47 | +$installMode = 0; |
|
48 | 48 | $installData = 0; |
49 | 49 | $tableprefixauto = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), rand(0, 33), 3).'_'; |
50 | 50 | |
51 | 51 | $args = array_slice($argv, 1); |
52 | 52 | |
53 | -if ( empty($args) ){ |
|
53 | +if (empty($args)) { |
|
54 | 54 | echo 'Install Evolution CMS'.PHP_EOL; |
55 | 55 | //$installYes = readline("Type 'y' to continue: "); |
56 | 56 | //if ($installYes != 'y') return; |
57 | 57 | |
58 | 58 | //set param manual |
59 | - $databasehost = readline($_lang['connection_screen_database_host']. ' [localhost] '); |
|
60 | - $databaseloginname = readline($_lang['connection_screen_database_login']. ' '); |
|
61 | - $databaseloginpassword = readline($_lang['connection_screen_database_pass']. ' '); |
|
62 | - $database_name = readline($_lang['connection_screen_database_name']. ' '); |
|
63 | - $tableprefix = readline($_lang['connection_screen_table_prefix']. ' ['.$tableprefixauto.'] '); |
|
64 | - $database_connection_method = readline($_lang['connection_screen_connection_method']. ' [SET CHARACTER SET] '); |
|
65 | - $database_collation = readline($_lang['connection_screen_collation']. ' [utf8_general_ci] '); |
|
66 | - $cmsadmin = readline($_lang['connection_screen_default_admin_login']. ' [admin] '); |
|
67 | - $cmsadminemail = readline($_lang['connection_screen_default_admin_email']. ' '); |
|
68 | - $cmspassword = readline($_lang['connection_screen_default_admin_password']. ' '); |
|
69 | - $managerlanguage = readline('Мanager language:' . ' [en] '); |
|
70 | - $installData = readline('Instal demo-site (y/n):' . ' [n] '); |
|
71 | - |
|
72 | -}else{ |
|
59 | + $databasehost = readline($_lang['connection_screen_database_host'].' [localhost] '); |
|
60 | + $databaseloginname = readline($_lang['connection_screen_database_login'].' '); |
|
61 | + $databaseloginpassword = readline($_lang['connection_screen_database_pass'].' '); |
|
62 | + $database_name = readline($_lang['connection_screen_database_name'].' '); |
|
63 | + $tableprefix = readline($_lang['connection_screen_table_prefix'].' ['.$tableprefixauto.'] '); |
|
64 | + $database_connection_method = readline($_lang['connection_screen_connection_method'].' [SET CHARACTER SET] '); |
|
65 | + $database_collation = readline($_lang['connection_screen_collation'].' [utf8_general_ci] '); |
|
66 | + $cmsadmin = readline($_lang['connection_screen_default_admin_login'].' [admin] '); |
|
67 | + $cmsadminemail = readline($_lang['connection_screen_default_admin_email'].' '); |
|
68 | + $cmspassword = readline($_lang['connection_screen_default_admin_password'].' '); |
|
69 | + $managerlanguage = readline('Мanager language:'.' [en] '); |
|
70 | + $installData = readline('Instal demo-site (y/n):'.' [n] '); |
|
71 | + |
|
72 | +} else { |
|
73 | 73 | |
74 | 74 | $cli_variables = []; |
75 | 75 | foreach ($args as $arg) { |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | |
103 | -if ($databasehost == '') { $databasehost= 'localhost'; } |
|
104 | -if ($tableprefix == ''){ $tableprefix = $tableprefixauto; } |
|
103 | +if ($databasehost == '') { $databasehost = 'localhost'; } |
|
104 | +if ($tableprefix == '') { $tableprefix = $tableprefixauto; } |
|
105 | 105 | if ($database_connection_method == '') { $database_connection_method = 'SET CHARACTER SET'; } |
106 | 106 | if ($database_collation == '') { $database_collation = 'utf8_general_ci'; } |
107 | -if ($cmsadmin == ''){ $cmsadmin = 'admin'; } |
|
107 | +if ($cmsadmin == '') { $cmsadmin = 'admin'; } |
|
108 | 108 | if ($managerlanguage == '') { $managerlanguage = 'en'; } |
109 | -if ($installData == 'y') { $installData = 1;} |
|
110 | -if ($mode == 'upgrade') { $installMode = 1;} |
|
109 | +if ($installData == 'y') { $installData = 1; } |
|
110 | +if ($mode == 'upgrade') { $installMode = 1; } |
|
111 | 111 | |
112 | 112 | //добавить обработку языка |
113 | 113 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | ////////////////////////////////////////////////////////////////////////////////////// |
126 | -if( ! function_exists('f_owc')){ |
|
126 | +if (!function_exists('f_owc')) { |
|
127 | 127 | /** |
128 | 128 | * @param $path |
129 | 129 | * @param $data |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | fwrite($hnd, $data); |
137 | 137 | fclose($hnd); |
138 | 138 | |
139 | - if(null !== $mode) chmod($path, $mode); |
|
140 | - }catch(Exception $e){ |
|
139 | + if (null !== $mode) chmod($path, $mode); |
|
140 | + } catch (Exception $e) { |
|
141 | 141 | // Nothing, this is NOT normal |
142 | 142 | unset($e); |
143 | 143 | } |
@@ -147,24 +147,24 @@ discard block |
||
147 | 147 | // check PHP version |
148 | 148 | define('PHP_MIN_VERSION', '5.4.0'); |
149 | 149 | $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility |
150 | -echo PHP_EOL . $_lang['checking_php_version']; |
|
150 | +echo PHP_EOL.$_lang['checking_php_version']; |
|
151 | 151 | // -1 if left is less, 0 if equal, +1 if left is higher |
152 | 152 | if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) { |
153 | 153 | $errors++; |
154 | - $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
155 | - echo $_lang['failed'] . ' ' . $tmp . PHP_EOL; |
|
154 | + $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
155 | + echo $_lang['failed'].' '.$tmp.PHP_EOL; |
|
156 | 156 | } else { |
157 | - echo $_lang['ok'] . PHP_EOL; |
|
157 | + echo $_lang['ok'].PHP_EOL; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | // check directories |
161 | 161 | // cache exists? |
162 | 162 | echo strip_tags($_lang['checking_if_cache_exist']); |
163 | 163 | if (!file_exists($path."../assets/cache") || !file_exists($path."../assets/cache/rss")) { |
164 | - echo $_lang['failed'] . PHP_EOL; |
|
164 | + echo $_lang['failed'].PHP_EOL; |
|
165 | 165 | $errors++; |
166 | 166 | } else { |
167 | - echo $_lang['ok'] . PHP_EOL; |
|
167 | + echo $_lang['ok'].PHP_EOL; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -172,82 +172,82 @@ discard block |
||
172 | 172 | echo strip_tags($_lang['checking_if_cache_writable']); |
173 | 173 | if (!is_writable($path."../assets/cache")) { |
174 | 174 | $errors++; |
175 | - echo $_lang['failed'] . PHP_EOL; |
|
175 | + echo $_lang['failed'].PHP_EOL; |
|
176 | 176 | } else { |
177 | - echo $_lang['ok'] . PHP_EOL; |
|
177 | + echo $_lang['ok'].PHP_EOL; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
181 | 181 | // cache files writable? |
182 | 182 | echo strip_tags($_lang['checking_if_cache_file_writable']); |
183 | 183 | $tmp = $path."../assets/cache/siteCache.idx.php"; |
184 | -if ( ! file_exists($tmp)) { |
|
184 | +if (!file_exists($tmp)) { |
|
185 | 185 | f_owc($tmp, "<?php //EVO site cache file ?>"); |
186 | 186 | } |
187 | -if ( ! is_writable($tmp)) { |
|
187 | +if (!is_writable($tmp)) { |
|
188 | 188 | $errors++; |
189 | - echo $_lang['failed'] . PHP_EOL; |
|
189 | + echo $_lang['failed'].PHP_EOL; |
|
190 | 190 | } else { |
191 | - echo $_lang['ok'] . PHP_EOL; |
|
191 | + echo $_lang['ok'].PHP_EOL; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
195 | 195 | echo strip_tags($_lang['checking_if_cache_file2_writable']); |
196 | -if ( ! is_writable($path."../assets/cache/sitePublishing.idx.php")) { |
|
196 | +if (!is_writable($path."../assets/cache/sitePublishing.idx.php")) { |
|
197 | 197 | $errors++; |
198 | - echo $_lang['failed'] . PHP_EOL; |
|
198 | + echo $_lang['failed'].PHP_EOL; |
|
199 | 199 | } else { |
200 | - echo $_lang['ok'] . PHP_EOL; |
|
200 | + echo $_lang['ok'].PHP_EOL; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
204 | 204 | // File Browser directories exists? |
205 | 205 | echo strip_tags($_lang['checking_if_images_exist']); |
206 | -switch(true){ |
|
206 | +switch (true) { |
|
207 | 207 | case !file_exists($path."../assets/images"): |
208 | 208 | case !file_exists($path."../assets/files"): |
209 | 209 | case !file_exists($path."../assets/backup"): |
210 | 210 | //case !file_exists("../assets/.thumbs"): |
211 | 211 | $errors++; |
212 | - echo $_lang['failed'] . PHP_EOL; |
|
212 | + echo $_lang['failed'].PHP_EOL; |
|
213 | 213 | break; |
214 | 214 | default: |
215 | - echo $_lang['ok'] . PHP_EOL; |
|
215 | + echo $_lang['ok'].PHP_EOL; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
219 | 219 | // File Browser directories writable? |
220 | 220 | echo strip_tags($_lang['checking_if_images_writable']); |
221 | -switch(true){ |
|
221 | +switch (true) { |
|
222 | 222 | case !is_writable($path."../assets/images"): |
223 | 223 | case !is_writable($path."../assets/files"): |
224 | 224 | case !is_writable($path."../assets/backup"): |
225 | 225 | //case !is_writable("../assets/.thumbs"): |
226 | 226 | $errors++; |
227 | - echo $_lang['failed'] . PHP_EOL; |
|
227 | + echo $_lang['failed'].PHP_EOL; |
|
228 | 228 | break; |
229 | 229 | default: |
230 | - echo $_lang['ok'] . PHP_EOL; |
|
230 | + echo $_lang['ok'].PHP_EOL; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
234 | 234 | // export exists? |
235 | 235 | echo strip_tags($_lang['checking_if_export_exists']); |
236 | 236 | if (!file_exists($path."../assets/export")) { |
237 | - echo $_lang['failed'] . PHP_EOL; |
|
237 | + echo $_lang['failed'].PHP_EOL; |
|
238 | 238 | $errors++; |
239 | 239 | } else { |
240 | - echo $_lang['ok'] . PHP_EOL; |
|
240 | + echo $_lang['ok'].PHP_EOL; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
244 | 244 | // export writable? |
245 | 245 | echo strip_tags($_lang['checking_if_export_writable']); |
246 | 246 | if (!is_writable($path."../assets/export")) { |
247 | - echo $_lang['failed'] . PHP_EOL; |
|
247 | + echo $_lang['failed'].PHP_EOL; |
|
248 | 248 | $errors++; |
249 | 249 | } else { |
250 | - echo $_lang['ok'] . PHP_EOL; |
|
250 | + echo $_lang['ok'].PHP_EOL; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | $isWriteable = is_writable($tmp); |
263 | 263 | if (!$isWriteable) { |
264 | 264 | $errors++; |
265 | - echo $_lang['failed'] . PHP_EOL; |
|
265 | + echo $_lang['failed'].PHP_EOL; |
|
266 | 266 | } else { |
267 | - echo $_lang['ok'] . PHP_EOL; |
|
267 | + echo $_lang['ok'].PHP_EOL; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); |
281 | 281 | $database_connection_charset = $database_collation; |
282 | 282 | $database_connection_method = $database_connection_method; |
283 | - $dbase = '`' . $database_name . '`'; |
|
283 | + $dbase = '`'.$database_name.'`'; |
|
284 | 284 | $table_prefix = $tableprefix; |
285 | 285 | } |
286 | 286 | echo $_lang['creating_database_connection']; |
@@ -320,33 +320,33 @@ discard block |
||
320 | 320 | |
321 | 321 | // check table prefix |
322 | 322 | if ($conn && $installMode == 0) { |
323 | - echo $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
324 | - if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
325 | - echo $_lang['failed'] . ' ' . $_lang['table_prefix_already_inuse_note'] . PHP_EOL; |
|
323 | + echo $_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
324 | + if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
325 | + echo $_lang['failed'].' '.$_lang['table_prefix_already_inuse_note'].PHP_EOL; |
|
326 | 326 | $errors++; |
327 | 327 | |
328 | 328 | } else { |
329 | - echo $_lang['ok'] . PHP_EOL; |
|
329 | + echo $_lang['ok'].PHP_EOL; |
|
330 | 330 | } |
331 | 331 | } elseif ($conn && $installMode == 2) { |
332 | - echo $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
333 | - if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
334 | - echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL; |
|
332 | + echo $_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
333 | + if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
334 | + echo $_lang['failed'].' '.$_lang['table_prefix_not_exist'].PHP_EOL; |
|
335 | 335 | $errors++; |
336 | 336 | |
337 | 337 | } else { |
338 | - echo $_lang['ok'] . PHP_EOL; |
|
338 | + echo $_lang['ok'].PHP_EOL; |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | 342 | // check mysql version |
343 | 343 | if ($conn) { |
344 | 344 | echo $_lang['checking_mysql_version']; |
345 | - if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) { |
|
346 | - echo $_lang['warning'] . ' ' . $_lang['mysql_5051'] . PHP_EOL; |
|
347 | - echo $_lang['mysql_5051_warning'] . PHP_EOL; |
|
345 | + if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) { |
|
346 | + echo $_lang['warning'].' '.$_lang['mysql_5051'].PHP_EOL; |
|
347 | + echo $_lang['mysql_5051_warning'].PHP_EOL; |
|
348 | 348 | } else { |
349 | - echo $_lang['ok'] . ' ' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . PHP_EOL; |
|
349 | + echo $_lang['ok'].' '.$_lang['mysql_version_is'].mysqli_get_server_info($conn).PHP_EOL; |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
@@ -354,20 +354,20 @@ discard block |
||
354 | 354 | if ($conn) { |
355 | 355 | echo $_lang['checking_mysql_strict_mode']; |
356 | 356 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
357 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
357 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
358 | 358 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
359 | 359 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
360 | 360 | // print_r($modes); |
361 | 361 | foreach ($modes as $mode) { |
362 | 362 | if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
363 | - echo $_lang['warning'] . ' ' . $_lang['strict_mode'] . PHP_EOL; |
|
364 | - echo $_lang['strict_mode_error'] . PHP_EOL; |
|
363 | + echo $_lang['warning'].' '.$_lang['strict_mode'].PHP_EOL; |
|
364 | + echo $_lang['strict_mode_error'].PHP_EOL; |
|
365 | 365 | } else { |
366 | - echo $_lang['ok'] . PHP_EOL; |
|
366 | + echo $_lang['ok'].PHP_EOL; |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | } else { |
370 | - echo $_lang['ok'] . PHP_EOL; |
|
370 | + echo $_lang['ok'].PHP_EOL; |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | // Version and strict mode check end |
@@ -383,17 +383,17 @@ discard block |
||
383 | 383 | f_owc($path."../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>'); |
384 | 384 | } |
385 | 385 | |
386 | -if($installMode > 0 && $_POST['installdata'] == "1") { |
|
387 | - echo $_lang['sample_web_site'] . ': ' . $_lang['sample_web_site_note'] . PHP_EOL; |
|
386 | +if ($installMode > 0 && $_POST['installdata'] == "1") { |
|
387 | + echo $_lang['sample_web_site'].': '.$_lang['sample_web_site_note'].PHP_EOL; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | if ($errors > 0) { |
391 | - echo $_lang['setup_cannot_continue'] . ' '; |
|
391 | + echo $_lang['setup_cannot_continue'].' '; |
|
392 | 392 | |
393 | - if($errors > 1){ |
|
394 | - echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
|
395 | - }else{ |
|
396 | - echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']. PHP_EOL; |
|
393 | + if ($errors > 1) { |
|
394 | + echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural']; |
|
395 | + } else { |
|
396 | + echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'].PHP_EOL; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | die(); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
423 | 423 | $database_connection_charset = $database_charset; |
424 | 424 | $database_connection_method = $database_connection_method; |
425 | - $dbase = "`" .$database_name. "`"; |
|
425 | + $dbase = "`".$database_name."`"; |
|
426 | 426 | $table_prefix = $tableprefix; |
427 | 427 | $adminname = $cmsadmin; |
428 | 428 | $adminemail = $cmsadminemail; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | // set session name variable |
435 | 435 | if (!isset ($site_sessionname)) { |
436 | - $site_sessionname = 'SN' . uniqid(''); |
|
436 | + $site_sessionname = 'SN'.uniqid(''); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | // get base path and url |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | array_pop($a); |
448 | 448 | $pth = implode("install", $a); |
449 | 449 | unset ($a); |
450 | -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
|
451 | -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); |
|
450 | +$base_url = $url.(substr($url, -1) != "/" ? "/" : ""); |
|
451 | +$base_path = $pth.(substr($pth, -1) != "/" ? "/" : ""); |
|
452 | 452 | |
453 | 453 | // connect to the database |
454 | 454 | echo $_lang['setup_database_create_connection'].': '; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | } |
461 | 461 | |
462 | 462 | // select database |
463 | -echo $_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: "; |
|
463 | +echo $_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: "; |
|
464 | 464 | if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) { |
465 | 465 | echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL; |
466 | 466 | $create = true; |
@@ -472,16 +472,16 @@ discard block |
||
472 | 472 | |
473 | 473 | // try to create the database |
474 | 474 | if ($create) { |
475 | - echo $_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: "; |
|
475 | + echo $_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: "; |
|
476 | 476 | // if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) { |
477 | - if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
477 | + if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
478 | 478 | echo $_lang['setup_database_creation_failed']." ".$_lang['setup_database_creation_failed_note'].PHP_EOL; |
479 | 479 | $errors += 1; |
480 | 480 | |
481 | - echo 'database charset: ' . $database_charset . PHP_EOL; |
|
482 | - echo 'database collation: ' . $database_collation . PHP_EOL; |
|
481 | + echo 'database charset: '.$database_charset.PHP_EOL; |
|
482 | + echo 'database collation: '.$database_collation.PHP_EOL; |
|
483 | 483 | |
484 | - echo $_lang['setup_database_creation_failed_note2'] . PHP_EOL; |
|
484 | + echo $_lang['setup_database_creation_failed_note2'].PHP_EOL; |
|
485 | 485 | |
486 | 486 | die(); |
487 | 487 | |
@@ -492,18 +492,18 @@ discard block |
||
492 | 492 | |
493 | 493 | // check table prefix |
494 | 494 | if ($installMode == 0) { |
495 | - echo $_lang['checking_table_prefix'] . $table_prefix . "`: "; |
|
496 | - if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
497 | - echo $_lang['failed'] . " " . $_lang['table_prefix_already_inuse'] . PHP_EOL; |
|
495 | + echo $_lang['checking_table_prefix'].$table_prefix."`: "; |
|
496 | + if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
497 | + echo $_lang['failed']." ".$_lang['table_prefix_already_inuse'].PHP_EOL; |
|
498 | 498 | $errors += 1; |
499 | - echo $_lang['table_prefix_already_inuse_note'] . PHP_EOL; |
|
499 | + echo $_lang['table_prefix_already_inuse_note'].PHP_EOL; |
|
500 | 500 | return; |
501 | 501 | } else { |
502 | 502 | echo $_lang['ok'].PHP_EOL; |
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
506 | -if(!function_exists('parseProperties')) { |
|
506 | +if (!function_exists('parseProperties')) { |
|
507 | 507 | /** |
508 | 508 | * parses a resource property string and returns the result as an array |
509 | 509 | * duplicate of method in documentParser class |
@@ -511,20 +511,20 @@ discard block |
||
511 | 511 | * @param string $propertyString |
512 | 512 | * @return array |
513 | 513 | */ |
514 | - function parseProperties($propertyString) { |
|
515 | - $parameter= array (); |
|
514 | + function parseProperties($propertyString){ |
|
515 | + $parameter = array(); |
|
516 | 516 | if (!empty ($propertyString)) { |
517 | - $tmpParams= explode("&", $propertyString); |
|
517 | + $tmpParams = explode("&", $propertyString); |
|
518 | 518 | $countParams = count($tmpParams); |
519 | - for ($x= 0; $x < $countParams; $x++) { |
|
519 | + for ($x = 0; $x < $countParams; $x++) { |
|
520 | 520 | if (strpos($tmpParams[$x], '=', 0)) { |
521 | - $pTmp= explode("=", $tmpParams[$x]); |
|
522 | - $pvTmp= explode(";", trim($pTmp[1])); |
|
521 | + $pTmp = explode("=", $tmpParams[$x]); |
|
522 | + $pvTmp = explode(";", trim($pTmp[1])); |
|
523 | 523 | if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
524 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
524 | + $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default |
|
525 | 525 | else |
526 | 526 | if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
527 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
527 | + $parameter[trim($pTmp[0])] = $pvTmp[2]; |
|
528 | 528 | } |
529 | 529 | } |
530 | 530 | } |
@@ -535,20 +535,20 @@ discard block |
||
535 | 535 | // check status of Inherit Parent Template plugin |
536 | 536 | $auto_template_logic = 'parent'; |
537 | 537 | if ($installMode != 0) { |
538 | - $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"); |
|
538 | + $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"); |
|
539 | 539 | $row = mysqli_fetch_row($rs); |
540 | - if(!$row) { |
|
540 | + if (!$row) { |
|
541 | 541 | // not installed |
542 | 542 | $auto_template_logic = 'system'; |
543 | 543 | } else { |
544 | - if($row[1] == 1) { |
|
544 | + if ($row[1] == 1) { |
|
545 | 545 | // installed but disabled |
546 | 546 | $auto_template_logic = 'system'; |
547 | 547 | } else { |
548 | 548 | // installed, enabled .. see how it's configured |
549 | 549 | $properties = parseProperties($row[0]); |
550 | - if(isset($properties['inheritTemplate'])) { |
|
551 | - if($properties['inheritTemplate'] == 'From First Sibling') { |
|
550 | + if (isset($properties['inheritTemplate'])) { |
|
551 | + if ($properties['inheritTemplate'] == 'From First Sibling') { |
|
552 | 552 | $auto_template_logic = 'sibling'; |
553 | 553 | } |
554 | 554 | } |
@@ -570,17 +570,16 @@ discard block |
||
570 | 570 | |
571 | 571 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
572 | 572 | $mt = &$moduleTemplates; |
573 | -if(is_dir($templatePath) && is_readable($templatePath)) { |
|
573 | +if (is_dir($templatePath) && is_readable($templatePath)) { |
|
574 | 574 | $d = dir($templatePath); |
575 | 575 | while (false !== ($tplfile = $d->read())) |
576 | 576 | { |
577 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
577 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
578 | 578 | $params = parse_docblock($templatePath, $tplfile); |
579 | - if(is_array($params) && (count($params)>0)) |
|
579 | + if (is_array($params) && (count($params) > 0)) |
|
580 | 580 | { |
581 | 581 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
582 | - $mt[] = array |
|
583 | - ( |
|
582 | + $mt[] = array( |
|
584 | 583 | $params['name'], |
585 | 584 | $description, |
586 | 585 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -598,12 +597,12 @@ discard block |
||
598 | 597 | |
599 | 598 | // setup Template Variable template files |
600 | 599 | $mtv = &$moduleTVs; |
601 | -if(is_dir($tvPath) && is_readable($tvPath)) { |
|
600 | +if (is_dir($tvPath) && is_readable($tvPath)) { |
|
602 | 601 | $d = dir($tvPath); |
603 | 602 | while (false !== ($tplfile = $d->read())) { |
604 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
603 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
605 | 604 | $params = parse_docblock($tvPath, $tplfile); |
606 | - if(is_array($params) && (count($params)>0)) { |
|
605 | + if (is_array($params) && (count($params) > 0)) { |
|
607 | 606 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
608 | 607 | $mtv[] = array( |
609 | 608 | $params['name'], |
@@ -615,9 +614,9 @@ discard block |
||
615 | 614 | $params['output_widget'], |
616 | 615 | $params['output_widget_params'], |
617 | 616 | "$templatePath/{$params['filename']}", /* not currently used */ |
618 | - $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */ |
|
617 | + $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */ |
|
619 | 618 | $params['modx_category'], |
620 | - $params['lock_tv'], /* value should be 1 or 0 */ |
|
619 | + $params['lock_tv'], /* value should be 1 or 0 */ |
|
621 | 620 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
622 | 621 | ); |
623 | 622 | } |
@@ -627,14 +626,14 @@ discard block |
||
627 | 626 | |
628 | 627 | // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content |
629 | 628 | $mc = &$moduleChunks; |
630 | -if(is_dir($chunkPath) && is_readable($chunkPath)) { |
|
629 | +if (is_dir($chunkPath) && is_readable($chunkPath)) { |
|
631 | 630 | $d = dir($chunkPath); |
632 | 631 | while (false !== ($tplfile = $d->read())) { |
633 | - if(substr($tplfile, -4) != '.tpl') { |
|
632 | + if (substr($tplfile, -4) != '.tpl') { |
|
634 | 633 | continue; |
635 | 634 | } |
636 | 635 | $params = parse_docblock($chunkPath, $tplfile); |
637 | - if(is_array($params) && count($params) > 0) { |
|
636 | + if (is_array($params) && count($params) > 0) { |
|
638 | 637 | $mc[] = array( |
639 | 638 | $params['name'], |
640 | 639 | $params['description'], |
@@ -650,14 +649,14 @@ discard block |
||
650 | 649 | |
651 | 650 | // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties |
652 | 651 | $ms = &$moduleSnippets; |
653 | -if(is_dir($snippetPath) && is_readable($snippetPath)) { |
|
652 | +if (is_dir($snippetPath) && is_readable($snippetPath)) { |
|
654 | 653 | $d = dir($snippetPath); |
655 | 654 | while (false !== ($tplfile = $d->read())) { |
656 | - if(substr($tplfile, -4) != '.tpl') { |
|
655 | + if (substr($tplfile, -4) != '.tpl') { |
|
657 | 656 | continue; |
658 | 657 | } |
659 | 658 | $params = parse_docblock($snippetPath, $tplfile); |
660 | - if(is_array($params) && count($params) > 0) { |
|
659 | + if (is_array($params) && count($params) > 0) { |
|
661 | 660 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
662 | 661 | $ms[] = array( |
663 | 662 | $params['name'], |
@@ -674,14 +673,14 @@ discard block |
||
674 | 673 | |
675 | 674 | // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties |
676 | 675 | $mp = &$modulePlugins; |
677 | -if(is_dir($pluginPath) && is_readable($pluginPath)) { |
|
676 | +if (is_dir($pluginPath) && is_readable($pluginPath)) { |
|
678 | 677 | $d = dir($pluginPath); |
679 | 678 | while (false !== ($tplfile = $d->read())) { |
680 | - if(substr($tplfile, -4) != '.tpl') { |
|
679 | + if (substr($tplfile, -4) != '.tpl') { |
|
681 | 680 | continue; |
682 | 681 | } |
683 | 682 | $params = parse_docblock($pluginPath, $tplfile); |
684 | - if(is_array($params) && count($params) > 0) { |
|
683 | + if (is_array($params) && count($params) > 0) { |
|
685 | 684 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
686 | 685 | $mp[] = array( |
687 | 686 | $params['name'], |
@@ -693,7 +692,7 @@ discard block |
||
693 | 692 | $params['modx_category'], |
694 | 693 | $params['legacy_names'], |
695 | 694 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
696 | - (int)$params['disabled'] |
|
695 | + (int) $params['disabled'] |
|
697 | 696 | ); |
698 | 697 | } |
699 | 698 | } |
@@ -703,14 +702,14 @@ discard block |
||
703 | 702 | // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams |
704 | 703 | $mm = &$moduleModules; |
705 | 704 | $mdp = &$moduleDependencies; |
706 | -if(is_dir($modulePath) && is_readable($modulePath)) { |
|
705 | +if (is_dir($modulePath) && is_readable($modulePath)) { |
|
707 | 706 | $d = dir($modulePath); |
708 | 707 | while (false !== ($tplfile = $d->read())) { |
709 | - if(substr($tplfile, -4) != '.tpl') { |
|
708 | + if (substr($tplfile, -4) != '.tpl') { |
|
710 | 709 | continue; |
711 | 710 | } |
712 | 711 | $params = parse_docblock($modulePath, $tplfile); |
713 | - if(is_array($params) && count($params) > 0) { |
|
712 | + if (is_array($params) && count($params) > 0) { |
|
714 | 713 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
715 | 714 | $mm[] = array( |
716 | 715 | $params['name'], |
@@ -718,12 +717,12 @@ discard block |
||
718 | 717 | "$modulePath/{$params['filename']}", |
719 | 718 | $params['properties'], |
720 | 719 | $params['guid'], |
721 | - (int)$params['shareparams'], |
|
720 | + (int) $params['shareparams'], |
|
722 | 721 | $params['modx_category'], |
723 | 722 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
724 | 723 | ); |
725 | 724 | } |
726 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
725 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
727 | 726 | $dependencies = explode(',', $params['dependencies']); |
728 | 727 | foreach ($dependencies as $dependency) { |
729 | 728 | $dependency = explode(':', $dependency); |
@@ -794,103 +793,103 @@ discard block |
||
794 | 793 | // setup callback function |
795 | 794 | $callBackFnc = "clean_up"; |
796 | 795 | |
797 | -function clean_up($sqlParser) { |
|
796 | +function clean_up($sqlParser){ |
|
798 | 797 | $ids = array(); |
799 | 798 | |
800 | 799 | // secure web documents - privateweb |
801 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
802 | - $sql = "SELECT DISTINCT sc.id |
|
800 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
801 | + $sql = "SELECT DISTINCT sc.id |
|
803 | 802 | FROM `".$sqlParser->prefix."site_content` sc |
804 | 803 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
805 | 804 | LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group |
806 | 805 | WHERE wga.id>0"; |
807 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
808 | - if(!$ds) { |
|
806 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
807 | + if (!$ds) { |
|
809 | 808 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
810 | 809 | } |
811 | 810 | else { |
812 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
813 | - if(count($ids)>0) { |
|
814 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
811 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
812 | + if (count($ids) > 0) { |
|
813 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
815 | 814 | unset($ids); |
816 | 815 | } |
817 | 816 | } |
818 | 817 | |
819 | 818 | // secure manager documents privatemgr |
820 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
821 | - $sql = "SELECT DISTINCT sc.id |
|
819 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
820 | + $sql = "SELECT DISTINCT sc.id |
|
822 | 821 | FROM `".$sqlParser->prefix."site_content` sc |
823 | 822 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
824 | 823 | LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group |
825 | 824 | WHERE mga.id>0"; |
826 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
827 | - if(!$ds) { |
|
825 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
826 | + if (!$ds) { |
|
828 | 827 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
829 | 828 | } |
830 | 829 | else { |
831 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
832 | - if(count($ids)>0) { |
|
833 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
830 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
831 | + if (count($ids) > 0) { |
|
832 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
834 | 833 | unset($ids); |
835 | 834 | } |
836 | 835 | } |
837 | 836 | } |
838 | 837 | |
839 | -function parse_docblock($element_dir, $filename) { |
|
838 | +function parse_docblock($element_dir, $filename){ |
|
840 | 839 | $params = array(); |
841 | - $fullpath = $element_dir . '/' . $filename; |
|
842 | - if(is_readable($fullpath)) { |
|
840 | + $fullpath = $element_dir.'/'.$filename; |
|
841 | + if (is_readable($fullpath)) { |
|
843 | 842 | $tpl = @fopen($fullpath, "r"); |
844 | - if($tpl) { |
|
843 | + if ($tpl) { |
|
845 | 844 | $params['filename'] = $filename; |
846 | 845 | $docblock_start_found = false; |
847 | 846 | $name_found = false; |
848 | 847 | $description_found = false; |
849 | 848 | |
850 | - while(!feof($tpl)) { |
|
849 | + while (!feof($tpl)) { |
|
851 | 850 | $line = fgets($tpl); |
852 | - if(!$docblock_start_found) { |
|
851 | + if (!$docblock_start_found) { |
|
853 | 852 | // find docblock start |
854 | - if(strpos($line, '/**') !== false) { |
|
853 | + if (strpos($line, '/**') !== false) { |
|
855 | 854 | $docblock_start_found = true; |
856 | 855 | } |
857 | 856 | continue; |
858 | - } elseif(!$name_found) { |
|
857 | + } elseif (!$name_found) { |
|
859 | 858 | // find name |
860 | 859 | $ma = null; |
861 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
860 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
862 | 861 | $params['name'] = trim($ma[1]); |
863 | 862 | $name_found = !empty($params['name']); |
864 | 863 | } |
865 | 864 | continue; |
866 | - } elseif(!$description_found) { |
|
865 | + } elseif (!$description_found) { |
|
867 | 866 | // find description |
868 | 867 | $ma = null; |
869 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
868 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
870 | 869 | $params['description'] = trim($ma[1]); |
871 | 870 | $description_found = !empty($params['description']); |
872 | 871 | } |
873 | 872 | continue; |
874 | 873 | } else { |
875 | 874 | $ma = null; |
876 | - if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
875 | + if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
877 | 876 | $param = trim($ma[1]); |
878 | 877 | $val = trim($ma[2]); |
879 | - if(!empty($param) && !empty($val)) { |
|
880 | - if($param == 'internal') { |
|
878 | + if (!empty($param) && !empty($val)) { |
|
879 | + if ($param == 'internal') { |
|
881 | 880 | $ma = null; |
882 | - if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
881 | + if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
883 | 882 | $param = trim($ma[1]); |
884 | 883 | $val = trim($ma[2]); |
885 | 884 | } |
886 | 885 | //if($val !== '0' && (empty($param) || empty($val))) { |
887 | - if(empty($param)) { |
|
886 | + if (empty($param)) { |
|
888 | 887 | continue; |
889 | 888 | } |
890 | 889 | } |
891 | 890 | $params[$param] = $val; |
892 | 891 | } |
893 | - } elseif(preg_match("/^\s*\*\/\s*$/", $line)) { |
|
892 | + } elseif (preg_match("/^\s*\*\/\s*$/", $line)) { |
|
894 | 893 | break; |
895 | 894 | } |
896 | 895 | } |
@@ -921,13 +920,13 @@ discard block |
||
921 | 920 | // display database results |
922 | 921 | if ($sqlParser->installFailed == true) { |
923 | 922 | $errors += 1; |
924 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
925 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
926 | - echo $_lang['installation_error_occured'] . PHP_EOL; |
|
923 | + echo $_lang['database_alerts'].PHP_EOL; |
|
924 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
925 | + echo $_lang['installation_error_occured'].PHP_EOL; |
|
927 | 926 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
928 | - echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL; |
|
927 | + echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL; |
|
929 | 928 | } |
930 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
929 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
931 | 930 | die(); |
932 | 931 | } else { |
933 | 932 | echo $_lang['ok'].PHP_EOL; |
@@ -937,7 +936,7 @@ discard block |
||
937 | 936 | // custom or not |
938 | 937 | if (file_exists($path."../assets/cache/siteManager.php")) { |
939 | 938 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
940 | -}else{ |
|
939 | +} else { |
|
941 | 940 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
942 | 941 | } |
943 | 942 | |
@@ -974,16 +973,16 @@ discard block |
||
974 | 973 | $chmodSuccess = @chmod($filename, 0404); |
975 | 974 | |
976 | 975 | if ($configFileFailed == true) { |
977 | - echo $_lang['failed'] . PHP_EOL; |
|
976 | + echo $_lang['failed'].PHP_EOL; |
|
978 | 977 | $errors += 1; |
979 | 978 | |
980 | - echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR .'/includes/config.inc.php' .PHP_EOL; |
|
979 | + echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL; |
|
981 | 980 | echo ' '.PHP_EOL; |
982 | 981 | echo ' '.PHP_EOL; |
983 | 982 | echo $configString; |
984 | 983 | echo ' '.PHP_EOL; |
985 | 984 | echo ' '.PHP_EOL; |
986 | - echo $_lang['cant_write_config_file_note'] . PHP_EOL; |
|
985 | + echo $_lang['cant_write_config_file_note'].PHP_EOL; |
|
987 | 986 | die(); |
988 | 987 | |
989 | 988 | } else { |
@@ -993,16 +992,16 @@ discard block |
||
993 | 992 | // generate new site_id and set manager theme to default |
994 | 993 | if ($installMode == 0) { |
995 | 994 | $siteid = uniqid(''); |
996 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
995 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
997 | 996 | } else { |
998 | 997 | // update site_id if missing |
999 | - $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); |
|
998 | + $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"); |
|
1000 | 999 | if ($ds) { |
1001 | 1000 | $r = mysqli_fetch_assoc($ds); |
1002 | 1001 | $siteid = $r['setting_value']; |
1003 | 1002 | if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') { |
1004 | 1003 | $siteid = uniqid(''); |
1005 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
1004 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
1006 | 1005 | } |
1007 | 1006 | } |
1008 | 1007 | } |
@@ -1014,29 +1013,29 @@ discard block |
||
1014 | 1013 | // display database results |
1015 | 1014 | if ($sqlParser->installFailed == true) { |
1016 | 1015 | $errors += 1; |
1017 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
1018 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
1019 | - echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL; |
|
1016 | + echo $_lang['database_alerts'].PHP_EOL; |
|
1017 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
1018 | + echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL; |
|
1020 | 1019 | /* |
1021 | 1020 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
1022 | 1021 | echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
1023 | 1022 | } |
1024 | 1023 | echo "</p>";*/ |
1025 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
1024 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
1026 | 1025 | die(); |
1027 | 1026 | } else { |
1028 | - echo $_lang['ok'] . PHP_EOL; |
|
1027 | + echo $_lang['ok'].PHP_EOL; |
|
1029 | 1028 | } |
1030 | 1029 | } |
1031 | 1030 | |
1032 | 1031 | // Install Templates |
1033 | 1032 | $moduleTemplate = $mt; |
1034 | 1033 | if (!empty($moduleTemplate) || $installData) { |
1035 | - echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL; |
|
1034 | + echo PHP_EOL.$_lang['templates'].":".PHP_EOL; |
|
1036 | 1035 | //$selTemplates = $_POST['template']; |
1037 | 1036 | foreach ($moduleTemplates as $k=>$moduleTemplate) { |
1038 | 1037 | $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; |
1039 | - if($installSample || is_array($moduleTemplate)) { |
|
1038 | + if ($installSample || is_array($moduleTemplate)) { |
|
1040 | 1039 | $name = mysqli_real_escape_string($conn, $moduleTemplate[0]); |
1041 | 1040 | $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]); |
1042 | 1041 | $category = mysqli_real_escape_string($conn, $moduleTemplate[4]); |
@@ -1044,7 +1043,7 @@ discard block |
||
1044 | 1043 | $filecontent = $moduleTemplate[3]; |
1045 | 1044 | $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site |
1046 | 1045 | if (!file_exists($filecontent)) { |
1047 | - echo " $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1046 | + echo " $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1048 | 1047 | } else { |
1049 | 1048 | // Create the category if it does not already exist |
1050 | 1049 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -1054,31 +1053,31 @@ discard block |
||
1054 | 1053 | $template = mysqli_real_escape_string($conn, $template); |
1055 | 1054 | |
1056 | 1055 | // See if the template already exists |
1057 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
|
1056 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"); |
|
1058 | 1057 | |
1059 | 1058 | if (mysqli_num_rows($rs)) { |
1060 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
1059 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
1061 | 1060 | $errors += 1; |
1062 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1061 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1063 | 1062 | return; |
1064 | 1063 | } |
1065 | - if(!is_null($save_sql_id_as)) { |
|
1064 | + if (!is_null($save_sql_id_as)) { |
|
1066 | 1065 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
1067 | - if(!$sql_id) { |
|
1068 | - $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
1066 | + if (!$sql_id) { |
|
1067 | + $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
1069 | 1068 | $sql_id = $idQuery['id']; |
1070 | 1069 | } |
1071 | 1070 | $custom_placeholders[$save_sql_id_as] = $sql_id; |
1072 | 1071 | } |
1073 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1072 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1074 | 1073 | } else { |
1075 | - if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
1074 | + if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
1076 | 1075 | $errors += 1; |
1077 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1076 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1078 | 1077 | die(); |
1079 | 1078 | } |
1080 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
1081 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1079 | + if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
1080 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1082 | 1081 | } |
1083 | 1082 | } |
1084 | 1083 | } |
@@ -1088,11 +1087,11 @@ discard block |
||
1088 | 1087 | // Install Template Variables |
1089 | 1088 | $moduleTVs = $mtv; |
1090 | 1089 | if (is_array($moduleTVs) || $installData) { |
1091 | - echo PHP_EOL . $_lang['tvs'].': '.PHP_EOL; |
|
1090 | + echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL; |
|
1092 | 1091 | //$selTVs = $_POST['tv']; |
1093 | 1092 | foreach ($moduleTVs as $k=>$moduleTV) { |
1094 | 1093 | $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; |
1095 | - if($installSample || is_array($moduleTVs)) { |
|
1094 | + if ($installSample || is_array($moduleTVs)) { |
|
1096 | 1095 | $name = mysqli_real_escape_string($conn, $moduleTV[0]); |
1097 | 1096 | $caption = mysqli_real_escape_string($conn, $moduleTV[1]); |
1098 | 1097 | $desc = mysqli_real_escape_string($conn, $moduleTV[2]); |
@@ -1110,24 +1109,24 @@ discard block |
||
1110 | 1109 | // Create the category if it does not already exist |
1111 | 1110 | $category = getCreateDbCategory($category, $sqlParser); |
1112 | 1111 | |
1113 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"); |
|
1112 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"); |
|
1114 | 1113 | if (mysqli_num_rows($rs)) { |
1115 | 1114 | $insert = true; |
1116 | - while($row = mysqli_fetch_assoc($rs)) { |
|
1117 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
1118 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1115 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
1116 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
1117 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1119 | 1118 | return; |
1120 | 1119 | } |
1121 | 1120 | $insert = false; |
1122 | 1121 | } |
1123 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1122 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1124 | 1123 | } else { |
1125 | - $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
1124 | + $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
1126 | 1125 | if (!mysqli_query($sqlParser->conn, $q)) { |
1127 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1126 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1128 | 1127 | return; |
1129 | 1128 | } |
1130 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1129 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1131 | 1130 | } |
1132 | 1131 | |
1133 | 1132 | // add template assignments |
@@ -1136,10 +1135,10 @@ discard block |
||
1136 | 1135 | if (count($assignments) > 0) { |
1137 | 1136 | |
1138 | 1137 | // remove existing tv -> template assignments |
1139 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
1138 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
1140 | 1139 | $row = mysqli_fetch_assoc($ds); |
1141 | 1140 | $id = $row["id"]; |
1142 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
1141 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''); |
|
1143 | 1142 | |
1144 | 1143 | // add tv -> template assignments |
1145 | 1144 | foreach ($assignments as $assignment) { |
@@ -1148,7 +1147,7 @@ discard block |
||
1148 | 1147 | if ($ds && $ts) { |
1149 | 1148 | $tRow = mysqli_fetch_assoc($ts); |
1150 | 1149 | $templateId = $tRow['id']; |
1151 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
1150 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
1152 | 1151 | } |
1153 | 1152 | } |
1154 | 1153 | } |
@@ -1159,12 +1158,12 @@ discard block |
||
1159 | 1158 | |
1160 | 1159 | $moduleChunks = $mc; |
1161 | 1160 | // Install Chunks |
1162 | -if (is_array ($moduleChunks) || $installData) { |
|
1163 | - echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL; |
|
1161 | +if (is_array($moduleChunks) || $installData) { |
|
1162 | + echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL; |
|
1164 | 1163 | foreach ($moduleChunks as $k=>$moduleChunk) { |
1165 | 1164 | $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; |
1166 | 1165 | $count_new_name = 0; |
1167 | - if($installSample || is_array ($moduleChunks)) { |
|
1166 | + if ($installSample || is_array($moduleChunks)) { |
|
1168 | 1167 | |
1169 | 1168 | $name = mysqli_real_escape_string($conn, $moduleChunk[0]); |
1170 | 1169 | $desc = mysqli_real_escape_string($conn, $moduleChunk[1]); |
@@ -1173,7 +1172,7 @@ discard block |
||
1173 | 1172 | $filecontent = $moduleChunk[2]; |
1174 | 1173 | |
1175 | 1174 | if (!file_exists($filecontent)) |
1176 | - echo " $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1175 | + echo " $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1177 | 1176 | else { |
1178 | 1177 | |
1179 | 1178 | // Create the category if it does not already exist |
@@ -1181,31 +1180,31 @@ discard block |
||
1181 | 1180 | |
1182 | 1181 | $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); |
1183 | 1182 | $chunk = mysqli_real_escape_string($conn, $chunk); |
1184 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); |
|
1183 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"); |
|
1185 | 1184 | $count_original_name = mysqli_num_rows($rs); |
1186 | - if($overwrite == 'false') { |
|
1187 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
1188 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); |
|
1185 | + if ($overwrite == 'false') { |
|
1186 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
1187 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"); |
|
1189 | 1188 | $count_new_name = mysqli_num_rows($rs); |
1190 | 1189 | } |
1191 | 1190 | $update = $count_original_name > 0 && $overwrite == 'true'; |
1192 | 1191 | if ($update) { |
1193 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
1192 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
1194 | 1193 | $errors += 1; |
1195 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1194 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1196 | 1195 | return; |
1197 | 1196 | } |
1198 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1199 | - } elseif($count_new_name == 0) { |
|
1200 | - if($count_original_name > 0 && $overwrite == 'false') { |
|
1197 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1198 | + } elseif ($count_new_name == 0) { |
|
1199 | + if ($count_original_name > 0 && $overwrite == 'false') { |
|
1201 | 1200 | $name = $newname; |
1202 | 1201 | } |
1203 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
1202 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
1204 | 1203 | $errors += 1; |
1205 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1204 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1206 | 1205 | return; |
1207 | 1206 | } |
1208 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1207 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1209 | 1208 | } |
1210 | 1209 | } |
1211 | 1210 | } |
@@ -1215,11 +1214,11 @@ discard block |
||
1215 | 1214 | // Install Modules |
1216 | 1215 | $moduleModules = $mm; |
1217 | 1216 | if (is_array($moduleModules) || $installData) { |
1218 | - echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL; |
|
1217 | + echo PHP_EOL.$_lang['modules'].":".PHP_EOL; |
|
1219 | 1218 | //$selModules = $_POST['module']; |
1220 | 1219 | foreach ($moduleModules as $k=>$moduleModule) { |
1221 | 1220 | $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; |
1222 | - if($installSample || is_array($moduleModules)) { |
|
1221 | + if ($installSample || is_array($moduleModules)) { |
|
1223 | 1222 | $name = mysqli_real_escape_string($conn, $moduleModule[0]); |
1224 | 1223 | $desc = mysqli_real_escape_string($conn, $moduleModule[1]); |
1225 | 1224 | $filecontent = $moduleModule[2]; |
@@ -1228,7 +1227,7 @@ discard block |
||
1228 | 1227 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
1229 | 1228 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
1230 | 1229 | if (!file_exists($filecontent)) |
1231 | - echo " $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1230 | + echo " $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1232 | 1231 | else { |
1233 | 1232 | |
1234 | 1233 | // Create the category if it does not already exist |
@@ -1237,24 +1236,24 @@ discard block |
||
1237 | 1236 | $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
1238 | 1237 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
1239 | 1238 | $module = mysqli_real_escape_string($conn, $module); |
1240 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
1239 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
1241 | 1240 | if (mysqli_num_rows($rs)) { |
1242 | 1241 | $row = mysqli_fetch_assoc($rs); |
1243 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1244 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
1245 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1242 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1243 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
1244 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1246 | 1245 | return; |
1247 | 1246 | } |
1248 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1247 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1249 | 1248 | } else { |
1250 | - if ($properties != NULL ){ |
|
1249 | + if ($properties != NULL) { |
|
1251 | 1250 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1252 | 1251 | } |
1253 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
1254 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
1252 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
1253 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
1255 | 1254 | return; |
1256 | 1255 | } |
1257 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1256 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1258 | 1257 | } |
1259 | 1258 | } |
1260 | 1259 | } |
@@ -1264,11 +1263,11 @@ discard block |
||
1264 | 1263 | // Install Plugins |
1265 | 1264 | $modulePlugins = $mp; |
1266 | 1265 | if (is_array($modulePlugins) || $installData) { |
1267 | - echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL; |
|
1266 | + echo PHP_EOL.$_lang['plugins'].":".PHP_EOL; |
|
1268 | 1267 | $selPlugs = $_POST['plugin']; |
1269 | 1268 | foreach ($modulePlugins as $k=>$modulePlugin) { |
1270 | 1269 | //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; |
1271 | - if($installSample || is_array($modulePlugins)) { |
|
1270 | + if ($installSample || is_array($modulePlugins)) { |
|
1272 | 1271 | $name = mysqli_real_escape_string($conn, $modulePlugin[0]); |
1273 | 1272 | $desc = mysqli_real_escape_string($conn, $modulePlugin[1]); |
1274 | 1273 | $filecontent = $modulePlugin[2]; |
@@ -1278,17 +1277,17 @@ discard block |
||
1278 | 1277 | $category = mysqli_real_escape_string($conn, $modulePlugin[6]); |
1279 | 1278 | $leg_names = ''; |
1280 | 1279 | $disabled = $modulePlugin[9]; |
1281 | - if(array_key_exists(7, $modulePlugin)) { |
|
1280 | + if (array_key_exists(7, $modulePlugin)) { |
|
1282 | 1281 | // parse comma-separated legacy names and prepare them for sql IN clause |
1283 | - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
|
1282 | + $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'"; |
|
1284 | 1283 | } |
1285 | 1284 | if (!file_exists($filecontent)) |
1286 | - echo " $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1285 | + echo " $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1287 | 1286 | else { |
1288 | 1287 | |
1289 | 1288 | // disable legacy versions based on legacy_names provided |
1290 | - if(!empty($leg_names)) { |
|
1291 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
1289 | + if (!empty($leg_names)) { |
|
1290 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
1292 | 1291 | $rs = mysqli_query($sqlParser->conn, $update_query); |
1293 | 1292 | } |
1294 | 1293 | |
@@ -1298,52 +1297,52 @@ discard block |
||
1298 | 1297 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
1299 | 1298 | $plugin = removeDocblock($plugin, 'plugin'); |
1300 | 1299 | $plugin = mysqli_real_escape_string($conn, $plugin); |
1301 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"); |
|
1300 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"); |
|
1302 | 1301 | if (mysqli_num_rows($rs)) { |
1303 | 1302 | $insert = true; |
1304 | - while($row = mysqli_fetch_assoc($rs)) { |
|
1305 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1306 | - if($row['description'] == $desc){ |
|
1307 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
1308 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1303 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
1304 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1305 | + if ($row['description'] == $desc) { |
|
1306 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
1307 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1309 | 1308 | return; |
1310 | 1309 | } |
1311 | 1310 | $insert = false; |
1312 | 1311 | } else { |
1313 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
1312 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
1314 | 1313 | echo mysqli_error($sqlParser->conn).PHP_EOL; |
1315 | 1314 | return; |
1316 | 1315 | } |
1317 | 1316 | } |
1318 | 1317 | } |
1319 | - if($insert === true) { |
|
1320 | - $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1321 | - if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
1318 | + if ($insert === true) { |
|
1319 | + $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1320 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
1322 | 1321 | echo mysqli_error($sqlParser->conn).PHP_EOL; |
1323 | 1322 | return; |
1324 | 1323 | } |
1325 | 1324 | } |
1326 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1325 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1327 | 1326 | } else { |
1328 | - if ($properties != NULL ){ |
|
1327 | + if ($properties != NULL) { |
|
1329 | 1328 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1330 | 1329 | } |
1331 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
1332 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1330 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
1331 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1333 | 1332 | return; |
1334 | 1333 | } |
1335 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1334 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1336 | 1335 | } |
1337 | 1336 | // add system events |
1338 | 1337 | if (count($events) > 0) { |
1339 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
1338 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
1340 | 1339 | if ($ds) { |
1341 | 1340 | $row = mysqli_fetch_assoc($ds); |
1342 | 1341 | $id = $row["id"]; |
1343 | 1342 | // remove existing events |
1344 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\''); |
|
1343 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\''); |
|
1345 | 1344 | // add new events |
1346 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')"); |
|
1345 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')"); |
|
1347 | 1346 | } |
1348 | 1347 | } |
1349 | 1348 | } |
@@ -1354,18 +1353,18 @@ discard block |
||
1354 | 1353 | // Install Snippets |
1355 | 1354 | $moduleSnippet = $ms; |
1356 | 1355 | if (is_array($moduleSnippet) || $installData) { |
1357 | - echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL; |
|
1356 | + echo PHP_EOL.$_lang['snippets'].":".PHP_EOL; |
|
1358 | 1357 | //$selSnips = $_POST['snippet']; |
1359 | 1358 | foreach ($moduleSnippets as $k=>$moduleSnippet) { |
1360 | 1359 | $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; |
1361 | - if($installSample || is_array($moduleSnippet)) { |
|
1360 | + if ($installSample || is_array($moduleSnippet)) { |
|
1362 | 1361 | $name = mysqli_real_escape_string($conn, $moduleSnippet[0]); |
1363 | 1362 | $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]); |
1364 | 1363 | $filecontent = $moduleSnippet[2]; |
1365 | 1364 | $properties = $moduleSnippet[3]; |
1366 | 1365 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
1367 | 1366 | if (!file_exists($filecontent)) |
1368 | - echo " $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1367 | + echo " $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1369 | 1368 | else { |
1370 | 1369 | |
1371 | 1370 | // Create the category if it does not already exist |
@@ -1374,24 +1373,24 @@ discard block |
||
1374 | 1373 | $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
1375 | 1374 | $snippet = removeDocblock($snippet, 'snippet'); |
1376 | 1375 | $snippet = mysqli_real_escape_string($conn, $snippet); |
1377 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
1376 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
1378 | 1377 | if (mysqli_num_rows($rs)) { |
1379 | 1378 | $row = mysqli_fetch_assoc($rs); |
1380 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1381 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
1382 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1379 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1380 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
1381 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1383 | 1382 | return; |
1384 | 1383 | } |
1385 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1384 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1386 | 1385 | } else { |
1387 | - if ($properties != NULL ){ |
|
1386 | + if ($properties != NULL) { |
|
1388 | 1387 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1389 | 1388 | } |
1390 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
1391 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1389 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
1390 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1392 | 1391 | return; |
1393 | 1392 | } |
1394 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1393 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1395 | 1394 | } |
1396 | 1395 | } |
1397 | 1396 | } |
@@ -1400,24 +1399,24 @@ discard block |
||
1400 | 1399 | |
1401 | 1400 | // Install demo-site |
1402 | 1401 | if ($installData && $moduleSQLDataFile) { |
1403 | - echo PHP_EOL . $_lang['installing_demo_site']; |
|
1402 | + echo PHP_EOL.$_lang['installing_demo_site']; |
|
1404 | 1403 | $sqlParser->process($moduleSQLDataFile); |
1405 | 1404 | // display database results |
1406 | 1405 | if ($sqlParser->installFailed == true) { |
1407 | 1406 | $errors += 1; |
1408 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
1409 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
1410 | - echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL; |
|
1407 | + echo $_lang['database_alerts'].PHP_EOL; |
|
1408 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
1409 | + echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL; |
|
1411 | 1410 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
1412 | - echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL; |
|
1411 | + echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL; |
|
1413 | 1412 | } |
1414 | 1413 | |
1415 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
1414 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
1416 | 1415 | return; |
1417 | 1416 | } else { |
1418 | 1417 | $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); |
1419 | 1418 | $rs = mysqli_query($sqlParser->conn, $sql); |
1420 | - if(mysqli_num_rows($rs)) { |
|
1419 | + if (mysqli_num_rows($rs)) { |
|
1421 | 1420 | $row = mysqli_fetch_assoc($rs); |
1422 | 1421 | $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']); |
1423 | 1422 | mysqli_query($sqlParser->conn, $sql); |
@@ -1429,9 +1428,9 @@ discard block |
||
1429 | 1428 | // Install Dependencies |
1430 | 1429 | $moduleDependencies = $mdp; |
1431 | 1430 | foreach ($moduleDependencies as $dependency) { |
1432 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
1431 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'); |
|
1433 | 1432 | if (!$ds) { |
1434 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1433 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1435 | 1434 | return; |
1436 | 1435 | } else { |
1437 | 1436 | $row = mysqli_fetch_assoc($ds); |
@@ -1439,37 +1438,37 @@ discard block |
||
1439 | 1438 | $moduleGuid = $row["guid"]; |
1440 | 1439 | } |
1441 | 1440 | // get extra id |
1442 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
1441 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'); |
|
1443 | 1442 | if (!$ds) { |
1444 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1443 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1445 | 1444 | return; |
1446 | 1445 | } else { |
1447 | 1446 | $row = mysqli_fetch_assoc($ds); |
1448 | 1447 | $extraId = $row["id"]; |
1449 | 1448 | } |
1450 | 1449 | // setup extra as module dependency |
1451 | - $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
1450 | + $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1'); |
|
1452 | 1451 | if (!$ds) { |
1453 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1452 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1454 | 1453 | return; |
1455 | 1454 | } else { |
1456 | 1455 | if (mysqli_num_rows($ds) === 0) { |
1457 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
1458 | - echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL; |
|
1456 | + mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'); |
|
1457 | + echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL; |
|
1459 | 1458 | } else { |
1460 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
1461 | - echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL; |
|
1459 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']); |
|
1460 | + echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL; |
|
1462 | 1461 | } |
1463 | 1462 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
1464 | 1463 | // set extra guid for plugins and snippets |
1465 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
1464 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'); |
|
1466 | 1465 | if (!$ds) { |
1467 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1466 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1468 | 1467 | return; |
1469 | 1468 | } else { |
1470 | 1469 | if (mysqli_num_rows($ds) != 0) { |
1471 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
1472 | - echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL; |
|
1470 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId); |
|
1471 | + echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL; |
|
1473 | 1472 | } |
1474 | 1473 | } |
1475 | 1474 | } |
@@ -1478,7 +1477,7 @@ discard block |
||
1478 | 1477 | |
1479 | 1478 | // call back function |
1480 | 1479 | if ($callBackFnc != "") |
1481 | - $callBackFnc ($sqlParser); |
|
1480 | + $callBackFnc($sqlParser); |
|
1482 | 1481 | |
1483 | 1482 | // Setup the MODX API -- needed for the cache processor |
1484 | 1483 | if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
@@ -1510,17 +1509,17 @@ discard block |
||
1510 | 1509 | } |
1511 | 1510 | |
1512 | 1511 | // setup completed! |
1513 | -echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL; |
|
1512 | +echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL; |
|
1514 | 1513 | //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>"; |
1515 | 1514 | if ($installMode == 0) { |
1516 | - echo strip_tags($_lang['installation_note']) . PHP_EOL; |
|
1515 | + echo strip_tags($_lang['installation_note']).PHP_EOL; |
|
1517 | 1516 | } else { |
1518 | - echo strip_tags($_lang['upgrade_note']) . PHP_EOL; |
|
1517 | + echo strip_tags($_lang['upgrade_note']).PHP_EOL; |
|
1519 | 1518 | } |
1520 | 1519 | |
1521 | 1520 | |
1522 | -if ( empty($args) ){ |
|
1523 | - echo PHP_EOL . 'Remove install folder?'.PHP_EOL; |
|
1521 | +if (empty($args)) { |
|
1522 | + echo PHP_EOL.'Remove install folder?'.PHP_EOL; |
|
1524 | 1523 | $removeInstall = readline("Type 'y' or 'n' to continue: "); |
1525 | 1524 | } |
1526 | 1525 | //remove installFolder |
@@ -1528,7 +1527,7 @@ discard block |
||
1528 | 1527 | removeFolder($path); |
1529 | 1528 | removeFolder($base_path.'.tx'); |
1530 | 1529 | unlink($base_path.'README.md'); |
1531 | - echo 'Install folder deleted!'. PHP_EOL . PHP_EOL; |
|
1530 | + echo 'Install folder deleted!'.PHP_EOL.PHP_EOL; |
|
1532 | 1531 | } |
1533 | 1532 | |
1534 | 1533 | /** |
@@ -1567,11 +1566,11 @@ discard block |
||
1567 | 1566 | * @param string $old |
1568 | 1567 | * @return string |
1569 | 1568 | */ |
1570 | -function propUpdate($new,$old){ |
|
1569 | +function propUpdate($new, $old){ |
|
1571 | 1570 | $newArr = parseProperties($new); |
1572 | 1571 | $oldArr = parseProperties($old); |
1573 | - foreach ($oldArr as $k => $v){ |
|
1574 | - if (isset($v['0']['options'])){ |
|
1572 | + foreach ($oldArr as $k => $v) { |
|
1573 | + if (isset($v['0']['options'])) { |
|
1575 | 1574 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
1576 | 1575 | } |
1577 | 1576 | } |
@@ -1586,30 +1585,30 @@ discard block |
||
1586 | 1585 | * @param bool|mixed $json |
1587 | 1586 | * @return string |
1588 | 1587 | */ |
1589 | -function parseProperties($propertyString, $json=false) { |
|
1590 | - $propertyString = str_replace('{}', '', $propertyString ); |
|
1591 | - $propertyString = str_replace('} {', ',', $propertyString ); |
|
1588 | +function parseProperties($propertyString, $json = false){ |
|
1589 | + $propertyString = str_replace('{}', '', $propertyString); |
|
1590 | + $propertyString = str_replace('} {', ',', $propertyString); |
|
1592 | 1591 | |
1593 | - if(empty($propertyString)) return array(); |
|
1594 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
1592 | + if (empty($propertyString)) return array(); |
|
1593 | + if ($propertyString == '{}' || $propertyString == '[]') return array(); |
|
1595 | 1594 | |
1596 | 1595 | $jsonFormat = isJson($propertyString, true); |
1597 | 1596 | $property = array(); |
1598 | 1597 | // old format |
1599 | - if ( $jsonFormat === false) { |
|
1600 | - $props= explode('&', $propertyString); |
|
1598 | + if ($jsonFormat === false) { |
|
1599 | + $props = explode('&', $propertyString); |
|
1601 | 1600 | foreach ($props as $prop) { |
1602 | 1601 | $prop = trim($prop); |
1603 | - if($prop === '') { |
|
1602 | + if ($prop === '') { |
|
1604 | 1603 | continue; |
1605 | 1604 | } |
1606 | 1605 | |
1607 | 1606 | $arr = explode(';', $prop); |
1608 | - if( ! is_array($arr)) { |
|
1607 | + if (!is_array($arr)) { |
|
1609 | 1608 | $arr = array(); |
1610 | 1609 | } |
1611 | 1610 | $key = explode('=', isset($arr[0]) ? $arr[0] : ''); |
1612 | - if( ! is_array($key) || empty($key[0])) { |
|
1611 | + if (!is_array($key) || empty($key[0])) { |
|
1613 | 1612 | continue; |
1614 | 1613 | } |
1615 | 1614 | |
@@ -1633,7 +1632,7 @@ discard block |
||
1633 | 1632 | |
1634 | 1633 | } |
1635 | 1634 | // new json-format |
1636 | - } else if(!empty($jsonFormat)){ |
|
1635 | + } else if (!empty($jsonFormat)) { |
|
1637 | 1636 | $property = $jsonFormat; |
1638 | 1637 | } |
1639 | 1638 | if ($json) { |
@@ -1648,7 +1647,7 @@ discard block |
||
1648 | 1647 | * @param bool $returnData |
1649 | 1648 | * @return bool|mixed |
1650 | 1649 | */ |
1651 | -function isJson($string, $returnData=false) { |
|
1650 | +function isJson($string, $returnData = false){ |
|
1652 | 1651 | $data = json_decode($string, true); |
1653 | 1652 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
1654 | 1653 | } |
@@ -1658,20 +1657,20 @@ discard block |
||
1658 | 1657 | * @param SqlParser $sqlParser |
1659 | 1658 | * @return int |
1660 | 1659 | */ |
1661 | -function getCreateDbCategory($category, $sqlParser) { |
|
1660 | +function getCreateDbCategory($category, $sqlParser){ |
|
1662 | 1661 | $dbase = $sqlParser->dbname; |
1663 | - $dbase = '`' . trim($dbase,'`') . '`'; |
|
1662 | + $dbase = '`'.trim($dbase, '`').'`'; |
|
1664 | 1663 | $table_prefix = $sqlParser->prefix; |
1665 | 1664 | $category_id = 0; |
1666 | - if(!empty($category)) { |
|
1665 | + if (!empty($category)) { |
|
1667 | 1666 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
1668 | 1667 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
1669 | - if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
1668 | + if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
1670 | 1669 | $category_id = $row['id']; |
1671 | 1670 | } else { |
1672 | 1671 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
1673 | 1672 | $rs = mysqli_query($sqlParser->conn, $q); |
1674 | - if($rs) { |
|
1673 | + if ($rs) { |
|
1675 | 1674 | $category_id = mysqli_insert_id($sqlParser->conn); |
1676 | 1675 | } |
1677 | 1676 | } |
@@ -1686,12 +1685,12 @@ discard block |
||
1686 | 1685 | * @param string $type |
1687 | 1686 | * @return string |
1688 | 1687 | */ |
1689 | -function removeDocblock($code, $type) { |
|
1688 | +function removeDocblock($code, $type){ |
|
1690 | 1689 | |
1691 | 1690 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
1692 | 1691 | |
1693 | 1692 | // Procedure taken from plugin.filesource.php |
1694 | - switch($type) { |
|
1693 | + switch ($type) { |
|
1695 | 1694 | case 'snippet': |
1696 | 1695 | $elm_name = 'snippets'; |
1697 | 1696 | $include = 'return require'; |
@@ -1707,7 +1706,7 @@ discard block |
||
1707 | 1706 | default: |
1708 | 1707 | return $cleaned; |
1709 | 1708 | }; |
1710 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
1709 | + if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
1711 | 1710 | return $cleaned; |
1712 | 1711 | |
1713 | 1712 | // fileBinding not found - return code incl docblock |
@@ -5,7 +5,7 @@ |
||
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 | public function include_lang($context = 'common') |
10 | 10 | { |
11 | 11 | parent::includeLang($context); |