@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | /** |
373 | 373 | * @param $fields |
374 | - * @param $table |
|
374 | + * @param string $table |
|
375 | 375 | * @param string $where |
376 | 376 | * @return bool|mixed|mysqli_result |
377 | 377 | */ |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | /** |
519 | - * @param $name |
|
519 | + * @param string $name |
|
520 | 520 | * @param mysqli_result|string $dsq |
521 | 521 | * @return array |
522 | 522 | */ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $pre = null, |
34 | 34 | $charset = '', |
35 | 35 | $connection_method = 'SET CHARACTER SET' |
36 | - ) { |
|
36 | + ){ |
|
37 | 37 | $this->config['host'] = $host ? $host : $GLOBALS['database_server']; |
38 | 38 | $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase']; |
39 | 39 | $this->config['user'] = $uid ? $uid : $GLOBALS['database_user']; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $ua = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT']); |
74 | 74 | $referer = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER']); |
75 | 75 | $modx->sendmail(array( |
76 | - 'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'], |
|
76 | + 'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'], |
|
77 | 77 | 'body' => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}", |
78 | 78 | 'type' => 'text' |
79 | 79 | )); |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | $tend = $modx->getMicroTime(); |
89 | 89 | $totaltime = $tend - $tstart; |
90 | 90 | if ($modx->dumpSQL) { |
91 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s", |
|
92 | - $totaltime) . "</fieldset><br />"; |
|
91 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s", |
|
92 | + $totaltime)."</fieldset><br />"; |
|
93 | 93 | } |
94 | 94 | $this->conn->set_charset($this->config['charset']); |
95 | 95 | $this->isConnected = true; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | if (1000 < $safeCount) { |
123 | 123 | exit("Too many loops '{$safeCount}'"); |
124 | 124 | } |
125 | - if ( ! ($this->conn instanceof mysqli)) { |
|
125 | + if (!($this->conn instanceof mysqli)) { |
|
126 | 126 | $this->connect(); |
127 | 127 | } |
128 | 128 | if (is_array($s)) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | public function query($sql, $watchError = true) |
149 | 149 | { |
150 | 150 | $modx = evolutionCMS(); |
151 | - if ( ! ($this->conn instanceof mysqli)) { |
|
151 | + if (!($this->conn instanceof mysqli)) { |
|
152 | 152 | $this->connect(); |
153 | 153 | } |
154 | 154 | $tStart = $modx->getMicroTime(); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | case 1091: |
169 | 169 | break; |
170 | 170 | default: |
171 | - $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql); |
|
171 | + $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql); |
|
172 | 172 | } |
173 | 173 | } else { |
174 | 174 | $tend = $modx->getMicroTime(); |
@@ -182,24 +182,24 @@ discard block |
||
182 | 182 | $debug_path[] = $line['function']; |
183 | 183 | } |
184 | 184 | $debug_path = implode(' > ', array_reverse($debug_path)); |
185 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms", |
|
186 | - $totalTime * 1000) . "</legend>"; |
|
187 | - $modx->queryCode .= $sql . '<br><br>'; |
|
185 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms", |
|
186 | + $totalTime * 1000)."</legend>"; |
|
187 | + $modx->queryCode .= $sql.'<br><br>'; |
|
188 | 188 | if ($modx->event->name) { |
189 | - $modx->queryCode .= 'Current Event => ' . $modx->event->name . '<br>'; |
|
189 | + $modx->queryCode .= 'Current Event => '.$modx->event->name.'<br>'; |
|
190 | 190 | } |
191 | 191 | if ($modx->event->activePlugin) { |
192 | - $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>'; |
|
192 | + $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>'; |
|
193 | 193 | } |
194 | 194 | if ($modx->currentSnippet) { |
195 | - $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>'; |
|
195 | + $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>'; |
|
196 | 196 | } |
197 | 197 | if (stripos($sql, 'select') === 0) { |
198 | - $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>'; |
|
198 | + $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>'; |
|
199 | 199 | } else { |
200 | - $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>'; |
|
200 | + $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>'; |
|
201 | 201 | } |
202 | - $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>'; |
|
202 | + $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>'; |
|
203 | 203 | $modx->queryCode .= "</fieldset><br />"; |
204 | 204 | } |
205 | 205 | $modx->executedQueries++; |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | if ($value === null || strtolower($value) === 'null') { |
307 | 307 | $f = 'NULL'; |
308 | 308 | } else { |
309 | - $f = "'" . $value . "'"; |
|
309 | + $f = "'".$value."'"; |
|
310 | 310 | } |
311 | - $fields[$key] = "`{$key}` = " . $f; |
|
311 | + $fields[$key] = "`{$key}` = ".$f; |
|
312 | 312 | } |
313 | 313 | $fields = implode(',', $fields); |
314 | 314 | } |
@@ -343,12 +343,12 @@ discard block |
||
343 | 343 | $this->query("INSERT INTO {$intotable} {$fields}"); |
344 | 344 | } else { |
345 | 345 | if (empty($fromtable)) { |
346 | - $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '", |
|
347 | - array_values($fields)) . "')"; |
|
346 | + $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '", |
|
347 | + array_values($fields))."')"; |
|
348 | 348 | $this->query("INSERT INTO {$intotable} {$fields}"); |
349 | 349 | } else { |
350 | 350 | $fromtable = $this->replaceFullTableName($fromtable); |
351 | - $fields = "(" . implode(",", array_keys($fields)) . ")"; |
|
351 | + $fields = "(".implode(",", array_keys($fields)).")"; |
|
352 | 352 | $where = trim($where); |
353 | 353 | $limit = trim($limit); |
354 | 354 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
@@ -442,8 +442,8 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function getInsertId($conn = null) |
444 | 444 | { |
445 | - if (! ($conn instanceof mysqli)) { |
|
446 | - $conn =& $this->conn; |
|
445 | + if (!($conn instanceof mysqli)) { |
|
446 | + $conn = & $this->conn; |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | return $conn->insert_id; |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | */ |
456 | 456 | public function getAffectedRows($conn = null) |
457 | 457 | { |
458 | - if (! ($conn instanceof mysqli)) { |
|
459 | - $conn =& $this->conn; |
|
458 | + if (!($conn instanceof mysqli)) { |
|
459 | + $conn = & $this->conn; |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | return $conn->affected_rows; |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function getLastError($conn = null) |
470 | 470 | { |
471 | - if (! ($conn instanceof mysqli)) { |
|
472 | - $conn =& $this->conn; |
|
471 | + if (!($conn instanceof mysqli)) { |
|
472 | + $conn = & $this->conn; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | return $conn->error; |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | { |
494 | 494 | $out = false; |
495 | 495 | if ($ds instanceof mysqli_result) { |
496 | - switch($mode){ |
|
496 | + switch ($mode) { |
|
497 | 497 | case 'assoc': |
498 | 498 | $out = $ds->fetch_assoc(); |
499 | 499 | break; |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | public function getColumn($name, $dsq) |
524 | 524 | { |
525 | 525 | $col = array(); |
526 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
526 | + if (!($dsq instanceof mysqli_result)) { |
|
527 | 527 | $dsq = $this->query($dsq); |
528 | 528 | } |
529 | 529 | if ($dsq) { |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | public function getColumnNames($dsq) |
543 | 543 | { |
544 | 544 | $names = array(); |
545 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
545 | + if (!($dsq instanceof mysqli_result)) { |
|
546 | 546 | $dsq = $this->query($dsq); |
547 | 547 | } |
548 | 548 | if ($dsq) { |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | public function getValue($dsq) |
563 | 563 | { |
564 | 564 | $out = false; |
565 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
565 | + if (!($dsq instanceof mysqli_result)) { |
|
566 | 566 | $dsq = $this->query($dsq); |
567 | 567 | } |
568 | 568 | if ($dsq) { |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $tableName = trim($tableName); |
661 | 661 | $dbase = trim($this->config['dbase'], '`'); |
662 | 662 | $prefix = $this->config['table_prefix']; |
663 | - if ((bool)$force === true) { |
|
663 | + if ((bool) $force === true) { |
|
664 | 664 | $result = "`{$dbase}`.`{$prefix}{$tableName}`"; |
665 | 665 | } elseif (strpos($tableName, '[+prefix+]') !== false) { |
666 | 666 | $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName); |
@@ -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 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @param int $flags |
11 | 11 | * @param string $encode |
12 | 12 | * @param int $safecount |
13 | - * @return string|array |
|
13 | + * @return null|string |
|
14 | 14 | */ |
15 | 15 | public function htmlspecialchars($str = '', $flags = ENT_COMPAT, $encode = '', $safecount = 0) |
16 | 16 | { |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php namespace EvolutionCMS; |
2 | 2 | |
3 | -use PHPMailer\PHPMailer\PHPMailer; |
|
4 | 3 | use PHPMailer\PHPMailer\Exception as PHPMailerException; |
4 | +use PHPMailer\PHPMailer\PHPMailer; |
|
5 | 5 | |
6 | 6 | class Mail extends PHPMailer |
7 | 7 | { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $modx = evolutionCMS(); |
31 | 31 | $this->modx = $modx; |
32 | - $this->PluginDir = MODX_MANAGER_PATH . 'includes/controls/phpmailer/'; |
|
32 | + $this->PluginDir = MODX_MANAGER_PATH.'includes/controls/phpmailer/'; |
|
33 | 33 | |
34 | 34 | switch ($modx->config['email_method']) { |
35 | 35 | 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 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | ini_set('sendmail_from', $old_from); |
235 | 235 | } |
236 | 236 | if (!$rt) { |
237 | - $msg = $this->Lang('instantiate') . "<br />\n"; |
|
237 | + $msg = $this->Lang('instantiate')."<br />\n"; |
|
238 | 238 | $msg .= "{$this->Subject}<br />\n"; |
239 | 239 | $msg .= "{$this->FromName}<{$this->From}><br />\n"; |
240 | 240 | $msg .= mb_convert_encoding($body, $this->modx->config['modx_charset'], $this->CharSet); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $classDump = call_user_func('get_object_vars', $this); |
257 | 257 | unset($classDump['modx']); |
258 | 258 | $this->modx->config['send_errormail'] = '0'; |
259 | - $this->modx->logEvent(0, 3, $msg . '<pre>' . print_r($classDump, true) . '</pre>', 'phpmailer'); |
|
259 | + $this->modx->logEvent(0, 3, $msg.'<pre>'.print_r($classDump, true).'</pre>', 'phpmailer'); |
|
260 | 260 | |
261 | 261 | return parent::SetError($msg); |
262 | 262 | } |
@@ -33,6 +33,9 @@ discard block |
||
33 | 33 | public $renderPagerFncArgs; |
34 | 34 | public static $dataSetPagerCnt; |
35 | 35 | |
36 | + /** |
|
37 | + * @param boolean|string $id |
|
38 | + */ |
|
36 | 39 | public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
37 | 40 | global $_PAGE; // use view state object |
38 | 41 | |
@@ -77,6 +80,9 @@ discard block |
||
77 | 80 | $this->pageSize = $ps; |
78 | 81 | } |
79 | 82 | |
83 | + /** |
|
84 | + * @param DataGrid $fncName |
|
85 | + */ |
|
80 | 86 | public function setRenderRowFnc($fncName, $args = "") { |
81 | 87 | $this->renderRowFnc = &$fncName; |
82 | 88 | $this->renderRowFncArgs = $args; // extra agruments |
@@ -13,18 +13,18 @@ discard block |
||
13 | 13 | |
14 | 14 | class DataSetPager implements DataSetPagerInterface{ |
15 | 15 | |
16 | - public $ds; // datasource |
|
16 | + public $ds; // datasource |
|
17 | 17 | public $pageSize; |
18 | 18 | public $pageNumber; |
19 | 19 | public $rows; |
20 | 20 | public $pager; |
21 | 21 | public $id; |
22 | 22 | |
23 | - // normal page |
|
23 | + // normal page |
|
24 | 24 | public $pageStyle; |
25 | 25 | public $pageClass; |
26 | 26 | |
27 | - // selected page |
|
27 | + // selected page |
|
28 | 28 | public $selPageStyle; |
29 | 29 | public $selPageClass; |
30 | 30 | public $renderRowFnc; |
@@ -34,164 +34,164 @@ discard block |
||
34 | 34 | public static $dataSetPagerCnt; |
35 | 35 | |
36 | 36 | public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
37 | - global $_PAGE; // use view state object |
|
38 | - |
|
39 | - // set id |
|
40 | - self::$dataSetPagerCnt++; |
|
41 | - $this->id = !empty($id) ? $id : "dsp" . self::$dataSetPagerCnt; |
|
42 | - |
|
43 | - // get pagenumber |
|
44 | - // by setting pager to -1 cause pager to load it's last page number |
|
45 | - if($pageNumber == -1) { |
|
46 | - $pageNumber = 1; |
|
47 | - if(isset($_GET["dpgn" . $this->id])) { |
|
48 | - $pageNumber = $_GET["dpgn" . $this->id]; |
|
49 | - } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) { |
|
50 | - $pageNumber = $_PAGE['vs'][$id . '_dpgn']; |
|
51 | - } |
|
52 | - } |
|
53 | - if(!is_numeric($pageNumber)) { |
|
54 | - $pageNumber = 1; |
|
55 | - } |
|
56 | - |
|
57 | - $this->ds = $ds; // datasource |
|
58 | - $this->pageSize = $pageSize; |
|
59 | - $this->pageNumber = $pageNumber; |
|
60 | - $this->rows = ''; |
|
61 | - $this->pager = ''; |
|
62 | - } |
|
37 | + global $_PAGE; // use view state object |
|
38 | + |
|
39 | + // set id |
|
40 | + self::$dataSetPagerCnt++; |
|
41 | + $this->id = !empty($id) ? $id : "dsp" . self::$dataSetPagerCnt; |
|
42 | + |
|
43 | + // get pagenumber |
|
44 | + // by setting pager to -1 cause pager to load it's last page number |
|
45 | + if($pageNumber == -1) { |
|
46 | + $pageNumber = 1; |
|
47 | + if(isset($_GET["dpgn" . $this->id])) { |
|
48 | + $pageNumber = $_GET["dpgn" . $this->id]; |
|
49 | + } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) { |
|
50 | + $pageNumber = $_PAGE['vs'][$id . '_dpgn']; |
|
51 | + } |
|
52 | + } |
|
53 | + if(!is_numeric($pageNumber)) { |
|
54 | + $pageNumber = 1; |
|
55 | + } |
|
56 | + |
|
57 | + $this->ds = $ds; // datasource |
|
58 | + $this->pageSize = $pageSize; |
|
59 | + $this->pageNumber = $pageNumber; |
|
60 | + $this->rows = ''; |
|
61 | + $this->pager = ''; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | public function getRenderedPager() { |
65 | - return $this->pager; |
|
66 | - } |
|
65 | + return $this->pager; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | public function getRenderedRows() { |
69 | - return $this->rows; |
|
70 | - } |
|
69 | + return $this->rows; |
|
70 | + } |
|
71 | 71 | |
72 | 72 | public function setDataSource($ds) { |
73 | - $this->ds = $ds; |
|
74 | - } |
|
73 | + $this->ds = $ds; |
|
74 | + } |
|
75 | 75 | |
76 | 76 | public function setPageSize($ps) { |
77 | - $this->pageSize = $ps; |
|
78 | - } |
|
77 | + $this->pageSize = $ps; |
|
78 | + } |
|
79 | 79 | |
80 | 80 | public function setRenderRowFnc($fncName, $args = "") { |
81 | - $this->renderRowFnc = &$fncName; |
|
82 | - $this->renderRowFncArgs = $args; // extra agruments |
|
81 | + $this->renderRowFnc = &$fncName; |
|
82 | + $this->renderRowFncArgs = $args; // extra agruments |
|
83 | 83 | |
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | public function setRenderPagerFnc($fncName, $args = "") { |
88 | - $this->renderPagerFnc = $fncName; |
|
89 | - $this->renderPagerFncArgs = $args; // extra agruments |
|
90 | - } |
|
88 | + $this->renderPagerFnc = $fncName; |
|
89 | + $this->renderPagerFncArgs = $args; // extra agruments |
|
90 | + } |
|
91 | 91 | |
92 | 92 | public function render() { |
93 | - $modx = evolutionCMS(); global $_PAGE; |
|
94 | - |
|
95 | - $isDataset = $modx->getDatabase()->isResult($this->ds); |
|
96 | - |
|
97 | - if(!$this->selPageStyle) { |
|
98 | - $this->selPageStyle = "font-weight:bold"; |
|
99 | - } |
|
100 | - |
|
101 | - // get total number of rows |
|
102 | - $tnr = ($isDataset) ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds); |
|
103 | - |
|
104 | - // render: no records found |
|
105 | - if($tnr <= 0) { |
|
106 | - $fnc = $this->renderRowFnc; |
|
107 | - $args = $this->renderRowFncArgs; |
|
108 | - if(isset($fnc)) { |
|
109 | - if($args != "") { |
|
110 | - $this->rows .= $fnc(0, null, $args); |
|
111 | - } // if agrs was specified then we will pass three params |
|
112 | - else { |
|
113 | - $this->rows .= $fnc(0, null); |
|
114 | - } // otherwise two will be passed |
|
115 | - } |
|
116 | - return; |
|
117 | - } |
|
118 | - |
|
119 | - // get total pages |
|
120 | - $tp = ceil($tnr / $this->pageSize); |
|
121 | - if($this->pageNumber > $tp) { |
|
122 | - $this->pageNumber = 1; |
|
123 | - } |
|
124 | - |
|
125 | - // get page number |
|
126 | - $p = $this->pageNumber; |
|
127 | - |
|
128 | - // save page number to view state if available |
|
129 | - if(isset($_PAGE['vs'])) { |
|
130 | - $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
131 | - } |
|
132 | - |
|
133 | - // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
|
134 | - if($tp > 1) { |
|
135 | - $url = ''; |
|
136 | - $fnc = $this->renderPagerFnc; |
|
137 | - $args = $this->renderPagerFncArgs; |
|
138 | - if(!isset($fnc)) { |
|
139 | - if($modx->isFrontend()) { |
|
140 | - $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
141 | - } else { |
|
142 | - $url = $_SERVER['PHP_SELF'] . '?'; |
|
143 | - } |
|
144 | - $i = 0; |
|
145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
146 | - $i++; |
|
147 | - $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
148 | - } |
|
149 | - if($i >= 1) { |
|
150 | - $url .= "&"; |
|
151 | - } |
|
152 | - } |
|
153 | - for($i = 1; $i <= $tp; $i++) { |
|
154 | - if(isset($fnc)) { |
|
155 | - if($args != "") { |
|
156 | - $this->pager .= $fnc($p, $i, $args); |
|
157 | - } else { |
|
158 | - $this->pager .= $fnc($p, $i); |
|
159 | - } |
|
160 | - } else { |
|
161 | - $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> "; |
|
162 | - } |
|
163 | - } |
|
164 | - } |
|
165 | - |
|
166 | - // render row : renderRowFnc($rowNumber,$row,$arguments="") |
|
167 | - $fnc = $this->renderRowFnc; |
|
168 | - $args = $this->renderRowFncArgs; |
|
169 | - |
|
170 | - if(isset($fnc)) { |
|
171 | - $i = 1; |
|
172 | - $fncObject = is_object($fnc); |
|
173 | - $minitems = (($p - 1) * $this->pageSize) + 1; |
|
174 | - $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
|
175 | - while($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) { |
|
176 | - if($i >= $minitems && $i <= $maxitems) { |
|
177 | - if($fncObject) { |
|
178 | - if($args != "") { |
|
179 | - $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
|
180 | - } else { |
|
181 | - $this->rows .= $fnc->RenderRowFnc($i, $row); |
|
182 | - } |
|
183 | - } else { |
|
184 | - if($args != "") { |
|
185 | - $this->rows .= $fnc($i, $row, $args); |
|
186 | - } // if agrs was specified then we wil pass three params |
|
187 | - else { |
|
188 | - $this->rows .= $fnc($i, $row); |
|
189 | - } // otherwise two will be passed |
|
190 | - } |
|
191 | - |
|
192 | - } |
|
193 | - $i++; |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
93 | + $modx = evolutionCMS(); global $_PAGE; |
|
94 | + |
|
95 | + $isDataset = $modx->getDatabase()->isResult($this->ds); |
|
96 | + |
|
97 | + if(!$this->selPageStyle) { |
|
98 | + $this->selPageStyle = "font-weight:bold"; |
|
99 | + } |
|
100 | + |
|
101 | + // get total number of rows |
|
102 | + $tnr = ($isDataset) ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds); |
|
103 | + |
|
104 | + // render: no records found |
|
105 | + if($tnr <= 0) { |
|
106 | + $fnc = $this->renderRowFnc; |
|
107 | + $args = $this->renderRowFncArgs; |
|
108 | + if(isset($fnc)) { |
|
109 | + if($args != "") { |
|
110 | + $this->rows .= $fnc(0, null, $args); |
|
111 | + } // if agrs was specified then we will pass three params |
|
112 | + else { |
|
113 | + $this->rows .= $fnc(0, null); |
|
114 | + } // otherwise two will be passed |
|
115 | + } |
|
116 | + return; |
|
117 | + } |
|
118 | + |
|
119 | + // get total pages |
|
120 | + $tp = ceil($tnr / $this->pageSize); |
|
121 | + if($this->pageNumber > $tp) { |
|
122 | + $this->pageNumber = 1; |
|
123 | + } |
|
124 | + |
|
125 | + // get page number |
|
126 | + $p = $this->pageNumber; |
|
127 | + |
|
128 | + // save page number to view state if available |
|
129 | + if(isset($_PAGE['vs'])) { |
|
130 | + $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
131 | + } |
|
132 | + |
|
133 | + // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
|
134 | + if($tp > 1) { |
|
135 | + $url = ''; |
|
136 | + $fnc = $this->renderPagerFnc; |
|
137 | + $args = $this->renderPagerFncArgs; |
|
138 | + if(!isset($fnc)) { |
|
139 | + if($modx->isFrontend()) { |
|
140 | + $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
141 | + } else { |
|
142 | + $url = $_SERVER['PHP_SELF'] . '?'; |
|
143 | + } |
|
144 | + $i = 0; |
|
145 | + foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
146 | + $i++; |
|
147 | + $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
148 | + } |
|
149 | + if($i >= 1) { |
|
150 | + $url .= "&"; |
|
151 | + } |
|
152 | + } |
|
153 | + for($i = 1; $i <= $tp; $i++) { |
|
154 | + if(isset($fnc)) { |
|
155 | + if($args != "") { |
|
156 | + $this->pager .= $fnc($p, $i, $args); |
|
157 | + } else { |
|
158 | + $this->pager .= $fnc($p, $i); |
|
159 | + } |
|
160 | + } else { |
|
161 | + $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> "; |
|
162 | + } |
|
163 | + } |
|
164 | + } |
|
165 | + |
|
166 | + // render row : renderRowFnc($rowNumber,$row,$arguments="") |
|
167 | + $fnc = $this->renderRowFnc; |
|
168 | + $args = $this->renderRowFncArgs; |
|
169 | + |
|
170 | + if(isset($fnc)) { |
|
171 | + $i = 1; |
|
172 | + $fncObject = is_object($fnc); |
|
173 | + $minitems = (($p - 1) * $this->pageSize) + 1; |
|
174 | + $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
|
175 | + while($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) { |
|
176 | + if($i >= $minitems && $i <= $maxitems) { |
|
177 | + if($fncObject) { |
|
178 | + if($args != "") { |
|
179 | + $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
|
180 | + } else { |
|
181 | + $this->rows .= $fnc->RenderRowFnc($i, $row); |
|
182 | + } |
|
183 | + } else { |
|
184 | + if($args != "") { |
|
185 | + $this->rows .= $fnc($i, $row, $args); |
|
186 | + } // if agrs was specified then we wil pass three params |
|
187 | + else { |
|
188 | + $this->rows .= $fnc($i, $row); |
|
189 | + } // otherwise two will be passed |
|
190 | + } |
|
191 | + |
|
192 | + } |
|
193 | + $i++; |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | 197 | } |
@@ -33,24 +33,24 @@ discard block |
||
33 | 33 | public $renderPagerFncArgs; |
34 | 34 | public static $dataSetPagerCnt; |
35 | 35 | |
36 | - public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
36 | + public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1){ |
|
37 | 37 | global $_PAGE; // use view state object |
38 | 38 | |
39 | 39 | // set id |
40 | 40 | self::$dataSetPagerCnt++; |
41 | - $this->id = !empty($id) ? $id : "dsp" . self::$dataSetPagerCnt; |
|
41 | + $this->id = !empty($id) ? $id : "dsp".self::$dataSetPagerCnt; |
|
42 | 42 | |
43 | 43 | // get pagenumber |
44 | 44 | // by setting pager to -1 cause pager to load it's last page number |
45 | - if($pageNumber == -1) { |
|
45 | + if ($pageNumber == -1) { |
|
46 | 46 | $pageNumber = 1; |
47 | - if(isset($_GET["dpgn" . $this->id])) { |
|
48 | - $pageNumber = $_GET["dpgn" . $this->id]; |
|
49 | - } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) { |
|
50 | - $pageNumber = $_PAGE['vs'][$id . '_dpgn']; |
|
47 | + if (isset($_GET["dpgn".$this->id])) { |
|
48 | + $pageNumber = $_GET["dpgn".$this->id]; |
|
49 | + } elseif (isset($_PAGE['vs'][$id.'_dpgn'])) { |
|
50 | + $pageNumber = $_PAGE['vs'][$id.'_dpgn']; |
|
51 | 51 | } |
52 | 52 | } |
53 | - if(!is_numeric($pageNumber)) { |
|
53 | + if (!is_numeric($pageNumber)) { |
|
54 | 54 | $pageNumber = 1; |
55 | 55 | } |
56 | 56 | |
@@ -61,40 +61,40 @@ discard block |
||
61 | 61 | $this->pager = ''; |
62 | 62 | } |
63 | 63 | |
64 | - public function getRenderedPager() { |
|
64 | + public function getRenderedPager(){ |
|
65 | 65 | return $this->pager; |
66 | 66 | } |
67 | 67 | |
68 | - public function getRenderedRows() { |
|
68 | + public function getRenderedRows(){ |
|
69 | 69 | return $this->rows; |
70 | 70 | } |
71 | 71 | |
72 | - public function setDataSource($ds) { |
|
72 | + public function setDataSource($ds){ |
|
73 | 73 | $this->ds = $ds; |
74 | 74 | } |
75 | 75 | |
76 | - public function setPageSize($ps) { |
|
76 | + public function setPageSize($ps){ |
|
77 | 77 | $this->pageSize = $ps; |
78 | 78 | } |
79 | 79 | |
80 | - public function setRenderRowFnc($fncName, $args = "") { |
|
80 | + public function setRenderRowFnc($fncName, $args = ""){ |
|
81 | 81 | $this->renderRowFnc = &$fncName; |
82 | - $this->renderRowFncArgs = $args; // extra agruments |
|
82 | + $this->renderRowFncArgs = $args; // extra agruments |
|
83 | 83 | |
84 | 84 | |
85 | 85 | } |
86 | 86 | |
87 | - public function setRenderPagerFnc($fncName, $args = "") { |
|
87 | + public function setRenderPagerFnc($fncName, $args = ""){ |
|
88 | 88 | $this->renderPagerFnc = $fncName; |
89 | - $this->renderPagerFncArgs = $args; // extra agruments |
|
89 | + $this->renderPagerFncArgs = $args; // extra agruments |
|
90 | 90 | } |
91 | 91 | |
92 | - public function render() { |
|
92 | + public function render(){ |
|
93 | 93 | $modx = evolutionCMS(); global $_PAGE; |
94 | 94 | |
95 | 95 | $isDataset = $modx->getDatabase()->isResult($this->ds); |
96 | 96 | |
97 | - if(!$this->selPageStyle) { |
|
97 | + if (!$this->selPageStyle) { |
|
98 | 98 | $this->selPageStyle = "font-weight:bold"; |
99 | 99 | } |
100 | 100 | |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | $tnr = ($isDataset) ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds); |
103 | 103 | |
104 | 104 | // render: no records found |
105 | - if($tnr <= 0) { |
|
105 | + if ($tnr <= 0) { |
|
106 | 106 | $fnc = $this->renderRowFnc; |
107 | 107 | $args = $this->renderRowFncArgs; |
108 | - if(isset($fnc)) { |
|
109 | - if($args != "") { |
|
108 | + if (isset($fnc)) { |
|
109 | + if ($args != "") { |
|
110 | 110 | $this->rows .= $fnc(0, null, $args); |
111 | 111 | } // if agrs was specified then we will pass three params |
112 | 112 | else { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | // get total pages |
120 | 120 | $tp = ceil($tnr / $this->pageSize); |
121 | - if($this->pageNumber > $tp) { |
|
121 | + if ($this->pageNumber > $tp) { |
|
122 | 122 | $this->pageNumber = 1; |
123 | 123 | } |
124 | 124 | |
@@ -126,39 +126,39 @@ discard block |
||
126 | 126 | $p = $this->pageNumber; |
127 | 127 | |
128 | 128 | // save page number to view state if available |
129 | - if(isset($_PAGE['vs'])) { |
|
130 | - $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
129 | + if (isset($_PAGE['vs'])) { |
|
130 | + $_PAGE['vs'][$this->id.'_dpgn'] = $p; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
134 | - if($tp > 1) { |
|
134 | + if ($tp > 1) { |
|
135 | 135 | $url = ''; |
136 | 136 | $fnc = $this->renderPagerFnc; |
137 | 137 | $args = $this->renderPagerFncArgs; |
138 | - if(!isset($fnc)) { |
|
139 | - if($modx->isFrontend()) { |
|
140 | - $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
138 | + if (!isset($fnc)) { |
|
139 | + if ($modx->isFrontend()) { |
|
140 | + $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full').'?'; |
|
141 | 141 | } else { |
142 | - $url = $_SERVER['PHP_SELF'] . '?'; |
|
142 | + $url = $_SERVER['PHP_SELF'].'?'; |
|
143 | 143 | } |
144 | 144 | $i = 0; |
145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
145 | + foreach ($_GET as $n => $v) if ($n != 'dpgn'.$this->id) { |
|
146 | 146 | $i++; |
147 | - $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
147 | + $url .= (($i > 1) ? "&" : "")."$n=$v"; |
|
148 | 148 | } |
149 | - if($i >= 1) { |
|
149 | + if ($i >= 1) { |
|
150 | 150 | $url .= "&"; |
151 | 151 | } |
152 | 152 | } |
153 | - for($i = 1; $i <= $tp; $i++) { |
|
154 | - if(isset($fnc)) { |
|
155 | - if($args != "") { |
|
153 | + for ($i = 1; $i <= $tp; $i++) { |
|
154 | + if (isset($fnc)) { |
|
155 | + if ($args != "") { |
|
156 | 156 | $this->pager .= $fnc($p, $i, $args); |
157 | 157 | } else { |
158 | 158 | $this->pager .= $fnc($p, $i); |
159 | 159 | } |
160 | 160 | } else { |
161 | - $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> "; |
|
161 | + $this->pager .= ($p == $i) ? " <span class='".$this->selPageClass."' style='".$this->selPageStyle."'>$i</span> " : " <a href='".$url."dpgn".$this->id."=$i' class='".$this->pageClass."' style='".$this->pageStyle."'>$i</a> "; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | $fnc = $this->renderRowFnc; |
168 | 168 | $args = $this->renderRowFncArgs; |
169 | 169 | |
170 | - if(isset($fnc)) { |
|
170 | + if (isset($fnc)) { |
|
171 | 171 | $i = 1; |
172 | 172 | $fncObject = is_object($fnc); |
173 | 173 | $minitems = (($p - 1) * $this->pageSize) + 1; |
174 | 174 | $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
175 | - while($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) { |
|
176 | - if($i >= $minitems && $i <= $maxitems) { |
|
177 | - if($fncObject) { |
|
178 | - if($args != "") { |
|
175 | + while ($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) { |
|
176 | + if ($i >= $minitems && $i <= $maxitems) { |
|
177 | + if ($fncObject) { |
|
178 | + if ($args != "") { |
|
179 | 179 | $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
180 | 180 | } else { |
181 | 181 | $this->rows .= $fnc->RenderRowFnc($i, $row); |
182 | 182 | } |
183 | 183 | } else { |
184 | - if($args != "") { |
|
184 | + if ($args != "") { |
|
185 | 185 | $this->rows .= $fnc($i, $row, $args); |
186 | 186 | } // if agrs was specified then we wil pass three params |
187 | 187 | else { |
@@ -11,7 +11,8 @@ discard block |
||
11 | 11 | # ----------------------------------------- |
12 | 12 | # |
13 | 13 | |
14 | -class DataSetPager implements DataSetPagerInterface{ |
|
14 | +class DataSetPager implements DataSetPagerInterface |
|
15 | +{ |
|
15 | 16 | |
16 | 17 | public $ds; // datasource |
17 | 18 | public $pageSize; |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | public $renderPagerFncArgs; |
34 | 35 | public static $dataSetPagerCnt; |
35 | 36 | |
36 | - public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
37 | + public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) |
|
38 | + { |
|
37 | 39 | global $_PAGE; // use view state object |
38 | 40 | |
39 | 41 | // set id |
@@ -61,35 +63,42 @@ discard block |
||
61 | 63 | $this->pager = ''; |
62 | 64 | } |
63 | 65 | |
64 | - public function getRenderedPager() { |
|
66 | + public function getRenderedPager() |
|
67 | + { |
|
65 | 68 | return $this->pager; |
66 | 69 | } |
67 | 70 | |
68 | - public function getRenderedRows() { |
|
71 | + public function getRenderedRows() |
|
72 | + { |
|
69 | 73 | return $this->rows; |
70 | 74 | } |
71 | 75 | |
72 | - public function setDataSource($ds) { |
|
76 | + public function setDataSource($ds) |
|
77 | + { |
|
73 | 78 | $this->ds = $ds; |
74 | 79 | } |
75 | 80 | |
76 | - public function setPageSize($ps) { |
|
81 | + public function setPageSize($ps) |
|
82 | + { |
|
77 | 83 | $this->pageSize = $ps; |
78 | 84 | } |
79 | 85 | |
80 | - public function setRenderRowFnc($fncName, $args = "") { |
|
86 | + public function setRenderRowFnc($fncName, $args = "") |
|
87 | + { |
|
81 | 88 | $this->renderRowFnc = &$fncName; |
82 | 89 | $this->renderRowFncArgs = $args; // extra agruments |
83 | 90 | |
84 | 91 | |
85 | 92 | } |
86 | 93 | |
87 | - public function setRenderPagerFnc($fncName, $args = "") { |
|
94 | + public function setRenderPagerFnc($fncName, $args = "") |
|
95 | + { |
|
88 | 96 | $this->renderPagerFnc = $fncName; |
89 | 97 | $this->renderPagerFncArgs = $args; // extra agruments |
90 | 98 | } |
91 | 99 | |
92 | - public function render() { |
|
100 | + public function render() |
|
101 | + { |
|
93 | 102 | $modx = evolutionCMS(); global $_PAGE; |
94 | 103 | |
95 | 104 | $isDataset = $modx->getDatabase()->isResult($this->ds); |
@@ -142,8 +151,10 @@ discard block |
||
142 | 151 | $url = $_SERVER['PHP_SELF'] . '?'; |
143 | 152 | } |
144 | 153 | $i = 0; |
145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
154 | + foreach($_GET as $n => $v) { |
|
155 | + if($n != 'dpgn' . $this->id) { |
|
146 | 156 | $i++; |
157 | + } |
|
147 | 158 | $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
148 | 159 | } |
149 | 160 | if($i >= 1) { |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | * EVO Installer |
4 | 4 | */ |
5 | 5 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); |
6 | -$base_path = dirname(__DIR__) . '/'; |
|
6 | +$base_path = dirname(__DIR__).'/'; |
|
7 | 7 | |
8 | -if (is_file($base_path . 'assets/cache/siteManager.php')) { |
|
9 | - include_once $base_path . 'assets/cache/siteManager.php'; |
|
8 | +if (is_file($base_path.'assets/cache/siteManager.php')) { |
|
9 | + include_once $base_path.'assets/cache/siteManager.php'; |
|
10 | 10 | } |
11 | -if (! defined('MGR_DIR')) { |
|
12 | - if (is_dir($base_path . 'manager')) { |
|
11 | +if (!defined('MGR_DIR')) { |
|
12 | + if (is_dir($base_path.'manager')) { |
|
13 | 13 | define('MGR_DIR', 'manager'); |
14 | 14 | } else { |
15 | 15 | die('MGR_DIR is not defined'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | require_once 'src/functions.php'; |
20 | 20 | |
21 | 21 | if (empty($_GET['self'])) { |
22 | - require_once '../' . MGR_DIR . '/includes/version.inc.php'; |
|
22 | + require_once '../'.MGR_DIR.'/includes/version.inc.php'; |
|
23 | 23 | |
24 | 24 | // start session |
25 | 25 | session_start(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | install_sessionCheck(); |
28 | 28 | |
29 | 29 | $moduleName = 'EVO'; |
30 | - $moduleVersion = $modx_branch . ' ' . $modx_version; |
|
30 | + $moduleVersion = $modx_branch.' '.$modx_version; |
|
31 | 31 | $moduleRelease = $modx_release_date; |
32 | 32 | $moduleSQLBaseFile = 'stubs/sql/setup.sql'; |
33 | 33 | $moduleSQLDataFile = 'stubs/sql/setup.data.sql'; |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | $action = isset($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'language'; |
69 | 69 | str_replace('.', '', $action); |
70 | 70 | |
71 | - $controller = 'src/controllers/' . $action . '.php'; |
|
72 | - if (! file_exists($controller)) { |
|
71 | + $controller = 'src/controllers/'.$action.'.php'; |
|
72 | + if (!file_exists($controller)) { |
|
73 | 73 | die("Invalid install action attempted. [action={$action}]"); |
74 | 74 | } |
75 | 75 | require $controller; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | } else { |
82 | 82 | $action = isset($_GET['action']) && is_scalar($_GET['action']) ? trim($_GET['action']) : 'language'; |
83 | 83 | str_replace('.', '', $action); |
84 | - $controller = 'src/controllers/' . $action . '.php'; |
|
85 | - if (! file_exists($controller)) { |
|
84 | + $controller = 'src/controllers/'.$action.'.php'; |
|
85 | + if (!file_exists($controller)) { |
|
86 | 86 | die("Invalid install action attempted. [action={$action}]"); |
87 | 87 | } |
88 | 88 | require $controller; |
@@ -20,14 +20,14 @@ |
||
20 | 20 | ($docid > 0 ? "id='$docid'" : "privatemgr = 1")); |
21 | 21 | $rs = $modx->getDatabase()->select( |
22 | 22 | 'DISTINCT sc.id', |
23 | - $modx->getFullTableName("site_content") . " sc |
|
24 | - LEFT JOIN " . $modx->getFullTableName("document_groups") . " dg ON dg.document = sc.id |
|
25 | - LEFT JOIN " . $modx->getFullTableName("membergroup_access") . " mga ON mga.documentgroup = dg.document_group", |
|
26 | - ($docid > 0 ? " sc.id='{$docid}' AND " : "") . "mga.id>0" |
|
23 | + $modx->getFullTableName("site_content")." sc |
|
24 | + LEFT JOIN " . $modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
|
25 | + LEFT JOIN " . $modx->getFullTableName("membergroup_access")." mga ON mga.documentgroup = dg.document_group", |
|
26 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."mga.id>0" |
|
27 | 27 | ); |
28 | 28 | $ids = $modx->getDatabase()->getColumn("id", $rs); |
29 | 29 | if (count($ids) > 0) { |
30 | 30 | $modx->getDatabase()->update('privatemgr = 1', $modx->getFullTableName("site_content"), |
31 | - "id IN (" . implode(", ", $ids) . ")"); |
|
31 | + "id IN (".implode(", ", $ids).")"); |
|
32 | 32 | } |
33 | 33 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | if (!empty($user_id)) { |
15 | 15 | // Raymond: grab the user settings from the database. |
16 | 16 | $rs = $modx->getDatabase()->select('setting_name, setting_value', $modx->getFullTableName('user_settings'), |
17 | - "user=" . $modx->getLoginUserID()); |
|
17 | + "user=".$modx->getLoginUserID()); |
|
18 | 18 | |
19 | 19 | $which_browser_default = $which_browser; |
20 | 20 | while ($row = $modx->getDatabase()->getRow($rs)) { |
@@ -20,14 +20,14 @@ |
||
20 | 20 | ($docid > 0 ? "id='$docid'" : "privateweb = 1")); |
21 | 21 | $rs = $modx->getDatabase()->select( |
22 | 22 | 'DISTINCT sc.id', |
23 | - $modx->getFullTableName("site_content") . " sc |
|
24 | - LEFT JOIN " . $modx->getFullTableName("document_groups") . " dg ON dg.document = sc.id |
|
25 | - LEFT JOIN " . $modx->getFullTableName("webgroup_access") . " wga ON wga.documentgroup = dg.document_group", |
|
26 | - ($docid > 0 ? " sc.id='{$docid}' AND " : "") . "wga.id>0" |
|
23 | + $modx->getFullTableName("site_content")." sc |
|
24 | + LEFT JOIN " . $modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
|
25 | + LEFT JOIN " . $modx->getFullTableName("webgroup_access")." wga ON wga.documentgroup = dg.document_group", |
|
26 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."wga.id>0" |
|
27 | 27 | ); |
28 | 28 | $ids = $modx->getDatabase()->getColumn("id", $rs); |
29 | 29 | if (count($ids) > 0) { |
30 | 30 | $modx->getDatabase()->update('privateweb = 1', $modx->getFullTableName("site_content"), |
31 | - "id IN (" . implode(", ", $ids) . ")"); |
|
31 | + "id IN (".implode(", ", $ids).")"); |
|
32 | 32 | } |
33 | 33 | } |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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 | global $SystemAlertMsgQueque; |
6 | 6 | // display system alert window if messages are available |
7 | 7 | if(count($SystemAlertMsgQueque) > 0) { |
8 | - include "sysalert.display.inc.php"; |
|
8 | + include "sysalert.display.inc.php"; |
|
9 | 9 | } |
10 | 10 | ?> |
11 | 11 | <script type='text/javascript'> |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | </script> |
20 | 20 | <?php |
21 | 21 | if(in_array($modx->getManagerApi()->action, array( |
22 | - 85, |
|
23 | - 27, |
|
24 | - 4, |
|
25 | - 72, |
|
26 | - 13, |
|
27 | - 11, |
|
28 | - 12, |
|
29 | - 87, |
|
30 | - 88 |
|
22 | + 85, |
|
23 | + 27, |
|
24 | + 4, |
|
25 | + 72, |
|
26 | + 13, |
|
27 | + 11, |
|
28 | + 12, |
|
29 | + 87, |
|
30 | + 88 |
|
31 | 31 | ))) { |
32 | - echo $modx->getManagerApi()->loadDatePicker($modx->config['mgr_date_picker_path']); |
|
32 | + echo $modx->getManagerApi()->loadDatePicker($modx->config['mgr_date_picker_path']); |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | </body> |
@@ -1,10 +1,10 @@ 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 | global $SystemAlertMsgQueque; |
6 | 6 | // display system alert window if messages are available |
7 | -if(count($SystemAlertMsgQueque) > 0) { |
|
7 | +if (count($SystemAlertMsgQueque) > 0) { |
|
8 | 8 | include "sysalert.display.inc.php"; |
9 | 9 | } |
10 | 10 | ?> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | }); |
19 | 19 | </script> |
20 | 20 | <?php |
21 | -if(in_array($modx->getManagerApi()->action, array( |
|
21 | +if (in_array($modx->getManagerApi()->action, array( |
|
22 | 22 | 85, |
23 | 23 | 27, |
24 | 24 | 4, |