@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php namespace Helpers; |
2 | 2 | |
3 | -include_once(MODX_BASE_PATH . 'assets/snippets/phpthumb/phpthumb.class.php'); |
|
4 | -require_once(MODX_BASE_PATH . 'assets/lib/Helpers/FS.php'); |
|
3 | +include_once(MODX_BASE_PATH.'assets/snippets/phpthumb/phpthumb.class.php'); |
|
4 | +require_once(MODX_BASE_PATH.'assets/lib/Helpers/FS.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Class PHPThumb |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->thumb->sourceFilename = $inputFile; |
45 | 45 | $ext = explode('.', $inputFile); |
46 | 46 | $ext = str_replace('jpeg', 'jpg', strtolower(array_pop($ext))); |
47 | - $options = 'f=' . $ext . '&' . $options; |
|
47 | + $options = 'f='.$ext.'&'.$options; |
|
48 | 48 | $this->setOptions($options); |
49 | 49 | if ($this->thumb->GenerateThumbnail() && $this->thumb->RenderToFile($outputFile)) { |
50 | 50 | return true; |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | case 'jpg': |
65 | 65 | $ext = $this->fs->takeFileExt($file); |
66 | 66 | if ($ext == 'jpeg' || $ext == 'jpg') { |
67 | - $cmd = '/usr/bin/jpegtran -optimize -progressive -copy none -outfile ' . escapeshellarg($file . '_') . ' ' . escapeshellarg($file); |
|
67 | + $cmd = '/usr/bin/jpegtran -optimize -progressive -copy none -outfile '.escapeshellarg($file.'_').' '.escapeshellarg($file); |
|
68 | 68 | exec($cmd, $result, $return_var); |
69 | - if ($this->fs->fileSize($file) > $this->fs->fileSize($file . '_')) { |
|
70 | - $this->fs->moveFile($file . '_', $file); |
|
69 | + if ($this->fs->fileSize($file) > $this->fs->fileSize($file.'_')) { |
|
70 | + $this->fs->moveFile($file.'_', $file); |
|
71 | 71 | } else { |
72 | - $this->fs->unlink($file . '_'); |
|
72 | + $this->fs->unlink($file.'_'); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | break; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -include_once(MODX_BASE_PATH . "assets/lib/Helpers/Collection.php"); |
|
2 | +include_once(MODX_BASE_PATH."assets/lib/Helpers/Collection.php"); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class DLCollection |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $index = $this->modx->db->getValue($rows); |
62 | 62 | $index = $index - 1; |
63 | 63 | $this->query("SET @index := " . $index); |
64 | - $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->indexName}`>{$index} AND `{$this->rfName}`={$rid} AND `{$this->pkName}` NOT IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
64 | + $this->query("update {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->indexName}`>{$index} AND `{$this->rfName}`={$rid} AND `{$this->pkName}` NOT IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
65 | 65 | $out = $this->modx->db->getAffectedRows(); |
66 | 66 | |
67 | 67 | return $out; |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | $ids = implode(',', $ids); |
97 | 97 | if ($dir == 'top') { |
98 | 98 | $this->query("SET @index := " . ($index - $cnt - 1)); |
99 | - $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
99 | + $this->query("update {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
100 | 100 | $this->query("SET @index := -1"); |
101 | 101 | } else { |
102 | 102 | $this->query("SET @index := -1"); |
103 | - $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
103 | + $this->query("update {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
104 | 104 | $this->query("SET @index := " . ($cnt - 1)); |
105 | 105 | } |
106 | - $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` NOT IN ({$ids})) AND `{$this->rfName}` = {$rid} ORDER BY `{$this->indexName}` ASC"); |
|
106 | + $this->query("update {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` NOT IN ({$ids})) AND `{$this->rfName}` = {$rid} ORDER BY `{$this->indexName}` ASC"); |
|
107 | 107 | $out = $this->modx->db->getAffectedRows(); |
108 | 108 | |
109 | 109 | return $out; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php namespace SimpleTab; |
2 | 2 | |
3 | -require_once(MODX_BASE_PATH . 'assets/lib/MODxAPI/autoTable.abstract.php'); |
|
4 | -require_once(MODX_BASE_PATH . 'assets/lib/Helpers/FS.php'); |
|
5 | -require_once(MODX_BASE_PATH . 'assets/lib/Helpers/PHPThumb.php'); |
|
3 | +require_once(MODX_BASE_PATH.'assets/lib/MODxAPI/autoTable.abstract.php'); |
|
4 | +require_once(MODX_BASE_PATH.'assets/lib/Helpers/FS.php'); |
|
5 | +require_once(MODX_BASE_PATH.'assets/lib/Helpers/PHPThumb.php'); |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Class dataTable |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $rows = $this->query("SELECT MIN(`{$this->indexName}`) FROM {$table} WHERE `{$this->pkName}` IN ({$ids})"); |
60 | 60 | $index = $this->modx->db->getValue($rows); |
61 | 61 | $index = $index - 1; |
62 | - $this->query("SET @index := " . $index); |
|
62 | + $this->query("SET @index := ".$index); |
|
63 | 63 | $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->indexName}`>{$index} AND `{$this->rfName}`={$rid} AND `{$this->pkName}` NOT IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
64 | 64 | $out = $this->modx->db->getAffectedRows(); |
65 | 65 | |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | $cnt = count($ids); |
95 | 95 | $ids = implode(',', $ids); |
96 | 96 | if ($dir == 'top') { |
97 | - $this->query("SET @index := " . ($index - $cnt - 1)); |
|
97 | + $this->query("SET @index := ".($index - $cnt - 1)); |
|
98 | 98 | $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
99 | 99 | $this->query("SET @index := -1"); |
100 | 100 | } else { |
101 | 101 | $this->query("SET @index := -1"); |
102 | 102 | $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
103 | - $this->query("SET @index := " . ($cnt - 1)); |
|
103 | + $this->query("SET @index := ".($cnt - 1)); |
|
104 | 104 | } |
105 | 105 | $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` NOT IN ({$ids})) AND `{$this->rfName}` = {$rid} ORDER BY `{$this->indexName}` ASC"); |
106 | 106 | $out = $this->modx->db->getAffectedRows(); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return; |
120 | 120 | } |
121 | 121 | if ($this->fs->checkFile($url)) { |
122 | - unlink(MODX_BASE_PATH . $url); |
|
122 | + unlink(MODX_BASE_PATH.$url); |
|
123 | 123 | } |
124 | 124 | $dir = $this->fs->takeFileDir($url); |
125 | 125 | $iterator = new \FilesystemIterator($dir); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return; |
131 | 131 | } |
132 | 132 | $thumbsCache = \APIhelpers::getkey($this->params, 'thumbsCache', $this->thumbsCache); |
133 | - $thumb = $thumbsCache . $url; |
|
133 | + $thumb = $thumbsCache.$url; |
|
134 | 134 | if ($this->fs->checkFile($thumb)) { |
135 | 135 | $this->deleteThumb($thumb, true); |
136 | 136 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $filename = $this->fs->takeFileName($name); |
184 | 184 | $ext = $this->fs->takeFileExt($name); |
185 | 185 | |
186 | - return $this->modx->stripAlias($filename) . '.' . $ext; |
|
186 | + return $this->modx->stripAlias($filename).'.'.$ext; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -196,12 +196,12 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function reorder($source, $target, $point, $rid, $orderDir) |
198 | 198 | { |
199 | - $rid = (int)$rid; |
|
199 | + $rid = (int) $rid; |
|
200 | 200 | $point = strtolower($point); |
201 | 201 | $orderDir = strtolower($orderDir); |
202 | - $sourceIndex = (int)$source[$this->indexName]; |
|
203 | - $targetIndex = (int)$target[$this->indexName]; |
|
204 | - $sourceId = (int)$source[$this->pkName]; |
|
202 | + $sourceIndex = (int) $source[$this->indexName]; |
|
203 | + $targetIndex = (int) $target[$this->indexName]; |
|
204 | + $sourceId = (int) $source[$this->pkName]; |
|
205 | 205 | $table = $this->makeTable($this->table); |
206 | 206 | $rows = 0; |
207 | 207 | /* more refactoring needed */ |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | return false; |
271 | 271 | } |
272 | 272 | $thumb = new \Helpers\PHPThumb(); |
273 | - $inputFile = MODX_BASE_PATH . $this->fs->relativePath($url); |
|
274 | - $outputFile = MODX_BASE_PATH . $this->fs->relativePath($folder) . '/' . $this->fs->relativePath($url); |
|
273 | + $inputFile = MODX_BASE_PATH.$this->fs->relativePath($url); |
|
274 | + $outputFile = MODX_BASE_PATH.$this->fs->relativePath($folder).'/'.$this->fs->relativePath($url); |
|
275 | 275 | $dir = $this->fs->takeFileDir($outputFile); |
276 | 276 | $this->fs->makeDir($dir, $this->modx->config['new_folder_permissions']); |
277 | 277 | if ($thumb->create($inputFile, $outputFile, $options)) { |
@@ -89,10 +89,10 @@ |
||
89 | 89 | } |
90 | 90 | if (!empty($this->set)) { |
91 | 91 | if ($this->newDoc) { |
92 | - $SQL = "INSERT {$this->ignoreError} INTO {$this->makeTable($this->table)} SET " . implode(', ', |
|
92 | + $SQL = "insert {$this->ignoreError} INTO {$this->makeTable($this->table)} SET " . implode(', ', |
|
93 | 93 | $this->set); |
94 | 94 | } else { |
95 | - $SQL = ($this->getID() === null) ? null : "UPDATE {$this->ignoreError} {$this->makeTable($this->table)} SET " . implode(', ', |
|
95 | + $SQL = ($this->getID() === null) ? null : "update {$this->ignoreError} {$this->makeTable($this->table)} SET " . implode(', ', |
|
96 | 96 | $this->set) . " WHERE `" . $this->pkName . "` = " . $this->getID(); |
97 | 97 | } |
98 | 98 | $this->query($SQL); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->close(); |
57 | 57 | $this->markAllEncode(); |
58 | 58 | $this->newDoc = false; |
59 | - $result = $this->query("SELECT * from {$this->makeTable($this->table)} where `" . $this->pkName . "`='" . $this->escape($id) . "'"); |
|
59 | + $result = $this->query("SELECT * from {$this->makeTable($this->table)} where `".$this->pkName."`='".$this->escape($id)."'"); |
|
60 | 60 | $this->fromArray($this->modx->db->getRow($result)); |
61 | 61 | $this->store($this->toArray()); |
62 | 62 | $this->id = $this->eraseField($this->pkName); |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | } |
98 | 98 | if (!empty($this->set)) { |
99 | 99 | if ($this->newDoc) { |
100 | - $SQL = "INSERT {$this->ignoreError} INTO {$this->makeTable($this->table)} SET " . implode(', ', |
|
100 | + $SQL = "INSERT {$this->ignoreError} INTO {$this->makeTable($this->table)} SET ".implode(', ', |
|
101 | 101 | $this->set); |
102 | 102 | } else { |
103 | - $SQL = ($this->getID() === null) ? null : "UPDATE {$this->ignoreError} {$this->makeTable($this->table)} SET " . implode(', ', |
|
104 | - $this->set) . " WHERE `" . $this->pkName . "` = " . $this->getID(); |
|
103 | + $SQL = ($this->getID() === null) ? null : "UPDATE {$this->ignoreError} {$this->makeTable($this->table)} SET ".implode(', ', |
|
104 | + $this->set)." WHERE `".$this->pkName."` = ".$this->getID(); |
|
105 | 105 | } |
106 | 106 | $this->query($SQL); |
107 | 107 | if ($this->newDoc) { |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | if (is_array($_ids) && $_ids != array()) { |
129 | 129 | $id = $this->sanitarIn($_ids); |
130 | 130 | if (!empty($id)) { |
131 | - $this->query("DELETE from {$this->makeTable($this->table)} where `" . $this->pkName . "` IN ({$id})"); |
|
131 | + $this->query("DELETE from {$this->makeTable($this->table)} where `".$this->pkName."` IN ({$id})"); |
|
132 | 132 | } |
133 | 133 | $this->clearCache($fire_events); |
134 | 134 | } else { |
135 | - throw new Exception('Invalid IDs list for delete: <pre>' . print_r($ids, 1) . '</pre>'); |
|
135 | + throw new Exception('Invalid IDs list for delete: <pre>'.print_r($ids, 1).'</pre>'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return $this; |
@@ -80,8 +80,7 @@ |
||
80 | 80 | foreach ($this->jsonFields as $field) { |
81 | 81 | if ($this->get($field) === null |
82 | 82 | && isset($this->default_field[$field]) |
83 | - && is_array($this->default_field[$field])) |
|
84 | - { |
|
83 | + && is_array($this->default_field[$field])) { |
|
85 | 84 | $this->set($field, $this->default_field[$field]); |
86 | 85 | } |
87 | 86 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | $where = sqlHelper::trimLogicalOp($where); |
157 | 157 | |
158 | - $where = "WHERE {$where}"; |
|
158 | + $where = "where {$where}"; |
|
159 | 159 | $whereArr = array(); |
160 | 160 | if (!$this->getCFGDef('showNoPublish', 0)) { |
161 | 161 | $whereArr[] = "c.published=1"; |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | |
237 | 237 | if ($this->getCFGDef('showNoPublish', 0)) { |
238 | 238 | if ($where != '') { |
239 | - $where = "WHERE {$where}"; |
|
239 | + $where = "where {$where}"; |
|
240 | 240 | } else { |
241 | 241 | $where = ''; |
242 | 242 | } |
243 | 243 | } else { |
244 | 244 | if ($where != '') { |
245 | - $where = "WHERE {$where} AND "; |
|
245 | + $where = "where {$where} AND "; |
|
246 | 246 | } else { |
247 | - $where = "WHERE {$where} "; |
|
247 | + $where = "where {$where} "; |
|
248 | 248 | } |
249 | 249 | $where .= "c.published=1"; |
250 | 250 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0)); |
260 | 260 | |
261 | - $rs = $this->dbQuery("SELECT {$fields} FROM {$tbl_site_content} {$where} {$group} {$sort} {$limit}"); |
|
261 | + $rs = $this->dbQuery("select {$fields} FROM {$tbl_site_content} {$where} {$group} {$sort} {$limit}"); |
|
262 | 262 | |
263 | 263 | while ($item = $this->modx->db->getRow($rs)) { |
264 | 264 | $out[$item['id']] = $item; |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | $tbl_site_content = $this->getTable('site_content', 'c'); |
285 | 285 | $sanitarInIDs = $this->sanitarIn($id); |
286 | 286 | if ($this->getCFGDef('showNoPublish', 0)) { |
287 | - $where = "WHERE {$where} c.parent IN ({$sanitarInIDs}"; |
|
287 | + $where = "where {$where} c.parent IN ({$sanitarInIDs}"; |
|
288 | 288 | } else { |
289 | - $where = "WHERE {$where} c.parent IN ({$sanitarInIDs}) AND c.deleted=0 AND c.published=1"; |
|
289 | + $where = "where {$where} c.parent IN ({$sanitarInIDs}) AND c.deleted=0 AND c.published=1"; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | $rs = $this->dbQuery("SELECT id FROM {$tbl_site_content} {$where} AND c.id IN(SELECT DISTINCT s.parent FROM " . $this->getTable('catalog', |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $fields = $this->getCFGDef('selectFields', 'c.*'); |
363 | 363 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
364 | 364 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
365 | - $rs = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " . |
|
365 | + $rs = $this->dbQuery("select {$fields} FROM " . $from . " " . $where . " " . |
|
366 | 366 | $group . " " . |
367 | 367 | $sort . " " . |
368 | 368 | $this->LimitSQL($this->getCFGDef('queryLimit', 0)) |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html |
8 | 8 | * @author Agel_Nash <[email protected]>, kabachello <[email protected]> |
9 | 9 | */ |
10 | -include_once(dirname(__FILE__) . "/site_content.php"); |
|
10 | +include_once(dirname(__FILE__)."/site_content.php"); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Class shopkeeperDocLister |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | if ($this->getCFGDef('contentPlaceholder', 0) !== 0) { |
119 | 119 | $this->toPlaceholders($tmp, 1, |
120 | - "item[" . $i . "]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
120 | + "item[".$i."]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
121 | 121 | } |
122 | 122 | $out .= $tmp; |
123 | 123 | if (next($this->_docs) !== false) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
146 | 146 | $where = $this->getCFGDef('addWhereList', ''); |
147 | 147 | $where = sqlHelper::trimLogicalOp($where); |
148 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
148 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
149 | 149 | if ($where != '' && $this->_filters['where'] != '') { |
150 | 150 | $where .= " AND "; |
151 | 151 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | case 'parents': |
165 | 165 | switch ($this->getCFGDef('showParent', '0')) { |
166 | 166 | case '-1': |
167 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")"; |
|
167 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.")"; |
|
168 | 168 | break; |
169 | 169 | case 0: |
170 | 170 | $tmpWhere = "c.parent IN ({$sanitarInIDs}) AND c.id NOT IN({$sanitarInIDs})"; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | if (($addDocs = $this->getCFGDef('documents', '')) != '') { |
178 | 178 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
179 | - $whereArr[] = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))"; |
|
179 | + $whereArr[] = "((".$tmpWhere.") OR c.id IN({$addDocs}))"; |
|
180 | 180 | } else { |
181 | 181 | $whereArr[] = $tmpWhere; |
182 | 182 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | break; |
187 | 187 | } |
188 | 188 | } |
189 | - $from = $tbl_site_content . " " . $this->_filters['join']; |
|
189 | + $from = $tbl_site_content." ".$this->_filters['join']; |
|
190 | 190 | $where = sqlHelper::trimLogicalOp($where); |
191 | 191 | |
192 | 192 | if (trim($where) != 'WHERE') { |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | $where = $this->getCFGDef('addWhereList', ''); |
222 | 222 | $where = sqlHelper::trimLogicalOp($where); |
223 | 223 | |
224 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
224 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
225 | 225 | $where = sqlHelper::trimLogicalOp($where); |
226 | 226 | |
227 | 227 | $tbl_site_content = $this->getTable('catalog', 'c'); |
228 | 228 | if ($sanitarInIDs != "''") { |
229 | - $where .= ($where ? " AND " : "") . "c.id IN ({$sanitarInIDs}) AND"; |
|
229 | + $where .= ($where ? " AND " : "")."c.id IN ({$sanitarInIDs}) AND"; |
|
230 | 230 | } |
231 | 231 | $where = sqlHelper::trimLogicalOp($where); |
232 | 232 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $fields = $this->getCFGDef('selectFields', 'c.*'); |
250 | 250 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
251 | 251 | $sort = $this->SortOrderSQL("c.createdon"); |
252 | - list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], |
|
252 | + list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content.' '.$this->_filters['join'], |
|
253 | 253 | $sort); |
254 | 254 | |
255 | 255 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0)); |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | $where = "WHERE {$where} c.parent IN ({$sanitarInIDs}) AND c.deleted=0 AND c.published=1"; |
286 | 286 | } |
287 | 287 | |
288 | - $rs = $this->dbQuery("SELECT id FROM {$tbl_site_content} {$where} AND c.id IN(SELECT DISTINCT s.parent FROM " . $this->getTable('catalog', |
|
289 | - 's') . ")"); |
|
288 | + $rs = $this->dbQuery("SELECT id FROM {$tbl_site_content} {$where} AND c.id IN(SELECT DISTINCT s.parent FROM ".$this->getTable('catalog', |
|
289 | + 's').")"); |
|
290 | 290 | |
291 | 291 | while ($item = $this->modx->db->getRow($rs)) { |
292 | 292 | $out[] = $item['id']; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $tbl_site_content = $this->getTable('catalog', 'c'); |
318 | 318 | |
319 | 319 | $sort = $this->SortOrderSQL("c.createdon"); |
320 | - list($from, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], $sort); |
|
320 | + list($from, $sort) = $this->injectSortByTV($tbl_site_content.' '.$this->_filters['join'], $sort); |
|
321 | 321 | $sanitarInIDs = $this->sanitarIn($this->IDs); |
322 | 322 | |
323 | 323 | $tmpWhere = null; |
@@ -325,14 +325,14 @@ discard block |
||
325 | 325 | if ($sanitarInIDs != "''") { |
326 | 326 | switch ($this->getCFGDef('showParent', '0')) { |
327 | 327 | case '-1': |
328 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")"; |
|
328 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.")"; |
|
329 | 329 | break; |
330 | 330 | case 0: |
331 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ") AND c.id NOT IN(" . $sanitarInIDs . ")"; |
|
331 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.") AND c.id NOT IN(".$sanitarInIDs.")"; |
|
332 | 332 | break; |
333 | 333 | case 1: |
334 | 334 | default: |
335 | - $tmpWhere = "(c.parent IN (" . $sanitarInIDs . ") OR c.id IN({$sanitarInIDs}))"; |
|
335 | + $tmpWhere = "(c.parent IN (".$sanitarInIDs.") OR c.id IN({$sanitarInIDs}))"; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | if (empty($tmpWhere)) { |
342 | 342 | $tmpWhere = "c.id IN({$addDocs})"; |
343 | 343 | } else { |
344 | - $tmpWhere = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))"; |
|
344 | + $tmpWhere = "((".$tmpWhere.") OR c.id IN({$addDocs}))"; |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | if (!empty($tmpWhere)) { |
@@ -351,16 +351,16 @@ discard block |
||
351 | 351 | $where[] = "c.published=1"; |
352 | 352 | } |
353 | 353 | if (!empty($where)) { |
354 | - $where = "WHERE " . implode(" AND ", $where); |
|
354 | + $where = "WHERE ".implode(" AND ", $where); |
|
355 | 355 | } else { |
356 | 356 | $where = ''; |
357 | 357 | } |
358 | 358 | $fields = $this->getCFGDef('selectFields', 'c.*'); |
359 | 359 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
360 | 360 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
361 | - $rs = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " . |
|
362 | - $group . " " . |
|
363 | - $sort . " " . |
|
361 | + $rs = $this->dbQuery("SELECT {$fields} FROM ".$from." ".$where." ". |
|
362 | + $group." ". |
|
363 | + $sort." ". |
|
364 | 364 | $this->LimitSQL($this->getCFGDef('queryLimit', 0)) |
365 | 365 | ); |
366 | 366 |
@@ -1700,8 +1700,8 @@ |
||
1700 | 1700 | $fltr_params = explode(':', $filter, 2); |
1701 | 1701 | $fltr = APIHelpers::getkey($fltr_params, 0, null); |
1702 | 1702 | /** |
1703 | - * @var tv_DL_filter|content_DL_filter $fltr_class |
|
1704 | - */ |
|
1703 | + * @var tv_DL_filter|content_DL_filter $fltr_class |
|
1704 | + */ |
|
1705 | 1705 | $fltr_class = $fltr . '_DL_filter'; |
1706 | 1706 | // check if the filter is implemented |
1707 | 1707 | if (!is_null($fltr)) { |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | * @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html |
6 | 6 | * @author Agel_Nash <[email protected]> |
7 | 7 | */ |
8 | -include_once(MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php'); |
|
9 | -include_once(MODX_BASE_PATH . 'assets/lib/Helpers/FS.php'); |
|
10 | -include_once(MODX_BASE_PATH . 'assets/lib/Helpers/Config.php'); |
|
11 | -require_once(dirname(dirname(__FILE__)) . "/lib/jsonHelper.class.php"); |
|
12 | -require_once(dirname(dirname(__FILE__)) . "/lib/sqlHelper.class.php"); |
|
13 | -require_once(dirname(dirname(__FILE__)) . "/lib/DLTemplate.class.php"); |
|
14 | -require_once(dirname(dirname(__FILE__)) . "/lib/DLCollection.class.php"); |
|
15 | -require_once(dirname(dirname(__FILE__)) . "/lib/xnop.class.php"); |
|
8 | +include_once(MODX_BASE_PATH.'assets/lib/APIHelpers.class.php'); |
|
9 | +include_once(MODX_BASE_PATH.'assets/lib/Helpers/FS.php'); |
|
10 | +include_once(MODX_BASE_PATH.'assets/lib/Helpers/Config.php'); |
|
11 | +require_once(dirname(dirname(__FILE__))."/lib/jsonHelper.class.php"); |
|
12 | +require_once(dirname(dirname(__FILE__))."/lib/sqlHelper.class.php"); |
|
13 | +require_once(dirname(dirname(__FILE__))."/lib/DLTemplate.class.php"); |
|
14 | +require_once(dirname(dirname(__FILE__))."/lib/DLCollection.class.php"); |
|
15 | +require_once(dirname(dirname(__FILE__))."/lib/xnop.class.php"); |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Class DocLister |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | case ')': |
308 | 308 | $open--; |
309 | 309 | if ($open == 0) { |
310 | - $res[] = $cur . ')'; |
|
310 | + $res[] = $cur.')'; |
|
311 | 311 | $cur = ''; |
312 | 312 | } else { |
313 | 313 | $cur .= $e; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function setDebug($flag = 0) |
373 | 373 | { |
374 | - $flag = abs((int)$flag); |
|
374 | + $flag = abs((int) $flag); |
|
375 | 375 | if ($this->_debugMode != $flag) { |
376 | 376 | $this->_debugMode = $flag; |
377 | 377 | $this->debug = null; |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | ini_set('display_errors', 1); |
382 | 382 | } |
383 | 383 | $dir = dirname(dirname(__FILE__)); |
384 | - if (file_exists($dir . "/lib/DLdebug.class.php")) { |
|
385 | - include_once($dir . "/lib/DLdebug.class.php"); |
|
384 | + if (file_exists($dir."/lib/DLdebug.class.php")) { |
|
385 | + include_once($dir."/lib/DLdebug.class.php"); |
|
386 | 386 | if (class_exists("DLdebug", false)) { |
387 | 387 | $this->debug = new DLdebug($this); |
388 | 388 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | } |
421 | 421 | $table = $this->_table[$name]; |
422 | 422 | if (!empty($alias) && is_scalar($alias)) { |
423 | - $table .= " as `" . $alias . "`"; |
|
423 | + $table .= " as `".$alias."`"; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | return $table; |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | public function jsonDecode($json, $config = array(), $nop = false) |
463 | 463 | { |
464 | 464 | $this->debug->debug( |
465 | - 'Decode JSON: ' . $this->debug->dumpData($json) . "\r\nwith config: " . $this->debug->dumpData($config), |
|
465 | + 'Decode JSON: '.$this->debug->dumpData($json)."\r\nwith config: ".$this->debug->dumpData($config), |
|
466 | 466 | 'jsonDecode', |
467 | 467 | 2 |
468 | 468 | ); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | { |
484 | 484 | $error = jsonHelper::json_last_error_msg(); |
485 | 485 | if (!in_array($error, array('error_none', 'other'))) { |
486 | - $this->debug->error($this->getMsg('json.' . $error) . ": " . $this->debug->dumpData($json, 'code'), 'JSON'); |
|
486 | + $this->debug->error($this->getMsg('json.'.$error).": ".$this->debug->dumpData($json, 'code'), 'JSON'); |
|
487 | 487 | $error = true; |
488 | 488 | } |
489 | 489 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | throw new Exception('Error load summary extender'); |
513 | 513 | } |
514 | 514 | |
515 | - if ((int)$this->getCFGDef('display', 0) > 0 && ( //OR paginate in extender's parameter |
|
515 | + if ((int) $this->getCFGDef('display', 0) > 0 && ( //OR paginate in extender's parameter |
|
516 | 516 | in_array('paginate', $extenders) || $this->getCFGDef('paginate', '') != '' || |
517 | 517 | $this->getCFGDef('TplPrevP', '') != '' || $this->getCFGDef('TplPage', '') != '' || |
518 | 518 | $this->getCFGDef('TplCurrentPage', '') != '' || $this->getCFGDef('TplWrapPaginate', '') != '' || |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | ) { |
523 | 523 | throw new Exception('Error load paginate extender'); |
524 | 524 | } else { |
525 | - if ((int)$this->getCFGDef('display', 0) == 0) { |
|
525 | + if ((int) $this->getCFGDef('display', 0) == 0) { |
|
526 | 526 | $extenders = $this->unsetArrayVal($extenders, 'paginate'); |
527 | 527 | } |
528 | 528 | } |
@@ -568,11 +568,11 @@ discard block |
||
568 | 568 | */ |
569 | 569 | public function getUrl($id = 0) |
570 | 570 | { |
571 | - $id = ((int)$id > 0) ? (int)$id : $this->getCurrentMODXPageID(); |
|
571 | + $id = ((int) $id > 0) ? (int) $id : $this->getCurrentMODXPageID(); |
|
572 | 572 | |
573 | 573 | $link = $this->checkExtender('request') ? $this->extender['request']->getLink() : $this->getRequest(); |
574 | 574 | if ($id == $this->modx->config['site_start']) { |
575 | - $url = $this->modx->config['site_url'] . ($link != '' ? "?{$link}" : ""); |
|
575 | + $url = $this->modx->config['site_url'].($link != '' ? "?{$link}" : ""); |
|
576 | 576 | } else { |
577 | 577 | $url = $this->modx->makeUrl($id, '', $link, $this->getCFGDef('urlScheme', '')); |
578 | 578 | } |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | */ |
634 | 634 | public function getCurrentMODXPageID() |
635 | 635 | { |
636 | - $id = isset($this->modx->documentIdentifier) ? (int)$this->modx->documentIdentifier : 0; |
|
636 | + $id = isset($this->modx->documentIdentifier) ? (int) $this->modx->documentIdentifier : 0; |
|
637 | 637 | $docData = isset($this->modx->documentObject) ? $this->modx->documentObject : array(); |
638 | 638 | |
639 | 639 | return empty($id) ? \APIHelpers::getkey($docData, 'id', 0) : $id; |
@@ -651,13 +651,13 @@ discard block |
||
651 | 651 | public function ErrorLogger($message, $code, $file, $line, $trace) |
652 | 652 | { |
653 | 653 | if (abs($this->getCFGDef('debug', '0')) == '1') { |
654 | - $out = "CODE #" . $code . "<br />"; |
|
655 | - $out .= "on file: " . $file . ":" . $line . "<br />"; |
|
654 | + $out = "CODE #".$code."<br />"; |
|
655 | + $out .= "on file: ".$file.":".$line."<br />"; |
|
656 | 656 | $out .= "<pre>"; |
657 | 657 | $out .= print_r($trace, 1); |
658 | 658 | $out .= "</pre>"; |
659 | 659 | |
660 | - $message = $out . $message; |
|
660 | + $message = $out.$message; |
|
661 | 661 | } |
662 | 662 | die($message); |
663 | 663 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | $ext = explode(",", $ext); |
687 | 687 | foreach ($ext as $item) { |
688 | 688 | if ($item != '' && !$this->_loadExtender($item)) { |
689 | - throw new Exception('Error load ' . APIHelpers::e($item) . ' extender'); |
|
689 | + throw new Exception('Error load '.APIHelpers::e($item).' extender'); |
|
690 | 690 | } |
691 | 691 | } |
692 | 692 | } |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | $this->debug->debugEnd( |
731 | 731 | "toPlaceholders", |
732 | - array($key . " placeholder" => $data), |
|
732 | + array($key." placeholder" => $data), |
|
733 | 733 | array('html') |
734 | 734 | ); |
735 | 735 | |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | } |
763 | 763 | } |
764 | 764 | $q = $quote ? "'" : ""; |
765 | - $out = $q . implode($q . "," . $q, $out) . $q; |
|
765 | + $out = $q.implode($q.",".$q, $out).$q; |
|
766 | 766 | |
767 | 767 | return $out; |
768 | 768 | } |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | if (empty($lang)) { |
784 | 784 | $lang = $this->getCFGDef('lang', $this->modx->config['manager_language']); |
785 | 785 | } |
786 | - if (file_exists(dirname(dirname(__FILE__)) . "/lang/" . $lang . ".php")) { |
|
787 | - $tmp = include(dirname(__FILE__) . "/lang/" . $lang . ".php"); |
|
786 | + if (file_exists(dirname(dirname(__FILE__))."/lang/".$lang.".php")) { |
|
787 | + $tmp = include(dirname(__FILE__)."/lang/".$lang.".php"); |
|
788 | 788 | $this->_customLang = is_array($tmp) ? $tmp : array(); |
789 | 789 | } |
790 | 790 | |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | } |
807 | 807 | |
808 | 808 | $this->debug->debug( |
809 | - 'Load language ' . $this->debug->dumpData($name) . "." . $this->debug->dumpData($lang), |
|
809 | + 'Load language '.$this->debug->dumpData($name).".".$this->debug->dumpData($lang), |
|
810 | 810 | 'loadlang', |
811 | 811 | 2 |
812 | 812 | ); |
@@ -814,8 +814,8 @@ discard block |
||
814 | 814 | $name = array($name); |
815 | 815 | } |
816 | 816 | foreach ($name as $n) { |
817 | - if (file_exists(dirname(__FILE__) . "/lang/" . $lang . "/" . $n . ".inc.php")) { |
|
818 | - $tmp = include(dirname(__FILE__) . "/lang/" . $lang . "/" . $n . ".inc.php"); |
|
817 | + if (file_exists(dirname(__FILE__)."/lang/".$lang."/".$n.".inc.php")) { |
|
818 | + $tmp = include(dirname(__FILE__)."/lang/".$lang."/".$n.".inc.php"); |
|
819 | 819 | if (is_array($tmp)) { |
820 | 820 | /** |
821 | 821 | * Переименовыываем элементы массива из array('test'=>'data') в array('name.test'=>'data') |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | } |
899 | 899 | } |
900 | 900 | |
901 | - $data[$this->getCFGDef("sysKey", "dl") . ".wrap"] = $this->renderWrap($out); |
|
901 | + $data[$this->getCFGDef("sysKey", "dl").".wrap"] = $this->renderWrap($out); |
|
902 | 902 | $out = $this->parseChunk($this->getCFGDef('tpl', ''), $data); |
903 | 903 | |
904 | 904 | return $out; |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | $out = $this->DLTemplate->parseChunk($name, $data, $parseDocumentSource); |
968 | 968 | $out = $this->parseLang($out); |
969 | 969 | if (empty($out)) { |
970 | - $this->debug->debug("Empty chunk: " . $this->debug->dumpData($name), '', 2); |
|
970 | + $this->debug->debug("Empty chunk: ".$this->debug->dumpData($name), '', 2); |
|
971 | 971 | } |
972 | 972 | $this->debug->debugEnd("parseChunk"); |
973 | 973 | |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | if ((($this->getCFGDef("noneWrapOuter", "1") && $docs == 0) || $docs > 0) && !empty($this->ownerTPL)) { |
1004 | 1004 | $this->debug->debug("", "renderWrapTPL", 2); |
1005 | 1005 | $parse = true; |
1006 | - $plh = array($this->getCFGDef("sysKey", "dl") . ".wrap" => $data); |
|
1006 | + $plh = array($this->getCFGDef("sysKey", "dl").".wrap" => $data); |
|
1007 | 1007 | /** |
1008 | 1008 | * @var $extPrepare prepare_DL_Extender |
1009 | 1009 | */ |
@@ -1053,10 +1053,10 @@ discard block |
||
1053 | 1053 | |
1054 | 1054 | $iterationName = ($i % 2 == 1) ? 'Odd' : 'Even'; |
1055 | 1055 | $tmp = strtolower($iterationName); |
1056 | - $class[] = $this->getCFGDef($tmp . 'Class', $tmp); |
|
1056 | + $class[] = $this->getCFGDef($tmp.'Class', $tmp); |
|
1057 | 1057 | |
1058 | - $this->renderTPL = $this->getCFGDef('tplId' . $i, $this->renderTPL); |
|
1059 | - $this->renderTPL = $this->getCFGDef('tpl' . $iterationName, $this->renderTPL); |
|
1058 | + $this->renderTPL = $this->getCFGDef('tplId'.$i, $this->renderTPL); |
|
1059 | + $this->renderTPL = $this->getCFGDef('tpl'.$iterationName, $this->renderTPL); |
|
1060 | 1060 | $iteration = $i; |
1061 | 1061 | |
1062 | 1062 | if ($this->extPaginate) { |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | $data[$this->getCFGDef( |
1084 | 1084 | "sysKey", |
1085 | 1085 | "dl" |
1086 | - ) . '.full_iteration'] = $iteration; |
|
1086 | + ).'.full_iteration'] = $iteration; |
|
1087 | 1087 | |
1088 | 1088 | if ($i == 1) { |
1089 | 1089 | $this->renderTPL = $this->getCFGDef('tplFirst', $this->renderTPL); |
@@ -1098,14 +1098,14 @@ discard block |
||
1098 | 1098 | $data[$this->getCFGDef( |
1099 | 1099 | "sysKey", |
1100 | 1100 | "dl" |
1101 | - ) . '.active'] = 1; //[+active+] - 1 if $modx->documentIdentifer equal ID this element |
|
1101 | + ).'.active'] = 1; //[+active+] - 1 if $modx->documentIdentifer equal ID this element |
|
1102 | 1102 | $class[] = $this->getCFGDef('currentClass', 'current'); |
1103 | 1103 | } else { |
1104 | - $data[$this->getCFGDef("sysKey", "dl") . '.active'] = 0; |
|
1104 | + $data[$this->getCFGDef("sysKey", "dl").'.active'] = 0; |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | $class = implode(" ", $class); |
1108 | - $data[$this->getCFGDef("sysKey", "dl") . '.class'] = $class; |
|
1108 | + $data[$this->getCFGDef("sysKey", "dl").'.class'] = $class; |
|
1109 | 1109 | |
1110 | 1110 | /** |
1111 | 1111 | * @var $extE e_DL_Extender |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | */ |
1216 | 1216 | public function checkExtender($name) |
1217 | 1217 | { |
1218 | - return (isset($this->extender[$name]) && $this->extender[$name] instanceof $name . "_DL_Extender"); |
|
1218 | + return (isset($this->extender[$name]) && $this->extender[$name] instanceof $name."_DL_Extender"); |
|
1219 | 1219 | } |
1220 | 1220 | |
1221 | 1221 | /** |
@@ -1256,16 +1256,16 @@ discard block |
||
1256 | 1256 | */ |
1257 | 1257 | protected function _loadExtender($name) |
1258 | 1258 | { |
1259 | - $this->debug->debug('Load Extender ' . $this->debug->dumpData($name), 'LoadExtender', 2); |
|
1259 | + $this->debug->debug('Load Extender '.$this->debug->dumpData($name), 'LoadExtender', 2); |
|
1260 | 1260 | $flag = false; |
1261 | 1261 | |
1262 | - $classname = ($name != '') ? $name . "_DL_Extender" : ""; |
|
1262 | + $classname = ($name != '') ? $name."_DL_Extender" : ""; |
|
1263 | 1263 | if ($classname != '' && isset($this->extender[$name]) && $this->extender[$name] instanceof $classname) { |
1264 | 1264 | $flag = true; |
1265 | 1265 | } else { |
1266 | 1266 | if (!class_exists($classname, false) && $classname != '') { |
1267 | - if (file_exists(dirname(__FILE__) . "/extender/" . $name . ".extender.inc")) { |
|
1268 | - include_once(dirname(__FILE__) . "/extender/" . $name . ".extender.inc"); |
|
1267 | + if (file_exists(dirname(__FILE__)."/extender/".$name.".extender.inc")) { |
|
1268 | + include_once(dirname(__FILE__)."/extender/".$name.".extender.inc"); |
|
1269 | 1269 | } |
1270 | 1270 | } |
1271 | 1271 | if (class_exists($classname, false) && $classname != '') { |
@@ -1274,7 +1274,7 @@ discard block |
||
1274 | 1274 | } |
1275 | 1275 | } |
1276 | 1276 | if (!$flag) { |
1277 | - $this->debug->debug("Error load Extender " . $this->debug->dumpData($name)); |
|
1277 | + $this->debug->debug("Error load Extender ".$this->debug->dumpData($name)); |
|
1278 | 1278 | } |
1279 | 1279 | $this->debug->debugEnd('LoadExtender'); |
1280 | 1280 | |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | */ |
1294 | 1294 | public function setIDs($IDs) |
1295 | 1295 | { |
1296 | - $this->debug->debug('set ID list ' . $this->debug->dumpData($IDs), 'setIDs', 2); |
|
1296 | + $this->debug->debug('set ID list '.$this->debug->dumpData($IDs), 'setIDs', 2); |
|
1297 | 1297 | $IDs = $this->cleanIDs($IDs); |
1298 | 1298 | $type = $this->getCFGDef('idType', 'parents'); |
1299 | 1299 | $depth = $this->getCFGDef('depth', ''); |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | public function cleanIDs($IDs, $sep = ',') |
1330 | 1330 | { |
1331 | 1331 | $this->debug->debug( |
1332 | - 'clean IDs ' . $this->debug->dumpData($IDs) . ' with separator ' . $this->debug->dumpData($sep), |
|
1332 | + 'clean IDs '.$this->debug->dumpData($IDs).' with separator '.$this->debug->dumpData($sep), |
|
1333 | 1333 | 'cleanIDs', |
1334 | 1334 | 2 |
1335 | 1335 | ); |
@@ -1339,8 +1339,8 @@ discard block |
||
1339 | 1339 | } |
1340 | 1340 | foreach ($IDs as $item) { |
1341 | 1341 | $item = trim($item); |
1342 | - if (is_numeric($item) && (int)$item >= 0) { //Fix 0xfffffffff |
|
1343 | - $out[] = (int)$item; |
|
1342 | + if (is_numeric($item) && (int) $item >= 0) { //Fix 0xfffffffff |
|
1343 | + $out[] = (int) $item; |
|
1344 | 1344 | } |
1345 | 1345 | } |
1346 | 1346 | $out = array_unique($out); |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | { |
1415 | 1415 | $out = ''; |
1416 | 1416 | if ($group != '') { |
1417 | - $out = 'GROUP BY ' . $group; |
|
1417 | + $out = 'GROUP BY '.$group; |
|
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | return $out; |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | $idList = $this->sanitarIn($this->IDs, ',', false); |
1445 | 1445 | $out = array('orderBy' => "FIND_IN_SET({$this->getCFGDef('sortBy', $this->getPK())}, '{$idList}')"); |
1446 | 1446 | $this->config->setConfig($out); //reload config; |
1447 | - $sort = "ORDER BY " . $out['orderBy']; |
|
1447 | + $sort = "ORDER BY ".$out['orderBy']; |
|
1448 | 1448 | break; |
1449 | 1449 | default: |
1450 | 1450 | $out = array('orderBy' => '', 'order' => '', 'sortBy' => ''); |
@@ -1464,13 +1464,13 @@ discard block |
||
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | $out['sortBy'] = (($tmp = $this->getCFGDef('sortBy', '')) != '') ? $tmp : $sortName; |
1467 | - $out['orderBy'] = $out['sortBy'] . " " . $out['order']; |
|
1467 | + $out['orderBy'] = $out['sortBy']." ".$out['order']; |
|
1468 | 1468 | } |
1469 | 1469 | $this->config->setConfig($out); //reload config; |
1470 | - $sort = "ORDER BY " . $out['orderBy']; |
|
1470 | + $sort = "ORDER BY ".$out['orderBy']; |
|
1471 | 1471 | break; |
1472 | 1472 | } |
1473 | - $this->debug->debugEnd("sortORDER", 'Get sort order for SQL: ' . $this->debug->dumpData($sort)); |
|
1473 | + $this->debug->debugEnd("sortORDER", 'Get sort order for SQL: '.$this->debug->dumpData($sort)); |
|
1474 | 1474 | |
1475 | 1475 | return $sort; |
1476 | 1476 | } |
@@ -1501,17 +1501,17 @@ discard block |
||
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | if ($limit != 0) { |
1504 | - $ret = "LIMIT " . (int)$offset . "," . (int)$limit; |
|
1504 | + $ret = "LIMIT ".(int) $offset.",".(int) $limit; |
|
1505 | 1505 | } else { |
1506 | 1506 | if ($offset != 0) { |
1507 | 1507 | /** |
1508 | 1508 | * To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter |
1509 | 1509 | * @see http://dev.mysql.com/doc/refman/5.0/en/select.html |
1510 | 1510 | */ |
1511 | - $ret = "LIMIT " . (int)$offset . ",18446744073709551615"; |
|
1511 | + $ret = "LIMIT ".(int) $offset.",18446744073709551615"; |
|
1512 | 1512 | } |
1513 | 1513 | } |
1514 | - $this->debug->debugEnd("limitSQL", "Get limit for SQL: " . $this->debug->dumpData($ret)); |
|
1514 | + $this->debug->debugEnd("limitSQL", "Get limit for SQL: ".$this->debug->dumpData($ret)); |
|
1515 | 1515 | |
1516 | 1516 | return $ret; |
1517 | 1517 | } |
@@ -1557,20 +1557,20 @@ discard block |
||
1557 | 1557 | $children = array(); // children of each ID |
1558 | 1558 | $ids = array(); |
1559 | 1559 | foreach ($data as $i => $r) { |
1560 | - $row =& $data[$i]; |
|
1560 | + $row = & $data[$i]; |
|
1561 | 1561 | $id = $row[$idName]; |
1562 | 1562 | $pid = $row[$pidName]; |
1563 | - $children[$pid][$id] =& $row; |
|
1563 | + $children[$pid][$id] = & $row; |
|
1564 | 1564 | if (!isset($children[$id])) { |
1565 | 1565 | $children[$id] = array(); |
1566 | 1566 | } |
1567 | - $row['#childNodes'] =& $children[$id]; |
|
1567 | + $row['#childNodes'] = & $children[$id]; |
|
1568 | 1568 | $ids[$row[$idName]] = true; |
1569 | 1569 | } |
1570 | 1570 | // Root elements are elements with non-found PIDs. |
1571 | 1571 | $this->_tree = array(); |
1572 | 1572 | foreach ($data as $i => $r) { |
1573 | - $row =& $data[$i]; |
|
1573 | + $row = & $data[$i]; |
|
1574 | 1574 | if (!isset($ids[$row[$pidName]])) { |
1575 | 1575 | $this->_tree[$row[$idName]] = $row; |
1576 | 1576 | } |
@@ -1587,11 +1587,11 @@ discard block |
||
1587 | 1587 | */ |
1588 | 1588 | public function getPK($full = true) |
1589 | 1589 | { |
1590 | - $idField = isset($this->idField) ? $this->idField: 'id'; |
|
1590 | + $idField = isset($this->idField) ? $this->idField : 'id'; |
|
1591 | 1591 | if ($full) { |
1592 | - $idField = '`' . $idField . '`'; |
|
1592 | + $idField = '`'.$idField.'`'; |
|
1593 | 1593 | if (!empty($this->alias)) { |
1594 | - $idField = '`' . $this->alias . '`.' . $idField; |
|
1594 | + $idField = '`'.$this->alias.'`.'.$idField; |
|
1595 | 1595 | } |
1596 | 1596 | } |
1597 | 1597 | |
@@ -1608,9 +1608,9 @@ discard block |
||
1608 | 1608 | { |
1609 | 1609 | $parentField = isset($this->parentField) ? $this->parentField : ''; |
1610 | 1610 | if ($full && !empty($parentField)) { |
1611 | - $parentField = '`' . $parentField . '`'; |
|
1611 | + $parentField = '`'.$parentField.'`'; |
|
1612 | 1612 | if (!empty($this->alias)) { |
1613 | - $parentField = '`' . $this->alias . '`.' . $parentField; |
|
1613 | + $parentField = '`'.$this->alias.'`.'.$parentField; |
|
1614 | 1614 | } |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | */ |
1627 | 1627 | protected function getFilters($filter_string) |
1628 | 1628 | { |
1629 | - $this->debug->debug("getFilters: " . $this->debug->dumpData($filter_string), 'getFilter', 1); |
|
1629 | + $this->debug->debug("getFilters: ".$this->debug->dumpData($filter_string), 'getFilter', 1); |
|
1630 | 1630 | // the filter parameter tells us, which filters can be used in this query |
1631 | 1631 | $filter_string = trim($filter_string, ' ;'); |
1632 | 1632 | if (!$filter_string) { |
@@ -1653,14 +1653,14 @@ discard block |
||
1653 | 1653 | } |
1654 | 1654 | } |
1655 | 1655 | $output['join'] = !empty($joins) ? implode(' ', $joins) : ''; |
1656 | - $output['where'] = !empty($wheres) ? '(' . implode($sql, $wheres) . ')' : ''; |
|
1656 | + $output['where'] = !empty($wheres) ? '('.implode($sql, $wheres).')' : ''; |
|
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | |
1660 | 1660 | if (!$logic_op_found) { |
1661 | 1661 | $filter = $this->loadFilter($filter_string); |
1662 | 1662 | if (!$filter) { |
1663 | - $this->debug->warning('Error while loading DocLister filter "' . $this->debug->dumpData($filter_string) . '": check syntax!'); |
|
1663 | + $this->debug->warning('Error while loading DocLister filter "'.$this->debug->dumpData($filter_string).'": check syntax!'); |
|
1664 | 1664 | $output = false; |
1665 | 1665 | } else { |
1666 | 1666 | $output['join'] = $filter->get_join(); |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | { |
1697 | 1697 | if (!empty($join)) { |
1698 | 1698 | if (!empty($this->_filters['join'])) { |
1699 | - $this->_filters['join'] .= ' ' . $join; |
|
1699 | + $this->_filters['join'] .= ' '.$join; |
|
1700 | 1700 | } else { |
1701 | 1701 | $this->_filters['join'] = $join; |
1702 | 1702 | } |
@@ -1717,19 +1717,19 @@ discard block |
||
1717 | 1717 | $type = trim($type); |
1718 | 1718 | switch (strtoupper($type)) { |
1719 | 1719 | case 'DECIMAL': |
1720 | - $field = 'CAST(' . $field . ' as DECIMAL(10,2))'; |
|
1720 | + $field = 'CAST('.$field.' as DECIMAL(10,2))'; |
|
1721 | 1721 | break; |
1722 | 1722 | case 'UNSIGNED': |
1723 | - $field = 'CAST(' . $field . ' as UNSIGNED)'; |
|
1723 | + $field = 'CAST('.$field.' as UNSIGNED)'; |
|
1724 | 1724 | break; |
1725 | 1725 | case 'BINARY': |
1726 | - $field = 'CAST(' . $field . ' as BINARY)'; |
|
1726 | + $field = 'CAST('.$field.' as BINARY)'; |
|
1727 | 1727 | break; |
1728 | 1728 | case 'DATETIME': |
1729 | - $field = 'CAST(' . $field . ' as DATETIME)'; |
|
1729 | + $field = 'CAST('.$field.' as DATETIME)'; |
|
1730 | 1730 | break; |
1731 | 1731 | case 'SIGNED': |
1732 | - $field = 'CAST(' . $field . ' as SIGNED)'; |
|
1732 | + $field = 'CAST('.$field.' as SIGNED)'; |
|
1733 | 1733 | break; |
1734 | 1734 | } |
1735 | 1735 | |
@@ -1743,18 +1743,18 @@ discard block |
||
1743 | 1743 | */ |
1744 | 1744 | protected function loadFilter($filter) |
1745 | 1745 | { |
1746 | - $this->debug->debug('Load filter ' . $this->debug->dumpData($filter), 'loadFilter', 2); |
|
1746 | + $this->debug->debug('Load filter '.$this->debug->dumpData($filter), 'loadFilter', 2); |
|
1747 | 1747 | $out = false; |
1748 | 1748 | $fltr_params = explode(':', $filter, 2); |
1749 | 1749 | $fltr = APIHelpers::getkey($fltr_params, 0, null); |
1750 | 1750 | /** |
1751 | 1751 | * @var tv_DL_filter|content_DL_filter $fltr_class |
1752 | 1752 | */ |
1753 | - $fltr_class = $fltr . '_DL_filter'; |
|
1753 | + $fltr_class = $fltr.'_DL_filter'; |
|
1754 | 1754 | // check if the filter is implemented |
1755 | 1755 | if (!is_null($fltr)) { |
1756 | - if (!class_exists($fltr_class) && file_exists(__DIR__ . '/filter/' . $fltr . '.filter.php')) { |
|
1757 | - require_once dirname(__FILE__) . '/filter/' . $fltr . '.filter.php'; |
|
1756 | + if (!class_exists($fltr_class) && file_exists(__DIR__.'/filter/'.$fltr.'.filter.php')) { |
|
1757 | + require_once dirname(__FILE__).'/filter/'.$fltr.'.filter.php'; |
|
1758 | 1758 | } |
1759 | 1759 | if (class_exists($fltr_class)) { |
1760 | 1760 | $this->totalFilters++; |
@@ -1781,7 +1781,7 @@ discard block |
||
1781 | 1781 | */ |
1782 | 1782 | public function getCountFilters() |
1783 | 1783 | { |
1784 | - return (int)$this->totalFilters; |
|
1784 | + return (int) $this->totalFilters; |
|
1785 | 1785 | } |
1786 | 1786 | |
1787 | 1787 | /** |
@@ -1819,7 +1819,7 @@ discard block |
||
1819 | 1819 | public function getRequest() |
1820 | 1820 | { |
1821 | 1821 | $URL = null; |
1822 | - parse_str(parse_url(MODX_SITE_URL . $_SERVER['REQUEST_URI'], PHP_URL_QUERY), $URL); |
|
1822 | + parse_str(parse_url(MODX_SITE_URL.$_SERVER['REQUEST_URI'], PHP_URL_QUERY), $URL); |
|
1823 | 1823 | |
1824 | 1824 | return http_build_query(array_merge($URL, array(DocLister::AliasRequest => null))); |
1825 | 1825 | } |
@@ -1134,7 +1134,8 @@ discard block |
||
1134 | 1134 | $fields = is_array($fields) ? $fields : explode(",", $fields); |
1135 | 1135 | if (is_array($array) && count($array) > 0) { |
1136 | 1136 | $tmp = array(); |
1137 | - foreach ($data as $i => $v) { //array_merge not valid work with integer index key |
|
1137 | + foreach ($data as $i => $v) { |
|
1138 | +//array_merge not valid work with integer index key |
|
1138 | 1139 | $tmp[$i] = (isset($array[$i]) ? array_merge($v, $array[$i]) : $v); |
1139 | 1140 | } |
1140 | 1141 | $data = $tmp; |
@@ -1339,7 +1340,8 @@ discard block |
||
1339 | 1340 | } |
1340 | 1341 | foreach ($IDs as $item) { |
1341 | 1342 | $item = trim($item); |
1342 | - if (is_numeric($item) && (int)$item >= 0) { //Fix 0xfffffffff |
|
1343 | + if (is_numeric($item) && (int)$item >= 0) { |
|
1344 | +//Fix 0xfffffffff |
|
1343 | 1345 | $out[] = (int)$item; |
1344 | 1346 | } |
1345 | 1347 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $fields = $this->getCFGDef('selectFields', '*'); |
236 | 236 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
237 | 237 | $sort = $this->SortOrderSQL($this->getPK()); |
238 | - $rs = $this->dbQuery("SELECT {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}"); |
|
238 | + $rs = $this->dbQuery("select {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}"); |
|
239 | 239 | |
240 | 240 | $pk = $this->getPK(false); |
241 | 241 | while ($item = $this->modx->db->getRow($rs)) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $sort = $this->SortOrderSQL($this->getPK()); |
306 | 306 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0)); |
307 | 307 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
308 | - $rs = $this->dbQuery("SELECT {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}"); |
|
308 | + $rs = $this->dbQuery("select {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}"); |
|
309 | 309 | |
310 | 310 | $pk = $this->getPK(false); |
311 | 311 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $where .= " AND " . $tmp; |
400 | 400 | } |
401 | 401 | |
402 | - $rs = $this->dbQuery("SELECT {$this->getPK()} FROM {$this->table} WHERE {$where}"); |
|
402 | + $rs = $this->dbQuery("select {$this->getPK()} FROM {$this->table} WHERE {$where}"); |
|
403 | 403 | $pk = $this->getPK(false); |
404 | 404 | while ($item = $this->modx->db->getRow($rs)) { |
405 | 405 | $out[] = $item[$pk]; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $item = $extUser->setUserData($item); //[+user.id.createdby+], [+user.fullname.publishedby+], [+dl.user.publishedby+].... |
84 | 84 | } |
85 | 85 | |
86 | - $item[$this->getCFGDef("sysKey", "dl") . '.summary'] = $extSummary ? $this->getSummary( |
|
86 | + $item[$this->getCFGDef("sysKey", "dl").'.summary'] = $extSummary ? $this->getSummary( |
|
87 | 87 | $item, |
88 | 88 | $extSummary |
89 | 89 | ) : ''; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | $item[$this->getCFGDef( |
96 | 96 | "sysKey", |
97 | 97 | "dl" |
98 | - ) . '.iteration'] = $i; //[+iteration+] - Number element. Starting from zero |
|
98 | + ).'.iteration'] = $i; //[+iteration+] - Number element. Starting from zero |
|
99 | 99 | |
100 | 100 | $date = $this->getCFGDef('dateSource', 'pub_date'); |
101 | 101 | if (isset($item[$date])) { |
102 | - $_date = is_numeric($item[$date]) && $item[$date] == (int)$item[$date] ? $item[$date] : strtotime($item[$date]); |
|
102 | + $_date = is_numeric($item[$date]) && $item[$date] == (int) $item[$date] ? $item[$date] : strtotime($item[$date]); |
|
103 | 103 | if ($_date !== false) { |
104 | 104 | $_date = $_date + $this->modx->config['server_offset_time']; |
105 | 105 | $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $this->toPlaceholders( |
132 | 132 | $tmp, |
133 | 133 | 1, |
134 | - "item[" . $i . "]" |
|
134 | + "item[".$i."]" |
|
135 | 135 | ); // [+item[x]+] – individual placeholder for each iteration documents on this page |
136 | 136 | } |
137 | 137 | $out .= $tmp; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | //without break |
181 | 181 | case ((array('1') == $fields || in_array('date', $fields)) && $date != 'date'): |
182 | 182 | if (isset($row[$date])) { |
183 | - $_date = is_numeric($row[$date]) && $row[$date] == (int)$row[$date] ? $row[$date] : strtotime($row[$date]); |
|
183 | + $_date = is_numeric($row[$date]) && $row[$date] == (int) $row[$date] ? $row[$date] : strtotime($row[$date]); |
|
184 | 184 | if ($_date !== false) { |
185 | 185 | $_date = $_date + $this->modx->config['server_offset_time']; |
186 | 186 | $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | $out = array(); |
219 | 219 | $sanitarInIDs = $this->sanitarIn($this->IDs); |
220 | 220 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
221 | - $from = $this->table . " " . $this->_filters['join']; |
|
221 | + $from = $this->table." ".$this->_filters['join']; |
|
222 | 222 | $where = $this->getCFGDef('addWhereList', ''); |
223 | 223 | |
224 | 224 | //====== block added by Dreamer to enable filters ====== |
225 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
225 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
226 | 226 | $where = sqlHelper::trimLogicalOp($where); |
227 | 227 | //------- end of block ------- |
228 | 228 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | if (!empty($where)) { |
240 | - $where = "WHERE " . implode(" AND ", $where); |
|
240 | + $where = "WHERE ".implode(" AND ", $where); |
|
241 | 241 | } else { |
242 | 242 | $where = ''; |
243 | 243 | } |
@@ -264,12 +264,12 @@ discard block |
||
264 | 264 | { |
265 | 265 | $where = array(); |
266 | 266 | $out = array(); |
267 | - $from = $this->table . " " . $this->_filters['join']; |
|
267 | + $from = $this->table." ".$this->_filters['join']; |
|
268 | 268 | $tmpWhere = $this->getCFGDef('addWhereList', ''); |
269 | 269 | $tmpWhere = sqlHelper::trimLogicalOp($tmpWhere); |
270 | 270 | |
271 | 271 | //====== block added by Dreamer to enable filters ====== |
272 | - $tmpWhere = ($tmpWhere ? $tmpWhere . ' AND ' : '') . $this->_filters['where']; |
|
272 | + $tmpWhere = ($tmpWhere ? $tmpWhere.' AND ' : '').$this->_filters['where']; |
|
273 | 273 | $tmpWhere = sqlHelper::trimLogicalOp($tmpWhere); |
274 | 274 | //------- end of block ------- |
275 | 275 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | |
282 | 282 | $tmpWhere = null; |
283 | 283 | if ($sanitarInIDs != "''") { |
284 | - $tmpWhere = "({$this->getParentField()} IN (" . $sanitarInIDs . ")"; |
|
284 | + $tmpWhere = "({$this->getParentField()} IN (".$sanitarInIDs.")"; |
|
285 | 285 | switch ($this->getCFGDef('showParent', '0')) { |
286 | 286 | case -1: |
287 | 287 | $tmpWhere .= ")"; |
288 | 288 | break; |
289 | 289 | case 0: |
290 | - $tmpWhere .= " AND {$this->getPK()} NOT IN(" . $sanitarInIDs . "))"; |
|
290 | + $tmpWhere .= " AND {$this->getPK()} NOT IN(".$sanitarInIDs."))"; |
|
291 | 291 | break; |
292 | 292 | case 1: |
293 | 293 | default: |
@@ -298,16 +298,16 @@ discard block |
||
298 | 298 | if (($addDocs = $this->getCFGDef('documents', '')) != '') { |
299 | 299 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
300 | 300 | if (empty($tmpWhere)) { |
301 | - $tmpWhere = $this->getPK() . " IN({$addDocs})"; |
|
301 | + $tmpWhere = $this->getPK()." IN({$addDocs})"; |
|
302 | 302 | } else { |
303 | - $tmpWhere = "((" . $tmpWhere . ") OR {$this->getPK()} IN({$addDocs}))"; |
|
303 | + $tmpWhere = "((".$tmpWhere.") OR {$this->getPK()} IN({$addDocs}))"; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | if (!empty($tmpWhere)) { |
307 | 307 | $where[] = $tmpWhere; |
308 | 308 | } |
309 | 309 | if (!empty($where)) { |
310 | - $where = "WHERE " . implode(" AND ", $where); |
|
310 | + $where = "WHERE ".implode(" AND ", $where); |
|
311 | 311 | } else { |
312 | 312 | $where = ''; |
313 | 313 | } |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | $out = 0; |
337 | 337 | $sanitarInIDs = $this->sanitarIn($this->IDs); |
338 | 338 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
339 | - $from = $this->table . " " . $this->_filters['join']; |
|
339 | + $from = $this->table." ".$this->_filters['join']; |
|
340 | 340 | $where = $this->getCFGDef('addWhereList', ''); |
341 | 341 | |
342 | 342 | //====== block added by Dreamer ====== |
343 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
343 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
344 | 344 | $where = sqlHelper::trimLogicalOp($where); |
345 | 345 | //------- end of block ------- |
346 | 346 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | } |
368 | 368 | if (($addDocs = $this->getCFGDef('documents', '')) != '') { |
369 | 369 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
370 | - $where[] = "((" . $tmpWhere . ") OR {$this->getPK()} IN({$addDocs}))"; |
|
370 | + $where[] = "((".$tmpWhere.") OR {$this->getPK()} IN({$addDocs}))"; |
|
371 | 371 | } else { |
372 | 372 | $where[] = $tmpWhere; |
373 | 373 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | } |
380 | 380 | } |
381 | 381 | if (!empty($where)) { |
382 | - $where = "WHERE " . implode(" AND ", $where); |
|
382 | + $where = "WHERE ".implode(" AND ", $where); |
|
383 | 383 | } else { |
384 | 384 | $where = ''; |
385 | 385 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $tmp = $this->getCFGDef('addWhereFolder', ''); |
407 | 407 | $where = "{$this->getParentField()} IN ({$sanitarInIDs})"; |
408 | 408 | if (!empty($tmp)) { |
409 | - $where .= " AND " . $tmp; |
|
409 | + $where .= " AND ".$tmp; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | $rs = $this->dbQuery("SELECT {$this->getPK()} FROM {$this->table} WHERE {$where}"); |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | session_regenerate_id(false); |
165 | 165 | $value = session_id(); |
166 | 166 | if ($mid = $this->modx->getLoginUserID('mgr')) { |
167 | - $this->modx->db->query("UPDATE {$this->makeTable('active_user_locks')} SET `sid`='{$value}' WHERE `internalKey`={$mid}"); |
|
168 | - $this->modx->db->query("UPDATE {$this->makeTable('active_user_sessions')} SET `sid`='{$value}' WHERE `internalKey`={$mid}"); |
|
169 | - $this->modx->db->query("UPDATE {$this->makeTable('active_users')} SET `sid`='{$value}' WHERE `internalKey`={$mid}"); |
|
167 | + $this->modx->db->query("update {$this->makeTable('active_user_locks')} SET `sid`='{$value}' WHERE `internalKey`={$mid}"); |
|
168 | + $this->modx->db->query("update {$this->makeTable('active_user_sessions')} SET `sid`='{$value}' WHERE `internalKey`={$mid}"); |
|
169 | + $this->modx->db->query("update {$this->makeTable('active_users')} SET `sid`='{$value}' WHERE `internalKey`={$mid}"); |
|
170 | 170 | } |
171 | 171 | break; |
172 | 172 | case 'editedon': |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | if ($this->newDoc) { |
244 | 244 | $SQL = "INSERT into {$this->makeTable('manager_users')} SET " . implode(', ', $this->set['user']); |
245 | 245 | } else { |
246 | - $SQL = "UPDATE {$this->makeTable('manager_users')} SET " . implode(', ', |
|
246 | + $SQL = "update {$this->makeTable('manager_users')} SET " . implode(', ', |
|
247 | 247 | $this->set['user']) . " WHERE id = " . $this->id; |
248 | 248 | } |
249 | 249 | $this->query($SQL); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $SQL = "INSERT into {$this->makeTable('user_attributes')} SET " . implode(', ', |
268 | 268 | $this->set['attribute']); |
269 | 269 | } else { |
270 | - $SQL = "UPDATE {$this->makeTable('user_attributes')} SET " . implode(', ', |
|
270 | + $SQL = "update {$this->makeTable('user_attributes')} SET " . implode(', ', |
|
271 | 271 | $this->set['attribute']) . " WHERE internalKey = " . $this->getID(); |
272 | 272 | } |
273 | 273 | $this->query($SQL); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | $result = $this->query("SELECT `setting_value` FROM {$this->makeTable('user_settings')} WHERE `user` = '{$this->id}' AND `setting_name` = '{$key}'"); |
281 | 281 | if ($this->modx->db->getRecordCount($result) > 0) { |
282 | - $this->query("UPDATE {$this->makeTable('user_settings')} SET `setting_value` = '{$value}' WHERE `user` = '{$this->id}' AND `setting_name` = '{$key}';"); |
|
282 | + $this->query("update {$this->makeTable('user_settings')} SET `setting_value` = '{$value}' WHERE `user` = '{$this->id}' AND `setting_name` = '{$key}';"); |
|
283 | 283 | } else { |
284 | 284 | $this->query("INSERT into {$this->makeTable('user_settings')} SET `user` = {$this->id},`setting_name` = '{$key}',`setting_value` = '{$value}';"); |
285 | 285 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return $this |
77 | 77 | */ |
78 | 78 | protected function setRememberTime($val){ |
79 | - $this->rememberTime = (int)$val; |
|
79 | + $this->rememberTime = (int) $val; |
|
80 | 80 | return $this; |
81 | 81 | } |
82 | 82 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | protected function findUser($data) |
105 | 105 | { |
106 | 106 | switch (true) { |
107 | - case (is_int($data) || ((int)$data > 0 && (string)intval($data) === $data)): |
|
107 | + case (is_int($data) || ((int) $data > 0 && (string) intval($data) === $data)): |
|
108 | 108 | $find = 'attribute.internalKey'; |
109 | 109 | break; |
110 | 110 | case filter_var($data, FILTER_VALIDATE_EMAIL): |
@@ -227,27 +227,27 @@ discard block |
||
227 | 227 | public function save($fire_events = false, $clearCache = false) |
228 | 228 | { |
229 | 229 | if ($this->get('email') == '' || $this->get('username') == '' || $this->get('password') == '') { |
230 | - $this->log['EmptyPKField'] = 'Email, username or password is empty <pre>' . print_r($this->toArray(), |
|
231 | - true) . '</pre>'; |
|
230 | + $this->log['EmptyPKField'] = 'Email, username or password is empty <pre>'.print_r($this->toArray(), |
|
231 | + true).'</pre>'; |
|
232 | 232 | |
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
236 | 236 | if (!$this->checkUnique('manager_users', 'username')) { |
237 | - $this->log['UniqueUsername'] = 'username not unique <pre>' . print_r($this->get('username'), |
|
238 | - true) . '</pre>'; |
|
237 | + $this->log['UniqueUsername'] = 'username not unique <pre>'.print_r($this->get('username'), |
|
238 | + true).'</pre>'; |
|
239 | 239 | |
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
243 | 243 | if (!$this->checkUnique('user_attributes', 'email', 'internalKey')) { |
244 | - $this->log['UniqueEmail'] = 'Email not unique <pre>' . print_r($this->get('email'), true) . '</pre>'; |
|
244 | + $this->log['UniqueEmail'] = 'Email not unique <pre>'.print_r($this->get('email'), true).'</pre>'; |
|
245 | 245 | |
246 | 246 | return false; |
247 | 247 | } |
248 | 248 | |
249 | - if(!$this->get('role')) { |
|
250 | - $this->log['UniqueEmail'] = 'Wrong manager role <pre>' . print_r($this->get('role'), true) . '</pre>'; |
|
249 | + if (!$this->get('role')) { |
|
250 | + $this->log['UniqueEmail'] = 'Wrong manager role <pre>'.print_r($this->get('role'), true).'</pre>'; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | $this->set('sessionid', ''); |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | } |
263 | 263 | if (!empty($this->set['user'])) { |
264 | 264 | if ($this->newDoc) { |
265 | - $SQL = "INSERT into {$this->makeTable('manager_users')} SET " . implode(', ', $this->set['user']); |
|
265 | + $SQL = "INSERT into {$this->makeTable('manager_users')} SET ".implode(', ', $this->set['user']); |
|
266 | 266 | } else { |
267 | - $SQL = "UPDATE {$this->makeTable('manager_users')} SET " . implode(', ', |
|
268 | - $this->set['user']) . " WHERE id = " . $this->id; |
|
267 | + $SQL = "UPDATE {$this->makeTable('manager_users')} SET ".implode(', ', |
|
268 | + $this->set['user'])." WHERE id = ".$this->id; |
|
269 | 269 | } |
270 | 270 | $this->query($SQL); |
271 | 271 | } |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | if (!empty($this->set['attribute'])) { |
286 | 286 | if ($this->newDoc) { |
287 | 287 | $this->set('internalKey', $this->id)->Uset('internalKey', 'attribute'); |
288 | - $SQL = "INSERT into {$this->makeTable('user_attributes')} SET " . implode(', ', |
|
288 | + $SQL = "INSERT into {$this->makeTable('user_attributes')} SET ".implode(', ', |
|
289 | 289 | $this->set['attribute']); |
290 | 290 | } else { |
291 | - $SQL = "UPDATE {$this->makeTable('user_attributes')} SET " . implode(', ', |
|
292 | - $this->set['attribute']) . " WHERE internalKey = " . $this->getID(); |
|
291 | + $SQL = "UPDATE {$this->makeTable('user_attributes')} SET ".implode(', ', |
|
292 | + $this->set['attribute'])." WHERE internalKey = ".$this->getID(); |
|
293 | 293 | } |
294 | 294 | $this->query($SQL); |
295 | 295 | } |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | ), $fire_events); |
447 | 447 | if (is_array($eventResult)) { |
448 | 448 | foreach ($eventResult as $result) { |
449 | - $pluginFlag = (bool)$result; |
|
449 | + $pluginFlag = (bool) $result; |
|
450 | 450 | } |
451 | 451 | } else { |
452 | - $pluginFlag = (bool)$eventResult; |
|
452 | + $pluginFlag = (bool) $eventResult; |
|
453 | 453 | } |
454 | 454 | if (!$pluginFlag) { |
455 | 455 | $hashType = $this->getPasswordHashType($_password); |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | { |
587 | 587 | if (!empty($cookieName) && $this->getID() !== null) { |
588 | 588 | $secure = $this->isSecure(); |
589 | - $remember = is_bool($remember) ? $this->getRememberTime() : (int)$remember; |
|
589 | + $remember = is_bool($remember) ? $this->getRememberTime() : (int) $remember; |
|
590 | 590 | $cookieValue = $this->get('username'); |
591 | 591 | $cookieExpires = time() + $remember; |
592 | 592 | setcookie($cookieName, $cookieValue, $cookieExpires, MODX_BASE_URL, '', $secure, true); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | $membergroup_access = $this->modx->getFullTableName('membergroup_access'); |
609 | 609 | |
610 | 610 | $sql = "SELECT `uga`.`documentgroup` FROM {$member_groups} as `ug` |
611 | - INNER JOIN {$membergroup_access} as `uga` ON `uga`.`membergroup`=`ug`.`user_group` WHERE `ug`.`member` = " . $user->getID(); |
|
611 | + INNER JOIN {$membergroup_access} as `uga` ON `uga`.`membergroup`=`ug`.`user_group` WHERE `ug`.`member` = ".$user->getID(); |
|
612 | 612 | $out = $this->modx->db->getColumn('documentgroup', $this->query($sql)); |
613 | 613 | |
614 | 614 | } |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | |
632 | 632 | $rs = $this->query("SELECT `ug`.`user_group`, `ugn`.`name` FROM {$member_groups} as `ug` |
633 | 633 | INNER JOIN {$membergroup_names} as `ugn` ON `ugn`.`id`=`ug`.`user_group` |
634 | - WHERE `ug`.`member` = " . $user->getID()); |
|
634 | + WHERE `ug`.`member` = ".$user->getID()); |
|
635 | 635 | while ($row = $this->modx->db->getRow($rs)) { |
636 | 636 | $out[$row['user_group']] = $row['name']; |
637 | 637 | } |
@@ -709,31 +709,31 @@ discard block |
||
709 | 709 | */ |
710 | 710 | public function makeHash($pass, $seed, $algorithm) |
711 | 711 | { |
712 | - $salt = md5($pass . $seed); |
|
712 | + $salt = md5($pass.$seed); |
|
713 | 713 | |
714 | 714 | switch ($algorithm) { |
715 | 715 | case 'BLOWFISH_Y': |
716 | - $salt = '$2y$07$' . substr($salt, 0, 22); |
|
716 | + $salt = '$2y$07$'.substr($salt, 0, 22); |
|
717 | 717 | break; |
718 | 718 | case 'BLOWFISH_A': |
719 | - $salt = '$2a$07$' . substr($salt, 0, 22); |
|
719 | + $salt = '$2a$07$'.substr($salt, 0, 22); |
|
720 | 720 | break; |
721 | 721 | case 'SHA512': |
722 | - $salt = '$6$' . substr($salt, 0, 16); |
|
722 | + $salt = '$6$'.substr($salt, 0, 16); |
|
723 | 723 | break; |
724 | 724 | case 'SHA256': |
725 | - $salt = '$5$' . substr($salt, 0, 16); |
|
725 | + $salt = '$5$'.substr($salt, 0, 16); |
|
726 | 726 | break; |
727 | 727 | case 'MD5': |
728 | - $salt = '$1$' . substr($salt, 0, 8); |
|
728 | + $salt = '$1$'.substr($salt, 0, 8); |
|
729 | 729 | break; |
730 | 730 | default: |
731 | 731 | $algorithm = 'UNCRYPT'; |
732 | 732 | break; |
733 | 733 | } |
734 | 734 | |
735 | - $pass = $algorithm !== 'UNCRYPT' ? sha1($pass) . crypt($pass, $salt) : sha1($salt . $pass); |
|
736 | - $out = strtolower($algorithm) . '>' . md5($salt . $pass) . substr(md5($salt), 0, 8); |
|
735 | + $pass = $algorithm !== 'UNCRYPT' ? sha1($pass).crypt($pass, $salt) : sha1($salt.$pass); |
|
736 | + $out = strtolower($algorithm).'>'.md5($salt.$pass).substr(md5($salt), 0, 8); |
|
737 | 737 | |
738 | 738 | return $out; |
739 | 739 | } |
@@ -75,7 +75,8 @@ discard block |
||
75 | 75 | * @param $val |
76 | 76 | * @return $this |
77 | 77 | */ |
78 | - protected function setRememberTime($val){ |
|
78 | + protected function setRememberTime($val) |
|
79 | + { |
|
79 | 80 | $this->rememberTime = (int)$val; |
80 | 81 | return $this; |
81 | 82 | } |
@@ -83,7 +84,8 @@ discard block |
||
83 | 84 | /** |
84 | 85 | * @return integer |
85 | 86 | */ |
86 | - public function getRememberTime(){ |
|
87 | + public function getRememberTime() |
|
88 | + { |
|
87 | 89 | return $this->rememberTime; |
88 | 90 | } |
89 | 91 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined('MODX_BASE_PATH')) { |
|
2 | +if (!defined('MODX_BASE_PATH')) { |
|
3 | 3 | die('What are you doing? Get out of here!'); |
4 | 4 | } |
5 | 5 |