@@ -373,7 +373,8 @@ discard block |
||
373 | 373 | * @return bool|mixed|mysqli_result |
374 | 374 | */ |
375 | 375 | public function save($fields, $table, $where = '') |
376 | - { // This is similar to "replace into table". |
|
376 | + { |
|
377 | +// This is similar to "replace into table". |
|
377 | 378 | |
378 | 379 | if ($where === '') { |
379 | 380 | $mode = 'insert'; |
@@ -490,7 +491,7 @@ discard block |
||
490 | 491 | { |
491 | 492 | $out = false; |
492 | 493 | if ($ds instanceof mysqli_result) { |
493 | - switch($mode){ |
|
494 | + switch($mode) { |
|
494 | 495 | case 'assoc': |
495 | 496 | $out = $ds->fetch_assoc(); |
496 | 497 | break; |
@@ -225,13 +225,13 @@ discard block |
||
225 | 225 | $orderBy = trim($orderBy); |
226 | 226 | $limit = trim($limit); |
227 | 227 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
228 | - $where = "WHERE {$where}"; |
|
228 | + $where = "where {$where}"; |
|
229 | 229 | } |
230 | 230 | if ($orderBy !== '' && stripos($orderBy, 'ORDER BY') !== 0) { |
231 | 231 | $orderBy = "ORDER BY {$orderBy}"; |
232 | 232 | } |
233 | 233 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
234 | - $limit = "LIMIT {$limit}"; |
|
234 | + $limit = "limit {$limit}"; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $out = $this->query("DELETE FROM {$from} {$where} {$orderBy} {$limit}"); |
@@ -272,16 +272,16 @@ discard block |
||
272 | 272 | $orderBy = trim($orderBy); |
273 | 273 | $limit = trim($limit); |
274 | 274 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
275 | - $where = "WHERE {$where}"; |
|
275 | + $where = "where {$where}"; |
|
276 | 276 | } |
277 | 277 | if ($orderBy !== '' && stripos($orderBy, 'ORDER') !== 0) { |
278 | 278 | $orderBy = "ORDER BY {$orderBy}"; |
279 | 279 | } |
280 | 280 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
281 | - $limit = "LIMIT {$limit}"; |
|
281 | + $limit = "limit {$limit}"; |
|
282 | 282 | } |
283 | 283 | |
284 | - return $this->query("SELECT {$fields} FROM {$from} {$where} {$orderBy} {$limit}"); |
|
284 | + return $this->query("select {$fields} FROM {$from} {$where} {$orderBy} {$limit}"); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | $where = trim($where); |
350 | 350 | $limit = trim($limit); |
351 | 351 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
352 | - $where = "WHERE {$where}"; |
|
352 | + $where = "where {$where}"; |
|
353 | 353 | } |
354 | 354 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
355 | - $limit = "LIMIT {$limit}"; |
|
355 | + $limit = "limit {$limit}"; |
|
356 | 356 | } |
357 | 357 | $this->query("INSERT INTO {$intotable} {$fields} SELECT {$fromfields} FROM {$fromtable} {$where} {$limit}"); |
358 | 358 | } |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | - * @param string|array $fields |
|
244 | - * @param string|array $from |
|
245 | - * @param string|array $where |
|
243 | + * @param string $fields |
|
244 | + * @param string $from |
|
245 | + * @param string $where |
|
246 | 246 | * @param string $orderBy |
247 | 247 | * @param string $limit |
248 | 248 | * @return bool|mysqli_result |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @param string $fromtable |
327 | 327 | * @param string $where |
328 | 328 | * @param string $limit |
329 | - * @return mixed |
|
329 | + * @return null|integer |
|
330 | 330 | */ |
331 | 331 | public function insert($fields, $intotable, $fromfields = "*", $fromtable = "", $where = "", $limit = "") |
332 | 332 | { |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | /** |
370 | 370 | * @param $fields |
371 | - * @param $table |
|
371 | + * @param string $table |
|
372 | 372 | * @param string $where |
373 | 373 | * @return bool|mixed|mysqli_result |
374 | 374 | */ |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | |
436 | 436 | /** |
437 | 437 | * @param null|mysqli $conn |
438 | - * @return mixed |
|
438 | + * @return integer |
|
439 | 439 | */ |
440 | 440 | public function getInsertId($conn = null) |
441 | 441 | { |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
516 | - * @param $name |
|
516 | + * @param string $name |
|
517 | 517 | * @param mysqli_result|string $dsq |
518 | 518 | * @return array |
519 | 519 | */ |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | /** |
574 | 574 | * @param string $table |
575 | - * @return array |
|
575 | + * @return boolean |
|
576 | 576 | */ |
577 | 577 | public function getTableMetaData($table) |
578 | 578 | { |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
622 | - * @param string|mysqli_result $rs |
|
622 | + * @param string $rs |
|
623 | 623 | * @param bool $index |
624 | 624 | * @return array |
625 | 625 | */ |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $pre = null, |
31 | 31 | $charset = '', |
32 | 32 | $connection_method = 'SET CHARACTER SET' |
33 | - ) { |
|
33 | + ){ |
|
34 | 34 | $this->config['host'] = $host ? $host : $GLOBALS['database_server']; |
35 | 35 | $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase']; |
36 | 36 | $this->config['user'] = $uid ? $uid : $GLOBALS['database_user']; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $ua = $modx->htmlspecialchars($_SERVER['HTTP_USER_AGENT']); |
71 | 71 | $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']); |
72 | 72 | $modx->sendmail(array( |
73 | - 'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'], |
|
73 | + 'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'], |
|
74 | 74 | 'body' => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}", |
75 | 75 | 'type' => 'text' |
76 | 76 | )); |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | $tend = $modx->getMicroTime(); |
86 | 86 | $totaltime = $tend - $tstart; |
87 | 87 | if ($modx->dumpSQL) { |
88 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s", |
|
89 | - $totaltime) . "</fieldset><br />"; |
|
88 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s", |
|
89 | + $totaltime)."</fieldset><br />"; |
|
90 | 90 | } |
91 | 91 | $this->conn->set_charset($this->config['charset']); |
92 | 92 | $this->isConnected = true; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if (1000 < $safeCount) { |
120 | 120 | exit("Too many loops '{$safeCount}'"); |
121 | 121 | } |
122 | - if ( ! ($this->conn instanceof mysqli)) { |
|
122 | + if (!($this->conn instanceof mysqli)) { |
|
123 | 123 | $this->connect(); |
124 | 124 | } |
125 | 125 | if (is_array($s)) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public function query($sql, $watchError = true) |
146 | 146 | { |
147 | 147 | $modx = evolutionCMS(); |
148 | - if ( ! ($this->conn instanceof mysqli)) { |
|
148 | + if (!($this->conn instanceof mysqli)) { |
|
149 | 149 | $this->connect(); |
150 | 150 | } |
151 | 151 | $tStart = $modx->getMicroTime(); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | case 1091: |
166 | 166 | break; |
167 | 167 | default: |
168 | - $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql); |
|
168 | + $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql); |
|
169 | 169 | } |
170 | 170 | } else { |
171 | 171 | $tend = $modx->getMicroTime(); |
@@ -179,24 +179,24 @@ discard block |
||
179 | 179 | $debug_path[] = $line['function']; |
180 | 180 | } |
181 | 181 | $debug_path = implode(' > ', array_reverse($debug_path)); |
182 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms", |
|
183 | - $totalTime * 1000) . "</legend>"; |
|
184 | - $modx->queryCode .= $sql . '<br><br>'; |
|
182 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms", |
|
183 | + $totalTime * 1000)."</legend>"; |
|
184 | + $modx->queryCode .= $sql.'<br><br>'; |
|
185 | 185 | if ($modx->event->name) { |
186 | - $modx->queryCode .= 'Current Event => ' . $modx->event->name . '<br>'; |
|
186 | + $modx->queryCode .= 'Current Event => '.$modx->event->name.'<br>'; |
|
187 | 187 | } |
188 | 188 | if ($modx->event->activePlugin) { |
189 | - $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>'; |
|
189 | + $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>'; |
|
190 | 190 | } |
191 | 191 | if ($modx->currentSnippet) { |
192 | - $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>'; |
|
192 | + $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>'; |
|
193 | 193 | } |
194 | 194 | if (stripos($sql, 'select') === 0) { |
195 | - $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>'; |
|
195 | + $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>'; |
|
196 | 196 | } else { |
197 | - $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>'; |
|
197 | + $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>'; |
|
198 | 198 | } |
199 | - $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>'; |
|
199 | + $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>'; |
|
200 | 200 | $modx->queryCode .= "</fieldset><br />"; |
201 | 201 | } |
202 | 202 | $modx->executedQueries++; |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | if ($value === null || strtolower($value) === 'null') { |
304 | 304 | $f = 'NULL'; |
305 | 305 | } else { |
306 | - $f = "'" . $value . "'"; |
|
306 | + $f = "'".$value."'"; |
|
307 | 307 | } |
308 | - $fields[$key] = "`{$key}` = " . $f; |
|
308 | + $fields[$key] = "`{$key}` = ".$f; |
|
309 | 309 | } |
310 | 310 | $fields = implode(',', $fields); |
311 | 311 | } |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | $this->query("INSERT INTO {$intotable} {$fields}"); |
341 | 341 | } else { |
342 | 342 | if (empty($fromtable)) { |
343 | - $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '", |
|
344 | - array_values($fields)) . "')"; |
|
343 | + $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '", |
|
344 | + array_values($fields))."')"; |
|
345 | 345 | $this->query("INSERT INTO {$intotable} {$fields}"); |
346 | 346 | } else { |
347 | 347 | $fromtable = $this->replaceFullTableName($fromtable); |
348 | - $fields = "(" . implode(",", array_keys($fields)) . ")"; |
|
348 | + $fields = "(".implode(",", array_keys($fields)).")"; |
|
349 | 349 | $where = trim($where); |
350 | 350 | $limit = trim($limit); |
351 | 351 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function getInsertId($conn = null) |
441 | 441 | { |
442 | - if (! ($conn instanceof mysqli)) { |
|
443 | - $conn =& $this->conn; |
|
442 | + if (!($conn instanceof mysqli)) { |
|
443 | + $conn = & $this->conn; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | return $conn->insert_id; |
@@ -452,8 +452,8 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function getAffectedRows($conn = null) |
454 | 454 | { |
455 | - if (! ($conn instanceof mysqli)) { |
|
456 | - $conn =& $this->conn; |
|
455 | + if (!($conn instanceof mysqli)) { |
|
456 | + $conn = & $this->conn; |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | return $conn->affected_rows; |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | */ |
466 | 466 | public function getLastError($conn = null) |
467 | 467 | { |
468 | - if (! ($conn instanceof mysqli)) { |
|
469 | - $conn =& $this->conn; |
|
468 | + if (!($conn instanceof mysqli)) { |
|
469 | + $conn = & $this->conn; |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | return $conn->error; |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | { |
491 | 491 | $out = false; |
492 | 492 | if ($ds instanceof mysqli_result) { |
493 | - switch($mode){ |
|
493 | + switch ($mode) { |
|
494 | 494 | case 'assoc': |
495 | 495 | $out = $ds->fetch_assoc(); |
496 | 496 | break; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | public function getColumn($name, $dsq) |
521 | 521 | { |
522 | 522 | $col = array(); |
523 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
523 | + if (!($dsq instanceof mysqli_result)) { |
|
524 | 524 | $dsq = $this->query($dsq); |
525 | 525 | } |
526 | 526 | if ($dsq) { |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | public function getColumnNames($dsq) |
540 | 540 | { |
541 | 541 | $names = array(); |
542 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
542 | + if (!($dsq instanceof mysqli_result)) { |
|
543 | 543 | $dsq = $this->query($dsq); |
544 | 544 | } |
545 | 545 | if ($dsq) { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | public function getValue($dsq) |
560 | 560 | { |
561 | 561 | $out = false; |
562 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
562 | + if (!($dsq instanceof mysqli_result)) { |
|
563 | 563 | $dsq = $this->query($dsq); |
564 | 564 | } |
565 | 565 | if ($dsq) { |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | $tableName = trim($tableName); |
658 | 658 | $dbase = trim($this->config['dbase'], '`'); |
659 | 659 | $prefix = $this->config['table_prefix']; |
660 | - if ((bool)$force === true) { |
|
660 | + if ((bool) $force === true) { |
|
661 | 661 | $result = "`{$dbase}`.`{$prefix}{$tableName}`"; |
662 | 662 | } elseif (strpos($tableName, '[+prefix+]') !== false) { |
663 | 663 | $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | return true; |
10 | 10 | } |
11 | 11 | |
12 | -if (!include_once(MODX_MANAGER_PATH . 'includes/extenders/phpass.class.inc.php')) { |
|
12 | +if (!include_once(MODX_MANAGER_PATH.'includes/extenders/phpass.class.inc.php')) { |
|
13 | 13 | return false; |
14 | 14 | } else { |
15 | 15 | $this->phpass = new PasswordHash; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * Time: 14:38 |
6 | 6 | */ |
7 | 7 | |
8 | -if (!include_once MODX_MANAGER_PATH . 'includes/extenders/maketable.class.php') { |
|
8 | +if (!include_once MODX_MANAGER_PATH.'includes/extenders/maketable.class.php') { |
|
9 | 9 | return false; |
10 | 10 | } else { |
11 | 11 | $this->table = new MakeTable; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $this->portable_hashes = $portable_hashes; |
50 | 50 | |
51 | - $this->random_state = microtime() . uniqid(mt_rand(), true); |
|
51 | + $this->random_state = microtime().uniqid(mt_rand(), true); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $output = ''; |
69 | 69 | for ($i = 0; $i < $count; $i += 16) { |
70 | 70 | $this->random_state = |
71 | - md5(microtime() . $this->random_state); |
|
71 | + md5(microtime().$this->random_state); |
|
72 | 72 | $output .= |
73 | 73 | pack('H*', md5($this->random_state)); |
74 | 74 | } |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | // consequently in lower iteration counts and hashes that are |
161 | 161 | // quicker to crack (by non-PHP code). |
162 | 162 | |
163 | - $hash = md5($salt . $password, true); |
|
163 | + $hash = md5($salt.$password, true); |
|
164 | 164 | do { |
165 | - $hash = md5($hash . $password, true); |
|
165 | + $hash = md5($hash.$password, true); |
|
166 | 166 | } while (--$count); |
167 | 167 | |
168 | 168 | $output = substr($setting, 0, 12); |
@@ -118,16 +118,16 @@ discard block |
||
118 | 118 | for ($i = 0; $i < $tablevel; $i++) { |
119 | 119 | $tabs .= "\t"; |
120 | 120 | } |
121 | - $listhtml = $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n"; |
|
121 | + $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n"; |
|
122 | 122 | foreach ($array as $key => $value) { |
123 | 123 | if (is_array($value)) { |
124 | - $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix, |
|
125 | - $type, $ordered, $tablevel + 2) . $tabs . "\t</li>\n"; |
|
124 | + $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix, |
|
125 | + $type, $ordered, $tablevel + 2).$tabs."\t</li>\n"; |
|
126 | 126 | } else { |
127 | - $listhtml .= $tabs . "\t<li>" . $value . "</li>\n"; |
|
127 | + $listhtml .= $tabs."\t<li>".$value."</li>\n"; |
|
128 | 128 | } |
129 | 129 | } |
130 | - $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n"; |
|
130 | + $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n"; |
|
131 | 131 | |
132 | 132 | return $listhtml; |
133 | 133 | } |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | $msg = addslashes($modx->db->escape($msg)); |
299 | 299 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
300 | 300 | $act = "__WebAlert();"; |
301 | - $fnc = "function __WebAlert(){" . substr($url, 11) . "};"; |
|
301 | + $fnc = "function __WebAlert(){".substr($url, 11)."};"; |
|
302 | 302 | } else { |
303 | - $act = ($url ? "window.location.href='" . addslashes($url) . "';" : ""); |
|
303 | + $act = ($url ? "window.location.href='".addslashes($url)."';" : ""); |
|
304 | 304 | } |
305 | 305 | $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
306 | 306 | if ($modx->isFrontend()) { |
@@ -72,7 +72,7 @@ |
||
72 | 72 | * @deprecated |
73 | 73 | * |
74 | 74 | * @param $rs |
75 | - * @return int|mixed |
|
75 | + * @return integer |
|
76 | 76 | */ |
77 | 77 | public function insertId($rs) |
78 | 78 | { |
@@ -177,7 +177,8 @@ |
||
177 | 177 | * @return bool|string |
178 | 178 | */ |
179 | 179 | public function putChunk($chunkName) |
180 | - { // alias name >.< |
|
180 | + { |
|
181 | +// alias name >.< |
|
181 | 182 | $modx = evolutionCMS(); |
182 | 183 | |
183 | 184 | return $modx->getChunk($chunkName); |
@@ -9,6 +9,6 @@ |
||
9 | 9 | return true; |
10 | 10 | } |
11 | 11 | |
12 | -include_once(MODX_MANAGER_PATH . 'includes/extenders/modifiers.class.inc.php'); |
|
12 | +include_once(MODX_MANAGER_PATH.'includes/extenders/modifiers.class.inc.php'); |
|
13 | 13 | $this->filter = new MODIFIERS; |
14 | 14 | return true; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * Time: 14:16 |
6 | 6 | */ |
7 | 7 | |
8 | -if (!include_once MODX_MANAGER_PATH . 'includes/extenders/manager.api.class.inc.php') { |
|
8 | +if (!include_once MODX_MANAGER_PATH.'includes/extenders/manager.api.class.inc.php') { |
|
9 | 9 | return false; |
10 | 10 | } else { |
11 | 11 | $this->manager = new ManagerAPI; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * Time: 14:17 |
7 | 7 | */ |
8 | 8 | |
9 | -if (!include_once(MODX_MANAGER_PATH . 'includes/extenders/modxmailer.class.inc.php')) { |
|
9 | +if (!include_once(MODX_MANAGER_PATH.'includes/extenders/modxmailer.class.inc.php')) { |
|
10 | 10 | return false; |
11 | 11 | } else { |
12 | 12 | $this->mail = new MODxMailer; |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
22 | 22 | include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
23 | 23 | if (isset($installStartTime)) { |
24 | - if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
24 | + if ((time() - $installStartTime) > 5 * 60) { |
|
25 | +// if install flag older than 5 minutes, discard |
|
25 | 26 | unset($installStartTime); |
26 | 27 | @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
27 | 28 | unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
@@ -163,7 +164,8 @@ discard block |
||
163 | 164 | } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
164 | 165 | $target = $theme_path . 'templates/actions/login.tpl'; |
165 | 166 | $login_tpl = file_get_contents($target); |
166 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
167 | + } elseif (is_file($theme_path . 'html/login.html')) { |
|
168 | +// ClipperCMS compatible |
|
167 | 169 | $target = $theme_path . 'html/login.html'; |
168 | 170 | $login_tpl = file_get_contents($target); |
169 | 171 | } else { |
@@ -102,19 +102,19 @@ |
||
102 | 102 | $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']); |
103 | 103 | |
104 | 104 | switch ($modx->config['manager_theme_mode']) { |
105 | - case '1': |
|
105 | + case '1': |
|
106 | 106 | $modx->setPlaceholder('manager_theme_style', 'lightness'); |
107 | 107 | break; |
108 | - case '2': |
|
108 | + case '2': |
|
109 | 109 | $modx->setPlaceholder('manager_theme_style', 'light'); |
110 | 110 | break; |
111 | - case '3': |
|
111 | + case '3': |
|
112 | 112 | $modx->setPlaceholder('manager_theme_style', 'dark'); |
113 | 113 | break; |
114 | - case '4': |
|
114 | + case '4': |
|
115 | 115 | $modx->setPlaceholder('manager_theme_style', 'darkness'); |
116 | 116 | break; |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | // andrazk 20070416 - notify user of install/update |
120 | 120 | if (isset($_GET['installGoingOn'])) { |
@@ -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'); |
@@ -81,25 +81,25 @@ discard block |
||
81 | 81 | $modx->setPlaceholder('manager_path', MGR_DIR); |
82 | 82 | $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
83 | 83 | $modx->setPlaceholder('login_message', $_lang["login_message"]); |
84 | - $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
84 | + $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
85 | 85 | $modx->setPlaceholder('year', date('Y')); |
86 | 86 | |
87 | 87 | // set login logo image |
88 | - if ( !empty($modx->config['login_logo']) ) { |
|
89 | - $modx->setPlaceholder('login_logo', MODX_SITE_URL . $modx->config['login_logo']); |
|
88 | + if (!empty($modx->config['login_logo'])) { |
|
89 | + $modx->setPlaceholder('login_logo', MODX_SITE_URL.$modx->config['login_logo']); |
|
90 | 90 | } else { |
91 | - $modx->setPlaceholder('login_logo', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-logo.png'); |
|
91 | + $modx->setPlaceholder('login_logo', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-logo.png'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // set login background image |
95 | - if ( !empty($modx->config['login_bg']) ) { |
|
96 | - $modx->setPlaceholder('login_bg', MODX_SITE_URL . $modx->config['login_bg']); |
|
95 | + if (!empty($modx->config['login_bg'])) { |
|
96 | + $modx->setPlaceholder('login_bg', MODX_SITE_URL.$modx->config['login_bg']); |
|
97 | 97 | } else { |
98 | - $modx->setPlaceholder('login_bg', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-background.jpg'); |
|
98 | + $modx->setPlaceholder('login_bg', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-background.jpg'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // set form position css class |
102 | - $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']); |
|
102 | + $modx->setPlaceholder('login_form_position_class', 'loginbox-'.$modx->config['login_form_position']); |
|
103 | 103 | |
104 | 104 | switch ($modx->config['manager_theme_mode']) { |
105 | 105 | case '1': |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | switch ($installGoingOn) { |
125 | 125 | case 1 : |
126 | 126 | $modx->setPlaceholder('login_message', |
127 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
127 | + "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>"); |
|
128 | 128 | break; |
129 | 129 | case 2 : |
130 | 130 | $modx->setPlaceholder('login_message', |
131 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
131 | + "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>"); |
|
132 | 132 | break; |
133 | 133 | } |
134 | 134 | } |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | if ($modx->config['use_captcha'] == 1) { |
137 | 137 | $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
138 | 138 | $modx->setPlaceholder('captcha_image', |
139 | - '<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>'); |
|
139 | + '<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>'); |
|
140 | 140 | $modx->setPlaceholder('captcha_input', |
141 | - '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
141 | + '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // login info |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | // invoke OnManagerLoginFormRender event |
158 | 158 | $evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
159 | - $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
159 | + $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : ''; |
|
160 | 160 | $modx->setPlaceholder('OnManagerLoginFormRender', $html); |
161 | 161 | |
162 | 162 | // load template |
@@ -174,29 +174,29 @@ discard block |
||
174 | 174 | $login_tpl = file_get_contents($target); |
175 | 175 | } |
176 | 176 | } else { |
177 | - $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
178 | - if (is_file($theme_path . 'style.php')) { |
|
179 | - include($theme_path . 'style.php'); |
|
177 | + $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/'; |
|
178 | + if (is_file($theme_path.'style.php')) { |
|
179 | + include($theme_path.'style.php'); |
|
180 | 180 | } |
181 | 181 | $chunk = $modx->getChunk($target); |
182 | 182 | if ($chunk !== false && !empty($chunk)) { |
183 | 183 | $login_tpl = $chunk; |
184 | - } elseif (is_file(MODX_BASE_PATH . $target)) { |
|
185 | - $target = MODX_BASE_PATH . $target; |
|
184 | + } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
185 | + $target = MODX_BASE_PATH.$target; |
|
186 | 186 | $login_tpl = file_get_contents($target); |
187 | 187 | } elseif (is_file($target)) { |
188 | 188 | $login_tpl = file_get_contents($target); |
189 | - } elseif (is_file($theme_path . 'login.tpl')) { |
|
190 | - $target = $theme_path . 'login.tpl'; |
|
189 | + } elseif (is_file($theme_path.'login.tpl')) { |
|
190 | + $target = $theme_path.'login.tpl'; |
|
191 | 191 | $login_tpl = file_get_contents($target); |
192 | - } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
|
193 | - $target = $theme_path . 'templates/actions/login.tpl'; |
|
192 | + } elseif (is_file($theme_path.'templates/actions/login.tpl')) { |
|
193 | + $target = $theme_path.'templates/actions/login.tpl'; |
|
194 | 194 | $login_tpl = file_get_contents($target); |
195 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
196 | - $target = $theme_path . 'html/login.html'; |
|
195 | + } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible |
|
196 | + $target = $theme_path.'html/login.html'; |
|
197 | 197 | $login_tpl = file_get_contents($target); |
198 | 198 | } else { |
199 | - $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
199 | + $target = MODX_MANAGER_PATH.'media/style/common/login.tpl'; |
|
200 | 200 | $login_tpl = file_get_contents($target); |
201 | 201 | } |
202 | 202 | } |
@@ -216,17 +216,17 @@ discard block |
||
216 | 216 | $modx->updateValidatedUserSession(); |
217 | 217 | |
218 | 218 | // Update last action in table active_users |
219 | - $itemid = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
219 | + $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
220 | 220 | $lasthittime = time(); |
221 | - $action = isset($_REQUEST['a']) ? (int)$_REQUEST['a'] : 1; |
|
221 | + $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
|
222 | 222 | |
223 | 223 | if ($action !== 1) { |
224 | - if ((int)$itemid <= 0) { |
|
224 | + if ((int) $itemid <= 0) { |
|
225 | 225 | $itemid = null; |
226 | 226 | } |
227 | 227 | $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", |
228 | 228 | $modx->getFullTableName('active_users') // Table |
229 | - , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string)$action, |
|
229 | + , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, |
|
230 | 230 | $itemid == null ? var_export(null, true) : $itemid); |
231 | 231 | $modx->db->query($sql); |
232 | 232 | } |