@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | $warningspresent = 0; |
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
22 | -if ($sysfiles_check!=='0'){ |
|
22 | +if ($sysfiles_check!=='0') { |
|
23 | 23 | $warningspresent = 1; |
24 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
25 | 25 | } |
26 | 26 | |
27 | -if (is_writable("includes/config.inc.php")){ |
|
27 | +if (is_writable("includes/config.inc.php")) { |
|
28 | 28 | // Warn if world writable |
29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
30 | 30 | $warningspresent = 1; |
@@ -120,7 +120,8 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return bool |
122 | 122 | */ |
123 | - function checkSiteCache() { |
|
123 | + function checkSiteCache() |
|
124 | + { |
|
124 | 125 | global $modx; |
125 | 126 | $checked= true; |
126 | 127 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -159,26 +160,36 @@ discard block |
||
159 | 160 | |
160 | 161 | if ($warningspresent==1) { |
161 | 162 | |
162 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
163 | +if(!isset($modx->config['send_errormail'])) { |
|
164 | + $modx->config['send_errormail']='3'; |
|
165 | +} |
|
163 | 166 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
164 | 167 | |
165 | 168 | for ($i=0;$i<count($warnings);$i++) { |
166 | 169 | switch ($warnings[$i][0]) { |
167 | 170 | case $_lang['configcheck_configinc']; |
168 | 171 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
169 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
172 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
173 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
174 | + } |
|
170 | 175 | break; |
171 | 176 | case $_lang['configcheck_installer'] : |
172 | 177 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
173 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
178 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
179 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
180 | + } |
|
174 | 181 | break; |
175 | 182 | case $_lang['configcheck_cache'] : |
176 | 183 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
177 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
184 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
185 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
186 | + } |
|
178 | 187 | break; |
179 | 188 | case $_lang['configcheck_images'] : |
180 | 189 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
181 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
190 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
191 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
192 | + } |
|
182 | 193 | break; |
183 | 194 | case $_lang['configcheck_sysfiles_mod']: |
184 | 195 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -186,7 +197,9 @@ discard block |
||
186 | 197 | if($modx->hasPermission('settings')) { |
187 | 198 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
188 | 199 | } |
189 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
200 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
201 | + $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
202 | + } |
|
190 | 203 | break; |
191 | 204 | case $_lang['configcheck_lang_difference'] : |
192 | 205 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | * @param string $sep |
16 | 16 | * @return mixed|string |
17 | 17 | */ |
18 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
18 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') |
|
19 | +{ |
|
19 | 20 | |
20 | 21 | global $modx; |
21 | 22 | $o = ''; |
@@ -59,7 +60,9 @@ discard block |
||
59 | 60 | if(isset($params['align']) && $params['align'] != 'none') { |
60 | 61 | $attr['align'] = $params['align']; |
61 | 62 | } |
62 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
63 | + foreach($attr as $k => $v) { |
|
64 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
65 | + } |
|
63 | 66 | $attributes .= ' ' . $params['attrib']; |
64 | 67 | |
65 | 68 | // Output the image with attributes |
@@ -128,7 +131,9 @@ discard block |
||
128 | 131 | 'style' => $params['style'], |
129 | 132 | 'target' => $params['target'], |
130 | 133 | ); |
131 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
134 | + foreach($attr as $k => $v) { |
|
135 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
136 | + } |
|
132 | 137 | $attributes .= ' ' . $params['attrib']; // add extra |
133 | 138 | |
134 | 139 | // Output the link |
@@ -157,7 +162,9 @@ discard block |
||
157 | 162 | 'class' => $params['class'], |
158 | 163 | 'style' => $params['style'], |
159 | 164 | ); |
160 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
165 | + foreach($attr as $k => $v) { |
|
166 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
167 | + } |
|
161 | 168 | $attributes .= ' ' . $params['attrib']; // add extra |
162 | 169 | |
163 | 170 | // Output the HTML Tag |
@@ -341,7 +348,8 @@ discard block |
||
341 | 348 | * @param string $s |
342 | 349 | * @return string |
343 | 350 | */ |
344 | -function decodeParamValue($s) { |
|
351 | +function decodeParamValue($s) |
|
352 | +{ |
|
345 | 353 | $s = str_replace("%3D", '=', $s); // = |
346 | 354 | return str_replace("%26", '&', $s); // & |
347 | 355 | } |
@@ -355,12 +363,16 @@ discard block |
||
355 | 363 | * @param bool $columns |
356 | 364 | * @return array|string |
357 | 365 | */ |
358 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
366 | +function parseInput($src, $delim = "||", $type = "string", $columns = true) |
|
367 | +{ |
|
368 | +// type can be: string, array |
|
359 | 369 | global $modx; |
360 | 370 | if($modx->db->isResult($src)) { |
361 | 371 | // must be a recordset |
362 | 372 | $rows = array(); |
363 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
373 | + while($cols = $modx->db->getRow($src, 'num')) { |
|
374 | + $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
375 | + } |
|
364 | 376 | return ($type == "array") ? $rows : implode($delim, $rows); |
365 | 377 | } else { |
366 | 378 | // must be a text |
@@ -376,7 +388,8 @@ discard block |
||
376 | 388 | * @param string $value |
377 | 389 | * @return bool|false|int |
378 | 390 | */ |
379 | -function getUnixtimeFromDateString($value) { |
|
391 | +function getUnixtimeFromDateString($value) |
|
392 | +{ |
|
380 | 393 | $timestamp = false; |
381 | 394 | // Check for MySQL or legacy style date |
382 | 395 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | * @param array $tvsArray |
23 | 23 | * @return string |
24 | 24 | */ |
25 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
25 | +function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) |
|
26 | +{ |
|
26 | 27 | global $modx; |
27 | 28 | $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
28 | 29 | $nvalue = trim($value); |
29 | - if (substr($nvalue, 0, 1) != '@') |
|
30 | - return $value; |
|
31 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
30 | + if (substr($nvalue, 0, 1) != '@') { |
|
31 | + return $value; |
|
32 | + } elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
32 | 33 | return '@Bindings is disabled.'; |
33 | - } |
|
34 | - else { |
|
34 | + } else { |
|
35 | 35 | list ($cmd, $param) = ParseCommand($nvalue); |
36 | 36 | $cmd = trim($cmd); |
37 | 37 | $param = parseTvValues($param, $tvsArray); |
@@ -47,10 +47,11 @@ discard block |
||
47 | 47 | |
48 | 48 | case "DOCUMENT" : // retrieve a document and process it's content |
49 | 49 | $rs = $modx->getDocument($param); |
50 | - if (is_array($rs)) |
|
51 | - $output = $rs['content']; |
|
52 | - else |
|
53 | - $output = "Unable to locate document $param"; |
|
50 | + if (is_array($rs)) { |
|
51 | + $output = $rs['content']; |
|
52 | + } else { |
|
53 | + $output = "Unable to locate document $param"; |
|
54 | + } |
|
54 | 55 | break; |
55 | 56 | |
56 | 57 | case "SELECT" : // selects a record from the cms database |
@@ -80,8 +81,10 @@ discard block |
||
80 | 81 | |
81 | 82 | // Grab document regardless of publish status |
82 | 83 | $doc = $modx->getPageInfo($parent_id, 0, 'id,parent,published'); |
83 | - if ($doc['parent'] != 0 && !$doc['published']) |
|
84 | - continue; // hide unpublished docs if we're not at the top |
|
84 | + if ($doc['parent'] != 0 && !$doc['published']) { |
|
85 | + continue; |
|
86 | + } |
|
87 | + // hide unpublished docs if we're not at the top |
|
85 | 88 | |
86 | 89 | $tv = $modx->getTemplateVar($name, '*', $doc['id'], $doc['published']); |
87 | 90 | |
@@ -129,10 +132,13 @@ discard block |
||
129 | 132 | * @param $file |
130 | 133 | * @return string |
131 | 134 | */ |
132 | -function ProcessFile($file) { |
|
135 | +function ProcessFile($file) |
|
136 | +{ |
|
133 | 137 | // get the file |
134 | 138 | $buffer = @file_get_contents($file); |
135 | - if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
139 | + if ($buffer === false) { |
|
140 | + $buffer = " Could not retrieve document '$file'."; |
|
141 | + } |
|
136 | 142 | return $buffer; |
137 | 143 | } |
138 | 144 | |
@@ -146,10 +152,8 @@ discard block |
||
146 | 152 | { |
147 | 153 | global $BINDINGS; |
148 | 154 | $binding_array = array(); |
149 | - foreach($BINDINGS as $cmd) |
|
150 | - { |
|
151 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
152 | - { |
|
155 | + foreach($BINDINGS as $cmd) { |
|
156 | + if(strpos($binding_string,'@'.$cmd)===0) { |
|
153 | 157 | $code = substr($binding_string,strlen($cmd)+1); |
154 | 158 | $binding_array = array($cmd,trim($code)); |
155 | 159 | break; |
@@ -356,7 +356,8 @@ discard block |
||
356 | 356 | * @param string $pwd |
357 | 357 | * @param string $ufn |
358 | 358 | */ |
359 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
359 | +function sendMailMessage($email, $uid, $pwd, $ufn) |
|
360 | +{ |
|
360 | 361 | global $modx, $_lang, $signupemail_message; |
361 | 362 | global $emailsubject, $emailsender; |
362 | 363 | global $site_name; |
@@ -389,7 +390,8 @@ discard block |
||
389 | 390 | * |
390 | 391 | * @param int $id |
391 | 392 | */ |
392 | -function saveUserSettings($id) { |
|
393 | +function saveUserSettings($id) |
|
394 | +{ |
|
393 | 395 | global $modx; |
394 | 396 | $tbl_user_settings = $modx->getFullTableName('user_settings'); |
395 | 397 | |
@@ -477,7 +479,8 @@ discard block |
||
477 | 479 | * |
478 | 480 | * @param $msg |
479 | 481 | */ |
480 | -function webAlertAndQuit($msg) { |
|
482 | +function webAlertAndQuit($msg) |
|
483 | +{ |
|
481 | 484 | global $id, $modx; |
482 | 485 | $mode = $_POST['mode']; |
483 | 486 | $modx->manager->saveFormValues($mode); |
@@ -490,7 +493,8 @@ discard block |
||
490 | 493 | * @param int $length |
491 | 494 | * @return string |
492 | 495 | */ |
493 | -function generate_password($length = 10) { |
|
496 | +function generate_password($length = 10) |
|
497 | +{ |
|
494 | 498 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
495 | 499 | $ps_len = strlen($allowable_characters); |
496 | 500 | mt_srand((double) microtime() * 1000000); |
@@ -79,7 +79,8 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function getParents($id, $path = '') |
82 | - { // modx:returns child's parent |
|
82 | + { |
|
83 | +// modx:returns child's parent |
|
83 | 84 | global $modx; |
84 | 85 | if (empty($this->aliases)) { |
85 | 86 | $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible"; |
@@ -456,7 +457,8 @@ discard block |
||
456 | 457 | $_ = trim($_); |
457 | 458 | } |
458 | 459 | $lastChar = substr($_, -1); |
459 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
460 | + if (!in_array($lastChar, $chars)) { |
|
461 | +// ,320,327,288,284,289 |
|
460 | 462 | if (!in_array($prev_token, |
461 | 463 | array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
462 | 464 | $_ .= ' '; |
@@ -296,7 +296,8 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @param string $msg |
298 | 298 | */ |
299 | -function jsAlert($msg) { |
|
299 | +function jsAlert($msg) |
|
300 | +{ |
|
300 | 301 | global $modx; |
301 | 302 | if($_POST['ajax'] != 1) { |
302 | 303 | echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
@@ -311,7 +312,8 @@ discard block |
||
311 | 312 | * @param string $dbasePassword |
312 | 313 | * @return bool |
313 | 314 | */ |
314 | -function login($username, $givenPassword, $dbasePassword) { |
|
315 | +function login($username, $givenPassword, $dbasePassword) |
|
316 | +{ |
|
315 | 317 | global $modx; |
316 | 318 | return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
317 | 319 | } |
@@ -323,7 +325,8 @@ discard block |
||
323 | 325 | * @param string $username |
324 | 326 | * @return bool |
325 | 327 | */ |
326 | -function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
|
328 | +function loginV1($internalKey, $givenPassword, $dbasePassword, $username) |
|
329 | +{ |
|
327 | 330 | global $modx; |
328 | 331 | |
329 | 332 | $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
@@ -353,7 +356,8 @@ discard block |
||
353 | 356 | * @param string $username |
354 | 357 | * @return bool |
355 | 358 | */ |
356 | -function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
|
359 | +function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) |
|
360 | +{ |
|
357 | 361 | global $modx; |
358 | 362 | |
359 | 363 | if($dbasePassword != md5($givenPassword)) { |
@@ -367,7 +371,8 @@ discard block |
||
367 | 371 | * @param string $username |
368 | 372 | * @param string $password |
369 | 373 | */ |
370 | -function updateNewHash($username, $password) { |
|
374 | +function updateNewHash($username, $password) |
|
375 | +{ |
|
371 | 376 | global $modx; |
372 | 377 | |
373 | 378 | $field = array(); |
@@ -381,16 +386,19 @@ discard block |
||
381 | 386 | * @param int $failed_allowed |
382 | 387 | * @param int $blocked_minutes |
383 | 388 | */ |
384 | -function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
|
389 | +function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) |
|
390 | +{ |
|
385 | 391 | global $modx; |
386 | 392 | |
387 | 393 | $failedlogins += 1; |
388 | 394 | |
389 | 395 | $fields = array('failedlogincount' => $failedlogins); |
390 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
396 | + if($failedlogins >= $failed_allowed) { |
|
397 | + //block user for too many fail attempts |
|
391 | 398 | { |
392 | 399 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
393 | 400 | } |
401 | + } |
|
394 | 402 | |
395 | 403 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
396 | 404 |
@@ -47,7 +47,8 @@ |
||
47 | 47 | /** |
48 | 48 | * @param int $parent |
49 | 49 | */ |
50 | -function getChildren($parent) { |
|
50 | +function getChildren($parent) |
|
51 | +{ |
|
51 | 52 | |
52 | 53 | global $modx; |
53 | 54 | global $children; |
@@ -42,7 +42,8 @@ discard block |
||
42 | 42 | * @param int $_toplevel |
43 | 43 | * @return int |
44 | 44 | */ |
45 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
45 | +function duplicateDocument($docid, $parent=null, $_toplevel=0) |
|
46 | +{ |
|
46 | 47 | global $modx, $_lang; |
47 | 48 | |
48 | 49 | // invoke OnBeforeDocDuplicate event |
@@ -63,8 +64,7 @@ discard block |
||
63 | 64 | $content = $modx->db->getRow($rs); |
64 | 65 | |
65 | 66 | // Handle incremental ID |
66 | - switch($modx->config['docid_incrmnt_method']) |
|
67 | - { |
|
67 | + switch($modx->config['docid_incrmnt_method']) { |
|
68 | 68 | case '1': |
69 | 69 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
70 | 70 | $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
@@ -85,8 +85,11 @@ discard block |
||
85 | 85 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
86 | 86 | $pagetitle = $modx->db->escape($pagetitle); |
87 | 87 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
88 | - if($count>=1) $count = ' '.($count+1); |
|
89 | - else $count = ''; |
|
88 | + if($count>=1) { |
|
89 | + $count = ' '.($count+1); |
|
90 | + } else { |
|
91 | + $count = ''; |
|
92 | + } |
|
90 | 93 | |
91 | 94 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
92 | 95 | $content['alias'] = null; |
@@ -95,7 +98,9 @@ discard block |
||
95 | 98 | } |
96 | 99 | |
97 | 100 | // change the parent accordingly |
98 | - if ($parent !== null) $content['parent'] = $parent; |
|
101 | + if ($parent !== null) { |
|
102 | + $content['parent'] = $parent; |
|
103 | + } |
|
99 | 104 | |
100 | 105 | // Change the author |
101 | 106 | $content['createdby'] = $userID; |
@@ -135,8 +140,9 @@ discard block |
||
135 | 140 | // Start duplicating all the child documents that aren't deleted. |
136 | 141 | $_toplevel++; |
137 | 142 | $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
138 | - while ($row = $modx->db->getRow($rs)) |
|
139 | - duplicateDocument($row['id'], $newparent, $_toplevel); |
|
143 | + while ($row = $modx->db->getRow($rs)) { |
|
144 | + duplicateDocument($row['id'], $newparent, $_toplevel); |
|
145 | + } |
|
140 | 146 | |
141 | 147 | // return the new doc id |
142 | 148 | return $newparent; |
@@ -148,7 +154,8 @@ discard block |
||
148 | 154 | * @param int $oldid |
149 | 155 | * @param int $newid |
150 | 156 | */ |
151 | -function duplicateTVs($oldid, $newid){ |
|
157 | +function duplicateTVs($oldid, $newid) |
|
158 | +{ |
|
152 | 159 | global $modx; |
153 | 160 | |
154 | 161 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
@@ -168,7 +175,8 @@ discard block |
||
168 | 175 | * @param int $oldid |
169 | 176 | * @param int $newid |
170 | 177 | */ |
171 | -function duplicateAccess($oldid, $newid){ |
|
178 | +function duplicateAccess($oldid, $newid) |
|
179 | +{ |
|
172 | 180 | global $modx; |
173 | 181 | |
174 | 182 | $tbldg = $modx->getFullTableName('document_groups'); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | // check if user has access permission, except admins |
15 | -if($_SESSION['mgrRole']!=1){ |
|
15 | +if($_SESSION['mgrRole']!=1) { |
|
16 | 16 | $rs = $modx->db->select( |
17 | 17 | 'sma.usergroup,mg.member', |
18 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -70,7 +70,8 @@ discard block |
||
70 | 70 | * @param array $params |
71 | 71 | * @return string |
72 | 72 | */ |
73 | -function evalModule($moduleCode,$params){ |
|
73 | +function evalModule($moduleCode,$params) |
|
74 | +{ |
|
74 | 75 | global $modx; |
75 | 76 | $modx->event->params = &$params; // store params inside event object |
76 | 77 | if(is_array($params)) { |
@@ -80,11 +81,9 @@ discard block |
||
80 | 81 | $mod = eval($moduleCode); |
81 | 82 | $msg = ob_get_contents(); |
82 | 83 | ob_end_clean(); |
83 | - if (isset($php_errormsg)) |
|
84 | - { |
|
84 | + if (isset($php_errormsg)) { |
|
85 | 85 | $error_info = error_get_last(); |
86 | - switch($error_info['type']) |
|
87 | - { |
|
86 | + switch($error_info['type']) { |
|
88 | 87 | case E_NOTICE : |
89 | 88 | $error_level = 1; |
90 | 89 | case E_USER_NOTICE : |
@@ -97,8 +96,7 @@ discard block |
||
97 | 96 | default: |
98 | 97 | $error_level = 99; |
99 | 98 | } |
100 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
101 | - { |
|
99 | + if($modx->config['error_reporting']==='99' || 2<$error_level) { |
|
102 | 100 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
103 | 101 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
104 | 102 | } |