@@ -8,8 +8,8 @@ |
||
8 | 8 | ******************************************************* |
9 | 9 | */ |
10 | 10 | |
11 | -use PHPMailer\PHPMailer\PHPMailer; |
|
12 | 11 | use PHPMailer\PHPMailer\Exception; |
12 | +use PHPMailer\PHPMailer\PHPMailer; |
|
13 | 13 | |
14 | 14 | require MODX_MANAGER_PATH . 'includes/controls/phpmailer/Exception.php'; |
15 | 15 | require MODX_MANAGER_PATH . 'includes/controls/phpmailer/PHPMailer.php'; |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | use PHPMailer\PHPMailer\PHPMailer; |
12 | 12 | use PHPMailer\PHPMailer\Exception; |
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 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function init(\DocumentParser $modx) |
32 | 32 | { |
33 | 33 | $this->modx = $modx; |
34 | - $this->PluginDir = MODX_MANAGER_PATH . 'includes/controls/phpmailer/'; |
|
34 | + $this->PluginDir = MODX_MANAGER_PATH.'includes/controls/phpmailer/'; |
|
35 | 35 | |
36 | 36 | switch ($modx->config['email_method']) { |
37 | 37 | case 'smtp': |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | mb_language($this->mb_language); |
96 | 96 | mb_internal_encoding($modx->config['modx_charset']); |
97 | 97 | } |
98 | - $exconf = MODX_MANAGER_PATH . 'includes/controls/phpmailer/config.inc.php'; |
|
98 | + $exconf = MODX_MANAGER_PATH.'includes/controls/phpmailer/config.inc.php'; |
|
99 | 99 | if (is_file($exconf)) { |
100 | 100 | include($exconf); |
101 | 101 | } |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | if ($this->modx->debug) { |
166 | - $debug_info = 'CharSet = ' . $this->CharSet . "\n"; |
|
167 | - $debug_info .= 'Encoding = ' . $this->Encoding . "\n"; |
|
168 | - $debug_info .= 'mb_language = ' . $this->mb_language . "\n"; |
|
169 | - $debug_info .= 'encode_header_method = ' . $this->encode_header_method . "\n"; |
|
166 | + $debug_info = 'CharSet = '.$this->CharSet."\n"; |
|
167 | + $debug_info .= 'Encoding = '.$this->Encoding."\n"; |
|
168 | + $debug_info .= 'mb_language = '.$this->mb_language."\n"; |
|
169 | + $debug_info .= 'encode_header_method = '.$this->encode_header_method."\n"; |
|
170 | 170 | $debug_info .= "send_mode = {$mode}\n"; |
171 | - $debug_info .= 'Subject = ' . $this->Subject . "\n"; |
|
171 | + $debug_info .= 'Subject = '.$this->Subject."\n"; |
|
172 | 172 | $log = "<pre>{$debug_info}\n{$header}\n{$org_body}</pre>"; |
173 | 173 | $this->modx->logEvent(1, 1, $log, 'MODxMailer debug information'); |
174 | 174 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | ini_set('sendmail_from', $old_from); |
229 | 229 | } |
230 | 230 | if (!$rt) { |
231 | - $msg = $this->Lang('instantiate') . "<br />\n"; |
|
231 | + $msg = $this->Lang('instantiate')."<br />\n"; |
|
232 | 232 | $msg .= "{$this->Subject}<br />\n"; |
233 | 233 | $msg .= "{$this->FromName}<{$this->From}><br />\n"; |
234 | 234 | $msg .= mb_convert_encoding($body, $this->modx->config['modx_charset'], $this->CharSet); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function SetError($msg) |
249 | 249 | { |
250 | - $msg .= '<pre>' . print_r(get_object_vars($this), true) . '</pre>'; |
|
250 | + $msg .= '<pre>'.print_r(get_object_vars($this), true).'</pre>'; |
|
251 | 251 | $this->modx->config['send_errormail'] = '0'; |
252 | 252 | $this->modx->logEvent(0, 3, $msg, 'phpmailer'); |
253 | 253 | |
@@ -276,14 +276,14 @@ discard block |
||
276 | 276 | /** |
277 | 277 | * @return string |
278 | 278 | */ |
279 | - public function getMIMEHeader() { |
|
279 | + public function getMIMEHeader(){ |
|
280 | 280 | return $this->MIMEHeader; |
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
284 | 284 | * @return string |
285 | 285 | */ |
286 | - public function getMIMEBody() { |
|
286 | + public function getMIMEBody(){ |
|
287 | 287 | return $this->MIMEBody; |
288 | 288 | } |
289 | 289 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @return $this |
294 | 294 | */ |
295 | - public function setMIMEHeader($header = '') { |
|
295 | + public function setMIMEHeader($header = ''){ |
|
296 | 296 | $this->MIMEHeader = $header; |
297 | 297 | |
298 | 298 | return $this; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @return $this |
305 | 305 | */ |
306 | - public function setMIMEBody($body = '') { |
|
306 | + public function setMIMEBody($body = ''){ |
|
307 | 307 | $this->MIMEBody = $body; |
308 | 308 | |
309 | 309 | return $this; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @return $this |
316 | 316 | */ |
317 | - public function setMailHeader($header = '') { |
|
317 | + public function setMailHeader($header = ''){ |
|
318 | 318 | $this->mailHeader = $header; |
319 | 319 | |
320 | 320 | return $this; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | /** |
324 | 324 | * @return string |
325 | 325 | */ |
326 | - public function getMessageID() { |
|
327 | - return trim($this->lastMessageID,'<>'); |
|
326 | + public function getMessageID(){ |
|
327 | + return trim($this->lastMessageID, '<>'); |
|
328 | 328 | } |
329 | 329 | } |
@@ -1,33 +1,32 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //:: EVO Installer Setup file |
3 | 3 | //::::::::::::::::::::::::::::::::::::::::: |
4 | -if (is_file($base_path . 'assets/cache/siteManager.php')) { |
|
5 | - include_once($base_path . 'assets/cache/siteManager.php'); |
|
4 | +if (is_file($base_path.'assets/cache/siteManager.php')) { |
|
5 | + include_once($base_path.'assets/cache/siteManager.php'); |
|
6 | 6 | } |
7 | -if(!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
7 | +if (!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
8 | 8 | |
9 | 9 | require_once('../'.MGR_DIR.'/includes/version.inc.php'); |
10 | 10 | |
11 | -$chunkPath = $base_path .'install/assets/chunks'; |
|
12 | -$snippetPath = $base_path .'install/assets/snippets'; |
|
13 | -$pluginPath = $base_path .'install/assets/plugins'; |
|
14 | -$modulePath = $base_path .'install/assets/modules'; |
|
15 | -$templatePath = $base_path .'install/assets/templates'; |
|
16 | -$tvPath = $base_path .'install/assets/tvs'; |
|
11 | +$chunkPath = $base_path.'install/assets/chunks'; |
|
12 | +$snippetPath = $base_path.'install/assets/snippets'; |
|
13 | +$pluginPath = $base_path.'install/assets/plugins'; |
|
14 | +$modulePath = $base_path.'install/assets/modules'; |
|
15 | +$templatePath = $base_path.'install/assets/templates'; |
|
16 | +$tvPath = $base_path.'install/assets/tvs'; |
|
17 | 17 | |
18 | 18 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
19 | 19 | $mt = &$moduleTemplates; |
20 | -if(is_dir($templatePath) && is_readable($templatePath)) { |
|
20 | +if (is_dir($templatePath) && is_readable($templatePath)) { |
|
21 | 21 | $d = dir($templatePath); |
22 | 22 | while (false !== ($tplfile = $d->read())) |
23 | 23 | { |
24 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
24 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
25 | 25 | $params = parse_docblock($templatePath, $tplfile); |
26 | - if(is_array($params) && (count($params)>0)) |
|
26 | + if (is_array($params) && (count($params) > 0)) |
|
27 | 27 | { |
28 | 28 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
29 | - $mt[] = array |
|
30 | - ( |
|
29 | + $mt[] = array( |
|
31 | 30 | $params['name'], |
32 | 31 | $description, |
33 | 32 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -45,12 +44,12 @@ discard block |
||
45 | 44 | |
46 | 45 | // setup Template Variable template files |
47 | 46 | $mtv = &$moduleTVs; |
48 | -if(is_dir($tvPath) && is_readable($tvPath)) { |
|
47 | +if (is_dir($tvPath) && is_readable($tvPath)) { |
|
49 | 48 | $d = dir($tvPath); |
50 | 49 | while (false !== ($tplfile = $d->read())) { |
51 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
50 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
52 | 51 | $params = parse_docblock($tvPath, $tplfile); |
53 | - if(is_array($params) && (count($params)>0)) { |
|
52 | + if (is_array($params) && (count($params) > 0)) { |
|
54 | 53 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
55 | 54 | $mtv[] = array( |
56 | 55 | $params['name'], |
@@ -62,9 +61,9 @@ discard block |
||
62 | 61 | $params['output_widget'], |
63 | 62 | $params['output_widget_params'], |
64 | 63 | "$templatePath/{$params['filename']}", /* not currently used */ |
65 | - $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */ |
|
64 | + $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */ |
|
66 | 65 | $params['modx_category'], |
67 | - $params['lock_tv'], /* value should be 1 or 0 */ |
|
66 | + $params['lock_tv'], /* value should be 1 or 0 */ |
|
68 | 67 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
69 | 68 | ); |
70 | 69 | } |
@@ -74,14 +73,14 @@ discard block |
||
74 | 73 | |
75 | 74 | // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content |
76 | 75 | $mc = &$moduleChunks; |
77 | -if(is_dir($chunkPath) && is_readable($chunkPath)) { |
|
76 | +if (is_dir($chunkPath) && is_readable($chunkPath)) { |
|
78 | 77 | $d = dir($chunkPath); |
79 | 78 | while (false !== ($tplfile = $d->read())) { |
80 | - if(substr($tplfile, -4) != '.tpl') { |
|
79 | + if (substr($tplfile, -4) != '.tpl') { |
|
81 | 80 | continue; |
82 | 81 | } |
83 | 82 | $params = parse_docblock($chunkPath, $tplfile); |
84 | - if(is_array($params) && count($params) > 0) { |
|
83 | + if (is_array($params) && count($params) > 0) { |
|
85 | 84 | $mc[] = array( |
86 | 85 | $params['name'], |
87 | 86 | $params['description'], |
@@ -97,14 +96,14 @@ discard block |
||
97 | 96 | |
98 | 97 | // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties |
99 | 98 | $ms = &$moduleSnippets; |
100 | -if(is_dir($snippetPath) && is_readable($snippetPath)) { |
|
99 | +if (is_dir($snippetPath) && is_readable($snippetPath)) { |
|
101 | 100 | $d = dir($snippetPath); |
102 | 101 | while (false !== ($tplfile = $d->read())) { |
103 | - if(substr($tplfile, -4) != '.tpl') { |
|
102 | + if (substr($tplfile, -4) != '.tpl') { |
|
104 | 103 | continue; |
105 | 104 | } |
106 | 105 | $params = parse_docblock($snippetPath, $tplfile); |
107 | - if(is_array($params) && count($params) > 0) { |
|
106 | + if (is_array($params) && count($params) > 0) { |
|
108 | 107 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
109 | 108 | $ms[] = array( |
110 | 109 | $params['name'], |
@@ -121,14 +120,14 @@ discard block |
||
121 | 120 | |
122 | 121 | // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties |
123 | 122 | $mp = &$modulePlugins; |
124 | -if(is_dir($pluginPath) && is_readable($pluginPath)) { |
|
123 | +if (is_dir($pluginPath) && is_readable($pluginPath)) { |
|
125 | 124 | $d = dir($pluginPath); |
126 | 125 | while (false !== ($tplfile = $d->read())) { |
127 | - if(substr($tplfile, -4) != '.tpl') { |
|
126 | + if (substr($tplfile, -4) != '.tpl') { |
|
128 | 127 | continue; |
129 | 128 | } |
130 | 129 | $params = parse_docblock($pluginPath, $tplfile); |
131 | - if(is_array($params) && count($params) > 0) { |
|
130 | + if (is_array($params) && count($params) > 0) { |
|
132 | 131 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
133 | 132 | $mp[] = array( |
134 | 133 | $params['name'], |
@@ -150,14 +149,14 @@ discard block |
||
150 | 149 | // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams |
151 | 150 | $mm = &$moduleModules; |
152 | 151 | $mdp = &$moduleDependencies; |
153 | -if(is_dir($modulePath) && is_readable($modulePath)) { |
|
152 | +if (is_dir($modulePath) && is_readable($modulePath)) { |
|
154 | 153 | $d = dir($modulePath); |
155 | 154 | while (false !== ($tplfile = $d->read())) { |
156 | - if(substr($tplfile, -4) != '.tpl') { |
|
155 | + if (substr($tplfile, -4) != '.tpl') { |
|
157 | 156 | continue; |
158 | 157 | } |
159 | 158 | $params = parse_docblock($modulePath, $tplfile); |
160 | - if(is_array($params) && count($params) > 0) { |
|
159 | + if (is_array($params) && count($params) > 0) { |
|
161 | 160 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
162 | 161 | $mm[] = array( |
163 | 162 | $params['name'], |
@@ -241,109 +240,109 @@ discard block |
||
241 | 240 | // setup callback function |
242 | 241 | $callBackFnc = "clean_up"; |
243 | 242 | |
244 | -function clean_up($sqlParser) { |
|
243 | +function clean_up($sqlParser){ |
|
245 | 244 | $ids = array(); |
246 | 245 | $mysqlVerOk = -1; |
247 | 246 | |
248 | - if(function_exists("mysqli_get_server_info")) { |
|
249 | - $mysqlVerOk = (version_compare(mysqli_get_server_info($sqlParser->conn),"4.0.2")>=0); |
|
247 | + if (function_exists("mysqli_get_server_info")) { |
|
248 | + $mysqlVerOk = (version_compare(mysqli_get_server_info($sqlParser->conn), "4.0.2") >= 0); |
|
250 | 249 | } |
251 | 250 | |
252 | 251 | // secure web documents - privateweb |
253 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
254 | - $sql = "SELECT DISTINCT sc.id |
|
252 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
253 | + $sql = "SELECT DISTINCT sc.id |
|
255 | 254 | FROM `".$sqlParser->prefix."site_content` sc |
256 | 255 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
257 | 256 | LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group |
258 | 257 | WHERE wga.id>0"; |
259 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
260 | - if(!$ds) { |
|
258 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
259 | + if (!$ds) { |
|
261 | 260 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
262 | 261 | } |
263 | 262 | else { |
264 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
265 | - if(count($ids)>0) { |
|
266 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
263 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
264 | + if (count($ids) > 0) { |
|
265 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
267 | 266 | unset($ids); |
268 | 267 | } |
269 | 268 | } |
270 | 269 | |
271 | 270 | // secure manager documents privatemgr |
272 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
273 | - $sql = "SELECT DISTINCT sc.id |
|
271 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
272 | + $sql = "SELECT DISTINCT sc.id |
|
274 | 273 | FROM `".$sqlParser->prefix."site_content` sc |
275 | 274 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
276 | 275 | LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group |
277 | 276 | WHERE mga.id>0"; |
278 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
279 | - if(!$ds) { |
|
277 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
278 | + if (!$ds) { |
|
280 | 279 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
281 | 280 | } |
282 | 281 | else { |
283 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
284 | - if(count($ids)>0) { |
|
285 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
282 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
283 | + if (count($ids) > 0) { |
|
284 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
286 | 285 | unset($ids); |
287 | 286 | } |
288 | 287 | } |
289 | 288 | } |
290 | 289 | |
291 | -function parse_docblock($element_dir, $filename) { |
|
290 | +function parse_docblock($element_dir, $filename){ |
|
292 | 291 | $params = array(); |
293 | - $fullpath = $element_dir . '/' . $filename; |
|
294 | - if(is_readable($fullpath)) { |
|
292 | + $fullpath = $element_dir.'/'.$filename; |
|
293 | + if (is_readable($fullpath)) { |
|
295 | 294 | $tpl = @fopen($fullpath, "r"); |
296 | - if($tpl) { |
|
295 | + if ($tpl) { |
|
297 | 296 | $params['filename'] = $filename; |
298 | 297 | $docblock_start_found = false; |
299 | 298 | $name_found = false; |
300 | 299 | $description_found = false; |
301 | 300 | $docblock_end_found = false; |
302 | 301 | |
303 | - while(!feof($tpl)) { |
|
302 | + while (!feof($tpl)) { |
|
304 | 303 | $line = fgets($tpl); |
305 | - if(!$docblock_start_found) { |
|
304 | + if (!$docblock_start_found) { |
|
306 | 305 | // find docblock start |
307 | - if(strpos($line, '/**') !== false) { |
|
306 | + if (strpos($line, '/**') !== false) { |
|
308 | 307 | $docblock_start_found = true; |
309 | 308 | } |
310 | 309 | continue; |
311 | - } elseif(!$name_found) { |
|
310 | + } elseif (!$name_found) { |
|
312 | 311 | // find name |
313 | 312 | $ma = null; |
314 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
313 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
315 | 314 | $params['name'] = trim($ma[1]); |
316 | 315 | $name_found = !empty($params['name']); |
317 | 316 | } |
318 | 317 | continue; |
319 | - } elseif(!$description_found) { |
|
318 | + } elseif (!$description_found) { |
|
320 | 319 | // find description |
321 | 320 | $ma = null; |
322 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
321 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
323 | 322 | $params['description'] = trim($ma[1]); |
324 | 323 | $description_found = !empty($params['description']); |
325 | 324 | } |
326 | 325 | continue; |
327 | 326 | } else { |
328 | 327 | $ma = null; |
329 | - if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
328 | + if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
330 | 329 | $param = trim($ma[1]); |
331 | 330 | $val = trim($ma[2]); |
332 | - if(!empty($param) && !empty($val)) { |
|
333 | - if($param == 'internal') { |
|
331 | + if (!empty($param) && !empty($val)) { |
|
332 | + if ($param == 'internal') { |
|
334 | 333 | $ma = null; |
335 | - if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
334 | + if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
336 | 335 | $param = trim($ma[1]); |
337 | 336 | $val = trim($ma[2]); |
338 | 337 | } |
339 | 338 | //if($val !== '0' && (empty($param) || empty($val))) { |
340 | - if(empty($param)) { |
|
339 | + if (empty($param)) { |
|
341 | 340 | continue; |
342 | 341 | } |
343 | 342 | } |
344 | 343 | $params[$param] = $val; |
345 | 344 | } |
346 | - } elseif(preg_match("/^\s*\*\/\s*$/", $line)) { |
|
345 | + } elseif (preg_match("/^\s*\*\/\s*$/", $line)) { |
|
347 | 346 | $docblock_end_found = true; |
348 | 347 | break; |
349 | 348 | } |
@@ -43,10 +43,10 @@ |
||
43 | 43 | var chk = document.install.rminstaller; |
44 | 44 | if(chk && chk.checked) { |
45 | 45 | // remove install folder and files |
46 | - window.location.href = "../<?php echo MGR_DIR;?>/processors/remove_installer.processor.php?rminstall=1"; |
|
46 | + window.location.href = "../<?php echo MGR_DIR; ?>/processors/remove_installer.processor.php?rminstall=1"; |
|
47 | 47 | } |
48 | 48 | else { |
49 | - window.location.href = "../<?php echo MGR_DIR;?>/"; |
|
49 | + window.location.href = "../<?php echo MGR_DIR; ?>/"; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | /* ]]> */ |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | $installMode = $_POST['installMode']; |
7 | 7 | |
8 | 8 | $self = 'install/connection.databasetest.php'; |
9 | -$base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
|
9 | +$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__)); |
|
10 | 10 | if (is_file("{$base_path}assets/cache/siteManager.php")) { |
11 | 11 | include_once("{$base_path}assets/cache/siteManager.php"); |
12 | 12 | } |
13 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
14 | - define('MGR_DIR','manager'); |
|
13 | +if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
14 | + define('MGR_DIR', 'manager'); |
|
15 | 15 | } |
16 | 16 | require_once("lang.php"); |
17 | 17 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
32 | 32 | $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";"; |
33 | 33 | |
34 | - if (! mysqli_query($conn, $query)){ |
|
34 | + if (!mysqli_query($conn, $query)) { |
|
35 | 35 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>'; |
36 | 36 | } |
37 | 37 | else { |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | global $_lang; |
5 | 5 | |
6 | 6 | // session loop-back tester |
7 | - if(!isset($_GET['action']) || $_GET['action']!=='mode') |
|
7 | + if (!isset($_GET['action']) || $_GET['action'] !== 'mode') |
|
8 | 8 | { |
9 | - if(!isset($_SESSION['test']) || $_SESSION['test']!=1) |
|
9 | + if (!isset($_SESSION['test']) || $_SESSION['test'] != 1) |
|
10 | 10 | { |
11 | 11 | echo ' |
12 | 12 | <html> |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | </head> |
23 | 23 | <body> |
24 | 24 | <div class="install"> |
25 | - <p>' . $_lang["session_problem"] . '</p> |
|
26 | - <p><a href="./">' .$_lang["session_problem_try_again"] . '</a></p> |
|
25 | + <p>' . $_lang["session_problem"].'</p> |
|
26 | + <p><a href="./">' .$_lang["session_problem_try_again"].'</a></p> |
|
27 | 27 | </div> |
28 | 28 | </body> |
29 | 29 | </html>'; |
@@ -32,28 +32,28 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -function parse($src,$ph,$left='[+',$right='+]') |
|
35 | +function parse($src, $ph, $left = '[+', $right = '+]') |
|
36 | 36 | { |
37 | - foreach($ph as $k=>$v) |
|
37 | + foreach ($ph as $k=>$v) |
|
38 | 38 | { |
39 | - $k = $left . $k . $right; |
|
40 | - $src = str_replace($k,$v,$src); |
|
39 | + $k = $left.$k.$right; |
|
40 | + $src = str_replace($k, $v, $src); |
|
41 | 41 | } |
42 | 42 | return $src; |
43 | 43 | } |
44 | 44 | |
45 | 45 | function ph() |
46 | 46 | { |
47 | - global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date; |
|
47 | + global $_lang, $moduleName, $moduleVersion, $modx_textdir, $modx_release_date; |
|
48 | 48 | |
49 | - if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode']; |
|
49 | + if (isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode']; |
|
50 | 50 | else $installmode = get_installmode(); |
51 | 51 | |
52 | 52 | $ph['pagetitle'] = $_lang['modx_install']; |
53 | - $ph['textdir'] = $modx_textdir ? ' id="rtl"':''; |
|
53 | + $ph['textdir'] = $modx_textdir ? ' id="rtl"' : ''; |
|
54 | 54 | $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd']; |
55 | 55 | $ph['version'] = $moduleVersion; |
56 | - $ph['release_date'] = ($modx_textdir ? '‏':'') . $modx_release_date; |
|
56 | + $ph['release_date'] = ($modx_textdir ? '‏' : '').$modx_release_date; |
|
57 | 57 | $ph['footer1'] = $_lang['modx_footer1']; |
58 | 58 | $ph['footer2'] = $_lang['modx_footer2']; |
59 | 59 | $ph['current_year'] = date('Y'); |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | |
63 | 63 | function get_installmode() |
64 | 64 | { |
65 | - global $base_path,$database_server, $database_user, $database_password, $dbase, $table_prefix; |
|
65 | + global $base_path, $database_server, $database_user, $database_password, $dbase, $table_prefix; |
|
66 | 66 | |
67 | 67 | $conf_path = "{$base_path}manager/includes/config.inc.php"; |
68 | 68 | if (!is_file($conf_path)) $installmode = 0; |
69 | - elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
69 | + elseif (isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
70 | 70 | else |
71 | 71 | { |
72 | 72 | include_once("{$base_path}manager/includes/config.inc.php"); |
73 | 73 | |
74 | - if(!isset($dbase) || empty($dbase)) $installmode = 0; |
|
74 | + if (!isset($dbase) || empty($dbase)) $installmode = 0; |
|
75 | 75 | else |
76 | 76 | { |
77 | 77 | $conn = mysqli_connect($database_server, $database_user, $database_password); |
78 | - if($conn) |
|
78 | + if ($conn) |
|
79 | 79 | { |
80 | 80 | $_SESSION['database_server'] = $database_server; |
81 | 81 | $_SESSION['database_user'] = $database_user; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | else $rs = false; |
88 | 88 | |
89 | - if($rs) |
|
89 | + if ($rs) |
|
90 | 90 | { |
91 | 91 | $_SESSION['dbase'] = $dbase; |
92 | 92 | $_SESSION['table_prefix'] = $table_prefix; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`"; |
97 | 97 | $rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'"); |
98 | - if($rs) |
|
98 | + if ($rs) |
|
99 | 99 | { |
100 | 100 | $row = mysqli_fetch_assoc($rs); |
101 | 101 | $settings_version = $row['setting_value']; |
@@ -5,12 +5,12 @@ discard block |
||
5 | 5 | $pwd = $_POST['pwd']; |
6 | 6 | |
7 | 7 | $self = 'install/connection.servertest.php'; |
8 | -$base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
|
8 | +$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__)); |
|
9 | 9 | if (is_file("{$base_path}assets/cache/siteManager.php")) { |
10 | 10 | include_once("{$base_path}assets/cache/siteManager.php"); |
11 | 11 | } |
12 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
13 | - define('MGR_DIR','manager'); |
|
12 | +if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
13 | + define('MGR_DIR', 'manager'); |
|
14 | 14 | } |
15 | 15 | require_once("lang.php"); |
16 | 16 | |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>'; |
23 | 23 | |
24 | 24 | // Mysql version check |
25 | - if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) { |
|
25 | + if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) { |
|
26 | 26 | $output .= '<br /><span style="color:#FF0000;"> '.$_lang['mysql_5051'].'</span>'; |
27 | 27 | } |
28 | 28 | // Mode check |
29 | 29 | $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode"); |
30 | - if (@mysqli_num_rows($mysqlmode) > 0){ |
|
30 | + if (@mysqli_num_rows($mysqlmode) > 0) { |
|
31 | 31 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
32 | 32 | $strictMode = false; |
33 | 33 | foreach ($modes as $mode) { |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | $pwd = $_POST['pwd']; |
6 | 6 | |
7 | 7 | $self = 'install/connection.collation.php'; |
8 | -$base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
|
8 | +$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__)); |
|
9 | 9 | if (is_file("{$base_path}assets/cache/siteManager.php")) { |
10 | 10 | include_once("{$base_path}assets/cache/siteManager.php"); |
11 | 11 | } |
12 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
13 | - define('MGR_DIR','manager'); |
|
12 | +if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
13 | + define('MGR_DIR', 'manager'); |
|
14 | 14 | } |
15 | 15 | require_once('lang.php'); |
16 | 16 | |
17 | 17 | $conn = mysqli_connect($host, $uid, $pwd); |
18 | -if(!$conn) exit('can not connect'); |
|
18 | +if (!$conn) exit('can not connect'); |
|
19 | 19 | |
20 | 20 | // get collation |
21 | 21 | $rs = mysqli_query($conn, "SHOW COLLATION"); |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | $database_collation = htmlentities($_POST['database_collation']); |
30 | 30 | $recommend_collation = $_lang['recommend_collation']; |
31 | 31 | |
32 | - if (isset($_[$recommend_collation])) $_[$recommend_collation] = ' selected'; |
|
33 | - elseif(isset($_['utf8mb4_general_ci'])) $_['utf8mb4_general_ci'] = ' selected'; |
|
34 | - elseif(isset($_['utf8_general_ci'])) $_['utf8_general_ci'] = ' selected'; |
|
35 | - elseif(isset($_[$database_collation])) $_[$database_collation] = ' selected'; |
|
32 | + if (isset($_[$recommend_collation])) $_[$recommend_collation] = ' selected'; |
|
33 | + elseif (isset($_['utf8mb4_general_ci'])) $_['utf8mb4_general_ci'] = ' selected'; |
|
34 | + elseif (isset($_['utf8_general_ci'])) $_['utf8_general_ci'] = ' selected'; |
|
35 | + elseif (isset($_[$database_collation])) $_[$database_collation] = ' selected'; |
|
36 | 36 | |
37 | - $_ = sortItem($_,$_lang['recommend_collations_order']); |
|
37 | + $_ = sortItem($_, $_lang['recommend_collations_order']); |
|
38 | 38 | |
39 | - foreach($_ as $collation=>$selected) { |
|
39 | + foreach ($_ as $collation=>$selected) { |
|
40 | 40 | $collation = htmlentities($collation); |
41 | 41 | // if(substr($collation,0,4)!=='utf8') continue; |
42 | - if(strpos($collation,'sjis')===0) continue; |
|
43 | - if($collation=='recommend') |
|
42 | + if (strpos($collation, 'sjis') === 0) continue; |
|
43 | + if ($collation == 'recommend') |
|
44 | 44 | $output .= '<optgroup label="recommend">'; |
45 | - elseif($collation=='unrecommend') |
|
45 | + elseif ($collation == 'unrecommend') |
|
46 | 46 | $output .= '</optgroup><optgroup label="unrecommend">'; |
47 | 47 | else |
48 | 48 | $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation); |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | |
58 | -function sortItem($array=array(),$order='utf8mb4,utf8') { |
|
58 | +function sortItem($array = array(), $order = 'utf8mb4,utf8'){ |
|
59 | 59 | $rs = array('recommend'=>''); |
60 | 60 | $order = explode(',', $order); |
61 | - foreach($order as $v) { |
|
62 | - foreach($array as $name=>$sel) { |
|
63 | - if(strpos($name,$v)!==false) { |
|
61 | + foreach ($order as $v) { |
|
62 | + foreach ($array as $name=>$sel) { |
|
63 | + if (strpos($name, $v) !== false) { |
|
64 | 64 | $rs[$name] = $array[$name]; |
65 | 65 | unset($array[$name]); |
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | - $rs['unrecommend']=''; |
|
69 | + $rs['unrecommend'] = ''; |
|
70 | 70 | return $rs + $array; |
71 | 71 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | } |
10 | 10 | |
11 | 11 | $self = 'install/index.php'; |
12 | -$base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
|
12 | +$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__)); |
|
13 | 13 | require_once("{$base_path}install/functions.php"); |
14 | 14 | |
15 | 15 | // set error reporting |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | if (is_file("{$base_path}assets/cache/siteManager.php")) { |
19 | 19 | include_once("{$base_path}assets/cache/siteManager.php"); |
20 | 20 | } |
21 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
21 | +if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
22 | 22 | define('MGR_DIR', 'manager'); |
23 | 23 | } |
24 | 24 | |
@@ -38,26 +38,26 @@ discard block |
||
38 | 38 | $moduleSQLDataFile = "setup.data.sql"; |
39 | 39 | $moduleSQLResetFile = "setup.data.reset.sql"; |
40 | 40 | |
41 | -$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content |
|
42 | -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content |
|
43 | -$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties |
|
44 | -$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid |
|
45 | -$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid |
|
46 | -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties |
|
47 | -$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties |
|
41 | +$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content |
|
42 | +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content |
|
43 | +$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties |
|
44 | +$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid |
|
45 | +$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid |
|
46 | +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties |
|
47 | +$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties |
|
48 | 48 | $moduleDependencies = array(); // module depedencies - array : module, table, column, type, name |
49 | 49 | |
50 | -$errors= 0; |
|
50 | +$errors = 0; |
|
51 | 51 | |
52 | 52 | // get post back status |
53 | 53 | $isPostBack = (count($_POST)); |
54 | 54 | |
55 | 55 | $ph = ph(); |
56 | -$ph = array_merge($ph,$_lang); |
|
56 | +$ph = array_merge($ph, $_lang); |
|
57 | 57 | $ph['install_language'] = $install_language; |
58 | 58 | |
59 | 59 | ob_start(); |
60 | -$action= isset ($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'language'; |
|
60 | +$action = isset ($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'language'; |
|
61 | 61 | if (!@include_once("actions/action_{$action}.php")) { |
62 | 62 | die ("Invalid install action attempted. [action={$action}]"); |
63 | 63 | } |
@@ -65,5 +65,5 @@ discard block |
||
65 | 65 | ob_end_clean(); |
66 | 66 | |
67 | 67 | $tpl = file_get_contents("{$base_path}install/template.tpl"); |
68 | -echo parse($tpl,$ph); |
|
68 | +echo parse($tpl, $ph); |
|
69 | 69 |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | * Filename: /install/lang.php |
11 | 11 | */ |
12 | 12 | |
13 | -$_lang = array (); |
|
13 | +$_lang = array(); |
|
14 | 14 | |
15 | 15 | #default fallback language file - english |
16 | 16 | $install_language = "english"; |
17 | 17 | |
18 | -$_langFiles= array ( |
|
18 | +$_langFiles = array( |
|
19 | 19 | "en" => "english", |
20 | 20 | "bg" => "bulgarian", |
21 | 21 | "cs" => "czech", |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | "es" => "spanish-utf8", |
37 | 37 | "sv" => "svenska" |
38 | 38 | ); |
39 | -$_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); |
|
39 | +$_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); |
|
40 | 40 | if (!empty($_langFiles[$_langISO6391])) $install_language = $_langFiles[$_langISO6391]; |
41 | 41 | |
42 | 42 | |
43 | -if (isset($_POST['language']) && !stristr($_POST['language'],"..")) { |
|
43 | +if (isset($_POST['language']) && !stristr($_POST['language'], "..")) { |
|
44 | 44 | $install_language = $_POST['language']; |
45 | 45 | } else { |
46 | - if (isset($_GET['language']) && !stristr($_GET['language'],"..")) |
|
46 | + if (isset($_GET['language']) && !stristr($_GET['language'], "..")) |
|
47 | 47 | $install_language = $_GET['language']; |
48 | 48 | } |
49 | 49 | # load language file |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | |
53 | 53 | $manager_language = $install_language; |
54 | 54 | |
55 | -if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) { |
|
55 | +if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'], "..")) { |
|
56 | 56 | $manager_language = $_POST['managerlanguage']; |
57 | 57 | } else { |
58 | - if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) |
|
58 | + if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'], "..")) |
|
59 | 59 | $manager_language = $_GET['managerlanguage']; |
60 | 60 | } |
61 | 61 | |
62 | -foreach($_lang as $k=>$v) |
|
62 | +foreach ($_lang as $k=>$v) |
|
63 | 63 | { |
64 | - if(strpos($v,'[+MGR_DIR+]')!==false) |
|
64 | + if (strpos($v, '[+MGR_DIR+]') !== false) |
|
65 | 65 | $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
66 | 66 | } |
67 | 67 | ?> |
68 | 68 | \ No newline at end of file |