@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | use PHPMailer\PHPMailer\PHPMailer; |
12 | 12 | use PHPMailer\PHPMailer\Exception as PHPMailerException; |
13 | 13 | |
14 | -require MODX_MANAGER_PATH . 'includes/controls/phpmailer/Exception.php'; |
|
15 | -require MODX_MANAGER_PATH . 'includes/controls/phpmailer/PHPMailer.php'; |
|
16 | -require MODX_MANAGER_PATH . 'includes/controls/phpmailer/SMTP.php'; |
|
14 | +require MODX_MANAGER_PATH.'includes/controls/phpmailer/Exception.php'; |
|
15 | +require MODX_MANAGER_PATH.'includes/controls/phpmailer/PHPMailer.php'; |
|
16 | +require MODX_MANAGER_PATH.'includes/controls/phpmailer/SMTP.php'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Class MODxMailer |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function init(DocumentParser $modx) |
47 | 47 | { |
48 | 48 | $this->modx = $modx; |
49 | - $this->PluginDir = MODX_MANAGER_PATH . 'includes/controls/phpmailer/'; |
|
49 | + $this->PluginDir = MODX_MANAGER_PATH.'includes/controls/phpmailer/'; |
|
50 | 50 | |
51 | 51 | switch ($modx->config['email_method']) { |
52 | 52 | case 'smtp': |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | mb_language($this->mb_language); |
111 | 111 | mb_internal_encoding($modx->config['modx_charset']); |
112 | 112 | } |
113 | - $exconf = MODX_MANAGER_PATH . 'includes/controls/phpmailer/config.inc.php'; |
|
113 | + $exconf = MODX_MANAGER_PATH.'includes/controls/phpmailer/config.inc.php'; |
|
114 | 114 | if (is_file($exconf)) { |
115 | 115 | include($exconf); |
116 | 116 | } |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | if ($this->modx->debug) { |
181 | - $debug_info = 'CharSet = ' . $this->CharSet . "\n"; |
|
182 | - $debug_info .= 'Encoding = ' . $this->Encoding . "\n"; |
|
183 | - $debug_info .= 'mb_language = ' . $this->mb_language . "\n"; |
|
184 | - $debug_info .= 'encode_header_method = ' . $this->encode_header_method . "\n"; |
|
181 | + $debug_info = 'CharSet = '.$this->CharSet."\n"; |
|
182 | + $debug_info .= 'Encoding = '.$this->Encoding."\n"; |
|
183 | + $debug_info .= 'mb_language = '.$this->mb_language."\n"; |
|
184 | + $debug_info .= 'encode_header_method = '.$this->encode_header_method."\n"; |
|
185 | 185 | $debug_info .= "send_mode = {$mode}\n"; |
186 | - $debug_info .= 'Subject = ' . $this->Subject . "\n"; |
|
186 | + $debug_info .= 'Subject = '.$this->Subject."\n"; |
|
187 | 187 | $log = "<pre>{$debug_info}\n{$header}\n{$org_body}</pre>"; |
188 | 188 | $this->modx->logEvent(1, 1, $log, 'MODxMailer debug information'); |
189 | 189 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | ini_set('sendmail_from', $old_from); |
250 | 250 | } |
251 | 251 | if (!$rt) { |
252 | - $msg = $this->Lang('instantiate') . "<br />\n"; |
|
252 | + $msg = $this->Lang('instantiate')."<br />\n"; |
|
253 | 253 | $msg .= "{$this->Subject}<br />\n"; |
254 | 254 | $msg .= "{$this->FromName}<{$this->From}><br />\n"; |
255 | 255 | $msg .= mb_convert_encoding($body, $this->modx->config['modx_charset'], $this->CharSet); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function SetError($msg) |
270 | 270 | { |
271 | - $msg .= '<pre>' . print_r(call_user_func('get_object_vars', $this), true) . '</pre>'; |
|
271 | + $msg .= '<pre>'.print_r(call_user_func('get_object_vars', $this), true).'</pre>'; |
|
272 | 272 | $this->modx->config['send_errormail'] = '0'; |
273 | 273 | $this->modx->logEvent(0, 3, $msg, 'phpmailer'); |
274 | 274 |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | <tr> |
7 | 7 | <td nowrap class="warning"><?php echo $_lang['udperms_title'] ?><br><small>[(use_udperms)]</small></td> |
8 | 8 | <td> |
9 | - <?php echo wrap_label($_lang['yes'],form_radio('use_udperms', 1, 'id="udPermsOn"'));?><br /> |
|
10 | - <?php echo wrap_label($_lang['no'], form_radio('use_udperms', 0, 'id="udPermsOff"'));?> |
|
9 | + <?php echo wrap_label($_lang['yes'], form_radio('use_udperms', 1, 'id="udPermsOn"')); ?><br /> |
|
10 | + <?php echo wrap_label($_lang['no'], form_radio('use_udperms', 0, 'id="udPermsOff"')); ?> |
|
11 | 11 | </td> |
12 | 12 | </tr> |
13 | 13 | <tr> |
@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | <tr> |
18 | 18 | <td colspan="2"><div class="split"></div></td> |
19 | 19 | </tr> |
20 | - <tr class="udPerms" <?php echo showHide($use_udperms==1);?>> |
|
20 | + <tr class="udPerms" <?php echo showHide($use_udperms == 1); ?>> |
|
21 | 21 | <td nowrap class="warning"><?php echo $_lang['udperms_allowroot_title'] ?><br><small>[(udperms_allowroot)]</small></td> |
22 | 22 | <td> |
23 | - <label><input type="radio" name="udperms_allowroot" value="1" <?php echo $udperms_allowroot=='1' ? 'checked="checked"' : "" ; ?> /> |
|
23 | + <label><input type="radio" name="udperms_allowroot" value="1" <?php echo $udperms_allowroot == '1' ? 'checked="checked"' : ""; ?> /> |
|
24 | 24 | <?php echo $_lang['yes']?></label><br /> |
25 | - <label><input type="radio" name="udperms_allowroot" value="0" <?php echo $udperms_allowroot=='0' ? 'checked="checked"' : "" ; ?> /> |
|
25 | + <label><input type="radio" name="udperms_allowroot" value="0" <?php echo $udperms_allowroot == '0' ? 'checked="checked"' : ""; ?> /> |
|
26 | 26 | <?php echo $_lang['no']?></label> |
27 | 27 | </td> |
28 | 28 | </tr> |
29 | - <tr class="udPerms" <?php echo showHide($use_udperms==1);?>> |
|
29 | + <tr class="udPerms" <?php echo showHide($use_udperms == 1); ?>> |
|
30 | 30 | <td width="200"> </td> |
31 | 31 | <td class="comment"><?php echo $_lang['udperms_allowroot_message'] ?></td> |
32 | 32 | </tr> |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | <tr> |
38 | 38 | <td nowrap class="warning"><?php echo $_lang['email_sender_method'] ?><br><small>[(email_sender_method)]</small></td> |
39 | 39 | <td> |
40 | - <label><input type="radio" name="email_sender_method" value="1" <?php echo $email_sender_method=='1' ? 'checked="checked"' : "" ; ?> /> |
|
40 | + <label><input type="radio" name="email_sender_method" value="1" <?php echo $email_sender_method == '1' ? 'checked="checked"' : ""; ?> /> |
|
41 | 41 | <?php echo $_lang['auto']?></label><br /> |
42 | - <label><input type="radio" name="email_sender_method" value="0" <?php echo $email_sender_method=='0' ? 'checked="checked"' : "" ; ?> /> |
|
42 | + <label><input type="radio" name="email_sender_method" value="0" <?php echo $email_sender_method == '0' ? 'checked="checked"' : ""; ?> /> |
|
43 | 43 | <?php echo $_lang['use_emailsender']?></label> |
44 | 44 | </td> |
45 | 45 | </tr> |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | <tr> |
56 | 56 | <td nowrap class="warning"><?php echo $_lang['email_method_title'] ?><br><small>[(email_method)]</small></td> |
57 | 57 | <td> |
58 | - <?php echo wrap_label($_lang['email_method_mail'],form_radio('email_method','mail','id="useMail"'));?><br /> |
|
59 | - <?php echo wrap_label($_lang['email_method_smtp'],form_radio('email_method','smtp','id="useSmtp"'));?> |
|
60 | - <div class="smtpRow" <?php echo showHide($email_method=='smtp');?>> |
|
61 | - <?php include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/snippet_smtp.inc.php'); ?> |
|
58 | + <?php echo wrap_label($_lang['email_method_mail'], form_radio('email_method', 'mail', 'id="useMail"')); ?><br /> |
|
59 | + <?php echo wrap_label($_lang['email_method_smtp'], form_radio('email_method', 'smtp', 'id="useSmtp"')); ?> |
|
60 | + <div class="smtpRow" <?php echo showHide($email_method == 'smtp'); ?>> |
|
61 | + <?php include_once(MODX_MANAGER_PATH.'actions/mutate_settings/snippet_smtp.inc.php'); ?> |
|
62 | 62 | </div> |
63 | 63 | </td> |
64 | 64 | </tr> |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | <br /> |
71 | 71 | <p><?php echo $_lang['update_settings_from_language']; ?></p> |
72 | 72 | <select name="reload_emailsubject" id="reload_emailsubject_select" onchange="confirmLangChange(this, 'emailsubject_default', 'emailsubject_field');"> |
73 | -<?php echo get_lang_options('emailsubject_default');?> |
|
73 | +<?php echo get_lang_options('emailsubject_default'); ?> |
|
74 | 74 | </select> |
75 | 75 | </td> |
76 | 76 | <td ><input id="emailsubject_field" name="emailsubject" onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" value="<?php echo $emailsubject; ?>" /> |
77 | - <input type="hidden" name="emailsubject_default" id="emailsubject_default_hidden" value="<?php echo addslashes($_lang['emailsubject_default']);?>" /> |
|
77 | + <input type="hidden" name="emailsubject_default" id="emailsubject_default_hidden" value="<?php echo addslashes($_lang['emailsubject_default']); ?>" /> |
|
78 | 78 | </td> |
79 | 79 | </tr> |
80 | 80 | <tr> |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | <br /> |
90 | 90 | <p><?php echo $_lang['update_settings_from_language']; ?></p> |
91 | 91 | <select name="reload_signupemail_message" id="reload_signupemail_message_select" onchange="confirmLangChange(this, 'system_email_signup', 'signupemail_message_textarea');"> |
92 | -<?php echo get_lang_options('system_email_signup');?> |
|
92 | +<?php echo get_lang_options('system_email_signup'); ?> |
|
93 | 93 | </select> |
94 | 94 | </td> |
95 | 95 | <td> <textarea id="signupemail_message_textarea" name="signupemail_message" style="width:100%; height: 120px;"><?php echo $signupemail_message; ?></textarea> |
96 | - <input type="hidden" name="system_email_signup_default" id="system_email_signup_hidden" value="<?php echo addslashes($_lang['system_email_signup']);?>" /> |
|
96 | + <input type="hidden" name="system_email_signup_default" id="system_email_signup_hidden" value="<?php echo addslashes($_lang['system_email_signup']); ?>" /> |
|
97 | 97 | </td> |
98 | 98 | </tr> |
99 | 99 | <tr> |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | <br /> |
109 | 109 | <p><?php echo $_lang['update_settings_from_language']; ?></p> |
110 | 110 | <select name="reload_websignupemail_message" id="reload_websignupemail_message_select" onchange="confirmLangChange(this, 'system_email_websignup', 'websignupemail_message_textarea');"> |
111 | -<?php echo get_lang_options('system_email_websignup');?> |
|
111 | +<?php echo get_lang_options('system_email_websignup'); ?> |
|
112 | 112 | </select> |
113 | 113 | </td> |
114 | 114 | <td> <textarea id="websignupemail_message_textarea" name="websignupemail_message" style="width:100%; height: 120px;"><?php echo $websignupemail_message; ?></textarea> |
115 | - <input type="hidden" name="system_email_websignup_default" id="system_email_websignup_hidden" value="<?php echo addslashes($_lang['system_email_websignup']);?>" /> |
|
115 | + <input type="hidden" name="system_email_websignup_default" id="system_email_websignup_hidden" value="<?php echo addslashes($_lang['system_email_websignup']); ?>" /> |
|
116 | 116 | </td> |
117 | 117 | </tr> |
118 | 118 | <tr> |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | <br /> |
128 | 128 | <p><?php echo $_lang['update_settings_from_language']; ?></p> |
129 | 129 | <select name="reload_system_email_webreminder_message" id="reload_system_email_webreminder_select" onchange="confirmLangChange(this, 'system_email_webreminder', 'system_email_webreminder_textarea');"> |
130 | -<?php echo get_lang_options('system_email_webreminder');?> |
|
130 | +<?php echo get_lang_options('system_email_webreminder'); ?> |
|
131 | 131 | </select> |
132 | 132 | </td> |
133 | 133 | <td> <textarea id="system_email_webreminder_textarea" name="webpwdreminder_message" style="width:100%; height: 120px;"><?php echo $webpwdreminder_message; ?></textarea> |
134 | - <input type="hidden" name="system_email_webreminder_default" id="system_email_webreminder_hidden" value="<?php echo addslashes($_lang['system_email_webreminder']);?>" /> |
|
134 | + <input type="hidden" name="system_email_webreminder_default" id="system_email_webreminder_hidden" value="<?php echo addslashes($_lang['system_email_webreminder']); ?>" /> |
|
135 | 135 | </td> |
136 | 136 | </tr> |
137 | 137 | <tr> |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | <?php |
144 | 144 | // invoke OnUserSettingsRender event |
145 | 145 | $evtOut = $modx->invokeEvent('OnUserSettingsRender'); |
146 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
146 | + if (is_array($evtOut)) echo implode("", $evtOut); |
|
147 | 147 | ?> |
148 | 148 | </td> |
149 | 149 | </tr> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $sitemenu['site'] = array( |
22 | 22 | 'site', |
23 | 23 | 'main', |
24 | - '<i class="fa fa-tachometer"></i>' . $_lang['home'], |
|
24 | + '<i class="fa fa-tachometer"></i>'.$_lang['home'], |
|
25 | 25 | 'index.php?a=2', |
26 | 26 | $_lang['home'], |
27 | 27 | '', |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | 'active' |
33 | 33 | ); |
34 | 34 | |
35 | -if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) { |
|
35 | +if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) { |
|
36 | 36 | $sitemenu['elements'] = array( |
37 | 37 | 'elements', |
38 | 38 | 'main', |
39 | - '<i class="fa fa-th"></i>' . $_lang['elements'], |
|
39 | + '<i class="fa fa-th"></i>'.$_lang['elements'], |
|
40 | 40 | 'javascript:;', |
41 | 41 | $_lang['elements'], |
42 | 42 | ' return false;', |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | ); |
49 | 49 | } |
50 | 50 | |
51 | -if($modx->hasPermission('exec_module')) { |
|
51 | +if ($modx->hasPermission('exec_module')) { |
|
52 | 52 | $sitemenu['modules'] = array( |
53 | 53 | 'modules', |
54 | 54 | 'main', |
55 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['modules'], |
|
55 | + '<i class="'.$_style['icons_modules'].'"></i>'.$_lang['modules'], |
|
56 | 56 | 'javascript:;', |
57 | 57 | $_lang['modules'], |
58 | 58 | ' return false;', |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | } |
66 | 66 | |
67 | -if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) { |
|
67 | +if ($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) { |
|
68 | 68 | $sitemenu['users'] = array( |
69 | 69 | 'users', |
70 | 70 | 'main', |
71 | - '<i class="fa fa-users"></i>' . $_lang['users'], |
|
71 | + '<i class="fa fa-users"></i>'.$_lang['users'], |
|
72 | 72 | 'javascript:;', |
73 | 73 | $_lang['users'], |
74 | 74 | ' return false;', |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | ); |
81 | 81 | } |
82 | 82 | |
83 | -if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) { |
|
83 | +if ($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) { |
|
84 | 84 | $sitemenu['tools'] = array( |
85 | 85 | 'tools', |
86 | 86 | 'main', |
87 | - '<i class="fa fa-wrench"></i>' . $_lang['tools'], |
|
87 | + '<i class="fa fa-wrench"></i>'.$_lang['tools'], |
|
88 | 88 | 'javascript:;', |
89 | 89 | $_lang['tools'], |
90 | 90 | ' return false;', |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | $tab = 0; |
100 | -if($modx->hasPermission('edit_template')) { |
|
100 | +if ($modx->hasPermission('edit_template')) { |
|
101 | 101 | $sitemenu['element_templates'] = array( |
102 | 102 | 'element_templates', |
103 | 103 | 'elements', |
104 | - '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
105 | - 'index.php?a=76&tab=' . $tab++, |
|
104 | + '<i class="fa fa-newspaper-o"></i>'.$_lang['manage_templates'].'<i class="fa fa-angle-right toggle"></i>', |
|
105 | + 'index.php?a=76&tab='.$tab++, |
|
106 | 106 | $_lang['manage_templates'], |
107 | 107 | '', |
108 | 108 | 'new_template,edit_template', |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | 'dropdown-toggle' |
113 | 113 | ); |
114 | 114 | } |
115 | -if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
115 | +if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
116 | 116 | $sitemenu['element_tplvars'] = array( |
117 | 117 | 'element_tplvars', |
118 | 118 | 'elements', |
119 | - '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
120 | - 'index.php?a=76&tab=' . $tab++, |
|
119 | + '<i class="fa fa-list-alt"></i>'.$_lang['tmplvars'].'<i class="fa fa-angle-right toggle"></i>', |
|
120 | + 'index.php?a=76&tab='.$tab++, |
|
121 | 121 | $_lang['tmplvars'], |
122 | 122 | '', |
123 | 123 | 'new_template,edit_template', |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | 'dropdown-toggle' |
128 | 128 | ); |
129 | 129 | } |
130 | -if($modx->hasPermission('edit_chunk')) { |
|
130 | +if ($modx->hasPermission('edit_chunk')) { |
|
131 | 131 | $sitemenu['element_htmlsnippets'] = array( |
132 | 132 | 'element_htmlsnippets', |
133 | 133 | 'elements', |
134 | - '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
135 | - 'index.php?a=76&tab=' . $tab++, |
|
134 | + '<i class="fa fa-th-large"></i>'.$_lang['manage_htmlsnippets'].'<i class="fa fa-angle-right toggle"></i>', |
|
135 | + 'index.php?a=76&tab='.$tab++, |
|
136 | 136 | $_lang['manage_htmlsnippets'], |
137 | 137 | '', |
138 | 138 | 'new_chunk,edit_chunk', |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | 'dropdown-toggle' |
143 | 143 | ); |
144 | 144 | } |
145 | -if($modx->hasPermission('edit_snippet')) { |
|
145 | +if ($modx->hasPermission('edit_snippet')) { |
|
146 | 146 | $sitemenu['element_snippets'] = array( |
147 | 147 | 'element_snippets', |
148 | 148 | 'elements', |
149 | - '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
150 | - 'index.php?a=76&tab=' . $tab++, |
|
149 | + '<i class="fa fa-code"></i>'.$_lang['manage_snippets'].'<i class="fa fa-angle-right toggle"></i>', |
|
150 | + 'index.php?a=76&tab='.$tab++, |
|
151 | 151 | $_lang['manage_snippets'], |
152 | 152 | '', |
153 | 153 | 'new_snippet,edit_snippet', |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | 'dropdown-toggle' |
158 | 158 | ); |
159 | 159 | } |
160 | -if($modx->hasPermission('edit_plugin')) { |
|
160 | +if ($modx->hasPermission('edit_plugin')) { |
|
161 | 161 | $sitemenu['element_plugins'] = array( |
162 | 162 | 'element_plugins', |
163 | 163 | 'elements', |
164 | - '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
165 | - 'index.php?a=76&tab=' . $tab++, |
|
164 | + '<i class="fa fa-plug"></i>'.$_lang['manage_plugins'].'<i class="fa fa-angle-right toggle"></i>', |
|
165 | + 'index.php?a=76&tab='.$tab++, |
|
166 | 166 | $_lang['manage_plugins'], |
167 | 167 | '', |
168 | 168 | 'new_plugin,edit_plugin', |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | } |
175 | 175 | //$sitemenu['element_categories'] = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,''); |
176 | 176 | |
177 | -if($modx->hasPermission('file_manager')) { |
|
177 | +if ($modx->hasPermission('file_manager')) { |
|
178 | 178 | $sitemenu['manage_files'] = array( |
179 | 179 | 'manage_files', |
180 | 180 | 'elements', |
181 | - '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
181 | + '<i class="fa fa-folder-open-o"></i>'.$_lang['manage_files'], |
|
182 | 182 | 'index.php?a=31', |
183 | 183 | $_lang['manage_files'], |
184 | 184 | '', |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | '' |
190 | 190 | ); |
191 | 191 | } |
192 | -if($modx->hasPermission('category_manager')) { |
|
192 | +if ($modx->hasPermission('category_manager')) { |
|
193 | 193 | $sitemenu['manage_categories'] = array( |
194 | 194 | 'manage_categories', |
195 | 195 | 'elements', |
196 | - '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
196 | + '<i class="fa fa-object-group"></i>'.$_lang['manage_categories'], |
|
197 | 197 | 'index.php?a=120', |
198 | 198 | $_lang['manage_categories'], |
199 | 199 | '', |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | // Modules Menu Items |
209 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) { |
|
209 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) { |
|
210 | 210 | $sitemenu['new_module'] = array( |
211 | 211 | 'new_module', |
212 | 212 | 'modules', |
213 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
213 | + '<i class="'.$_style['icons_modules'].'"></i>'.$_lang['module_management'], |
|
214 | 214 | 'index.php?a=106', |
215 | 215 | $_lang['module_management'], |
216 | 216 | '', |
@@ -222,24 +222,24 @@ discard block |
||
222 | 222 | ); |
223 | 223 | } |
224 | 224 | |
225 | -if($modx->hasPermission('exec_module')) { |
|
226 | - if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
225 | +if ($modx->hasPermission('exec_module')) { |
|
226 | + if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
227 | 227 | $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member |
228 | - FROM ' . $modx->getFullTableName('site_modules') . ' AS sm |
|
229 | - LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id |
|
230 | - LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group |
|
231 | - WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
|
228 | + FROM ' . $modx->getFullTableName('site_modules').' AS sm |
|
229 | + LEFT JOIN ' . $modx->getFullTableName('site_module_access').' AS sma ON sma.module = sm.id |
|
230 | + LEFT JOIN ' . $modx->getFullTableName('member_groups').' AS mg ON sma.usergroup = mg.user_group |
|
231 | + WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID().') AND sm.disabled != 1 AND sm.locked != 1 |
|
232 | 232 | ORDER BY sm.name'); |
233 | 233 | } else { |
234 | 234 | $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name'); |
235 | 235 | } |
236 | - if($modx->db->getRecordCount($rs)) { |
|
236 | + if ($modx->db->getRecordCount($rs)) { |
|
237 | 237 | while ($row = $modx->db->getRow($rs)) { |
238 | - $sitemenu['module' . $row['id']] = array( |
|
239 | - 'module' . $row['id'], |
|
238 | + $sitemenu['module'.$row['id']] = array( |
|
239 | + 'module'.$row['id'], |
|
240 | 240 | 'modules', |
241 | - ($row['icon'] != '' ? '<i class="'.$row['icon'].'"></i>' : '<i class="'.$_style['icons_module'].'"></i>') . $row['name'], |
|
242 | - 'index.php?a=112&id=' . $row['id'], |
|
241 | + ($row['icon'] != '' ? '<i class="'.$row['icon'].'"></i>' : '<i class="'.$_style['icons_module'].'"></i>').$row['name'], |
|
242 | + 'index.php?a=112&id='.$row['id'], |
|
243 | 243 | $row['name'], |
244 | 244 | '', |
245 | 245 | '', |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | |
255 | 255 | // security menu items (users) |
256 | 256 | |
257 | -if($modx->hasPermission('edit_user')) { |
|
257 | +if ($modx->hasPermission('edit_user')) { |
|
258 | 258 | $sitemenu['user_management_title'] = array( |
259 | 259 | 'user_management_title', |
260 | 260 | 'users', |
261 | - '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
261 | + '<i class="fa fa fa-user"></i>'.$_lang['user_management_title'].'<i class="fa fa-angle-right toggle"></i>', |
|
262 | 262 | 'index.php?a=75', |
263 | 263 | $_lang['user_management_title'], |
264 | 264 | '', |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | ); |
271 | 271 | } |
272 | 272 | |
273 | -if($modx->hasPermission('edit_web_user')) { |
|
273 | +if ($modx->hasPermission('edit_web_user')) { |
|
274 | 274 | $sitemenu['web_user_management_title'] = array( |
275 | 275 | 'web_user_management_title', |
276 | 276 | 'users', |
277 | - '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
277 | + '<i class="fa fa-users"></i>'.$_lang['web_user_management_title'].'<i class="fa fa-angle-right toggle"></i>', |
|
278 | 278 | 'index.php?a=99', |
279 | 279 | $_lang['web_user_management_title'], |
280 | 280 | '', |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | ); |
287 | 287 | } |
288 | 288 | |
289 | -if($modx->hasPermission('edit_role')) { |
|
289 | +if ($modx->hasPermission('edit_role')) { |
|
290 | 290 | $sitemenu['role_management_title'] = array( |
291 | 291 | 'role_management_title', |
292 | 292 | 'users', |
293 | - '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
293 | + '<i class="fa fa-legal"></i>'.$_lang['role_management_title'], |
|
294 | 294 | 'index.php?a=86', |
295 | 295 | $_lang['role_management_title'], |
296 | 296 | '', |
@@ -302,11 +302,11 @@ discard block |
||
302 | 302 | ); |
303 | 303 | } |
304 | 304 | |
305 | -if($modx->hasPermission('access_permissions')) { |
|
305 | +if ($modx->hasPermission('access_permissions')) { |
|
306 | 306 | $sitemenu['manager_permissions'] = array( |
307 | 307 | 'manager_permissions', |
308 | 308 | 'users', |
309 | - '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
309 | + '<i class="fa fa-male"></i>'.$_lang['manager_permissions'], |
|
310 | 310 | 'index.php?a=40', |
311 | 311 | $_lang['manager_permissions'], |
312 | 312 | '', |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | ); |
319 | 319 | } |
320 | 320 | |
321 | -if($modx->hasPermission('web_access_permissions')) { |
|
321 | +if ($modx->hasPermission('web_access_permissions')) { |
|
322 | 322 | $sitemenu['web_permissions'] = array( |
323 | 323 | 'web_permissions', |
324 | 324 | 'users', |
325 | - '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
325 | + '<i class="fa fa-universal-access"></i>'.$_lang['web_permissions'], |
|
326 | 326 | 'index.php?a=91', |
327 | 327 | $_lang['web_permissions'], |
328 | 328 | '', |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $sitemenu['refresh_site'] = array( |
340 | 340 | 'refresh_site', |
341 | 341 | 'tools', |
342 | - '<i class="fa fa-recycle"></i>' . $_lang['refresh_site'], |
|
342 | + '<i class="fa fa-recycle"></i>'.$_lang['refresh_site'], |
|
343 | 343 | 'index.php?a=26', |
344 | 344 | $_lang['refresh_site'], |
345 | 345 | '', |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | 'a', // tag |
354 | 354 | 'javascript:;', // href |
355 | 355 | 'btn btn-secondary', // class or btn-success |
356 | - 'modx.popup({url:\'index.php?a=26\', title:\'' . $_lang['refresh_site'] . '\', icon: \'fa-recycle\', iframe: \'ajax\', selector: \'.tab-page>.container\', position: \'right top\', width: \'auto\', maxheight: \'50%\', wrap: \'body\' })', // onclick |
|
356 | + 'modx.popup({url:\'index.php?a=26\', title:\''.$_lang['refresh_site'].'\', icon: \'fa-recycle\', iframe: \'ajax\', selector: \'.tab-page>.container\', position: \'right top\', width: \'auto\', maxheight: \'50%\', wrap: \'body\' })', // onclick |
|
357 | 357 | $_lang['refresh_site'], // title |
358 | 358 | '<i class="fa fa-recycle"></i>' // innerHTML |
359 | 359 | ) |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $sitemenu['search'] = array( |
364 | 364 | 'search', |
365 | 365 | 'tools', |
366 | - '<i class="fa fa-search"></i>' . $_lang['search'], |
|
366 | + '<i class="fa fa-search"></i>'.$_lang['search'], |
|
367 | 367 | 'index.php?a=71', |
368 | 368 | $_lang['search'], |
369 | 369 | '', |
@@ -374,11 +374,11 @@ discard block |
||
374 | 374 | '' |
375 | 375 | ); |
376 | 376 | |
377 | -if($modx->hasPermission('bk_manager')) { |
|
377 | +if ($modx->hasPermission('bk_manager')) { |
|
378 | 378 | $sitemenu['bk_manager'] = array( |
379 | 379 | 'bk_manager', |
380 | 380 | 'tools', |
381 | - '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
381 | + '<i class="fa fa-database"></i>'.$_lang['bk_manager'], |
|
382 | 382 | 'index.php?a=93', |
383 | 383 | $_lang['bk_manager'], |
384 | 384 | '', |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | ); |
391 | 391 | } |
392 | 392 | |
393 | -if($modx->hasPermission('remove_locks')) { |
|
393 | +if ($modx->hasPermission('remove_locks')) { |
|
394 | 394 | $sitemenu['remove_locks'] = array( |
395 | 395 | 'remove_locks', |
396 | 396 | 'tools', |
397 | - '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
397 | + '<i class="fa fa-hourglass"></i>'.$_lang['remove_locks'], |
|
398 | 398 | 'javascript:modx.removeLocks();', |
399 | 399 | $_lang['remove_locks'], |
400 | 400 | '', |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | ); |
407 | 407 | } |
408 | 408 | |
409 | -if($modx->hasPermission('import_static')) { |
|
409 | +if ($modx->hasPermission('import_static')) { |
|
410 | 410 | $sitemenu['import_site'] = array( |
411 | 411 | 'import_site', |
412 | 412 | 'tools', |
413 | - '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
413 | + '<i class="fa fa-upload"></i>'.$_lang['import_site'], |
|
414 | 414 | 'index.php?a=95', |
415 | 415 | $_lang['import_site'], |
416 | 416 | '', |
@@ -422,11 +422,11 @@ discard block |
||
422 | 422 | ); |
423 | 423 | } |
424 | 424 | |
425 | -if($modx->hasPermission('export_static')) { |
|
425 | +if ($modx->hasPermission('export_static')) { |
|
426 | 426 | $sitemenu['export_site'] = array( |
427 | 427 | 'export_site', |
428 | 428 | 'tools', |
429 | - '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
429 | + '<i class="fa fa-download"></i>'.$_lang['export_site'], |
|
430 | 430 | 'index.php?a=83', |
431 | 431 | $_lang['export_site'], |
432 | 432 | '', |
@@ -439,20 +439,20 @@ discard block |
||
439 | 439 | } |
440 | 440 | |
441 | 441 | $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu)); |
442 | -if(is_array($menu)) { |
|
442 | +if (is_array($menu)) { |
|
443 | 443 | $newmenu = array(); |
444 | - foreach($menu as $item){ |
|
445 | - if(is_array(unserialize($item))){ |
|
444 | + foreach ($menu as $item) { |
|
445 | + if (is_array(unserialize($item))) { |
|
446 | 446 | $newmenu = array_merge($newmenu, unserialize($item)); |
447 | 447 | } |
448 | 448 | } |
449 | - if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
449 | + if (count($newmenu) > 0) $sitemenu = $newmenu; |
|
450 | 450 | } |
451 | 451 | |
452 | -if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) { |
|
453 | - include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
452 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/includes/menu.class.inc.php')) { |
|
453 | + include_once(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/includes/menu.class.inc.php'); |
|
454 | 454 | } else { |
455 | - include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
455 | + include_once(MODX_MANAGER_PATH.'includes/menu.class.inc.php'); |
|
456 | 456 | } |
457 | 457 | $menu = new EVOmenu(); |
458 | 458 | $menu->Build($sitemenu, array( |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | if (isset($_COOKIE['MODX_themeColor'])) { |
20 | - $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
|
20 | + $body_class .= ' '.$_COOKIE['MODX_themeColor']; |
|
21 | 21 | } else { |
22 | 22 | $body_class .= ' dark'; |
23 | 23 | } |
24 | 24 | |
25 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime; |
|
25 | +$css = 'media/style/'.$modx->config['manager_theme'].'/style.css?v='.$lastInstallTime; |
|
26 | 26 | |
27 | 27 | if ($modx->config['manager_theme'] == 'default') { |
28 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
29 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
28 | + if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) { |
|
29 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
30 | 30 | $minifier = new Formatter\CSSMinify(); |
31 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
32 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
33 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css'); |
|
34 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css'); |
|
35 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css'); |
|
36 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css'); |
|
37 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css'); |
|
38 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css'); |
|
39 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css'); |
|
40 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css'); |
|
41 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'); |
|
31 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
32 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
33 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css'); |
|
34 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css'); |
|
35 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css'); |
|
36 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css'); |
|
37 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css'); |
|
38 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css'); |
|
39 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css'); |
|
40 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css'); |
|
41 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'); |
|
42 | 42 | $css = $minifier->minify(); |
43 | - file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
|
43 | + file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css); |
|
44 | 44 | } |
45 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
46 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
45 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
46 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
59 | 59 | <link rel="stylesheet" type="text/css" href="<?= $css ?>" /> |
60 | 60 | <script type="text/javascript" src="media/script/tabpane.js"></script> |
61 | - <?= sprintf('<script type="text/javascript" src="%s"></script>' . "\n", $modx->config['mgr_jquery_path']) ?> |
|
61 | + <?= sprintf('<script type="text/javascript" src="%s"></script>'."\n", $modx->config['mgr_jquery_path']) ?> |
|
62 | 62 | <?php if ($modx->config['show_picker'] != "0") { ?> |
63 | 63 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/color.switcher.js" type="text/javascript"></script> |
64 | 64 | <?php } ?> |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | <?php } ?> |
71 | 71 | |
72 | 72 | <!-- OnManagerMainFrameHeaderHTMLBlock --> |
73 | - <?= $onManagerMainFrameHeaderHTMLBlock . "\n" ?> |
|
73 | + <?= $onManagerMainFrameHeaderHTMLBlock."\n" ?> |
|
74 | 74 | |
75 | 75 | <script type="text/javascript"> |
76 | 76 | /* <![CDATA[ */ |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | <?php |
368 | 368 | if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
369 | - echo 'doRefresh(' . $_REQUEST['r'] . ");\n"; |
|
369 | + echo 'doRefresh('.$_REQUEST['r'].");\n"; |
|
370 | 370 | } |
371 | 371 | ?> |
372 | 372 |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | // andrazk 20070416 - if installer is running, destroy active sessions |
21 | -if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
|
22 | - include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
21 | +if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) { |
|
22 | + include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
23 | 23 | if (isset($installStartTime)) { |
24 | 24 | if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
25 | 25 | unset($installStartTime); |
26 | - @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
|
27 | - unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
26 | + @ chmod(MODX_BASE_PATH.'assets/cache/installProc.inc.php', 0755); |
|
27 | + unlink(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
28 | 28 | } else { |
29 | 29 | if ($_SERVER['REQUEST_METHOD'] != 'POST') { |
30 | 30 | if (isset($_COOKIE[session_name()])) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | // setcookie(session_name(), '', 0, MODX_BASE_URL); |
51 | 51 | } |
52 | 52 | header('HTTP/1.0 307 Redirect'); |
53 | - header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2'); |
|
53 | + header('Location: '.MODX_MANAGER_URL.'index.php?installGoingOn=2'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // establish fallback to English default |
63 | 63 | include_once "lang/english.inc.php"; |
64 | 64 | // include localized overrides |
65 | - include_once "lang/" . $manager_language . ".inc.php"; |
|
65 | + include_once "lang/".$manager_language.".inc.php"; |
|
66 | 66 | } else { |
67 | 67 | include_once "lang/english.inc.php"; |
68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
71 | 71 | $modx->setPlaceholder('theme', $manager_theme); |
72 | 72 | $modx->setPlaceholder('favicon', |
73 | - (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico')); |
|
73 | + (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico')); |
|
74 | 74 | |
75 | 75 | // invoke OnManagerLoginFormPrerender event |
76 | 76 | $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender'); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
83 | 83 | $modx->setPlaceholder('login_message', $_lang["login_message"]); |
84 | 84 | $modx->setPlaceholder('manager_theme_url', |
85 | - MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
85 | + MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
86 | 86 | $modx->setPlaceholder('year', date('Y')); |
87 | 87 | $modx->setPlaceholder('manager_theme_style', |
88 | 88 | (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : 'dark')); |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | switch ($installGoingOn) { |
96 | 96 | case 1 : |
97 | 97 | $modx->setPlaceholder('login_message', |
98 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
98 | + "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>"); |
|
99 | 99 | break; |
100 | 100 | case 2 : |
101 | 101 | $modx->setPlaceholder('login_message', |
102 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
102 | + "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>"); |
|
103 | 103 | break; |
104 | 104 | } |
105 | 105 | } |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | if ($modx->config['use_captcha'] == 1) { |
108 | 108 | $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
109 | 109 | $modx->setPlaceholder('captcha_image', |
110 | - '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>'); |
|
110 | + '<a href="'.MODX_MANAGER_URL.'" class="loginCaptcha"><img id="captcha_image" src="'.MODX_MANAGER_URL.'includes/veriword.php?rand='.rand().'" alt="'.$_lang["login_captcha_message"].'" /></a>'); |
|
111 | 111 | $modx->setPlaceholder('captcha_input', |
112 | - '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
112 | + '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // login info |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | // invoke OnManagerLoginFormRender event |
129 | 129 | $evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
130 | - $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
130 | + $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : ''; |
|
131 | 131 | $modx->setPlaceholder('OnManagerLoginFormRender', $html); |
132 | 132 | |
133 | 133 | // load template |
@@ -145,29 +145,29 @@ discard block |
||
145 | 145 | $login_tpl = file_get_contents($target); |
146 | 146 | } |
147 | 147 | } else { |
148 | - $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
149 | - if (is_file($theme_path . 'style.php')) { |
|
150 | - include($theme_path . 'style.php'); |
|
148 | + $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/'; |
|
149 | + if (is_file($theme_path.'style.php')) { |
|
150 | + include($theme_path.'style.php'); |
|
151 | 151 | } |
152 | 152 | $chunk = $modx->getChunk($target); |
153 | 153 | if ($chunk !== false && !empty($chunk)) { |
154 | 154 | $login_tpl = $chunk; |
155 | - } elseif (is_file(MODX_BASE_PATH . $target)) { |
|
156 | - $target = MODX_BASE_PATH . $target; |
|
155 | + } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
156 | + $target = MODX_BASE_PATH.$target; |
|
157 | 157 | $login_tpl = file_get_contents($target); |
158 | 158 | } elseif (is_file($target)) { |
159 | 159 | $login_tpl = file_get_contents($target); |
160 | - } elseif (is_file($theme_path . 'login.tpl')) { |
|
161 | - $target = $theme_path . 'login.tpl'; |
|
160 | + } elseif (is_file($theme_path.'login.tpl')) { |
|
161 | + $target = $theme_path.'login.tpl'; |
|
162 | 162 | $login_tpl = file_get_contents($target); |
163 | - } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
|
164 | - $target = $theme_path . 'templates/actions/login.tpl'; |
|
163 | + } elseif (is_file($theme_path.'templates/actions/login.tpl')) { |
|
164 | + $target = $theme_path.'templates/actions/login.tpl'; |
|
165 | 165 | $login_tpl = file_get_contents($target); |
166 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
167 | - $target = $theme_path . 'html/login.html'; |
|
166 | + } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible |
|
167 | + $target = $theme_path.'html/login.html'; |
|
168 | 168 | $login_tpl = file_get_contents($target); |
169 | 169 | } else { |
170 | - $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
170 | + $target = MODX_MANAGER_PATH.'media/style/common/login.tpl'; |
|
171 | 171 | $login_tpl = file_get_contents($target); |
172 | 172 | } |
173 | 173 | } |
@@ -187,17 +187,17 @@ discard block |
||
187 | 187 | $modx->updateValidatedUserSession(); |
188 | 188 | |
189 | 189 | // Update last action in table active_users |
190 | - $itemid = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
190 | + $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
191 | 191 | $lasthittime = time(); |
192 | - $action = isset($_REQUEST['a']) ? (int)$_REQUEST['a'] : 1; |
|
192 | + $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
|
193 | 193 | |
194 | 194 | if ($action !== 1) { |
195 | - if ((int)$itemid <= 0) { |
|
195 | + if ((int) $itemid <= 0) { |
|
196 | 196 | $itemid = null; |
197 | 197 | } |
198 | 198 | $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", |
199 | 199 | $modx->getFullTableName('active_users') // Table |
200 | - , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string)$action, |
|
200 | + , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, |
|
201 | 201 | $itemid == null ? var_export(null, true) : $itemid); |
202 | 202 | $modx->db->query($sql); |
203 | 203 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | header("X-XSS-Protection: 0"); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | if (isset($_COOKIE['MODX_themeColor'])) { |
49 | - $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
|
49 | + $body_class .= ' '.$_COOKIE['MODX_themeColor']; |
|
50 | 50 | } else { |
51 | 51 | $body_class .= ' dark'; |
52 | 52 | } |
@@ -76,36 +76,36 @@ discard block |
||
76 | 76 | $user['which_browser'] = $modx->config['which_browser']; |
77 | 77 | } |
78 | 78 | |
79 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
|
79 | +$css = 'media/style/'.$modx->config['manager_theme'].'/css/page.css?v='.$lastInstallTime; |
|
80 | 80 | |
81 | 81 | if ($modx->config['manager_theme'] == 'default') { |
82 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
83 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
82 | + if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) { |
|
83 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
84 | 84 | $minifier = new Formatter\CSSMinify(); |
85 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
86 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
87 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css'); |
|
88 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css'); |
|
89 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css'); |
|
90 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css'); |
|
91 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css'); |
|
92 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css'); |
|
93 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css'); |
|
94 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css'); |
|
95 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'); |
|
85 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
86 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
87 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css'); |
|
88 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css'); |
|
89 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css'); |
|
90 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css'); |
|
91 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css'); |
|
92 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css'); |
|
93 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css'); |
|
94 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css'); |
|
95 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'); |
|
96 | 96 | $css = $minifier->minify(); |
97 | - file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
|
97 | + file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css); |
|
98 | 98 | } |
99 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
100 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
99 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
100 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | -$modx->config['global_tabs'] = (int)($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin'))); |
|
104 | +$modx->config['global_tabs'] = (int) ($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin'))); |
|
105 | 105 | |
106 | 106 | ?> |
107 | 107 | <!DOCTYPE html> |
108 | -<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="') . $mxla . '" xml:lang="' . $mxla . '"' ?>> |
|
108 | +<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="').$mxla.'" xml:lang="'.$mxla.'"' ?>> |
|
109 | 109 | <head> |
110 | 110 | <title><?= $site_name ?>- (EVO CMS Manager)</title> |
111 | 111 | <meta http-equiv="Content-Type" content="text/html; charset=<?= $modx_manager_charset ?>" /> |
@@ -136,20 +136,20 @@ discard block |
||
136 | 136 | MODX_SITE_URL: '<?= MODX_SITE_URL ?>', |
137 | 137 | MODX_MANAGER_URL: '<?= MODX_MANAGER_URL ?>', |
138 | 138 | user: { |
139 | - role: <?= (int)$user['role'] ?>, |
|
139 | + role: <?= (int) $user['role'] ?>, |
|
140 | 140 | username: '<?= $user['username'] ?>' |
141 | 141 | }, |
142 | 142 | config: { |
143 | 143 | mail_check_timeperiod: <?= $modx->config['mail_check_timeperiod'] ?>, |
144 | - menu_height: <?= (int)$menu_height ?>, |
|
145 | - tree_width: <?= (int)$tree_width ?>, |
|
146 | - tree_min_width: <?= (int)$tree_min_width ?>, |
|
147 | - session_timeout: <?= (int)$modx->config['session_timeout'] ?>, |
|
148 | - site_start: <?= (int)$modx->config['site_start'] ?>, |
|
149 | - tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int)$modx->config['tree_page_click'] : 27) ?>, |
|
144 | + menu_height: <?= (int) $menu_height ?>, |
|
145 | + tree_width: <?= (int) $tree_width ?>, |
|
146 | + tree_min_width: <?= (int) $tree_min_width ?>, |
|
147 | + session_timeout: <?= (int) $modx->config['session_timeout'] ?>, |
|
148 | + site_start: <?= (int) $modx->config['site_start'] ?>, |
|
149 | + tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int) $modx->config['tree_page_click'] : 27) ?>, |
|
150 | 150 | theme: '<?= $modx->config['manager_theme'] ?>', |
151 | 151 | which_browser: '<?= $user['which_browser'] ?>', |
152 | - layout: <?= (int)$manager_layout ?>, |
|
152 | + layout: <?= (int) $manager_layout ?>, |
|
153 | 153 | textdir: '<?= $modx_textdir ?>', |
154 | 154 | global_tabs: <?= $modx->config['global_tabs'] ?> |
155 | 155 | |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | delete a[b]; |
235 | 235 | }, |
236 | 236 | openedArray: [], |
237 | - lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . "\n" ?> |
|
237 | + lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)."\n" ?> |
|
238 | 238 | }; |
239 | 239 | <?php |
240 | 240 | $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray']))); |
241 | - echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n"; |
|
241 | + echo (empty($opened) ? '' : 'modx.openedArray['.implode("] = 1;\n modx.openedArray[", $opened).'] = 1;')."\n"; |
|
242 | 242 | ?> |
243 | 243 | </script> |
244 | 244 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/modx.min.js?v=<?= $lastInstallTime ?>"></script> |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | <a href="javascript:;" class="dropdown-toggle" onclick="return false;"> |
321 | 321 | <span class="username"><?= $user['username'] ?></span> |
322 | 322 | <?php if ($user['photo']) { ?> |
323 | - <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL . $user['photo'] ?>);"></span> |
|
323 | + <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL.$user['photo'] ?>);"></span> |
|
324 | 324 | <?php } else { ?> |
325 | 325 | <span class="icon"><?= $_style['menu_user'] ?></span> |
326 | 326 | <?php } ?> |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $version = 'Evolution'; |
348 | 348 | ?> |
349 | 349 | <?php |
350 | - echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>' . $version . ' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']); |
|
350 | + echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>'.$version.' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']); |
|
351 | 351 | ?> |
352 | 352 | </ul> |
353 | 353 | </li> |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | */ |
529 | 529 | function constructLink($action, $img, $text, $allowed) |
530 | 530 | { |
531 | - if ((bool)$allowed) { |
|
531 | + if ((bool) $allowed) { |
|
532 | 532 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action); |
533 | 533 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text); |
534 | 534 | } |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | <script type="text/javascript"> |
540 | 540 | |
541 | 541 | if (document.getElementById('treeMenu')) { |
542 | - <?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
542 | + <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
543 | 543 | |
544 | 544 | document.getElementById('treeMenu_openelements').onclick = function(e) { |
545 | 545 | e.preventDefault(); |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | } |
558 | 558 | }; |
559 | 559 | <?php } ?> |
560 | - <?php if($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
560 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
561 | 561 | |
562 | 562 | document.getElementById('treeMenu_openimages').onclick = function(e) { |
563 | 563 | e.preventDefault(); |
564 | 564 | if (modx.config.global_tabs && !e.shiftKey) { |
565 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'}); |
|
565 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'}); |
|
566 | 566 | } else { |
567 | 567 | var randomNum = '<?= $_lang["files_files"] ?>'; |
568 | 568 | if (e.shiftKey) { |
@@ -575,12 +575,12 @@ discard block |
||
575 | 575 | } |
576 | 576 | }; |
577 | 577 | <?php } ?> |
578 | - <?php if($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
578 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
579 | 579 | |
580 | 580 | document.getElementById('treeMenu_openfiles').onclick = function(e) { |
581 | 581 | e.preventDefault(); |
582 | 582 | if (modx.config.global_tabs && !e.shiftKey) { |
583 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'}); |
|
583 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'}); |
|
584 | 584 | } else { |
585 | 585 | var randomNum = '<?= $_lang["files_files"] ?>'; |
586 | 586 | if (e.shiftKey) { |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | |
635 | 635 | </div> |
636 | 636 | <?php if ($modx->config['show_picker'] != "0") { |
637 | - include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php'); |
|
637 | + include('media/style/'.$modx->config['manager_theme'].'/color.switcher.php'); |
|
638 | 638 | } ?> |
639 | 639 | </body> |
640 | 640 | </html> |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function __call($method_name, $arguments) |
207 | 207 | { |
208 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
208 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
209 | 209 | if (method_exists($this->old, $method_name)) { |
210 | 210 | $error_type = 1; |
211 | 211 | } else { |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | $info = debug_backtrace(); |
224 | 224 | $m[] = $msg; |
225 | 225 | if (!empty($this->currentSnippet)) { |
226 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
226 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
227 | 227 | } elseif (!empty($this->event->activePlugin)) { |
228 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
228 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
229 | 229 | } |
230 | 230 | $m[] = $this->decoded_request_uri; |
231 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
231 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
232 | 232 | $msg = implode('<br />', $m); |
233 | 233 | $this->logEvent(0, $error_type, $msg, $title); |
234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | $flag = false; |
247 | 247 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
248 | - $flag = (bool)$this->{$connector}->conn; |
|
248 | + $flag = (bool) $this->{$connector}->conn; |
|
249 | 249 | } |
250 | 250 | return $flag; |
251 | 251 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | if (!$out && $flag) { |
274 | 274 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
275 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
275 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
276 | 276 | $out = is_file($filename) ? include $filename : false; |
277 | 277 | } |
278 | 278 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | public function getMicroTime() |
290 | 290 | { |
291 | 291 | list ($usec, $sec) = explode(' ', microtime()); |
292 | - return ((float)$usec + (float)$sec); |
|
292 | + return ((float) $usec + (float) $sec); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | // append the redirect count string to the url |
314 | 314 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
315 | 315 | if ($currentNumberOfRedirects > 3) { |
316 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
316 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
317 | 317 | } else { |
318 | 318 | $currentNumberOfRedirects += 1; |
319 | 319 | if (strpos($url, "?") > 0) { |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | if ($type == 'REDIRECT_REFRESH') { |
327 | - $header = 'Refresh: 0;URL=' . $url; |
|
327 | + $header = 'Refresh: 0;URL='.$url; |
|
328 | 328 | } elseif ($type == 'REDIRECT_META') { |
329 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
329 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
330 | 330 | echo $header; |
331 | 331 | exit; |
332 | 332 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | global $base_url, $site_url; |
335 | 335 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
336 | 336 | // append $site_url to make it work with Location: |
337 | - $url = $site_url . substr($url, strlen($base_url)); |
|
337 | + $url = $site_url.substr($url, strlen($base_url)); |
|
338 | 338 | } |
339 | 339 | if (strpos($url, "\n") === false) { |
340 | - $header = 'Location: ' . $url; |
|
340 | + $header = 'Location: '.$url; |
|
341 | 341 | } else { |
342 | 342 | $this->messageQuit('No newline allowed in redirect url.'); |
343 | 343 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | header($responseCode); |
347 | 347 | } |
348 | 348 | |
349 | - if(!empty($header)) { |
|
349 | + if (!empty($header)) { |
|
350 | 350 | header($header); |
351 | 351 | } |
352 | 352 | |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | |
452 | 452 | private function recoverySiteCache() |
453 | 453 | { |
454 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
455 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
454 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
455 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
456 | 456 | |
457 | 457 | if (is_file($site_cache_path)) { |
458 | 458 | include($site_cache_path); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | return; |
462 | 462 | } |
463 | 463 | |
464 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
464 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
465 | 465 | $cache = new synccache(); |
466 | 466 | $cache->setCachepath($site_cache_dir); |
467 | 467 | $cache->setReport(false); |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | $this->invokeEvent("OnBeforeManagerPageInit"); |
514 | 514 | } |
515 | 515 | |
516 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
517 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
516 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
517 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
518 | 518 | } else { |
519 | 519 | if ($usrType == 'web') { |
520 | 520 | $from = $tbl_web_user_settings; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
535 | 535 | } |
536 | 536 | if (isset ($usrType)) { |
537 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
537 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
538 | 538 | } // store user settings in session |
539 | 539 | } |
540 | 540 | } |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | $suf = $this->config['friendly_url_suffix']; |
680 | 680 | $pre = preg_quote($pre, '/'); |
681 | 681 | $suf = preg_quote($suf, '/'); |
682 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
682 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
683 | 683 | $q = $_[1]; |
684 | 684 | } |
685 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
685 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
686 | 686 | $q = $_[1]; |
687 | 687 | } |
688 | 688 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
705 | 705 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
706 | 706 | if ($this->config['use_alias_path'] == 1) { |
707 | - if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
707 | + if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
708 | 708 | $this->documentMethod = 'id'; |
709 | 709 | return $q; |
710 | 710 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | */ |
739 | 739 | public function getHashFile($key) |
740 | 740 | { |
741 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
741 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
@@ -749,9 +749,9 @@ discard block |
||
749 | 749 | $hash = $id; |
750 | 750 | $tmp = null; |
751 | 751 | $params = array(); |
752 | - if(!empty($this->systemCacheKey)){ |
|
752 | + if (!empty($this->systemCacheKey)) { |
|
753 | 753 | $hash = $this->systemCacheKey; |
754 | - }else { |
|
754 | + } else { |
|
755 | 755 | if (!empty($_GET)) { |
756 | 756 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
757 | 757 | $params = $_GET; |
@@ -759,8 +759,8 @@ discard block |
||
759 | 759 | $hash .= '_'.md5(http_build_query($params)); |
760 | 760 | } |
761 | 761 | } |
762 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
763 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
762 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
763 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
764 | 764 | $tmp = array_pop($evtOut); |
765 | 765 | } |
766 | 766 | return empty($tmp) ? $hash : $tmp; |
@@ -902,12 +902,12 @@ discard block |
||
902 | 902 | if ($js = $this->getRegisteredClientStartupScripts()) { |
903 | 903 | // change to just before closing </head> |
904 | 904 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
905 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
905 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | // Insert jscripts & html block into template - template must have a </body> tag |
909 | 909 | if ($js = $this->getRegisteredClientScripts()) { |
910 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
910 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
911 | 911 | } |
912 | 912 | // End fix by sirlancelot |
913 | 913 | |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | // send out content-type and content-disposition headers |
919 | 919 | if (IN_PARSER_MODE == "true") { |
920 | 920 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
921 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
921 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
922 | 922 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
923 | 923 | // header('HTTP/1.0 404 Not Found'); |
924 | 924 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $name = preg_replace('|-+|', '-', $name); |
937 | 937 | $name = trim($name, '-'); |
938 | 938 | } |
939 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
939 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
940 | 940 | header($header); |
941 | 941 | } |
942 | 942 | } |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | |
945 | 945 | $stats = $this->getTimerStats($this->tstart); |
946 | 946 | |
947 | - $out =& $this->documentOutput; |
|
947 | + $out = & $this->documentOutput; |
|
948 | 948 | $out = str_replace("[^q^]", $stats['queries'], $out); |
949 | 949 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
950 | 950 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -983,17 +983,17 @@ discard block |
||
983 | 983 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
984 | 984 | $tt += $t; |
985 | 985 | } |
986 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
986 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
987 | 987 | echo $this->snippetsCode; |
988 | 988 | } |
989 | 989 | if ($this->dumpPlugins) { |
990 | 990 | $ps = ""; |
991 | 991 | $tt = 0; |
992 | 992 | foreach ($this->pluginsTime as $s => $t) { |
993 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
993 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
994 | 994 | $tt += $t; |
995 | 995 | } |
996 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
996 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
997 | 997 | echo $this->pluginsCode; |
998 | 998 | } |
999 | 999 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $srcTags = explode(',', $tags); |
1020 | 1020 | $repTags = array(); |
1021 | 1021 | foreach ($srcTags as $tag) { |
1022 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1022 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1023 | 1023 | } |
1024 | 1024 | return array($srcTags, $repTags); |
1025 | 1025 | } |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1042 | 1042 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1043 | 1043 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1044 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1044 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1045 | 1045 | |
1046 | 1046 | return $stats; |
1047 | 1047 | } |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | { |
1075 | 1075 | $cacheRefreshTime = 0; |
1076 | 1076 | $recent_update = 0; |
1077 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1077 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1078 | 1078 | $this->recentUpdate = $recent_update; |
1079 | 1079 | |
1080 | 1080 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1128,8 +1128,8 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | $docObjSerial = serialize($this->documentObject); |
1131 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1132 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1131 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1132 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1133 | 1133 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1134 | 1134 | } |
1135 | 1135 | } |
@@ -1171,16 +1171,16 @@ discard block |
||
1171 | 1171 | return array(); |
1172 | 1172 | } |
1173 | 1173 | $spacer = md5('<<<EVO>>>'); |
1174 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1175 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1176 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1177 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1174 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
1175 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
1176 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
1177 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
1178 | 1178 | |
1179 | 1179 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1180 | 1180 | $pos[']]>'] = strpos($content, ']]>'); |
1181 | 1181 | |
1182 | 1182 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1183 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1183 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | $lp = explode($left, $content); |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | } |
1245 | 1245 | } |
1246 | 1246 | } |
1247 | - foreach($tags as $i=>$tag) { |
|
1248 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1247 | + foreach ($tags as $i=>$tag) { |
|
1248 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1249 | 1249 | } |
1250 | 1250 | return $tags; |
1251 | 1251 | } |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | foreach ($matches[1] as $i => $key) { |
1288 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1288 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1289 | 1289 | if (substr($key, 0, 1) == '#') { |
1290 | 1290 | $key = substr($key, 1); |
1291 | 1291 | } // remove # for QuickEdit format |
@@ -1305,8 +1305,8 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | if (is_array($value)) { |
1308 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1309 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1308 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1309 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1310 | 1310 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1311 | 1311 | } |
1312 | 1312 | |
@@ -1317,8 +1317,8 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | if (strpos($content, $s) !== false) { |
1319 | 1319 | $content = str_replace($s, $value, $content); |
1320 | - } elseif($this->debug) { |
|
1321 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1320 | + } elseif ($this->debug) { |
|
1321 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1322 | 1322 | } |
1323 | 1323 | } |
1324 | 1324 | |
@@ -1485,8 +1485,8 @@ discard block |
||
1485 | 1485 | $s = &$matches[0][$i]; |
1486 | 1486 | if (strpos($content, $s) !== false) { |
1487 | 1487 | $content = str_replace($s, $value, $content); |
1488 | - } elseif($this->debug) { |
|
1489 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1488 | + } elseif ($this->debug) { |
|
1489 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1490 | 1490 | } |
1491 | 1491 | } |
1492 | 1492 | return $content; |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1542 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1542 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1543 | 1543 | if ($this->config['enable_at_syntax']) { |
1544 | 1544 | $value = $this->mergeConditionalTagsContent($value); |
1545 | 1545 | } |
@@ -1554,8 +1554,8 @@ discard block |
||
1554 | 1554 | $s = &$matches[0][$i]; |
1555 | 1555 | if (strpos($content, $s) !== false) { |
1556 | 1556 | $content = str_replace($s, $value, $content); |
1557 | - } elseif($this->debug) { |
|
1558 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1557 | + } elseif ($this->debug) { |
|
1558 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | return $content; |
@@ -1613,8 +1613,8 @@ discard block |
||
1613 | 1613 | $s = &$matches[0][$i]; |
1614 | 1614 | if (strpos($content, $s) !== false) { |
1615 | 1615 | $content = str_replace($s, $value, $content); |
1616 | - } elseif($this->debug) { |
|
1617 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1616 | + } elseif ($this->debug) { |
|
1617 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1618 | 1618 | } |
1619 | 1619 | } |
1620 | 1620 | return $content; |
@@ -1638,7 +1638,7 @@ discard block |
||
1638 | 1638 | return $content; |
1639 | 1639 | } |
1640 | 1640 | |
1641 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1641 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1642 | 1642 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1643 | 1643 | |
1644 | 1644 | $pieces = explode('<@IF:', $content); |
@@ -1649,7 +1649,7 @@ discard block |
||
1649 | 1649 | } |
1650 | 1650 | list($cmd, $text) = explode('>', $split, 2); |
1651 | 1651 | $cmd = str_replace("'", "\'", $cmd); |
1652 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1652 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1653 | 1653 | $content .= $text; |
1654 | 1654 | } |
1655 | 1655 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1660,13 +1660,13 @@ discard block |
||
1660 | 1660 | } |
1661 | 1661 | list($cmd, $text) = explode('>', $split, 2); |
1662 | 1662 | $cmd = str_replace("'", "\'", $cmd); |
1663 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1663 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1664 | 1664 | $content .= $text; |
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1668 | 1668 | ob_start(); |
1669 | - $content = eval('?>' . $content); |
|
1669 | + $content = eval('?>'.$content); |
|
1670 | 1670 | $content = ob_get_clean(); |
1671 | 1671 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1672 | 1672 | |
@@ -1791,7 +1791,7 @@ discard block |
||
1791 | 1791 | $matches = $this->getTagsFromContent($content, $left, $right); |
1792 | 1792 | if (!empty($matches)) { |
1793 | 1793 | foreach ($matches[0] as $i => $v) { |
1794 | - $addBreakMatches[$i] = $v . "\n"; |
|
1794 | + $addBreakMatches[$i] = $v."\n"; |
|
1795 | 1795 | } |
1796 | 1796 | $content = str_replace($addBreakMatches, '', $content); |
1797 | 1797 | if (strpos($content, $left) !== false) { |
@@ -1824,8 +1824,8 @@ discard block |
||
1824 | 1824 | $s = &$matches[0][$i]; |
1825 | 1825 | if (strpos($content, $s) !== false) { |
1826 | 1826 | $content = str_replace($s, $v, $content); |
1827 | - } elseif($this->debug) { |
|
1828 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1827 | + } elseif ($this->debug) { |
|
1828 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1829 | 1829 | } |
1830 | 1830 | } |
1831 | 1831 | return $content; |
@@ -1889,7 +1889,7 @@ discard block |
||
1889 | 1889 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1890 | 1890 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1891 | 1891 | if ($this->isBackend()) { |
1892 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1892 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1893 | 1893 | } |
1894 | 1894 | } |
1895 | 1895 | } else { |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1936 | 1936 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1937 | 1937 | if ($this->isBackend()) { |
1938 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1938 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1939 | 1939 | } |
1940 | 1940 | } |
1941 | 1941 | } |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | if (is_array($return) || is_object($return)) { |
1944 | 1944 | return $return; |
1945 | 1945 | } else { |
1946 | - return $echo . $return; |
|
1946 | + return $echo.$return; |
|
1947 | 1947 | } |
1948 | 1948 | } |
1949 | 1949 | |
@@ -1981,8 +1981,8 @@ discard block |
||
1981 | 1981 | } |
1982 | 1982 | if (strpos($content, $s) !== false) { |
1983 | 1983 | $content = str_replace($s, $value, $content); |
1984 | - } elseif($this->debug) { |
|
1985 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1984 | + } elseif ($this->debug) { |
|
1985 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1986 | 1986 | } |
1987 | 1987 | continue; |
1988 | 1988 | } |
@@ -1993,8 +1993,8 @@ discard block |
||
1993 | 1993 | |
1994 | 1994 | if (strpos($content, $s) !== false) { |
1995 | 1995 | $content = str_replace($s, $value, $content); |
1996 | - } elseif($this->debug) { |
|
1997 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1996 | + } elseif ($this->debug) { |
|
1997 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1998 | 1998 | } |
1999 | 1999 | } |
2000 | 2000 | |
@@ -2085,7 +2085,7 @@ discard block |
||
2085 | 2085 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2086 | 2086 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2087 | 2087 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2088 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2088 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2089 | 2089 | $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code); |
2090 | 2090 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2091 | 2091 | } |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2330 | 2330 | $count = $this->db->getRecordCount($rs); |
2331 | 2331 | if (1 < $count) { |
2332 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2332 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2333 | 2333 | } |
2334 | 2334 | if ($count) { |
2335 | 2335 | $row = $this->db->getRow($rs); |
@@ -2355,7 +2355,7 @@ discard block |
||
2355 | 2355 | public function toAlias($text) |
2356 | 2356 | { |
2357 | 2357 | $suff = $this->config['friendly_url_suffix']; |
2358 | - return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
2358 | + return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
2359 | 2359 | } |
2360 | 2360 | |
2361 | 2361 | /** |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | $suff = '/'; |
2388 | 2388 | } |
2389 | 2389 | |
2390 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2390 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2424,7 +2424,7 @@ discard block |
||
2424 | 2424 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2425 | 2425 | $ids = implode(',', array_unique($match['1'])); |
2426 | 2426 | if ($ids) { |
2427 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2427 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2428 | 2428 | while ($row = $this->db->getRow($res)) { |
2429 | 2429 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2430 | 2430 | $parent = $row['parent']; |
@@ -2435,7 +2435,7 @@ discard block |
||
2435 | 2435 | $parent = $this->aliasListing[$parent]['parent']; |
2436 | 2436 | } |
2437 | 2437 | |
2438 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2438 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2439 | 2439 | } else { |
2440 | 2440 | $aliases[$row['id']] = $row['alias']; |
2441 | 2441 | } |
@@ -2447,7 +2447,7 @@ discard block |
||
2447 | 2447 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2448 | 2448 | $pref = $this->config['friendly_url_prefix']; |
2449 | 2449 | $suff = $this->config['friendly_url_suffix']; |
2450 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2450 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2451 | 2451 | global $modx; |
2452 | 2452 | $thealias = $aliases[$m[1]]; |
2453 | 2453 | $thefolder = $isfolder[$m[1]]; |
@@ -2463,7 +2463,7 @@ discard block |
||
2463 | 2463 | |
2464 | 2464 | } else { |
2465 | 2465 | $in = '!\[\~([0-9]+)\~\]!is'; |
2466 | - $out = "index.php?id=" . '\1'; |
|
2466 | + $out = "index.php?id=".'\1'; |
|
2467 | 2467 | $documentSource = preg_replace($in, $out, $documentSource); |
2468 | 2468 | } |
2469 | 2469 | |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2485 | 2485 | $len_base_url = strlen($this->config['base_url']); |
2486 | 2486 | |
2487 | - $url_path = $q;//LANG |
|
2487 | + $url_path = $q; //LANG |
|
2488 | 2488 | |
2489 | 2489 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2490 | 2490 | $url_path = substr($url_path, $len_base_url); |
@@ -2496,7 +2496,7 @@ discard block |
||
2496 | 2496 | $strictURL = substr($strictURL, $len_base_url); |
2497 | 2497 | } |
2498 | 2498 | $http_host = $_SERVER['HTTP_HOST']; |
2499 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2499 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2500 | 2500 | |
2501 | 2501 | $site_url = $this->config['site_url']; |
2502 | 2502 | $url_query_string = explode('?', $_SERVER['REQUEST_URI'])[1]; |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | } |
2514 | 2514 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2515 | 2515 | if (empty($_POST)) { |
2516 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2516 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2517 | 2517 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2518 | 2518 | exit(0); |
2519 | 2519 | } |
@@ -2576,7 +2576,7 @@ discard block |
||
2576 | 2576 | $docgrp = implode(",", $docgrp); |
2577 | 2577 | } |
2578 | 2578 | // get document |
2579 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2579 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2580 | 2580 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2581 | 2581 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2582 | 2582 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2612,9 +2612,9 @@ discard block |
||
2612 | 2612 | } |
2613 | 2613 | if ($documentObject['template']) { |
2614 | 2614 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2615 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2616 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2617 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2615 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2616 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2617 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2618 | 2618 | $tmplvars = array(); |
2619 | 2619 | while ($row = $this->db->getRow($rs)) { |
2620 | 2620 | $tmplvars[$row['name']] = array( |
@@ -2660,7 +2660,7 @@ discard block |
||
2660 | 2660 | $st = md5($source); |
2661 | 2661 | } |
2662 | 2662 | if ($this->dumpSnippets == 1) { |
2663 | - $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2663 | + $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2664 | 2664 | } |
2665 | 2665 | |
2666 | 2666 | // invoke OnParseDocument event |
@@ -2702,7 +2702,7 @@ discard block |
||
2702 | 2702 | */ |
2703 | 2703 | public function executeParser() |
2704 | 2704 | { |
2705 | - if(MODX_CLI) { |
|
2705 | + if (MODX_CLI) { |
|
2706 | 2706 | throw new RuntimeException('Call DocumentParser::executeParser on CLI mode'); |
2707 | 2707 | } |
2708 | 2708 | |
@@ -2748,7 +2748,7 @@ discard block |
||
2748 | 2748 | |
2749 | 2749 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2750 | 2750 | if ($this->config['use_alias_path'] == 1) { |
2751 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2751 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2752 | 2752 | if (isset($this->documentListing[$alias])) { |
2753 | 2753 | $this->documentIdentifier = $this->documentListing[$alias]; |
2754 | 2754 | } else { |
@@ -2809,7 +2809,7 @@ discard block |
||
2809 | 2809 | } else { |
2810 | 2810 | $docAlias = $this->db->escape($this->documentIdentifier); |
2811 | 2811 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2812 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2812 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2813 | 2813 | } |
2814 | 2814 | } |
2815 | 2815 | $this->documentMethod = 'id'; |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | $_REQUEST[$n] = $_GET[$n] = $v; |
2867 | 2867 | } |
2868 | 2868 | } |
2869 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2869 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2870 | 2870 | $this->q = $qp['path']; |
2871 | 2871 | return $qp['path']; |
2872 | 2872 | } |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | $this->sendErrorPage(); |
2961 | 2961 | } else { |
2962 | 2962 | // Inculde the necessary files to check document permissions |
2963 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
2963 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
2964 | 2964 | $udperms = new udperms(); |
2965 | 2965 | $udperms->user = $this->getLoginUserID(); |
2966 | 2966 | $udperms->document = $this->documentIdentifier; |
@@ -3014,7 +3014,7 @@ discard block |
||
3014 | 3014 | while ($id && $height--) { |
3015 | 3015 | $thisid = $id; |
3016 | 3016 | if ($this->config['aliaslistingfolder'] == 1) { |
3017 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3017 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3018 | 3018 | if (!$id || $id == '0') { |
3019 | 3019 | break; |
3020 | 3020 | } |
@@ -3065,15 +3065,15 @@ discard block |
||
3065 | 3065 | |
3066 | 3066 | if ($this->config['aliaslistingfolder'] == 1) { |
3067 | 3067 | |
3068 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3068 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3069 | 3069 | $idx = array(); |
3070 | 3070 | while ($row = $this->db->getRow($res)) { |
3071 | 3071 | $pAlias = ''; |
3072 | 3072 | if (isset($this->aliasListing[$row['parent']])) { |
3073 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3074 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3073 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3074 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3075 | 3075 | }; |
3076 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3076 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3077 | 3077 | if ($row['isfolder'] == 1) { |
3078 | 3078 | $idx[] = $row['id']; |
3079 | 3079 | } |
@@ -3105,7 +3105,7 @@ discard block |
||
3105 | 3105 | $depth--; |
3106 | 3106 | |
3107 | 3107 | foreach ($documentMap_cache[$id] as $childId) { |
3108 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3108 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3109 | 3109 | if (!strlen($pkey)) { |
3110 | 3110 | $pkey = "{$childId}"; |
3111 | 3111 | } |
@@ -3134,7 +3134,7 @@ discard block |
||
3134 | 3134 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3135 | 3135 | $fnc = substr($url, 11); |
3136 | 3136 | } elseif ($url) { |
3137 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3137 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3138 | 3138 | } else { |
3139 | 3139 | $fnc = "history.back(-1);"; |
3140 | 3140 | } |
@@ -3143,7 +3143,7 @@ discard block |
||
3143 | 3143 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3144 | 3144 | <script> |
3145 | 3145 | function __alertQuit() { |
3146 | - alert('" . addslashes($msg) . "'); |
|
3146 | + alert('".addslashes($msg)."'); |
|
3147 | 3147 | {$fnc} |
3148 | 3148 | } |
3149 | 3149 | window.setTimeout('__alertQuit();',100); |
@@ -3165,9 +3165,9 @@ discard block |
||
3165 | 3165 | $state = 0; |
3166 | 3166 | $pms = $_SESSION['mgrPermissions']; |
3167 | 3167 | if ($pms) { |
3168 | - $state = ((bool)$pms[$pm] === true); |
|
3168 | + $state = ((bool) $pms[$pm] === true); |
|
3169 | 3169 | } |
3170 | - return (int)$state; |
|
3170 | + return (int) $state; |
|
3171 | 3171 | } |
3172 | 3172 | |
3173 | 3173 | /** |
@@ -3180,8 +3180,8 @@ discard block |
||
3180 | 3180 | */ |
3181 | 3181 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3182 | 3182 | { |
3183 | - $id = (int)$id; |
|
3184 | - $type = (int)$type; |
|
3183 | + $id = (int) $id; |
|
3184 | + $type = (int) $type; |
|
3185 | 3185 | if (!$type || !$id) { |
3186 | 3186 | return null; |
3187 | 3187 | } |
@@ -3231,7 +3231,7 @@ discard block |
||
3231 | 3231 | return $lockedElements; |
3232 | 3232 | } |
3233 | 3233 | |
3234 | - $type = (int)$type; |
|
3234 | + $type = (int) $type; |
|
3235 | 3235 | if (isset($lockedElements[$type])) { |
3236 | 3236 | return $lockedElements[$type]; |
3237 | 3237 | } else { |
@@ -3248,7 +3248,7 @@ discard block |
||
3248 | 3248 | $this->lockedElements = array(); |
3249 | 3249 | $this->cleanupExpiredLocks(); |
3250 | 3250 | |
3251 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3251 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3252 | 3252 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3253 | 3253 | while ($row = $this->db->getRow($rs)) { |
3254 | 3254 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3271,7 +3271,7 @@ discard block |
||
3271 | 3271 | public function cleanupExpiredLocks() |
3272 | 3272 | { |
3273 | 3273 | // Clean-up active_user_sessions first |
3274 | - $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3274 | + $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3275 | 3275 | $validSessionTimeLimit = $this->time - $timeout; |
3276 | 3276 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3277 | 3277 | |
@@ -3284,7 +3284,7 @@ discard block |
||
3284 | 3284 | foreach ($rs as $row) { |
3285 | 3285 | $userSids[] = $row['sid']; |
3286 | 3286 | } |
3287 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3287 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3288 | 3288 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3289 | 3289 | } else { |
3290 | 3290 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3368,8 +3368,8 @@ discard block |
||
3368 | 3368 | public function lockElement($type, $id) |
3369 | 3369 | { |
3370 | 3370 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3371 | - $type = (int)$type; |
|
3372 | - $id = (int)$id; |
|
3371 | + $type = (int) $type; |
|
3372 | + $id = (int) $id; |
|
3373 | 3373 | if (!$type || !$id || !$userId) { |
3374 | 3374 | return false; |
3375 | 3375 | } |
@@ -3390,8 +3390,8 @@ discard block |
||
3390 | 3390 | public function unlockElement($type, $id, $includeAllUsers = false) |
3391 | 3391 | { |
3392 | 3392 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3393 | - $type = (int)$type; |
|
3394 | - $id = (int)$id; |
|
3393 | + $type = (int) $type; |
|
3394 | + $id = (int) $id; |
|
3395 | 3395 | if (!$type || !$id) { |
3396 | 3396 | return false; |
3397 | 3397 | } |
@@ -3458,8 +3458,8 @@ discard block |
||
3458 | 3458 | } |
3459 | 3459 | |
3460 | 3460 | $usertype = $this->isFrontend() ? 1 : 0; |
3461 | - $evtid = (int)$evtid; |
|
3462 | - $type = (int)$type; |
|
3461 | + $evtid = (int) $evtid; |
|
3462 | + $type = (int) $type; |
|
3463 | 3463 | |
3464 | 3464 | // Types: 1 = information, 2 = warning, 3 = error |
3465 | 3465 | if ($type < 1) { |
@@ -3481,8 +3481,8 @@ discard block |
||
3481 | 3481 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3482 | 3482 | if ($this->config['send_errormail'] <= $type) { |
3483 | 3483 | $this->sendmail(array( |
3484 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3485 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3484 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3485 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3486 | 3486 | 'type' => 'text' |
3487 | 3487 | )); |
3488 | 3488 | } |
@@ -3530,7 +3530,7 @@ discard block |
||
3530 | 3530 | $p['fromname'] = $userinfo['username']; |
3531 | 3531 | } |
3532 | 3532 | if ($msg === '' && !isset($p['body'])) { |
3533 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3533 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3534 | 3534 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3535 | 3535 | $p['body'] = $msg; |
3536 | 3536 | } |
@@ -3570,8 +3570,8 @@ discard block |
||
3570 | 3570 | $files = array(); |
3571 | 3571 | } |
3572 | 3572 | foreach ($files as $f) { |
3573 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3574 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3573 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3574 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3575 | 3575 | } |
3576 | 3576 | } |
3577 | 3577 | $rs = $this->mail->send(); |
@@ -3616,7 +3616,7 @@ discard block |
||
3616 | 3616 | */ |
3617 | 3617 | public function isFrontend() |
3618 | 3618 | { |
3619 | - return ! $this->isBackend(); |
|
3619 | + return !$this->isBackend(); |
|
3620 | 3620 | } |
3621 | 3621 | |
3622 | 3622 | /** |
@@ -3641,14 +3641,14 @@ discard block |
||
3641 | 3641 | $tblsc = $this->getFullTableName("site_content"); |
3642 | 3642 | $tbldg = $this->getFullTableName("document_groups"); |
3643 | 3643 | // modify field names to use sc. table reference |
3644 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3645 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3644 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3645 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3646 | 3646 | // get document groups for current user |
3647 | 3647 | if ($docgrp = $this->getUserDocGroups()) { |
3648 | 3648 | $docgrp = implode(",", $docgrp); |
3649 | 3649 | } |
3650 | 3650 | // build query |
3651 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3651 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3652 | 3652 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3653 | 3653 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3654 | 3654 | $resourceArray = $this->db->makeArray($result); |
@@ -3678,14 +3678,14 @@ discard block |
||
3678 | 3678 | $tbldg = $this->getFullTableName("document_groups"); |
3679 | 3679 | |
3680 | 3680 | // modify field names to use sc. table reference |
3681 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3682 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3681 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3682 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3683 | 3683 | // get document groups for current user |
3684 | 3684 | if ($docgrp = $this->getUserDocGroups()) { |
3685 | 3685 | $docgrp = implode(",", $docgrp); |
3686 | 3686 | } |
3687 | 3687 | // build query |
3688 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3688 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3689 | 3689 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3690 | 3690 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3691 | 3691 | $resourceArray = $this->db->makeArray($result); |
@@ -3720,16 +3720,16 @@ discard block |
||
3720 | 3720 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3721 | 3721 | } |
3722 | 3722 | |
3723 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3724 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3723 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3724 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3725 | 3725 | |
3726 | 3726 | if ($where != '') { |
3727 | - $where = 'AND ' . $where; |
|
3727 | + $where = 'AND '.$where; |
|
3728 | 3728 | } |
3729 | 3729 | |
3730 | 3730 | // modify field names to use sc. table reference |
3731 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3732 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3731 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3732 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3733 | 3733 | |
3734 | 3734 | // get document groups for current user |
3735 | 3735 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3737,7 +3737,7 @@ discard block |
||
3737 | 3737 | } |
3738 | 3738 | |
3739 | 3739 | // build query |
3740 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3740 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3741 | 3741 | |
3742 | 3742 | $tblsc = $this->getFullTableName('site_content'); |
3743 | 3743 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3789,10 +3789,10 @@ discard block |
||
3789 | 3789 | return false; |
3790 | 3790 | } else { |
3791 | 3791 | // modify field names to use sc. table reference |
3792 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3793 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3792 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3793 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3794 | 3794 | if ($where != '') { |
3795 | - $where = 'AND ' . $where; |
|
3795 | + $where = 'AND '.$where; |
|
3796 | 3796 | } |
3797 | 3797 | |
3798 | 3798 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3803,13 +3803,13 @@ discard block |
||
3803 | 3803 | $docgrp = implode(',', $docgrp); |
3804 | 3804 | } |
3805 | 3805 | |
3806 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3806 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3807 | 3807 | |
3808 | 3808 | $tblsc = $this->getFullTableName('site_content'); |
3809 | 3809 | $tbldg = $this->getFullTableName('document_groups'); |
3810 | 3810 | |
3811 | 3811 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3812 | - LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
3812 | + LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
3813 | 3813 | |
3814 | 3814 | $resourceArray = $this->db->makeArray($result); |
3815 | 3815 | |
@@ -3914,12 +3914,12 @@ discard block |
||
3914 | 3914 | $tbldg = $this->getFullTableName("document_groups"); |
3915 | 3915 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3916 | 3916 | // modify field names to use sc. table reference |
3917 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3917 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3918 | 3918 | // get document groups for current user |
3919 | 3919 | if ($docgrp = $this->getUserDocGroups()) { |
3920 | 3920 | $docgrp = implode(",", $docgrp); |
3921 | 3921 | } |
3922 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3922 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3923 | 3923 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3924 | 3924 | $pageInfo = $this->db->getRow($result); |
3925 | 3925 | |
@@ -3966,7 +3966,7 @@ discard block |
||
3966 | 3966 | { |
3967 | 3967 | if ($this->currentSnippet) { |
3968 | 3968 | $tbl = $this->getFullTableName("site_snippets"); |
3969 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
3969 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
3970 | 3970 | if ($snippetId = $this->db->getValue($rs)) { |
3971 | 3971 | return $snippetId; |
3972 | 3972 | } |
@@ -3993,23 +3993,23 @@ discard block |
||
3993 | 3993 | */ |
3994 | 3994 | public function clearCache($type = '', $report = false) |
3995 | 3995 | { |
3996 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
3996 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
3997 | 3997 | if (is_array($type)) { |
3998 | 3998 | foreach ($type as $_) { |
3999 | 3999 | $this->clearCache($_, $report); |
4000 | 4000 | } |
4001 | 4001 | } elseif ($type == 'full') { |
4002 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
4002 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
4003 | 4003 | $sync = new synccache(); |
4004 | 4004 | $sync->setCachepath($cache_dir); |
4005 | 4005 | $sync->setReport($report); |
4006 | 4006 | $sync->emptyCache(); |
4007 | 4007 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4008 | 4008 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4009 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4010 | - $cache_path = $cache_dir . $file_name; |
|
4009 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4010 | + $cache_path = $cache_dir.$file_name; |
|
4011 | 4011 | $files = glob($cache_path); |
4012 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4012 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4013 | 4013 | foreach ($files as $file) { |
4014 | 4014 | if (!is_file($file)) { |
4015 | 4015 | continue; |
@@ -4017,7 +4017,7 @@ discard block |
||
4017 | 4017 | unlink($file); |
4018 | 4018 | } |
4019 | 4019 | } else { |
4020 | - $files = glob($cache_dir . '*'); |
|
4020 | + $files = glob($cache_dir.'*'); |
|
4021 | 4021 | foreach ($files as $file) { |
4022 | 4022 | $name = basename($file); |
4023 | 4023 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4086,7 +4086,7 @@ discard block |
||
4086 | 4086 | $f_url_suffix = '/'; |
4087 | 4087 | } |
4088 | 4088 | |
4089 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4089 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4090 | 4090 | |
4091 | 4091 | if ($al && $al['alias']) { |
4092 | 4092 | $alias = $al['alias']; |
@@ -4094,7 +4094,7 @@ discard block |
||
4094 | 4094 | |
4095 | 4095 | } |
4096 | 4096 | |
4097 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4097 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4098 | 4098 | $url = "{$alias}{$args}"; |
4099 | 4099 | } else { |
4100 | 4100 | $url = "index.php?id={$id}{$args}"; |
@@ -4113,7 +4113,7 @@ discard block |
||
4113 | 4113 | } |
4114 | 4114 | |
4115 | 4115 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4116 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4116 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4117 | 4117 | } |
4118 | 4118 | |
4119 | 4119 | //fix strictUrl by Bumkaka |
@@ -4122,9 +4122,9 @@ discard block |
||
4122 | 4122 | } |
4123 | 4123 | |
4124 | 4124 | if ($this->config['xhtml_urls']) { |
4125 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4125 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4126 | 4126 | } else { |
4127 | - $url = $host . $virtualDir . $url; |
|
4127 | + $url = $host.$virtualDir.$url; |
|
4128 | 4128 | } |
4129 | 4129 | |
4130 | 4130 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4148,21 +4148,21 @@ discard block |
||
4148 | 4148 | if (isset($this->aliasListing[$id])) { |
4149 | 4149 | $out = $this->aliasListing[$id]; |
4150 | 4150 | } else { |
4151 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4151 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4152 | 4152 | if ($this->db->getRecordCount($q) == '1') { |
4153 | 4153 | $q = $this->db->getRow($q); |
4154 | 4154 | $this->aliasListing[$id] = array( |
4155 | - 'id' => (int)$q['id'], |
|
4155 | + 'id' => (int) $q['id'], |
|
4156 | 4156 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4157 | - 'parent' => (int)$q['parent'], |
|
4158 | - 'isfolder' => (int)$q['isfolder'], |
|
4157 | + 'parent' => (int) $q['parent'], |
|
4158 | + 'isfolder' => (int) $q['isfolder'], |
|
4159 | 4159 | ); |
4160 | 4160 | if ($this->aliasListing[$id]['parent'] > 0) { |
4161 | 4161 | //fix alias_path_usage |
4162 | 4162 | if ($this->config['use_alias_path'] == '1') { |
4163 | 4163 | //&& $tmp['path'] != '' - fix error slash with epty path |
4164 | 4164 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4165 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4165 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4166 | 4166 | } else { |
4167 | 4167 | $this->aliasListing[$id]['path'] = ''; |
4168 | 4168 | } |
@@ -4203,7 +4203,7 @@ discard block |
||
4203 | 4203 | $out = array(); |
4204 | 4204 | if (empty($this->version) || !is_array($this->version)) { |
4205 | 4205 | //include for compatibility modx version < 1.0.10 |
4206 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4206 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4207 | 4207 | $this->version = array(); |
4208 | 4208 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4209 | 4209 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4225,18 +4225,18 @@ discard block |
||
4225 | 4225 | { |
4226 | 4226 | if (isset ($this->snippetCache[$snippetName])) { |
4227 | 4227 | $snippet = $this->snippetCache[$snippetName]; |
4228 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4228 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4229 | 4229 | } else { // not in cache so let's check the db |
4230 | - $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
|
4230 | + $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."' AND ss.disabled=0;"; |
|
4231 | 4231 | $result = $this->db->query($sql); |
4232 | 4232 | if ($this->db->getRecordCount($result) == 1) { |
4233 | 4233 | $row = $this->db->getRow($result); |
4234 | 4234 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4235 | 4235 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4236 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4236 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4237 | 4237 | } else { |
4238 | 4238 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4239 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4239 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4240 | 4240 | } |
4241 | 4241 | } |
4242 | 4242 | // load default params/properties |
@@ -4336,8 +4336,8 @@ discard block |
||
4336 | 4336 | } |
4337 | 4337 | if (strpos($tpl, $s) !== false) { |
4338 | 4338 | $tpl = str_replace($s, $value, $tpl); |
4339 | - } elseif($this->debug) { |
|
4340 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4339 | + } elseif ($this->debug) { |
|
4340 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4341 | 4341 | } |
4342 | 4342 | } |
4343 | 4343 | |
@@ -4386,7 +4386,7 @@ discard block |
||
4386 | 4386 | case 'CODE': |
4387 | 4387 | break; |
4388 | 4388 | case 'FILE': |
4389 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4389 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4390 | 4390 | break; |
4391 | 4391 | case 'CHUNK': |
4392 | 4392 | $template = $this->getChunk($template); |
@@ -4419,7 +4419,7 @@ discard block |
||
4419 | 4419 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4420 | 4420 | return '-'; |
4421 | 4421 | } |
4422 | - $timestamp = (int)$timestamp; |
|
4422 | + $timestamp = (int) $timestamp; |
|
4423 | 4423 | |
4424 | 4424 | switch ($this->config['datetime_format']) { |
4425 | 4425 | case 'YYYY/mm/dd': |
@@ -4439,7 +4439,7 @@ discard block |
||
4439 | 4439 | } |
4440 | 4440 | |
4441 | 4441 | if (empty($mode)) { |
4442 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4442 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4443 | 4443 | } elseif ($mode == 'dateOnly') { |
4444 | 4444 | $strTime = strftime($dateFormat, $timestamp); |
4445 | 4445 | } elseif ($mode == 'formatOnly') { |
@@ -4493,7 +4493,7 @@ discard block |
||
4493 | 4493 | $S = 0; |
4494 | 4494 | } |
4495 | 4495 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4496 | - $timeStamp = (int)$timeStamp; |
|
4496 | + $timeStamp = (int) $timeStamp; |
|
4497 | 4497 | return $timeStamp; |
4498 | 4498 | } |
4499 | 4499 | |
@@ -4535,7 +4535,7 @@ discard block |
||
4535 | 4535 | if ($v === 'value') { |
4536 | 4536 | unset($_[$i]); |
4537 | 4537 | } else { |
4538 | - $_[$i] = 'tv.' . $v; |
|
4538 | + $_[$i] = 'tv.'.$v; |
|
4539 | 4539 | } |
4540 | 4540 | } |
4541 | 4541 | $fields = implode(',', $_); |
@@ -4544,12 +4544,12 @@ discard block |
||
4544 | 4544 | } |
4545 | 4545 | |
4546 | 4546 | if ($tvsort != '') { |
4547 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4547 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4548 | 4548 | } |
4549 | 4549 | if ($tvidnames == "*") { |
4550 | 4550 | $query = "tv.id<>0"; |
4551 | 4551 | } else { |
4552 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4552 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4553 | 4553 | } |
4554 | 4554 | |
4555 | 4555 | $this->getUserDocGroups(); |
@@ -4693,7 +4693,7 @@ discard block |
||
4693 | 4693 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
4694 | 4694 | } |
4695 | 4695 | |
4696 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
4696 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
4697 | 4697 | return false; |
4698 | 4698 | } else { |
4699 | 4699 | |
@@ -4711,23 +4711,23 @@ discard block |
||
4711 | 4711 | } |
4712 | 4712 | |
4713 | 4713 | // get user defined template variables |
4714 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4715 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4714 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4715 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4716 | 4716 | |
4717 | 4717 | if ($idnames == '*') { |
4718 | 4718 | $query = 'tv.id<>0'; |
4719 | 4719 | } else { |
4720 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4720 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4721 | 4721 | } |
4722 | 4722 | |
4723 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4724 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4725 | - LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4723 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4724 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4725 | + LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4726 | 4726 | |
4727 | 4727 | $result = $this->db->makeArray($rs); |
4728 | 4728 | |
4729 | 4729 | // get default/built-in template variables |
4730 | - if(is_array($docRow)){ |
|
4730 | + if (is_array($docRow)) { |
|
4731 | 4731 | ksort($docRow); |
4732 | 4732 | |
4733 | 4733 | foreach ($docRow as $key => $value) { |
@@ -4765,22 +4765,22 @@ discard block |
||
4765 | 4765 | */ |
4766 | 4766 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
4767 | 4767 | { |
4768 | - if (is_array($idnames) && empty($idnames) ) { |
|
4768 | + if (is_array($idnames) && empty($idnames)) { |
|
4769 | 4769 | return false; |
4770 | 4770 | } else { |
4771 | 4771 | $output = array(); |
4772 | 4772 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4773 | 4773 | |
4774 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4774 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4775 | 4775 | // remove sort for speed |
4776 | 4776 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4777 | 4777 | |
4778 | 4778 | if ($result == false) { |
4779 | 4779 | return false; |
4780 | 4780 | } else { |
4781 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4782 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4783 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4781 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4782 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4783 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4784 | 4784 | |
4785 | 4785 | for ($i = 0; $i < count($result); $i++) { |
4786 | 4786 | $row = $result[$i]; |
@@ -4805,7 +4805,7 @@ discard block |
||
4805 | 4805 | */ |
4806 | 4806 | public function getFullTableName($tbl) |
4807 | 4807 | { |
4808 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4808 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4809 | 4809 | } |
4810 | 4810 | |
4811 | 4811 | /** |
@@ -4884,7 +4884,7 @@ discard block |
||
4884 | 4884 | public function getCachePath() |
4885 | 4885 | { |
4886 | 4886 | global $base_url; |
4887 | - $pth = $base_url . $this->getCacheFolder(); |
|
4887 | + $pth = $base_url.$this->getCacheFolder(); |
|
4888 | 4888 | return $pth; |
4889 | 4889 | } |
4890 | 4890 | |
@@ -4936,8 +4936,8 @@ discard block |
||
4936 | 4936 | $out = false; |
4937 | 4937 | |
4938 | 4938 | if (!empty($context)) { |
4939 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4940 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4939 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4940 | + $out = $_SESSION[$context.'InternalKey']; |
|
4941 | 4941 | } |
4942 | 4942 | } else { |
4943 | 4943 | switch (true) { |
@@ -4965,8 +4965,8 @@ discard block |
||
4965 | 4965 | $out = false; |
4966 | 4966 | |
4967 | 4967 | if (!empty($context)) { |
4968 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4969 | - $out = $_SESSION[$context . 'Shortname']; |
|
4968 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4969 | + $out = $_SESSION[$context.'Shortname']; |
|
4970 | 4970 | } |
4971 | 4971 | } else { |
4972 | 4972 | switch (true) { |
@@ -5037,8 +5037,8 @@ discard block |
||
5037 | 5037 | */ |
5038 | 5038 | public function getWebUserInfo($uid) |
5039 | 5039 | { |
5040 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5041 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5040 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5041 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5042 | 5042 | if ($row = $this->db->getRow($rs)) { |
5043 | 5043 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5044 | 5044 | $row["usertype"] = "web"; |
@@ -5074,7 +5074,7 @@ discard block |
||
5074 | 5074 | } else if (is_array($dg)) { |
5075 | 5075 | // resolve ids to names |
5076 | 5076 | $dgn = array(); |
5077 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5077 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5078 | 5078 | while ($row = $this->db->getRow($ds)) { |
5079 | 5079 | $dgn[] = $row['name']; |
5080 | 5080 | } |
@@ -5102,7 +5102,7 @@ discard block |
||
5102 | 5102 | $rt = false; |
5103 | 5103 | if ($_SESSION["webValidated"] == 1) { |
5104 | 5104 | $tbl = $this->getFullTableName("web_users"); |
5105 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5105 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5106 | 5106 | if ($row = $this->db->getRow($ds)) { |
5107 | 5107 | if ($row["password"] == md5($oldPwd)) { |
5108 | 5108 | if (strlen($newPwd) < 6) { |
@@ -5112,7 +5112,7 @@ discard block |
||
5112 | 5112 | } else { |
5113 | 5113 | $this->db->update(array( |
5114 | 5114 | 'password' => $this->db->escape($newPwd), |
5115 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5115 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5116 | 5116 | // invoke OnWebChangePassword event |
5117 | 5117 | $this->invokeEvent("OnWebChangePassword", array( |
5118 | 5118 | "userid" => $row["id"], |
@@ -5143,8 +5143,8 @@ discard block |
||
5143 | 5143 | // check cache |
5144 | 5144 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5145 | 5145 | if (!is_array($grpNames)) { |
5146 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5147 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5146 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5147 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5148 | 5148 | $grpNames = $this->db->getColumn("name", $rs); |
5149 | 5149 | // save to cache |
5150 | 5150 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5177,7 +5177,7 @@ discard block |
||
5177 | 5177 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5178 | 5178 | $this->sjscripts[$nextpos] = $src; |
5179 | 5179 | } else { |
5180 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5180 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5181 | 5181 | } |
5182 | 5182 | } |
5183 | 5183 | |
@@ -5256,7 +5256,7 @@ discard block |
||
5256 | 5256 | } |
5257 | 5257 | |
5258 | 5258 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5259 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5259 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5260 | 5260 | } |
5261 | 5261 | if ($startup) { |
5262 | 5262 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5403,7 +5403,7 @@ discard block |
||
5403 | 5403 | $eventtime = $this->getMicroTime() - $eventtime; |
5404 | 5404 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5405 | 5405 | foreach ($parameter as $k => $v) { |
5406 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5406 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5407 | 5407 | } |
5408 | 5408 | $this->pluginsCode .= '</fieldset><br />'; |
5409 | 5409 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5431,13 +5431,13 @@ discard block |
||
5431 | 5431 | $plugin = array(); |
5432 | 5432 | if (isset ($this->pluginCache[$pluginName])) { |
5433 | 5433 | $pluginCode = $this->pluginCache[$pluginName]; |
5434 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5434 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5435 | 5435 | } else { |
5436 | 5436 | $pluginName = $this->db->escape($pluginName); |
5437 | 5437 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5438 | 5438 | if ($row = $this->db->getRow($result)) { |
5439 | 5439 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5440 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5440 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5441 | 5441 | } else { |
5442 | 5442 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5443 | 5443 | $pluginProperties = ''; |
@@ -5544,7 +5544,7 @@ discard block |
||
5544 | 5544 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5545 | 5545 | { |
5546 | 5546 | $params = array(); |
5547 | - $fullpath = $element_dir . '/' . $filename; |
|
5547 | + $fullpath = $element_dir.'/'.$filename; |
|
5548 | 5548 | if (is_readable($fullpath)) { |
5549 | 5549 | $tpl = @fopen($fullpath, "r"); |
5550 | 5550 | if ($tpl) { |
@@ -5711,8 +5711,8 @@ discard block |
||
5711 | 5711 | $ph = array('site_url' => MODX_SITE_URL); |
5712 | 5712 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5713 | 5713 | $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i'; |
5714 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5715 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5714 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5715 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5716 | 5716 | foreach ($parsed as $key => $val) { |
5717 | 5717 | if (is_array($val)) { |
5718 | 5718 | foreach ($val as $key2 => $val2) { |
@@ -5721,7 +5721,7 @@ discard block |
||
5721 | 5721 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5722 | 5722 | } |
5723 | 5723 | if (preg_match($regexEmail, $val2, $url)) { |
5724 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5724 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5725 | 5725 | } |
5726 | 5726 | $parsed[$key][$key2] = $val2; |
5727 | 5727 | } |
@@ -5731,7 +5731,7 @@ discard block |
||
5731 | 5731 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5732 | 5732 | } |
5733 | 5733 | if (preg_match($regexEmail, $val, $url)) { |
5734 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5734 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5735 | 5735 | } |
5736 | 5736 | $parsed[$key] = $val; |
5737 | 5737 | } |
@@ -5745,32 +5745,32 @@ discard block |
||
5745 | 5745 | ); |
5746 | 5746 | |
5747 | 5747 | $nl = "\n"; |
5748 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5749 | - $list .= '<p>' . $nl; |
|
5750 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5751 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5752 | - $list .= '</p><br/>' . $nl; |
|
5753 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5754 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5755 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5756 | - $list .= '<br/>' . $nl; |
|
5748 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5749 | + $list .= '<p>'.$nl; |
|
5750 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5751 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5752 | + $list .= '</p><br/>'.$nl; |
|
5753 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5754 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5755 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5756 | + $list .= '<br/>'.$nl; |
|
5757 | 5757 | $first = true; |
5758 | 5758 | foreach ($arrayParams as $param => $label) { |
5759 | 5759 | if (isset($parsed[$param])) { |
5760 | 5760 | if ($first) { |
5761 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5762 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5761 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5762 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5763 | 5763 | $first = false; |
5764 | 5764 | } |
5765 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5766 | - $list .= ' <ul>' . $nl; |
|
5765 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5766 | + $list .= ' <ul>'.$nl; |
|
5767 | 5767 | foreach ($parsed[$param] as $val) { |
5768 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5768 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5769 | 5769 | } |
5770 | - $list .= ' </ul></li>' . $nl; |
|
5770 | + $list .= ' </ul></li>'.$nl; |
|
5771 | 5771 | } |
5772 | 5772 | } |
5773 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5773 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5774 | 5774 | |
5775 | 5775 | return $list; |
5776 | 5776 | } |
@@ -5846,7 +5846,7 @@ discard block |
||
5846 | 5846 | */ |
5847 | 5847 | public function addSnippet($name, $phpCode) |
5848 | 5848 | { |
5849 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5849 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5850 | 5850 | } |
5851 | 5851 | |
5852 | 5852 | /** |
@@ -5855,7 +5855,7 @@ discard block |
||
5855 | 5855 | */ |
5856 | 5856 | public function addChunk($name, $text) |
5857 | 5857 | { |
5858 | - $this->chunkCache['#' . $name] = $text; |
|
5858 | + $this->chunkCache['#'.$name] = $text; |
|
5859 | 5859 | } |
5860 | 5860 | |
5861 | 5861 | /** |
@@ -5891,7 +5891,7 @@ discard block |
||
5891 | 5891 | } |
5892 | 5892 | |
5893 | 5893 | if (!$isSafe) { |
5894 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5894 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5895 | 5895 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5896 | 5896 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5897 | 5897 | return; |
@@ -5905,7 +5905,7 @@ discard block |
||
5905 | 5905 | return 'array()'; |
5906 | 5906 | } |
5907 | 5907 | |
5908 | - $output = $echo . $return; |
|
5908 | + $output = $echo.$return; |
|
5909 | 5909 | modx_sanitize_gpc($output); |
5910 | 5910 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5911 | 5911 | } |
@@ -5923,8 +5923,8 @@ discard block |
||
5923 | 5923 | |
5924 | 5924 | $safe = explode(',', $safe_functions); |
5925 | 5925 | |
5926 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5927 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5926 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5927 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5928 | 5928 | foreach ($tokens as $i => $token) { |
5929 | 5929 | if (!is_array($token)) { |
5930 | 5930 | continue; |
@@ -5960,7 +5960,7 @@ discard block |
||
5960 | 5960 | public function atBindFileContent($str = '') |
5961 | 5961 | { |
5962 | 5962 | |
5963 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5963 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5964 | 5964 | |
5965 | 5965 | if (stripos($str, '@FILE') !== 0) { |
5966 | 5966 | return $str; |
@@ -5983,7 +5983,7 @@ discard block |
||
5983 | 5983 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
5984 | 5984 | |
5985 | 5985 | foreach ($search_path as $path) { |
5986 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
5986 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
5987 | 5987 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
5988 | 5988 | return $errorMsg; |
5989 | 5989 | } elseif (is_file($file_path)) { |
@@ -5997,7 +5997,7 @@ discard block |
||
5997 | 5997 | return $errorMsg; |
5998 | 5998 | } |
5999 | 5999 | |
6000 | - $content = (string)file_get_contents($file_path); |
|
6000 | + $content = (string) file_get_contents($file_path); |
|
6001 | 6001 | if ($content === false) { |
6002 | 6002 | return $errorMsg; |
6003 | 6003 | } |
@@ -6110,22 +6110,22 @@ discard block |
||
6110 | 6110 | |
6111 | 6111 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6112 | 6112 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6113 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6113 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6114 | 6114 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6115 | 6115 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6116 | 6116 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6117 | 6117 | if ($is_error) { |
6118 | 6118 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6119 | 6119 | if ($msg != 'PHP Parse Error') { |
6120 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6120 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6121 | 6121 | } |
6122 | 6122 | } else { |
6123 | 6123 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6124 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6124 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6125 | 6125 | } |
6126 | 6126 | |
6127 | 6127 | if (!empty ($query)) { |
6128 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></div>'; |
|
6128 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></div>'; |
|
6129 | 6129 | } |
6130 | 6130 | |
6131 | 6131 | $errortype = array( |
@@ -6148,13 +6148,13 @@ discard block |
||
6148 | 6148 | |
6149 | 6149 | if (!empty($nr) || !empty($file)) { |
6150 | 6150 | if ($text != '') { |
6151 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6151 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6152 | 6152 | } |
6153 | 6153 | if ($output != '') { |
6154 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6154 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6155 | 6155 | } |
6156 | 6156 | if ($nr !== '') { |
6157 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6157 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6158 | 6158 | } |
6159 | 6159 | if ($file) { |
6160 | 6160 | $table[] = array('File', $file); |
@@ -6174,7 +6174,7 @@ discard block |
||
6174 | 6174 | } |
6175 | 6175 | |
6176 | 6176 | if (!empty($this->event->activePlugin)) { |
6177 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6177 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6178 | 6178 | } |
6179 | 6179 | |
6180 | 6180 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6184,17 +6184,17 @@ discard block |
||
6184 | 6184 | $table[] = array('REQUEST_URI', $request_uri); |
6185 | 6185 | |
6186 | 6186 | if ($this->manager->action) { |
6187 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6187 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6188 | 6188 | global $action_list; |
6189 | 6189 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6190 | 6190 | |
6191 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6191 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6192 | 6192 | } |
6193 | 6193 | |
6194 | 6194 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6195 | 6195 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6196 | 6196 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6197 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6197 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6198 | 6198 | } |
6199 | 6199 | $table[] = array('Referer', $referer); |
6200 | 6200 | $table[] = array('User Agent', $ua); |
@@ -6215,7 +6215,7 @@ discard block |
||
6215 | 6215 | |
6216 | 6216 | $mem = memory_get_peak_usage(true); |
6217 | 6217 | $total_mem = $mem - $this->mstart; |
6218 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6218 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6219 | 6219 | |
6220 | 6220 | $queryTime = $this->queryTime; |
6221 | 6221 | $phpTime = $totalTime - $queryTime; |
@@ -6236,18 +6236,18 @@ discard block |
||
6236 | 6236 | $str .= $this->get_backtrace(debug_backtrace()); |
6237 | 6237 | // Log error |
6238 | 6238 | if (!empty($this->currentSnippet)) { |
6239 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6239 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6240 | 6240 | } elseif (!empty($this->event->activePlugin)) { |
6241 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6241 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6242 | 6242 | } elseif ($source !== '') { |
6243 | - $source = 'Parser - ' . $source; |
|
6243 | + $source = 'Parser - '.$source; |
|
6244 | 6244 | } elseif ($query !== '') { |
6245 | 6245 | $source = 'SQL Query'; |
6246 | 6246 | } else { |
6247 | 6247 | $source = 'Parser'; |
6248 | 6248 | } |
6249 | 6249 | if ($msg) { |
6250 | - $source .= ' / ' . $msg; |
|
6250 | + $source .= ' / '.$msg; |
|
6251 | 6251 | } |
6252 | 6252 | if (isset($actionName) && !empty($actionName)) { |
6253 | 6253 | $source .= $actionName; |
@@ -6279,12 +6279,12 @@ discard block |
||
6279 | 6279 | |
6280 | 6280 | // Display error |
6281 | 6281 | if (isset($_SESSION['mgrValidated'])) { |
6282 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' » ' . $release_date . '</title> |
|
6282 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' » '.$release_date.'</title> |
|
6283 | 6283 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6284 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6284 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6285 | 6285 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6286 | 6286 | </head><body> |
6287 | - ' . $str . '</body></html>'; |
|
6287 | + ' . $str.'</body></html>'; |
|
6288 | 6288 | |
6289 | 6289 | } else { |
6290 | 6290 | echo 'Error'; |
@@ -6322,7 +6322,7 @@ discard block |
||
6322 | 6322 | switch ($val['type']) { |
6323 | 6323 | case '->': |
6324 | 6324 | case '::': |
6325 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6325 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6326 | 6326 | break; |
6327 | 6327 | default: |
6328 | 6328 | $functionName = $val['function']; |
@@ -6332,7 +6332,7 @@ discard block |
||
6332 | 6332 | $args = array_pad(array(), $_, '$var'); |
6333 | 6333 | $args = implode(", ", $args); |
6334 | 6334 | $modx = &$this; |
6335 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6335 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6336 | 6336 | $arg = $val['args'][$tmp - 1]; |
6337 | 6337 | switch (true) { |
6338 | 6338 | case is_null($arg): { |
@@ -6344,7 +6344,7 @@ discard block |
||
6344 | 6344 | break; |
6345 | 6345 | } |
6346 | 6346 | case is_scalar($arg): { |
6347 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6347 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6348 | 6348 | break; |
6349 | 6349 | } |
6350 | 6350 | case is_bool($arg): { |
@@ -6352,23 +6352,23 @@ discard block |
||
6352 | 6352 | break; |
6353 | 6353 | } |
6354 | 6354 | case is_array($arg): { |
6355 | - $out = 'array $var' . $tmp; |
|
6355 | + $out = 'array $var'.$tmp; |
|
6356 | 6356 | break; |
6357 | 6357 | } |
6358 | 6358 | case is_object($arg): { |
6359 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6359 | + $out = get_class($arg).' $var'.$tmp; |
|
6360 | 6360 | break; |
6361 | 6361 | } |
6362 | 6362 | default: { |
6363 | - $out = '$var' . $tmp; |
|
6363 | + $out = '$var'.$tmp; |
|
6364 | 6364 | } |
6365 | 6365 | } |
6366 | 6366 | $tmp++; |
6367 | 6367 | return $out; |
6368 | 6368 | }, $args); |
6369 | 6369 | $line = array( |
6370 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6371 | - $path . " on line " . $val['line'] |
|
6370 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6371 | + $path." on line ".$val['line'] |
|
6372 | 6372 | ); |
6373 | 6373 | $table[] = array(implode("<br />", $line)); |
6374 | 6374 | } |
@@ -6409,7 +6409,7 @@ discard block |
||
6409 | 6409 | $alias = strip_tags($alias); // strip HTML |
6410 | 6410 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6411 | 6411 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6412 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6412 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6413 | 6413 | $alias = trim($alias, '-'); // trim excess |
6414 | 6414 | return $alias; |
6415 | 6415 | } |
@@ -6425,7 +6425,7 @@ discard block |
||
6425 | 6425 | $precisions = count($sizes) - 1; |
6426 | 6426 | foreach ($sizes as $unit => $bytes) { |
6427 | 6427 | if ($size >= $bytes) { |
6428 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6428 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6429 | 6429 | } |
6430 | 6430 | $precisions--; |
6431 | 6431 | } |
@@ -6529,10 +6529,10 @@ discard block |
||
6529 | 6529 | |
6530 | 6530 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6531 | 6531 | return false; |
6532 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6533 | - $file_path = MODX_BASE_PATH . $str; |
|
6534 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6535 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6532 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6533 | + $file_path = MODX_BASE_PATH.$str; |
|
6534 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6535 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6536 | 6536 | } else { |
6537 | 6537 | return false; |
6538 | 6538 | } |
@@ -6658,7 +6658,7 @@ discard block |
||
6658 | 6658 | $title = 'no title'; |
6659 | 6659 | } |
6660 | 6660 | if (is_array($msg)) { |
6661 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6661 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6662 | 6662 | } elseif ($msg === '') { |
6663 | 6663 | $msg = $_SERVER['REQUEST_URI']; |
6664 | 6664 | } |
@@ -6703,7 +6703,7 @@ discard block |
||
6703 | 6703 | if (is_array($SystemAlertMsgQueque)) { |
6704 | 6704 | $title = ''; |
6705 | 6705 | if ($this->name && $this->activePlugin) { |
6706 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6706 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6707 | 6707 | } |
6708 | 6708 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6709 | 6709 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * php cli-install.php --database_server=localhost --database=db --database_user=dbuser --database_password=dbpass --table_prefix=evo_ --cmsadmin=admin [email protected] --cmspassword=123456 --language=ru --mode=new --installData=n --removeInstall=y |
5 | 5 | */ |
6 | 6 | |
7 | -$path = dirname(__FILE__) . '/'; |
|
7 | +$path = dirname(__FILE__).'/'; |
|
8 | 8 | |
9 | 9 | /* |
10 | 10 | $autoloader = realpath(__DIR__.'/../vendor/autoload.php'); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | }*/ |
14 | 14 | |
15 | 15 | $self = 'install/index.php'; |
16 | -$base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
|
16 | +$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__)); |
|
17 | 17 | define('MODX_API_MODE', true); |
18 | 18 | define('MODX_BASE_PATH', $base_path); |
19 | 19 | define('MODX_SITE_URL', '/'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if (is_file($path."../assets/cache/siteManager.php")) { |
27 | 27 | include_once($path."../assets/cache/siteManager.php"); |
28 | 28 | } |
29 | -if(!defined('MGR_DIR') && is_dir($path."../manager")) { |
|
29 | +if (!defined('MGR_DIR') && is_dir($path."../manager")) { |
|
30 | 30 | define('MGR_DIR', 'manager'); |
31 | 31 | } |
32 | 32 | |
@@ -40,43 +40,43 @@ discard block |
||
40 | 40 | $moduleSQLDataFile = $path."setup.data.sql"; |
41 | 41 | $moduleSQLResetFile = $path."setup.data.reset.sql"; |
42 | 42 | |
43 | -$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content |
|
44 | -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content |
|
45 | -$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties |
|
46 | -$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid |
|
47 | -$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid |
|
48 | -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties |
|
49 | -$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties |
|
43 | +$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content |
|
44 | +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content |
|
45 | +$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties |
|
46 | +$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid |
|
47 | +$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid |
|
48 | +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties |
|
49 | +$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties |
|
50 | 50 | $moduleDependencies = array(); // module depedencies - array : module, table, column, type, name |
51 | -$errors= 0; |
|
51 | +$errors = 0; |
|
52 | 52 | |
53 | 53 | |
54 | -$installMode= 0; |
|
54 | +$installMode = 0; |
|
55 | 55 | $installData = 0; |
56 | 56 | $tableprefixauto = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), rand(0, 33), 3).'_'; |
57 | 57 | |
58 | 58 | $args = array_slice($argv, 1); |
59 | 59 | |
60 | -if ( empty($args) ){ |
|
60 | +if (empty($args)) { |
|
61 | 61 | echo 'Install Evolution CMS?'.PHP_EOL; |
62 | 62 | $installYes = readline("Type 'y' to continue: "); |
63 | 63 | if ($installYes != 'y') return; |
64 | 64 | |
65 | 65 | //set param manual |
66 | - $databasehost = readline($_lang['connection_screen_database_host']. ' [localhost] '); |
|
67 | - $databaseloginname = readline($_lang['connection_screen_database_login']. ' '); |
|
68 | - $databaseloginpassword = readline($_lang['connection_screen_database_pass']. ' '); |
|
69 | - $database_name = readline($_lang['connection_screen_database_name']. ' '); |
|
70 | - $tableprefix = readline($_lang['connection_screen_table_prefix']. ' ['.$tableprefixauto.'] '); |
|
71 | - $database_connection_method = readline($_lang['connection_screen_connection_method']. ' [SET CHARACTER SET] '); |
|
72 | - $database_collation = readline($_lang['connection_screen_collation']. ' [utf8_general_ci] '); |
|
73 | - $cmsadmin = readline($_lang['connection_screen_default_admin_login']. ' [admin] '); |
|
74 | - $cmsadminemail = readline($_lang['connection_screen_default_admin_email']. ' '); |
|
75 | - $cmspassword = readline($_lang['connection_screen_default_admin_password']. ' '); |
|
76 | - $managerlanguage = readline('Мanager language:' . ' [en] '); |
|
77 | - $installData = readline('Instal demo-site (y/n):' . ' [n] '); |
|
66 | + $databasehost = readline($_lang['connection_screen_database_host'].' [localhost] '); |
|
67 | + $databaseloginname = readline($_lang['connection_screen_database_login'].' '); |
|
68 | + $databaseloginpassword = readline($_lang['connection_screen_database_pass'].' '); |
|
69 | + $database_name = readline($_lang['connection_screen_database_name'].' '); |
|
70 | + $tableprefix = readline($_lang['connection_screen_table_prefix'].' ['.$tableprefixauto.'] '); |
|
71 | + $database_connection_method = readline($_lang['connection_screen_connection_method'].' [SET CHARACTER SET] '); |
|
72 | + $database_collation = readline($_lang['connection_screen_collation'].' [utf8_general_ci] '); |
|
73 | + $cmsadmin = readline($_lang['connection_screen_default_admin_login'].' [admin] '); |
|
74 | + $cmsadminemail = readline($_lang['connection_screen_default_admin_email'].' '); |
|
75 | + $cmspassword = readline($_lang['connection_screen_default_admin_password'].' '); |
|
76 | + $managerlanguage = readline('Мanager language:'.' [en] '); |
|
77 | + $installData = readline('Instal demo-site (y/n):'.' [n] '); |
|
78 | 78 | |
79 | -}else{ |
|
79 | +} else { |
|
80 | 80 | |
81 | 81 | $cli_variables = []; |
82 | 82 | foreach ($args as $arg) { |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | -if ($databasehost == '') { $databasehost= 'localhost'; } |
|
111 | -if ($tableprefix == ''){ $tableprefix = $tableprefixauto; } |
|
110 | +if ($databasehost == '') { $databasehost = 'localhost'; } |
|
111 | +if ($tableprefix == '') { $tableprefix = $tableprefixauto; } |
|
112 | 112 | if ($database_connection_method == '') { $database_connection_method = 'SET CHARACTER SET'; } |
113 | 113 | if ($database_collation == '') { $database_collation = 'utf8_general_ci'; } |
114 | -if ($cmsadmin == ''){ $cmsadmin = 'admin'; } |
|
114 | +if ($cmsadmin == '') { $cmsadmin = 'admin'; } |
|
115 | 115 | if ($managerlanguage == '') { $managerlanguage = 'en'; } |
116 | -if ($installData == 'y') { $installData = 1;} |
|
117 | -if ($mode == 'upgrade') { $installMode = 1;} |
|
116 | +if ($installData == 'y') { $installData = 1; } |
|
117 | +if ($mode == 'upgrade') { $installMode = 1; } |
|
118 | 118 | |
119 | 119 | //добавить обработку языка |
120 | 120 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | ////////////////////////////////////////////////////////////////////////////////////// |
133 | -if( ! function_exists('f_owc')){ |
|
133 | +if (!function_exists('f_owc')) { |
|
134 | 134 | /** |
135 | 135 | * @param $path |
136 | 136 | * @param $data |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | fwrite($hnd, $data); |
144 | 144 | fclose($hnd); |
145 | 145 | |
146 | - if(null !== $mode) chmod($path, $mode); |
|
147 | - }catch(Exception $e){ |
|
146 | + if (null !== $mode) chmod($path, $mode); |
|
147 | + } catch (Exception $e) { |
|
148 | 148 | // Nothing, this is NOT normal |
149 | 149 | unset($e); |
150 | 150 | } |
@@ -154,24 +154,24 @@ discard block |
||
154 | 154 | // check PHP version |
155 | 155 | define('PHP_MIN_VERSION', '5.4.0'); |
156 | 156 | $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility |
157 | -echo PHP_EOL . $_lang['checking_php_version']; |
|
157 | +echo PHP_EOL.$_lang['checking_php_version']; |
|
158 | 158 | // -1 if left is less, 0 if equal, +1 if left is higher |
159 | 159 | if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) { |
160 | 160 | $errors++; |
161 | - $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
162 | - echo $_lang['failed'] . ' ' . $tmp . PHP_EOL; |
|
161 | + $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
162 | + echo $_lang['failed'].' '.$tmp.PHP_EOL; |
|
163 | 163 | } else { |
164 | - echo $_lang['ok'] . PHP_EOL; |
|
164 | + echo $_lang['ok'].PHP_EOL; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // check directories |
168 | 168 | // cache exists? |
169 | 169 | echo strip_tags($_lang['checking_if_cache_exist']); |
170 | 170 | if (!file_exists($path."../assets/cache") || !file_exists($path."../assets/cache/rss")) { |
171 | - echo $_lang['failed'] . PHP_EOL; |
|
171 | + echo $_lang['failed'].PHP_EOL; |
|
172 | 172 | $errors++; |
173 | 173 | } else { |
174 | - echo $_lang['ok'] . PHP_EOL; |
|
174 | + echo $_lang['ok'].PHP_EOL; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -179,82 +179,82 @@ discard block |
||
179 | 179 | echo strip_tags($_lang['checking_if_cache_writable']); |
180 | 180 | if (!is_writable($path."../assets/cache")) { |
181 | 181 | $errors++; |
182 | - echo $_lang['failed'] . PHP_EOL; |
|
182 | + echo $_lang['failed'].PHP_EOL; |
|
183 | 183 | } else { |
184 | - echo $_lang['ok'] . PHP_EOL; |
|
184 | + echo $_lang['ok'].PHP_EOL; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
188 | 188 | // cache files writable? |
189 | 189 | echo strip_tags($_lang['checking_if_cache_file_writable']); |
190 | 190 | $tmp = $path."../assets/cache/siteCache.idx.php"; |
191 | -if ( ! file_exists($tmp)) { |
|
191 | +if (!file_exists($tmp)) { |
|
192 | 192 | f_owc($tmp, "<?php //EVO site cache file ?>"); |
193 | 193 | } |
194 | -if ( ! is_writable($tmp)) { |
|
194 | +if (!is_writable($tmp)) { |
|
195 | 195 | $errors++; |
196 | - echo $_lang['failed'] . PHP_EOL; |
|
196 | + echo $_lang['failed'].PHP_EOL; |
|
197 | 197 | } else { |
198 | - echo $_lang['ok'] . PHP_EOL; |
|
198 | + echo $_lang['ok'].PHP_EOL; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | 202 | echo strip_tags($_lang['checking_if_cache_file2_writable']); |
203 | -if ( ! is_writable($path."../assets/cache/sitePublishing.idx.php")) { |
|
203 | +if (!is_writable($path."../assets/cache/sitePublishing.idx.php")) { |
|
204 | 204 | $errors++; |
205 | - echo $_lang['failed'] . PHP_EOL; |
|
205 | + echo $_lang['failed'].PHP_EOL; |
|
206 | 206 | } else { |
207 | - echo $_lang['ok'] . PHP_EOL; |
|
207 | + echo $_lang['ok'].PHP_EOL; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
211 | 211 | // File Browser directories exists? |
212 | 212 | echo strip_tags($_lang['checking_if_images_exist']); |
213 | -switch(true){ |
|
213 | +switch (true) { |
|
214 | 214 | case !file_exists($path."../assets/images"): |
215 | 215 | case !file_exists($path."../assets/files"): |
216 | 216 | case !file_exists($path."../assets/backup"): |
217 | 217 | //case !file_exists("../assets/.thumbs"): |
218 | 218 | $errors++; |
219 | - echo $_lang['failed'] . PHP_EOL; |
|
219 | + echo $_lang['failed'].PHP_EOL; |
|
220 | 220 | break; |
221 | 221 | default: |
222 | - echo $_lang['ok'] . PHP_EOL; |
|
222 | + echo $_lang['ok'].PHP_EOL; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
226 | 226 | // File Browser directories writable? |
227 | 227 | echo strip_tags($_lang['checking_if_images_writable']); |
228 | -switch(true){ |
|
228 | +switch (true) { |
|
229 | 229 | case !is_writable($path."../assets/images"): |
230 | 230 | case !is_writable($path."../assets/files"): |
231 | 231 | case !is_writable($path."../assets/backup"): |
232 | 232 | //case !is_writable("../assets/.thumbs"): |
233 | 233 | $errors++; |
234 | - echo $_lang['failed'] . PHP_EOL; |
|
234 | + echo $_lang['failed'].PHP_EOL; |
|
235 | 235 | break; |
236 | 236 | default: |
237 | - echo $_lang['ok'] . PHP_EOL; |
|
237 | + echo $_lang['ok'].PHP_EOL; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
241 | 241 | // export exists? |
242 | 242 | echo strip_tags($_lang['checking_if_export_exists']); |
243 | 243 | if (!file_exists($path."../assets/export")) { |
244 | - echo $_lang['failed'] . PHP_EOL; |
|
244 | + echo $_lang['failed'].PHP_EOL; |
|
245 | 245 | $errors++; |
246 | 246 | } else { |
247 | - echo $_lang['ok'] . PHP_EOL; |
|
247 | + echo $_lang['ok'].PHP_EOL; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
251 | 251 | // export writable? |
252 | 252 | echo strip_tags($_lang['checking_if_export_writable']); |
253 | 253 | if (!is_writable($path."../assets/export")) { |
254 | - echo $_lang['failed'] . PHP_EOL; |
|
254 | + echo $_lang['failed'].PHP_EOL; |
|
255 | 255 | $errors++; |
256 | 256 | } else { |
257 | - echo $_lang['ok'] . PHP_EOL; |
|
257 | + echo $_lang['ok'].PHP_EOL; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | $isWriteable = is_writable($tmp); |
270 | 270 | if (!$isWriteable) { |
271 | 271 | $errors++; |
272 | - echo $_lang['failed'] . PHP_EOL; |
|
272 | + echo $_lang['failed'].PHP_EOL; |
|
273 | 273 | } else { |
274 | - echo $_lang['ok'] . PHP_EOL; |
|
274 | + echo $_lang['ok'].PHP_EOL; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); |
288 | 288 | $database_connection_charset = $database_collation; |
289 | 289 | $database_connection_method = $database_connection_method; |
290 | - $dbase = '`' . $database_name . '`'; |
|
290 | + $dbase = '`'.$database_name.'`'; |
|
291 | 291 | $table_prefix = $tableprefix; |
292 | 292 | } |
293 | 293 | echo $_lang['creating_database_connection']; |
@@ -327,33 +327,33 @@ discard block |
||
327 | 327 | |
328 | 328 | // check table prefix |
329 | 329 | if ($conn && $installMode == 0) { |
330 | - echo $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
331 | - if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
332 | - echo $_lang['failed'] . ' ' . $_lang['table_prefix_already_inuse_note'] . PHP_EOL; |
|
330 | + echo $_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
331 | + if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
332 | + echo $_lang['failed'].' '.$_lang['table_prefix_already_inuse_note'].PHP_EOL; |
|
333 | 333 | $errors++; |
334 | 334 | |
335 | 335 | } else { |
336 | - echo $_lang['ok'] . PHP_EOL; |
|
336 | + echo $_lang['ok'].PHP_EOL; |
|
337 | 337 | } |
338 | 338 | } elseif ($conn && $installMode == 2) { |
339 | - echo $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
340 | - if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
341 | - echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL; |
|
339 | + echo $_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
340 | + if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
341 | + echo $_lang['failed'].' '.$_lang['table_prefix_not_exist'].PHP_EOL; |
|
342 | 342 | $errors++; |
343 | 343 | |
344 | 344 | } else { |
345 | - echo $_lang['ok'] . PHP_EOL; |
|
345 | + echo $_lang['ok'].PHP_EOL; |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
349 | 349 | // check mysql version |
350 | 350 | if ($conn) { |
351 | 351 | echo $_lang['checking_mysql_version']; |
352 | - if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) { |
|
353 | - echo $_lang['warning'] . ' ' . $_lang['mysql_5051'] . PHP_EOL; |
|
354 | - echo $_lang['mysql_5051_warning'] . PHP_EOL; |
|
352 | + if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) { |
|
353 | + echo $_lang['warning'].' '.$_lang['mysql_5051'].PHP_EOL; |
|
354 | + echo $_lang['mysql_5051_warning'].PHP_EOL; |
|
355 | 355 | } else { |
356 | - echo $_lang['ok'] . ' ' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . PHP_EOL; |
|
356 | + echo $_lang['ok'].' '.$_lang['mysql_version_is'].mysqli_get_server_info($conn).PHP_EOL; |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | |
@@ -361,20 +361,20 @@ discard block |
||
361 | 361 | if ($conn) { |
362 | 362 | echo $_lang['checking_mysql_strict_mode']; |
363 | 363 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
364 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
364 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
365 | 365 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
366 | 366 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
367 | 367 | // print_r($modes); |
368 | 368 | foreach ($modes as $mode) { |
369 | 369 | if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
370 | - echo $_lang['warning'] . ' ' . $_lang['strict_mode'] . PHP_EOL; |
|
371 | - echo $_lang['strict_mode_error'] . PHP_EOL; |
|
370 | + echo $_lang['warning'].' '.$_lang['strict_mode'].PHP_EOL; |
|
371 | + echo $_lang['strict_mode_error'].PHP_EOL; |
|
372 | 372 | } else { |
373 | - echo $_lang['ok'] . PHP_EOL; |
|
373 | + echo $_lang['ok'].PHP_EOL; |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | } else { |
377 | - echo $_lang['ok'] . PHP_EOL; |
|
377 | + echo $_lang['ok'].PHP_EOL; |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | // Version and strict mode check end |
@@ -390,17 +390,17 @@ discard block |
||
390 | 390 | f_owc($path."../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>'); |
391 | 391 | } |
392 | 392 | |
393 | -if($installMode > 0 && $_POST['installdata'] == "1") { |
|
394 | - echo $_lang['sample_web_site'] . ': ' . $_lang['sample_web_site_note'] . PHP_EOL; |
|
393 | +if ($installMode > 0 && $_POST['installdata'] == "1") { |
|
394 | + echo $_lang['sample_web_site'].': '.$_lang['sample_web_site_note'].PHP_EOL; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | if ($errors > 0) { |
398 | - echo $_lang['setup_cannot_continue'] . ' '; |
|
398 | + echo $_lang['setup_cannot_continue'].' '; |
|
399 | 399 | |
400 | - if($errors > 1){ |
|
401 | - echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
|
402 | - }else{ |
|
403 | - echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']. PHP_EOL; |
|
400 | + if ($errors > 1) { |
|
401 | + echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural']; |
|
402 | + } else { |
|
403 | + echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'].PHP_EOL; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | die(); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
430 | 430 | $database_connection_charset = $database_charset; |
431 | 431 | $database_connection_method = $database_connection_method; |
432 | - $dbase = "`" .$database_name. "`"; |
|
432 | + $dbase = "`".$database_name."`"; |
|
433 | 433 | $table_prefix = $tableprefix; |
434 | 434 | $adminname = $cmsadmin; |
435 | 435 | $adminemail = $cmsadminemail; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | // set session name variable |
442 | 442 | if (!isset ($site_sessionname)) { |
443 | - $site_sessionname = 'SN' . uniqid(''); |
|
443 | + $site_sessionname = 'SN'.uniqid(''); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | // get base path and url |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | array_pop($a); |
455 | 455 | $pth = implode("install", $a); |
456 | 456 | unset ($a); |
457 | -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
|
458 | -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); |
|
457 | +$base_url = $url.(substr($url, -1) != "/" ? "/" : ""); |
|
458 | +$base_path = $pth.(substr($pth, -1) != "/" ? "/" : ""); |
|
459 | 459 | |
460 | 460 | // connect to the database |
461 | 461 | echo $_lang['setup_database_create_connection'].': '; |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | } |
468 | 468 | |
469 | 469 | // select database |
470 | -echo $_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: "; |
|
470 | +echo $_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: "; |
|
471 | 471 | if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) { |
472 | 472 | echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL; |
473 | 473 | $create = true; |
@@ -479,16 +479,16 @@ discard block |
||
479 | 479 | |
480 | 480 | // try to create the database |
481 | 481 | if ($create) { |
482 | - echo $_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: "; |
|
482 | + echo $_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: "; |
|
483 | 483 | // if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) { |
484 | - if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
484 | + if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
485 | 485 | echo $_lang['setup_database_creation_failed']." ".$_lang['setup_database_creation_failed_note'].PHP_EOL; |
486 | 486 | $errors += 1; |
487 | 487 | |
488 | - echo 'database charset: ' . $database_charset . PHP_EOL; |
|
489 | - echo 'database collation: ' . $database_collation . PHP_EOL; |
|
488 | + echo 'database charset: '.$database_charset.PHP_EOL; |
|
489 | + echo 'database collation: '.$database_collation.PHP_EOL; |
|
490 | 490 | |
491 | - echo $_lang['setup_database_creation_failed_note2'] . PHP_EOL; |
|
491 | + echo $_lang['setup_database_creation_failed_note2'].PHP_EOL; |
|
492 | 492 | |
493 | 493 | die(); |
494 | 494 | |
@@ -499,18 +499,18 @@ discard block |
||
499 | 499 | |
500 | 500 | // check table prefix |
501 | 501 | if ($installMode == 0) { |
502 | - echo $_lang['checking_table_prefix'] . $table_prefix . "`: "; |
|
503 | - if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
504 | - echo $_lang['failed'] . " " . $_lang['table_prefix_already_inuse'] . PHP_EOL; |
|
502 | + echo $_lang['checking_table_prefix'].$table_prefix."`: "; |
|
503 | + if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
504 | + echo $_lang['failed']." ".$_lang['table_prefix_already_inuse'].PHP_EOL; |
|
505 | 505 | $errors += 1; |
506 | - echo $_lang['table_prefix_already_inuse_note'] . PHP_EOL; |
|
506 | + echo $_lang['table_prefix_already_inuse_note'].PHP_EOL; |
|
507 | 507 | return; |
508 | 508 | } else { |
509 | 509 | echo $_lang['ok'].PHP_EOL; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | -if(!function_exists('parseProperties')) { |
|
513 | +if (!function_exists('parseProperties')) { |
|
514 | 514 | /** |
515 | 515 | * parses a resource property string and returns the result as an array |
516 | 516 | * duplicate of method in documentParser class |
@@ -518,20 +518,20 @@ discard block |
||
518 | 518 | * @param string $propertyString |
519 | 519 | * @return array |
520 | 520 | */ |
521 | - function parseProperties($propertyString) { |
|
522 | - $parameter= array (); |
|
521 | + function parseProperties($propertyString){ |
|
522 | + $parameter = array(); |
|
523 | 523 | if (!empty ($propertyString)) { |
524 | - $tmpParams= explode("&", $propertyString); |
|
524 | + $tmpParams = explode("&", $propertyString); |
|
525 | 525 | $countParams = count($tmpParams); |
526 | - for ($x= 0; $x < $countParams; $x++) { |
|
526 | + for ($x = 0; $x < $countParams; $x++) { |
|
527 | 527 | if (strpos($tmpParams[$x], '=', 0)) { |
528 | - $pTmp= explode("=", $tmpParams[$x]); |
|
529 | - $pvTmp= explode(";", trim($pTmp[1])); |
|
528 | + $pTmp = explode("=", $tmpParams[$x]); |
|
529 | + $pvTmp = explode(";", trim($pTmp[1])); |
|
530 | 530 | if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
531 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
531 | + $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default |
|
532 | 532 | else |
533 | 533 | if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
534 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
534 | + $parameter[trim($pTmp[0])] = $pvTmp[2]; |
|
535 | 535 | } |
536 | 536 | } |
537 | 537 | } |
@@ -542,20 +542,20 @@ discard block |
||
542 | 542 | // check status of Inherit Parent Template plugin |
543 | 543 | $auto_template_logic = 'parent'; |
544 | 544 | if ($installMode != 0) { |
545 | - $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"); |
|
545 | + $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"); |
|
546 | 546 | $row = mysqli_fetch_row($rs); |
547 | - if(!$row) { |
|
547 | + if (!$row) { |
|
548 | 548 | // not installed |
549 | 549 | $auto_template_logic = 'system'; |
550 | 550 | } else { |
551 | - if($row[1] == 1) { |
|
551 | + if ($row[1] == 1) { |
|
552 | 552 | // installed but disabled |
553 | 553 | $auto_template_logic = 'system'; |
554 | 554 | } else { |
555 | 555 | // installed, enabled .. see how it's configured |
556 | 556 | $properties = parseProperties($row[0]); |
557 | - if(isset($properties['inheritTemplate'])) { |
|
558 | - if($properties['inheritTemplate'] == 'From First Sibling') { |
|
557 | + if (isset($properties['inheritTemplate'])) { |
|
558 | + if ($properties['inheritTemplate'] == 'From First Sibling') { |
|
559 | 559 | $auto_template_logic = 'sibling'; |
560 | 560 | } |
561 | 561 | } |
@@ -577,17 +577,16 @@ discard block |
||
577 | 577 | |
578 | 578 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
579 | 579 | $mt = &$moduleTemplates; |
580 | -if(is_dir($templatePath) && is_readable($templatePath)) { |
|
580 | +if (is_dir($templatePath) && is_readable($templatePath)) { |
|
581 | 581 | $d = dir($templatePath); |
582 | 582 | while (false !== ($tplfile = $d->read())) |
583 | 583 | { |
584 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
584 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
585 | 585 | $params = parse_docblock($templatePath, $tplfile); |
586 | - if(is_array($params) && (count($params)>0)) |
|
586 | + if (is_array($params) && (count($params) > 0)) |
|
587 | 587 | { |
588 | 588 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
589 | - $mt[] = array |
|
590 | - ( |
|
589 | + $mt[] = array( |
|
591 | 590 | $params['name'], |
592 | 591 | $description, |
593 | 592 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -605,12 +604,12 @@ discard block |
||
605 | 604 | |
606 | 605 | // setup Template Variable template files |
607 | 606 | $mtv = &$moduleTVs; |
608 | -if(is_dir($tvPath) && is_readable($tvPath)) { |
|
607 | +if (is_dir($tvPath) && is_readable($tvPath)) { |
|
609 | 608 | $d = dir($tvPath); |
610 | 609 | while (false !== ($tplfile = $d->read())) { |
611 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
610 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
612 | 611 | $params = parse_docblock($tvPath, $tplfile); |
613 | - if(is_array($params) && (count($params)>0)) { |
|
612 | + if (is_array($params) && (count($params) > 0)) { |
|
614 | 613 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
615 | 614 | $mtv[] = array( |
616 | 615 | $params['name'], |
@@ -622,9 +621,9 @@ discard block |
||
622 | 621 | $params['output_widget'], |
623 | 622 | $params['output_widget_params'], |
624 | 623 | "$templatePath/{$params['filename']}", /* not currently used */ |
625 | - $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */ |
|
624 | + $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */ |
|
626 | 625 | $params['modx_category'], |
627 | - $params['lock_tv'], /* value should be 1 or 0 */ |
|
626 | + $params['lock_tv'], /* value should be 1 or 0 */ |
|
628 | 627 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
629 | 628 | ); |
630 | 629 | } |
@@ -634,14 +633,14 @@ discard block |
||
634 | 633 | |
635 | 634 | // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content |
636 | 635 | $mc = &$moduleChunks; |
637 | -if(is_dir($chunkPath) && is_readable($chunkPath)) { |
|
636 | +if (is_dir($chunkPath) && is_readable($chunkPath)) { |
|
638 | 637 | $d = dir($chunkPath); |
639 | 638 | while (false !== ($tplfile = $d->read())) { |
640 | - if(substr($tplfile, -4) != '.tpl') { |
|
639 | + if (substr($tplfile, -4) != '.tpl') { |
|
641 | 640 | continue; |
642 | 641 | } |
643 | 642 | $params = parse_docblock($chunkPath, $tplfile); |
644 | - if(is_array($params) && count($params) > 0) { |
|
643 | + if (is_array($params) && count($params) > 0) { |
|
645 | 644 | $mc[] = array( |
646 | 645 | $params['name'], |
647 | 646 | $params['description'], |
@@ -657,14 +656,14 @@ discard block |
||
657 | 656 | |
658 | 657 | // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties |
659 | 658 | $ms = &$moduleSnippets; |
660 | -if(is_dir($snippetPath) && is_readable($snippetPath)) { |
|
659 | +if (is_dir($snippetPath) && is_readable($snippetPath)) { |
|
661 | 660 | $d = dir($snippetPath); |
662 | 661 | while (false !== ($tplfile = $d->read())) { |
663 | - if(substr($tplfile, -4) != '.tpl') { |
|
662 | + if (substr($tplfile, -4) != '.tpl') { |
|
664 | 663 | continue; |
665 | 664 | } |
666 | 665 | $params = parse_docblock($snippetPath, $tplfile); |
667 | - if(is_array($params) && count($params) > 0) { |
|
666 | + if (is_array($params) && count($params) > 0) { |
|
668 | 667 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
669 | 668 | $ms[] = array( |
670 | 669 | $params['name'], |
@@ -681,14 +680,14 @@ discard block |
||
681 | 680 | |
682 | 681 | // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties |
683 | 682 | $mp = &$modulePlugins; |
684 | -if(is_dir($pluginPath) && is_readable($pluginPath)) { |
|
683 | +if (is_dir($pluginPath) && is_readable($pluginPath)) { |
|
685 | 684 | $d = dir($pluginPath); |
686 | 685 | while (false !== ($tplfile = $d->read())) { |
687 | - if(substr($tplfile, -4) != '.tpl') { |
|
686 | + if (substr($tplfile, -4) != '.tpl') { |
|
688 | 687 | continue; |
689 | 688 | } |
690 | 689 | $params = parse_docblock($pluginPath, $tplfile); |
691 | - if(is_array($params) && count($params) > 0) { |
|
690 | + if (is_array($params) && count($params) > 0) { |
|
692 | 691 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
693 | 692 | $mp[] = array( |
694 | 693 | $params['name'], |
@@ -700,7 +699,7 @@ discard block |
||
700 | 699 | $params['modx_category'], |
701 | 700 | $params['legacy_names'], |
702 | 701 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
703 | - (int)$params['disabled'] |
|
702 | + (int) $params['disabled'] |
|
704 | 703 | ); |
705 | 704 | } |
706 | 705 | } |
@@ -710,14 +709,14 @@ discard block |
||
710 | 709 | // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams |
711 | 710 | $mm = &$moduleModules; |
712 | 711 | $mdp = &$moduleDependencies; |
713 | -if(is_dir($modulePath) && is_readable($modulePath)) { |
|
712 | +if (is_dir($modulePath) && is_readable($modulePath)) { |
|
714 | 713 | $d = dir($modulePath); |
715 | 714 | while (false !== ($tplfile = $d->read())) { |
716 | - if(substr($tplfile, -4) != '.tpl') { |
|
715 | + if (substr($tplfile, -4) != '.tpl') { |
|
717 | 716 | continue; |
718 | 717 | } |
719 | 718 | $params = parse_docblock($modulePath, $tplfile); |
720 | - if(is_array($params) && count($params) > 0) { |
|
719 | + if (is_array($params) && count($params) > 0) { |
|
721 | 720 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
722 | 721 | $mm[] = array( |
723 | 722 | $params['name'], |
@@ -725,12 +724,12 @@ discard block |
||
725 | 724 | "$modulePath/{$params['filename']}", |
726 | 725 | $params['properties'], |
727 | 726 | $params['guid'], |
728 | - (int)$params['shareparams'], |
|
727 | + (int) $params['shareparams'], |
|
729 | 728 | $params['modx_category'], |
730 | 729 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
731 | 730 | ); |
732 | 731 | } |
733 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
732 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
734 | 733 | $dependencies = explode(',', $params['dependencies']); |
735 | 734 | foreach ($dependencies as $dependency) { |
736 | 735 | $dependency = explode(':', $dependency); |
@@ -801,103 +800,103 @@ discard block |
||
801 | 800 | // setup callback function |
802 | 801 | $callBackFnc = "clean_up"; |
803 | 802 | |
804 | -function clean_up($sqlParser) { |
|
803 | +function clean_up($sqlParser){ |
|
805 | 804 | $ids = array(); |
806 | 805 | |
807 | 806 | // secure web documents - privateweb |
808 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
809 | - $sql = "SELECT DISTINCT sc.id |
|
807 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
808 | + $sql = "SELECT DISTINCT sc.id |
|
810 | 809 | FROM `".$sqlParser->prefix."site_content` sc |
811 | 810 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
812 | 811 | LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group |
813 | 812 | WHERE wga.id>0"; |
814 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
815 | - if(!$ds) { |
|
813 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
814 | + if (!$ds) { |
|
816 | 815 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
817 | 816 | } |
818 | 817 | else { |
819 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
820 | - if(count($ids)>0) { |
|
821 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
818 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
819 | + if (count($ids) > 0) { |
|
820 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
822 | 821 | unset($ids); |
823 | 822 | } |
824 | 823 | } |
825 | 824 | |
826 | 825 | // secure manager documents privatemgr |
827 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
828 | - $sql = "SELECT DISTINCT sc.id |
|
826 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
827 | + $sql = "SELECT DISTINCT sc.id |
|
829 | 828 | FROM `".$sqlParser->prefix."site_content` sc |
830 | 829 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
831 | 830 | LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group |
832 | 831 | WHERE mga.id>0"; |
833 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
834 | - if(!$ds) { |
|
832 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
833 | + if (!$ds) { |
|
835 | 834 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
836 | 835 | } |
837 | 836 | else { |
838 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
839 | - if(count($ids)>0) { |
|
840 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
837 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
838 | + if (count($ids) > 0) { |
|
839 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
841 | 840 | unset($ids); |
842 | 841 | } |
843 | 842 | } |
844 | 843 | } |
845 | 844 | |
846 | -function parse_docblock($element_dir, $filename) { |
|
845 | +function parse_docblock($element_dir, $filename){ |
|
847 | 846 | $params = array(); |
848 | - $fullpath = $element_dir . '/' . $filename; |
|
849 | - if(is_readable($fullpath)) { |
|
847 | + $fullpath = $element_dir.'/'.$filename; |
|
848 | + if (is_readable($fullpath)) { |
|
850 | 849 | $tpl = @fopen($fullpath, "r"); |
851 | - if($tpl) { |
|
850 | + if ($tpl) { |
|
852 | 851 | $params['filename'] = $filename; |
853 | 852 | $docblock_start_found = false; |
854 | 853 | $name_found = false; |
855 | 854 | $description_found = false; |
856 | 855 | |
857 | - while(!feof($tpl)) { |
|
856 | + while (!feof($tpl)) { |
|
858 | 857 | $line = fgets($tpl); |
859 | - if(!$docblock_start_found) { |
|
858 | + if (!$docblock_start_found) { |
|
860 | 859 | // find docblock start |
861 | - if(strpos($line, '/**') !== false) { |
|
860 | + if (strpos($line, '/**') !== false) { |
|
862 | 861 | $docblock_start_found = true; |
863 | 862 | } |
864 | 863 | continue; |
865 | - } elseif(!$name_found) { |
|
864 | + } elseif (!$name_found) { |
|
866 | 865 | // find name |
867 | 866 | $ma = null; |
868 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
867 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
869 | 868 | $params['name'] = trim($ma[1]); |
870 | 869 | $name_found = !empty($params['name']); |
871 | 870 | } |
872 | 871 | continue; |
873 | - } elseif(!$description_found) { |
|
872 | + } elseif (!$description_found) { |
|
874 | 873 | // find description |
875 | 874 | $ma = null; |
876 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
875 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
877 | 876 | $params['description'] = trim($ma[1]); |
878 | 877 | $description_found = !empty($params['description']); |
879 | 878 | } |
880 | 879 | continue; |
881 | 880 | } else { |
882 | 881 | $ma = null; |
883 | - if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
882 | + if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
884 | 883 | $param = trim($ma[1]); |
885 | 884 | $val = trim($ma[2]); |
886 | - if(!empty($param) && !empty($val)) { |
|
887 | - if($param == 'internal') { |
|
885 | + if (!empty($param) && !empty($val)) { |
|
886 | + if ($param == 'internal') { |
|
888 | 887 | $ma = null; |
889 | - if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
888 | + if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
890 | 889 | $param = trim($ma[1]); |
891 | 890 | $val = trim($ma[2]); |
892 | 891 | } |
893 | 892 | //if($val !== '0' && (empty($param) || empty($val))) { |
894 | - if(empty($param)) { |
|
893 | + if (empty($param)) { |
|
895 | 894 | continue; |
896 | 895 | } |
897 | 896 | } |
898 | 897 | $params[$param] = $val; |
899 | 898 | } |
900 | - } elseif(preg_match("/^\s*\*\/\s*$/", $line)) { |
|
899 | + } elseif (preg_match("/^\s*\*\/\s*$/", $line)) { |
|
901 | 900 | break; |
902 | 901 | } |
903 | 902 | } |
@@ -928,13 +927,13 @@ discard block |
||
928 | 927 | // display database results |
929 | 928 | if ($sqlParser->installFailed == true) { |
930 | 929 | $errors += 1; |
931 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
932 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
933 | - echo $_lang['installation_error_occured'] . PHP_EOL; |
|
930 | + echo $_lang['database_alerts'].PHP_EOL; |
|
931 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
932 | + echo $_lang['installation_error_occured'].PHP_EOL; |
|
934 | 933 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
935 | - echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL; |
|
934 | + echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL; |
|
936 | 935 | } |
937 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
936 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
938 | 937 | die(); |
939 | 938 | } else { |
940 | 939 | echo $_lang['ok'].PHP_EOL; |
@@ -944,7 +943,7 @@ discard block |
||
944 | 943 | // custom or not |
945 | 944 | if (file_exists($path."../assets/cache/siteManager.php")) { |
946 | 945 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
947 | -}else{ |
|
946 | +} else { |
|
948 | 947 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
949 | 948 | } |
950 | 949 | |
@@ -981,16 +980,16 @@ discard block |
||
981 | 980 | $chmodSuccess = @chmod($filename, 0404); |
982 | 981 | |
983 | 982 | if ($configFileFailed == true) { |
984 | - echo $_lang['failed'] . PHP_EOL; |
|
983 | + echo $_lang['failed'].PHP_EOL; |
|
985 | 984 | $errors += 1; |
986 | 985 | |
987 | - echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR .'/includes/config.inc.php' .PHP_EOL; |
|
986 | + echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL; |
|
988 | 987 | echo ' '.PHP_EOL; |
989 | 988 | echo ' '.PHP_EOL; |
990 | 989 | echo $configString; |
991 | 990 | echo ' '.PHP_EOL; |
992 | 991 | echo ' '.PHP_EOL; |
993 | - echo $_lang['cant_write_config_file_note'] . PHP_EOL; |
|
992 | + echo $_lang['cant_write_config_file_note'].PHP_EOL; |
|
994 | 993 | die(); |
995 | 994 | |
996 | 995 | } else { |
@@ -1000,16 +999,16 @@ discard block |
||
1000 | 999 | // generate new site_id and set manager theme to default |
1001 | 1000 | if ($installMode == 0) { |
1002 | 1001 | $siteid = uniqid(''); |
1003 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
1002 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
1004 | 1003 | } else { |
1005 | 1004 | // update site_id if missing |
1006 | - $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); |
|
1005 | + $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"); |
|
1007 | 1006 | if ($ds) { |
1008 | 1007 | $r = mysqli_fetch_assoc($ds); |
1009 | 1008 | $siteid = $r['setting_value']; |
1010 | 1009 | if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') { |
1011 | 1010 | $siteid = uniqid(''); |
1012 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
1011 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
1013 | 1012 | } |
1014 | 1013 | } |
1015 | 1014 | } |
@@ -1021,29 +1020,29 @@ discard block |
||
1021 | 1020 | // display database results |
1022 | 1021 | if ($sqlParser->installFailed == true) { |
1023 | 1022 | $errors += 1; |
1024 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
1025 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
1026 | - echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL; |
|
1023 | + echo $_lang['database_alerts'].PHP_EOL; |
|
1024 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
1025 | + echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL; |
|
1027 | 1026 | /* |
1028 | 1027 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
1029 | 1028 | echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
1030 | 1029 | } |
1031 | 1030 | echo "</p>";*/ |
1032 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
1031 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
1033 | 1032 | die(); |
1034 | 1033 | } else { |
1035 | - echo $_lang['ok'] . PHP_EOL; |
|
1034 | + echo $_lang['ok'].PHP_EOL; |
|
1036 | 1035 | } |
1037 | 1036 | } |
1038 | 1037 | |
1039 | 1038 | // Install Templates |
1040 | 1039 | $moduleTemplate = $mt; |
1041 | 1040 | if (!empty($moduleTemplate) || $installData) { |
1042 | - echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL; |
|
1041 | + echo PHP_EOL.$_lang['templates'].":".PHP_EOL; |
|
1043 | 1042 | //$selTemplates = $_POST['template']; |
1044 | 1043 | foreach ($moduleTemplates as $k=>$moduleTemplate) { |
1045 | 1044 | $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; |
1046 | - if($installSample || is_array($moduleTemplate)) { |
|
1045 | + if ($installSample || is_array($moduleTemplate)) { |
|
1047 | 1046 | $name = mysqli_real_escape_string($conn, $moduleTemplate[0]); |
1048 | 1047 | $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]); |
1049 | 1048 | $category = mysqli_real_escape_string($conn, $moduleTemplate[4]); |
@@ -1051,7 +1050,7 @@ discard block |
||
1051 | 1050 | $filecontent = $moduleTemplate[3]; |
1052 | 1051 | $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site |
1053 | 1052 | if (!file_exists($filecontent)) { |
1054 | - echo " $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1053 | + echo " $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1055 | 1054 | } else { |
1056 | 1055 | // Create the category if it does not already exist |
1057 | 1056 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -1061,31 +1060,31 @@ discard block |
||
1061 | 1060 | $template = mysqli_real_escape_string($conn, $template); |
1062 | 1061 | |
1063 | 1062 | // See if the template already exists |
1064 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
|
1063 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"); |
|
1065 | 1064 | |
1066 | 1065 | if (mysqli_num_rows($rs)) { |
1067 | - 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;")) { |
|
1066 | + 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;")) { |
|
1068 | 1067 | $errors += 1; |
1069 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1068 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1070 | 1069 | return; |
1071 | 1070 | } |
1072 | - if(!is_null($save_sql_id_as)) { |
|
1071 | + if (!is_null($save_sql_id_as)) { |
|
1073 | 1072 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
1074 | - if(!$sql_id) { |
|
1075 | - $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
1073 | + if (!$sql_id) { |
|
1074 | + $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
1076 | 1075 | $sql_id = $idQuery['id']; |
1077 | 1076 | } |
1078 | 1077 | $custom_placeholders[$save_sql_id_as] = $sql_id; |
1079 | 1078 | } |
1080 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1079 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1081 | 1080 | } else { |
1082 | - if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
1081 | + if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
1083 | 1082 | $errors += 1; |
1084 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1083 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1085 | 1084 | die(); |
1086 | 1085 | } |
1087 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
1088 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1086 | + if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
1087 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1089 | 1088 | } |
1090 | 1089 | } |
1091 | 1090 | } |
@@ -1095,11 +1094,11 @@ discard block |
||
1095 | 1094 | // Install Template Variables |
1096 | 1095 | $moduleTVs = $mtv; |
1097 | 1096 | if (is_array($moduleTVs) || $installData) { |
1098 | - echo PHP_EOL . $_lang['tvs'].': '.PHP_EOL; |
|
1097 | + echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL; |
|
1099 | 1098 | //$selTVs = $_POST['tv']; |
1100 | 1099 | foreach ($moduleTVs as $k=>$moduleTV) { |
1101 | 1100 | $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; |
1102 | - if($installSample || is_array($moduleTVs)) { |
|
1101 | + if ($installSample || is_array($moduleTVs)) { |
|
1103 | 1102 | $name = mysqli_real_escape_string($conn, $moduleTV[0]); |
1104 | 1103 | $caption = mysqli_real_escape_string($conn, $moduleTV[1]); |
1105 | 1104 | $desc = mysqli_real_escape_string($conn, $moduleTV[2]); |
@@ -1117,24 +1116,24 @@ discard block |
||
1117 | 1116 | // Create the category if it does not already exist |
1118 | 1117 | $category = getCreateDbCategory($category, $sqlParser); |
1119 | 1118 | |
1120 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"); |
|
1119 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"); |
|
1121 | 1120 | if (mysqli_num_rows($rs)) { |
1122 | 1121 | $insert = true; |
1123 | - while($row = mysqli_fetch_assoc($rs)) { |
|
1124 | - 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']};")) { |
|
1125 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1122 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
1123 | + 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']};")) { |
|
1124 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1126 | 1125 | return; |
1127 | 1126 | } |
1128 | 1127 | $insert = false; |
1129 | 1128 | } |
1130 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1129 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1131 | 1130 | } else { |
1132 | - $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');"; |
|
1131 | + $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');"; |
|
1133 | 1132 | if (!mysqli_query($sqlParser->conn, $q)) { |
1134 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1133 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1135 | 1134 | return; |
1136 | 1135 | } |
1137 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1136 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1138 | 1137 | } |
1139 | 1138 | |
1140 | 1139 | // add template assignments |
@@ -1143,10 +1142,10 @@ discard block |
||
1143 | 1142 | if (count($assignments) > 0) { |
1144 | 1143 | |
1145 | 1144 | // remove existing tv -> template assignments |
1146 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
1145 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
1147 | 1146 | $row = mysqli_fetch_assoc($ds); |
1148 | 1147 | $id = $row["id"]; |
1149 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
1148 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''); |
|
1150 | 1149 | |
1151 | 1150 | // add tv -> template assignments |
1152 | 1151 | foreach ($assignments as $assignment) { |
@@ -1155,7 +1154,7 @@ discard block |
||
1155 | 1154 | if ($ds && $ts) { |
1156 | 1155 | $tRow = mysqli_fetch_assoc($ts); |
1157 | 1156 | $templateId = $tRow['id']; |
1158 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
1157 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
1159 | 1158 | } |
1160 | 1159 | } |
1161 | 1160 | } |
@@ -1166,12 +1165,12 @@ discard block |
||
1166 | 1165 | |
1167 | 1166 | $moduleChunks = $mc; |
1168 | 1167 | // Install Chunks |
1169 | -if (is_array ($moduleChunks) || $installData) { |
|
1170 | - echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL; |
|
1168 | +if (is_array($moduleChunks) || $installData) { |
|
1169 | + echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL; |
|
1171 | 1170 | foreach ($moduleChunks as $k=>$moduleChunk) { |
1172 | 1171 | $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; |
1173 | 1172 | $count_new_name = 0; |
1174 | - if($installSample || is_array ($moduleChunks)) { |
|
1173 | + if ($installSample || is_array($moduleChunks)) { |
|
1175 | 1174 | |
1176 | 1175 | $name = mysqli_real_escape_string($conn, $moduleChunk[0]); |
1177 | 1176 | $desc = mysqli_real_escape_string($conn, $moduleChunk[1]); |
@@ -1180,7 +1179,7 @@ discard block |
||
1180 | 1179 | $filecontent = $moduleChunk[2]; |
1181 | 1180 | |
1182 | 1181 | if (!file_exists($filecontent)) |
1183 | - echo " $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1182 | + echo " $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1184 | 1183 | else { |
1185 | 1184 | |
1186 | 1185 | // Create the category if it does not already exist |
@@ -1188,31 +1187,31 @@ discard block |
||
1188 | 1187 | |
1189 | 1188 | $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); |
1190 | 1189 | $chunk = mysqli_real_escape_string($conn, $chunk); |
1191 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); |
|
1190 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"); |
|
1192 | 1191 | $count_original_name = mysqli_num_rows($rs); |
1193 | - if($overwrite == 'false') { |
|
1194 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
1195 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); |
|
1192 | + if ($overwrite == 'false') { |
|
1193 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
1194 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"); |
|
1196 | 1195 | $count_new_name = mysqli_num_rows($rs); |
1197 | 1196 | } |
1198 | 1197 | $update = $count_original_name > 0 && $overwrite == 'true'; |
1199 | 1198 | if ($update) { |
1200 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
1199 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
1201 | 1200 | $errors += 1; |
1202 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1201 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1203 | 1202 | return; |
1204 | 1203 | } |
1205 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1206 | - } elseif($count_new_name == 0) { |
|
1207 | - if($count_original_name > 0 && $overwrite == 'false') { |
|
1204 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1205 | + } elseif ($count_new_name == 0) { |
|
1206 | + if ($count_original_name > 0 && $overwrite == 'false') { |
|
1208 | 1207 | $name = $newname; |
1209 | 1208 | } |
1210 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
1209 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
1211 | 1210 | $errors += 1; |
1212 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1211 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1213 | 1212 | return; |
1214 | 1213 | } |
1215 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1214 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1216 | 1215 | } |
1217 | 1216 | } |
1218 | 1217 | } |
@@ -1222,11 +1221,11 @@ discard block |
||
1222 | 1221 | // Install Modules |
1223 | 1222 | $moduleModules = $mm; |
1224 | 1223 | if (is_array($moduleModules) || $installData) { |
1225 | - echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL; |
|
1224 | + echo PHP_EOL.$_lang['modules'].":".PHP_EOL; |
|
1226 | 1225 | //$selModules = $_POST['module']; |
1227 | 1226 | foreach ($moduleModules as $k=>$moduleModule) { |
1228 | 1227 | $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; |
1229 | - if($installSample || is_array($moduleModules)) { |
|
1228 | + if ($installSample || is_array($moduleModules)) { |
|
1230 | 1229 | $name = mysqli_real_escape_string($conn, $moduleModule[0]); |
1231 | 1230 | $desc = mysqli_real_escape_string($conn, $moduleModule[1]); |
1232 | 1231 | $filecontent = $moduleModule[2]; |
@@ -1235,7 +1234,7 @@ discard block |
||
1235 | 1234 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
1236 | 1235 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
1237 | 1236 | if (!file_exists($filecontent)) |
1238 | - echo " $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1237 | + echo " $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1239 | 1238 | else { |
1240 | 1239 | |
1241 | 1240 | // Create the category if it does not already exist |
@@ -1244,24 +1243,24 @@ discard block |
||
1244 | 1243 | $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
1245 | 1244 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
1246 | 1245 | $module = mysqli_real_escape_string($conn, $module); |
1247 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
1246 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
1248 | 1247 | if (mysqli_num_rows($rs)) { |
1249 | 1248 | $row = mysqli_fetch_assoc($rs); |
1250 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1251 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
1252 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1249 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1250 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
1251 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1253 | 1252 | return; |
1254 | 1253 | } |
1255 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1254 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1256 | 1255 | } else { |
1257 | - if ($properties != NULL ){ |
|
1256 | + if ($properties != NULL) { |
|
1258 | 1257 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1259 | 1258 | } |
1260 | - 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);")) { |
|
1261 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
1259 | + 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);")) { |
|
1260 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
1262 | 1261 | return; |
1263 | 1262 | } |
1264 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1263 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1265 | 1264 | } |
1266 | 1265 | } |
1267 | 1266 | } |
@@ -1271,11 +1270,11 @@ discard block |
||
1271 | 1270 | // Install Plugins |
1272 | 1271 | $modulePlugins = $mp; |
1273 | 1272 | if (is_array($modulePlugins) || $installData) { |
1274 | - echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL; |
|
1273 | + echo PHP_EOL.$_lang['plugins'].":".PHP_EOL; |
|
1275 | 1274 | $selPlugs = $_POST['plugin']; |
1276 | 1275 | foreach ($modulePlugins as $k=>$modulePlugin) { |
1277 | 1276 | //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; |
1278 | - if($installSample || is_array($modulePlugins)) { |
|
1277 | + if ($installSample || is_array($modulePlugins)) { |
|
1279 | 1278 | $name = mysqli_real_escape_string($conn, $modulePlugin[0]); |
1280 | 1279 | $desc = mysqli_real_escape_string($conn, $modulePlugin[1]); |
1281 | 1280 | $filecontent = $modulePlugin[2]; |
@@ -1285,17 +1284,17 @@ discard block |
||
1285 | 1284 | $category = mysqli_real_escape_string($conn, $modulePlugin[6]); |
1286 | 1285 | $leg_names = ''; |
1287 | 1286 | $disabled = $modulePlugin[9]; |
1288 | - if(array_key_exists(7, $modulePlugin)) { |
|
1287 | + if (array_key_exists(7, $modulePlugin)) { |
|
1289 | 1288 | // parse comma-separated legacy names and prepare them for sql IN clause |
1290 | - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
|
1289 | + $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'"; |
|
1291 | 1290 | } |
1292 | 1291 | if (!file_exists($filecontent)) |
1293 | - echo " $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1292 | + echo " $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1294 | 1293 | else { |
1295 | 1294 | |
1296 | 1295 | // disable legacy versions based on legacy_names provided |
1297 | - if(!empty($leg_names)) { |
|
1298 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
1296 | + if (!empty($leg_names)) { |
|
1297 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
1299 | 1298 | $rs = mysqli_query($sqlParser->conn, $update_query); |
1300 | 1299 | } |
1301 | 1300 | |
@@ -1305,52 +1304,52 @@ discard block |
||
1305 | 1304 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
1306 | 1305 | $plugin = removeDocblock($plugin, 'plugin'); |
1307 | 1306 | $plugin = mysqli_real_escape_string($conn, $plugin); |
1308 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"); |
|
1307 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"); |
|
1309 | 1308 | if (mysqli_num_rows($rs)) { |
1310 | 1309 | $insert = true; |
1311 | - while($row = mysqli_fetch_assoc($rs)) { |
|
1312 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1313 | - if($row['description'] == $desc){ |
|
1314 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
1315 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1310 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
1311 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1312 | + if ($row['description'] == $desc) { |
|
1313 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
1314 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1316 | 1315 | return; |
1317 | 1316 | } |
1318 | 1317 | $insert = false; |
1319 | 1318 | } else { |
1320 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
1319 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
1321 | 1320 | echo mysqli_error($sqlParser->conn).PHP_EOL; |
1322 | 1321 | return; |
1323 | 1322 | } |
1324 | 1323 | } |
1325 | 1324 | } |
1326 | - if($insert === true) { |
|
1327 | - $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1328 | - 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);")) { |
|
1325 | + if ($insert === true) { |
|
1326 | + $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1327 | + 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);")) { |
|
1329 | 1328 | echo mysqli_error($sqlParser->conn).PHP_EOL; |
1330 | 1329 | return; |
1331 | 1330 | } |
1332 | 1331 | } |
1333 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1332 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1334 | 1333 | } else { |
1335 | - if ($properties != NULL ){ |
|
1334 | + if ($properties != NULL) { |
|
1336 | 1335 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1337 | 1336 | } |
1338 | - 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);")) { |
|
1339 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1337 | + 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);")) { |
|
1338 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1340 | 1339 | return; |
1341 | 1340 | } |
1342 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1341 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1343 | 1342 | } |
1344 | 1343 | // add system events |
1345 | 1344 | if (count($events) > 0) { |
1346 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
1345 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
1347 | 1346 | if ($ds) { |
1348 | 1347 | $row = mysqli_fetch_assoc($ds); |
1349 | 1348 | $id = $row["id"]; |
1350 | 1349 | // remove existing events |
1351 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\''); |
|
1350 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\''); |
|
1352 | 1351 | // add new events |
1353 | - 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) . "')"); |
|
1352 | + 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)."')"); |
|
1354 | 1353 | } |
1355 | 1354 | } |
1356 | 1355 | } |
@@ -1361,18 +1360,18 @@ discard block |
||
1361 | 1360 | // Install Snippets |
1362 | 1361 | $moduleSnippet = $ms; |
1363 | 1362 | if (is_array($moduleSnippet) || $installData) { |
1364 | - echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL; |
|
1363 | + echo PHP_EOL.$_lang['snippets'].":".PHP_EOL; |
|
1365 | 1364 | //$selSnips = $_POST['snippet']; |
1366 | 1365 | foreach ($moduleSnippets as $k=>$moduleSnippet) { |
1367 | 1366 | $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; |
1368 | - if($installSample || is_array($moduleSnippet)) { |
|
1367 | + if ($installSample || is_array($moduleSnippet)) { |
|
1369 | 1368 | $name = mysqli_real_escape_string($conn, $moduleSnippet[0]); |
1370 | 1369 | $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]); |
1371 | 1370 | $filecontent = $moduleSnippet[2]; |
1372 | 1371 | $properties = $moduleSnippet[3]; |
1373 | 1372 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
1374 | 1373 | if (!file_exists($filecontent)) |
1375 | - echo " $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1374 | + echo " $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1376 | 1375 | else { |
1377 | 1376 | |
1378 | 1377 | // Create the category if it does not already exist |
@@ -1381,24 +1380,24 @@ discard block |
||
1381 | 1380 | $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
1382 | 1381 | $snippet = removeDocblock($snippet, 'snippet'); |
1383 | 1382 | $snippet = mysqli_real_escape_string($conn, $snippet); |
1384 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
1383 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
1385 | 1384 | if (mysqli_num_rows($rs)) { |
1386 | 1385 | $row = mysqli_fetch_assoc($rs); |
1387 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1388 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
1389 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1386 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1387 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
1388 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1390 | 1389 | return; |
1391 | 1390 | } |
1392 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1391 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1393 | 1392 | } else { |
1394 | - if ($properties != NULL ){ |
|
1393 | + if ($properties != NULL) { |
|
1395 | 1394 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1396 | 1395 | } |
1397 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
1398 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1396 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
1397 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1399 | 1398 | return; |
1400 | 1399 | } |
1401 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1400 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1402 | 1401 | } |
1403 | 1402 | } |
1404 | 1403 | } |
@@ -1407,24 +1406,24 @@ discard block |
||
1407 | 1406 | |
1408 | 1407 | // Install demo-site |
1409 | 1408 | if ($installData && $moduleSQLDataFile) { |
1410 | - echo PHP_EOL . $_lang['installing_demo_site']; |
|
1409 | + echo PHP_EOL.$_lang['installing_demo_site']; |
|
1411 | 1410 | $sqlParser->process($moduleSQLDataFile); |
1412 | 1411 | // display database results |
1413 | 1412 | if ($sqlParser->installFailed == true) { |
1414 | 1413 | $errors += 1; |
1415 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
1416 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
1417 | - echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL; |
|
1414 | + echo $_lang['database_alerts'].PHP_EOL; |
|
1415 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
1416 | + echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL; |
|
1418 | 1417 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
1419 | - echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL; |
|
1418 | + echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL; |
|
1420 | 1419 | } |
1421 | 1420 | |
1422 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
1421 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
1423 | 1422 | return; |
1424 | 1423 | } else { |
1425 | 1424 | $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); |
1426 | 1425 | $rs = mysqli_query($sqlParser->conn, $sql); |
1427 | - if(mysqli_num_rows($rs)) { |
|
1426 | + if (mysqli_num_rows($rs)) { |
|
1428 | 1427 | $row = mysqli_fetch_assoc($rs); |
1429 | 1428 | $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']); |
1430 | 1429 | mysqli_query($sqlParser->conn, $sql); |
@@ -1436,9 +1435,9 @@ discard block |
||
1436 | 1435 | // Install Dependencies |
1437 | 1436 | $moduleDependencies = $mdp; |
1438 | 1437 | foreach ($moduleDependencies as $dependency) { |
1439 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
1438 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'); |
|
1440 | 1439 | if (!$ds) { |
1441 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1440 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1442 | 1441 | return; |
1443 | 1442 | } else { |
1444 | 1443 | $row = mysqli_fetch_assoc($ds); |
@@ -1446,37 +1445,37 @@ discard block |
||
1446 | 1445 | $moduleGuid = $row["guid"]; |
1447 | 1446 | } |
1448 | 1447 | // get extra id |
1449 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
1448 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'); |
|
1450 | 1449 | if (!$ds) { |
1451 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1450 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1452 | 1451 | return; |
1453 | 1452 | } else { |
1454 | 1453 | $row = mysqli_fetch_assoc($ds); |
1455 | 1454 | $extraId = $row["id"]; |
1456 | 1455 | } |
1457 | 1456 | // setup extra as module dependency |
1458 | - $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'); |
|
1457 | + $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'); |
|
1459 | 1458 | if (!$ds) { |
1460 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1459 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1461 | 1460 | return; |
1462 | 1461 | } else { |
1463 | 1462 | if (mysqli_num_rows($ds) === 0) { |
1464 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
1465 | - echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL; |
|
1463 | + mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'); |
|
1464 | + echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL; |
|
1466 | 1465 | } else { |
1467 | - 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']); |
|
1468 | - echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL; |
|
1466 | + 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']); |
|
1467 | + echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL; |
|
1469 | 1468 | } |
1470 | 1469 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
1471 | 1470 | // set extra guid for plugins and snippets |
1472 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
1471 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'); |
|
1473 | 1472 | if (!$ds) { |
1474 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1473 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1475 | 1474 | return; |
1476 | 1475 | } else { |
1477 | 1476 | if (mysqli_num_rows($ds) != 0) { |
1478 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
1479 | - echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL; |
|
1477 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId); |
|
1478 | + echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL; |
|
1480 | 1479 | } |
1481 | 1480 | } |
1482 | 1481 | } |
@@ -1485,7 +1484,7 @@ discard block |
||
1485 | 1484 | |
1486 | 1485 | // call back function |
1487 | 1486 | if ($callBackFnc != "") |
1488 | - $callBackFnc ($sqlParser); |
|
1487 | + $callBackFnc($sqlParser); |
|
1489 | 1488 | |
1490 | 1489 | // Setup the MODX API -- needed for the cache processor |
1491 | 1490 | if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
@@ -1518,22 +1517,22 @@ discard block |
||
1518 | 1517 | } |
1519 | 1518 | |
1520 | 1519 | // setup completed! |
1521 | -echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL; |
|
1520 | +echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL; |
|
1522 | 1521 | //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>"; |
1523 | 1522 | if ($installMode == 0) { |
1524 | - echo strip_tags($_lang['installation_note']) . PHP_EOL; |
|
1523 | + echo strip_tags($_lang['installation_note']).PHP_EOL; |
|
1525 | 1524 | } else { |
1526 | - echo strip_tags($_lang['upgrade_note']) . PHP_EOL; |
|
1525 | + echo strip_tags($_lang['upgrade_note']).PHP_EOL; |
|
1527 | 1526 | } |
1528 | 1527 | |
1529 | 1528 | |
1530 | -if ( empty($args) ){ |
|
1531 | - echo PHP_EOL . 'Remove install folder?'.PHP_EOL; |
|
1529 | +if (empty($args)) { |
|
1530 | + echo PHP_EOL.'Remove install folder?'.PHP_EOL; |
|
1532 | 1531 | $removeInstall = readline("Type 'y' or 'n' to continue: "); |
1533 | 1532 | } |
1534 | 1533 | //remove installFolder |
1535 | 1534 | if ($removeInstall == 'y') { |
1536 | - echo 'Install folder deleted!'. PHP_EOL . PHP_EOL; |
|
1535 | + echo 'Install folder deleted!'.PHP_EOL.PHP_EOL; |
|
1537 | 1536 | } |
1538 | 1537 | |
1539 | 1538 | /** |
@@ -1543,11 +1542,11 @@ discard block |
||
1543 | 1542 | * @param string $old |
1544 | 1543 | * @return string |
1545 | 1544 | */ |
1546 | -function propUpdate($new,$old){ |
|
1545 | +function propUpdate($new, $old){ |
|
1547 | 1546 | $newArr = parseProperties($new); |
1548 | 1547 | $oldArr = parseProperties($old); |
1549 | - foreach ($oldArr as $k => $v){ |
|
1550 | - if (isset($v['0']['options'])){ |
|
1548 | + foreach ($oldArr as $k => $v) { |
|
1549 | + if (isset($v['0']['options'])) { |
|
1551 | 1550 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
1552 | 1551 | } |
1553 | 1552 | } |
@@ -1562,30 +1561,30 @@ discard block |
||
1562 | 1561 | * @param bool|mixed $json |
1563 | 1562 | * @return string |
1564 | 1563 | */ |
1565 | -function parseProperties($propertyString, $json=false) { |
|
1566 | - $propertyString = str_replace('{}', '', $propertyString ); |
|
1567 | - $propertyString = str_replace('} {', ',', $propertyString ); |
|
1564 | +function parseProperties($propertyString, $json = false){ |
|
1565 | + $propertyString = str_replace('{}', '', $propertyString); |
|
1566 | + $propertyString = str_replace('} {', ',', $propertyString); |
|
1568 | 1567 | |
1569 | - if(empty($propertyString)) return array(); |
|
1570 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
1568 | + if (empty($propertyString)) return array(); |
|
1569 | + if ($propertyString == '{}' || $propertyString == '[]') return array(); |
|
1571 | 1570 | |
1572 | 1571 | $jsonFormat = isJson($propertyString, true); |
1573 | 1572 | $property = array(); |
1574 | 1573 | // old format |
1575 | - if ( $jsonFormat === false) { |
|
1576 | - $props= explode('&', $propertyString); |
|
1574 | + if ($jsonFormat === false) { |
|
1575 | + $props = explode('&', $propertyString); |
|
1577 | 1576 | foreach ($props as $prop) { |
1578 | 1577 | $prop = trim($prop); |
1579 | - if($prop === '') { |
|
1578 | + if ($prop === '') { |
|
1580 | 1579 | continue; |
1581 | 1580 | } |
1582 | 1581 | |
1583 | 1582 | $arr = explode(';', $prop); |
1584 | - if( ! is_array($arr)) { |
|
1583 | + if (!is_array($arr)) { |
|
1585 | 1584 | $arr = array(); |
1586 | 1585 | } |
1587 | 1586 | $key = explode('=', isset($arr[0]) ? $arr[0] : ''); |
1588 | - if( ! is_array($key) || empty($key[0])) { |
|
1587 | + if (!is_array($key) || empty($key[0])) { |
|
1589 | 1588 | continue; |
1590 | 1589 | } |
1591 | 1590 | |
@@ -1609,7 +1608,7 @@ discard block |
||
1609 | 1608 | |
1610 | 1609 | } |
1611 | 1610 | // new json-format |
1612 | - } else if(!empty($jsonFormat)){ |
|
1611 | + } else if (!empty($jsonFormat)) { |
|
1613 | 1612 | $property = $jsonFormat; |
1614 | 1613 | } |
1615 | 1614 | if ($json) { |
@@ -1624,7 +1623,7 @@ discard block |
||
1624 | 1623 | * @param bool $returnData |
1625 | 1624 | * @return bool|mixed |
1626 | 1625 | */ |
1627 | -function isJson($string, $returnData=false) { |
|
1626 | +function isJson($string, $returnData = false){ |
|
1628 | 1627 | $data = json_decode($string, true); |
1629 | 1628 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
1630 | 1629 | } |
@@ -1634,20 +1633,20 @@ discard block |
||
1634 | 1633 | * @param SqlParser $sqlParser |
1635 | 1634 | * @return int |
1636 | 1635 | */ |
1637 | -function getCreateDbCategory($category, $sqlParser) { |
|
1636 | +function getCreateDbCategory($category, $sqlParser){ |
|
1638 | 1637 | $dbase = $sqlParser->dbname; |
1639 | - $dbase = '`' . trim($dbase,'`') . '`'; |
|
1638 | + $dbase = '`'.trim($dbase, '`').'`'; |
|
1640 | 1639 | $table_prefix = $sqlParser->prefix; |
1641 | 1640 | $category_id = 0; |
1642 | - if(!empty($category)) { |
|
1641 | + if (!empty($category)) { |
|
1643 | 1642 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
1644 | 1643 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
1645 | - if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
1644 | + if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
1646 | 1645 | $category_id = $row['id']; |
1647 | 1646 | } else { |
1648 | 1647 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
1649 | 1648 | $rs = mysqli_query($sqlParser->conn, $q); |
1650 | - if($rs) { |
|
1649 | + if ($rs) { |
|
1651 | 1650 | $category_id = mysqli_insert_id($sqlParser->conn); |
1652 | 1651 | } |
1653 | 1652 | } |
@@ -1662,12 +1661,12 @@ discard block |
||
1662 | 1661 | * @param string $type |
1663 | 1662 | * @return string |
1664 | 1663 | */ |
1665 | -function removeDocblock($code, $type) { |
|
1664 | +function removeDocblock($code, $type){ |
|
1666 | 1665 | |
1667 | 1666 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
1668 | 1667 | |
1669 | 1668 | // Procedure taken from plugin.filesource.php |
1670 | - switch($type) { |
|
1669 | + switch ($type) { |
|
1671 | 1670 | case 'snippet': |
1672 | 1671 | $elm_name = 'snippets'; |
1673 | 1672 | $include = 'return require'; |
@@ -1683,7 +1682,7 @@ discard block |
||
1683 | 1682 | default: |
1684 | 1683 | return $cleaned; |
1685 | 1684 | }; |
1686 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
1685 | + if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
1687 | 1686 | return $cleaned; |
1688 | 1687 | |
1689 | 1688 | // fileBinding not found - return code incl docblock |