@@ -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 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function build_sql_where($table_alias, $field, $operator, $value) |
129 | 129 | { |
130 | - $this->DocLister->debug->debug('Build SQL query for filters: ' . $this->DocLister->debug->dumpData(func_get_args()), |
|
130 | + $this->DocLister->debug->debug('Build SQL query for filters: '.$this->DocLister->debug->dumpData(func_get_args()), |
|
131 | 131 | 'buildQuery', 2); |
132 | 132 | $output = sqlHelper::tildeField($field, $table_alias); |
133 | 133 | |
@@ -135,28 +135,28 @@ discard block |
||
135 | 135 | case '=': |
136 | 136 | case 'eq': |
137 | 137 | case 'is': |
138 | - $output .= " = '" . $this->modx->db->escape($value) . "'"; |
|
138 | + $output .= " = '".$this->modx->db->escape($value)."'"; |
|
139 | 139 | break; |
140 | 140 | case '!=': |
141 | 141 | case 'no': |
142 | 142 | case 'isnot': |
143 | - $output .= " != '" . $this->modx->db->escape($value) . "'"; |
|
143 | + $output .= " != '".$this->modx->db->escape($value)."'"; |
|
144 | 144 | break; |
145 | 145 | case '>': |
146 | 146 | case 'gt': |
147 | - $output .= ' > ' . str_replace(',', '.', floatval($value)); |
|
147 | + $output .= ' > '.str_replace(',', '.', floatval($value)); |
|
148 | 148 | break; |
149 | 149 | case '<': |
150 | 150 | case 'lt': |
151 | - $output .= ' < ' . str_replace(',', '.', floatval($value)); |
|
151 | + $output .= ' < '.str_replace(',', '.', floatval($value)); |
|
152 | 152 | break; |
153 | 153 | case '<=': |
154 | 154 | case 'elt': |
155 | - $output .= ' <= ' . str_replace(',', '.', floatval($value)); |
|
155 | + $output .= ' <= '.str_replace(',', '.', floatval($value)); |
|
156 | 156 | break; |
157 | 157 | case '>=': |
158 | 158 | case 'egt': |
159 | - $output .= ' >= ' . str_replace(',', '.', floatval($value)); |
|
159 | + $output .= ' >= '.str_replace(',', '.', floatval($value)); |
|
160 | 160 | break; |
161 | 161 | case '%': |
162 | 162 | case 'like': |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $output = $this->DocLister->LikeEscape($output, $value, '=', '%[+value+]'); |
170 | 170 | break; |
171 | 171 | case 'regexp': |
172 | - $output .= " REGEXP '" . $this->modx->db->escape($value) . "'"; |
|
172 | + $output .= " REGEXP '".$this->modx->db->escape($value)."'"; |
|
173 | 173 | break; |
174 | 174 | case 'against': |
175 | 175 | /** content:pagetitle,description,content,introtext:against:искомая строка */ |
@@ -192,16 +192,16 @@ discard block |
||
192 | 192 | $word_arr[] = $this->DocLister->LikeEscape($output, $word); |
193 | 193 | } |
194 | 194 | if (!empty($word_arr)) { |
195 | - $output = '(' . implode(' OR ', $word_arr) . ')'; |
|
195 | + $output = '('.implode(' OR ', $word_arr).')'; |
|
196 | 196 | } else { |
197 | 197 | $output = ''; |
198 | 198 | } |
199 | 199 | break; |
200 | 200 | case 'in': |
201 | - $output .= ' IN(' . $this->DocLister->sanitarIn($value, ',', true) . ')'; |
|
201 | + $output .= ' IN('.$this->DocLister->sanitarIn($value, ',', true).')'; |
|
202 | 202 | break; |
203 | 203 | case 'notin': |
204 | - $output .= ' NOT IN(' . $this->DocLister->sanitarIn($value, ',', true) . ')'; |
|
204 | + $output .= ' NOT IN('.$this->DocLister->sanitarIn($value, ',', true).')'; |
|
205 | 205 | break; |
206 | 206 | default: |
207 | 207 | $output = ''; |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | $this->tv_id = $tmp[0]; |
50 | 50 | } |
51 | 51 | if (!$this->tv_id) { |
52 | - $tvid = $this->modx->db->query("SELECT id FROM " . $this->DocLister->getTable('site_tmplvars') . " WHERE `name` = '" . $this->modx->db->escape($this->field) . "'"); |
|
52 | + $tvid = $this->modx->db->query("SELECT id FROM ".$this->DocLister->getTable('site_tmplvars')." WHERE `name` = '".$this->modx->db->escape($this->field)."'"); |
|
53 | 53 | $this->tv_id = intval($this->modx->db->getValue($tvid)); |
54 | 54 | } |
55 | 55 | |
56 | 56 | if (!$this->tv_id) { |
57 | - $this->DocLister->debug->warning('DocLister filtering by template variable "' . $this->DocLister->debug->dumpData($this->field) . '" failed. TV not found!'); |
|
57 | + $this->DocLister->debug->warning('DocLister filtering by template variable "'.$this->DocLister->debug->dumpData($this->field).'" failed. TV not found!'); |
|
58 | 58 | } else { |
59 | 59 | // create the alias for the join |
60 | - $alias = 'dltv_' . $this->field; |
|
60 | + $alias = 'dltv_'.$this->field; |
|
61 | 61 | if ($this->totalFilters > 0) { |
62 | - $alias .= '_' . $this->totalFilters; |
|
62 | + $alias .= '_'.$this->totalFilters; |
|
63 | 63 | } |
64 | 64 | $this->setTableAlias($alias); |
65 | 65 | $this->tvName = $this->field; |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | $join = ''; |
80 | 80 | $exists = $this->DocLister->checkTableAlias($this->tvName, $this->extTV->tvValuesTable()); |
81 | 81 | $alias = $this->DocLister->TableAlias($this->tvName, $this->extTV->tvValuesTable(), $this->getTableAlias()); |
82 | - $this->field = $alias . ".value"; |
|
82 | + $this->field = $alias.".value"; |
|
83 | 83 | if (!$exists) { |
84 | - $join = 'LEFT JOIN ' . $this->DocLister->getTable($this->extTV->tvValuesTable(), |
|
85 | - $alias) . ' ON `' . $alias . '`.`contentid`=`' . content_DL_filter::TableAlias . '`.`id` AND `' . $alias . '`.`tmplvarid`=' . $this->tv_id; |
|
84 | + $join = 'LEFT JOIN '.$this->DocLister->getTable($this->extTV->tvValuesTable(), |
|
85 | + $alias).' ON `'.$alias.'`.`contentid`=`'.content_DL_filter::TableAlias.'`.`id` AND `'.$alias.'`.`tmplvarid`='.$this->tv_id; |
|
86 | 86 | } else { |
87 | 87 | $this->setTableAlias($alias); |
88 | 88 | } |
@@ -44,10 +44,10 @@ |
||
44 | 44 | $reflectTPL = APIHelpers::getkey($params, 'reflectTPL', |
45 | 45 | '@CODE: <li><a href="[+url+]" title="[+title+]">[+title+]</a></li>'); |
46 | 46 | /** |
47 | - * activeReflectTPL |
|
48 | - * Шаблон активной даты. |
|
49 | - * Поддерживается такие же плейсхолдеры, как и в шаблоне reflectTPL |
|
50 | - */ |
|
47 | + * activeReflectTPL |
|
48 | + * Шаблон активной даты. |
|
49 | + * Поддерживается такие же плейсхолдеры, как и в шаблоне reflectTPL |
|
50 | + */ |
|
51 | 51 | $activeReflectTPL = APIHelpers::getkey($params, 'activeReflectTPL', '@CODE: <li><span>[+title+]</span></li>'); |
52 | 52 | |
53 | 53 | list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function () { |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | * &limitAfter=`3` |
11 | 11 | * ]] |
12 | 12 | */ |
13 | -include_once(MODX_BASE_PATH . 'assets/snippets/DocLister/lib/DLCollection.class.php'); |
|
14 | -include_once(MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php'); |
|
15 | -include_once(MODX_BASE_PATH . 'assets/snippets/DocLister/lib/DLReflect.class.php'); |
|
13 | +include_once(MODX_BASE_PATH.'assets/snippets/DocLister/lib/DLCollection.class.php'); |
|
14 | +include_once(MODX_BASE_PATH.'assets/lib/APIHelpers.class.php'); |
|
15 | +include_once(MODX_BASE_PATH.'assets/snippets/DocLister/lib/DLReflect.class.php'); |
|
16 | 16 | |
17 | 17 | $params = is_array($modx->event->params) ? $modx->event->params : array(); |
18 | 18 | |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | $activeReflectTPL = APIHelpers::getkey($params, 'activeReflectTPL', '@CODE: <li><span>[+title+]</span></li>'); |
52 | 52 | |
53 | -list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function () { |
|
53 | +list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function(){ |
|
54 | 54 | return array('m-Y', '%m-%Y', array('DLReflect', 'validateMonth')); |
55 | -}, function () { |
|
55 | +}, function(){ |
|
56 | 56 | return array('Y', '%Y', array('DLReflect', 'validateYear')); |
57 | 57 | }); |
58 | 58 | $tmp = $originalDate = date($dateFormat); |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | * Возможные значения: Любое число. 0 расценивается как все доступные месяцы |
143 | 143 | * Значение по умолчанию: 0 |
144 | 144 | */ |
145 | -$limitBefore = (int)APIHelpers::getkey($params, 'limitBefore', 0); |
|
145 | +$limitBefore = (int) APIHelpers::getkey($params, 'limitBefore', 0); |
|
146 | 146 | /** |
147 | 147 | * limitAfter |
148 | 148 | * Число элементов после месяца указанного в activeMonth параметре |
149 | 149 | * Возможные значения: Любое число. 0 расценивается как все доступные месяцы |
150 | 150 | * Значение по умолчанию: 0 |
151 | 151 | */ |
152 | -$limitAfter = (int)APIHelpers::getkey($params, 'limitAfter', 0); |
|
152 | +$limitAfter = (int) APIHelpers::getkey($params, 'limitAfter', 0); |
|
153 | 153 | $display = $limitBefore + 1 + $limitAfter; |
154 | 154 | |
155 | 155 | $out = ''; |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | $DLParams['saveDLObject'] = 'DLAPI'; |
162 | 162 | if ($reflectSource == 'tv') { |
163 | 163 | $DLParams['tvSortType'] = 'TVDATETIME'; |
164 | - $DLParams['selectFields'] = "DATE_FORMAT(STR_TO_DATE(`dltv_" . $reflectField . "_1`.`value`,'%d-%m-%Y %H:%i:%s'), '" . $sqlDateFormat . "') as `id`"; |
|
164 | + $DLParams['selectFields'] = "DATE_FORMAT(STR_TO_DATE(`dltv_".$reflectField."_1`.`value`,'%d-%m-%Y %H:%i:%s'), '".$sqlDateFormat."') as `id`"; |
|
165 | 165 | } else { |
166 | 166 | $DLParams['orderBy'] = $reflectField; |
167 | - $DLParams['selectFields'] = "DATE_FORMAT(FROM_UNIXTIME(" . $reflectField . "), '" . $sqlDateFormat . "') as `id`"; |
|
167 | + $DLParams['selectFields'] = "DATE_FORMAT(FROM_UNIXTIME(".$reflectField."), '".$sqlDateFormat."') as `id`"; |
|
168 | 168 | } |
169 | 169 | $totalReflects = $modx->runSnippet('DocLister', $DLParams); |
170 | 170 | /** Получаем объект DocLister'a */ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $totalReflects = array(); |
182 | 182 | } |
183 | 183 | $totalReflects = new DLCollection($modx, $totalReflects); |
184 | -$totalReflects = $totalReflects->filter(function ($el) { |
|
184 | +$totalReflects = $totalReflects->filter(function($el){ |
|
185 | 185 | return !empty($el['id']); |
186 | 186 | }); |
187 | 187 | /** Добавляем активную дату в коллекцию */ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $totalReflects->add(array('id' => $originalCurrentReflect), $originalCurrentReflect); |
196 | 196 | } |
197 | 197 | /** Сортируем даты по возрастанию */ |
198 | -$totalReflects->sort(function ($a, $b) use ($dateFormat) { |
|
198 | +$totalReflects->sort(function($a, $b) use ($dateFormat) { |
|
199 | 199 | $aDate = DateTime::createFromFormat($dateFormat, $a['id']); |
200 | 200 | $bDate = DateTime::createFromFormat($dateFormat, $b['id']); |
201 | 201 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | })->reindex(); |
204 | 204 | |
205 | 205 | /** Разделяем коллекцию дат на 2 части (до текущей даты и после) */ |
206 | -list($lReflect, $rReflect) = $totalReflects->partition(function ($key, $val) use ( |
|
206 | +list($lReflect, $rReflect) = $totalReflects->partition(function($key, $val) use ( |
|
207 | 207 | $activeReflect, |
208 | 208 | $originalDate, |
209 | 209 | $dateFormat |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | $sortDir = APIHelpers::getkey($params, 'sortDir', 'ASC'); |
269 | 269 | /** Сортируем результатирующий список */ |
270 | -$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat) { |
|
270 | +$outReflects = $outReflects->sort(function($a, $b) use ($sortDir, $dateFormat) { |
|
271 | 271 | $aDate = DateTime::createFromFormat($dateFormat, $a); |
272 | 272 | $bDate = DateTime::createFromFormat($dateFormat, $b); |
273 | 273 | $out = false; |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | foreach ($outReflects as $reflectItem) { |
288 | 288 | $tpl = (!is_null($activeReflect) && $activeReflect == $reflectItem) ? $activeReflectTPL : $reflectTPL; |
289 | 289 | |
290 | - $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI) { |
|
290 | + $data = DLReflect::switchReflect($reflectType, function() use ($reflectItem, $DLAPI) { |
|
291 | 291 | list($vMonth, $vYear) = explode('-', $reflectItem, 2); |
292 | 292 | |
293 | 293 | return array( |
294 | 294 | 'monthNum' => $vMonth, |
295 | - 'monthName' => $DLAPI->getMsg('months.' . (int)$vMonth), |
|
295 | + 'monthName' => $DLAPI->getMsg('months.'.(int) $vMonth), |
|
296 | 296 | 'year' => $vYear, |
297 | 297 | ); |
298 | - }, function () use ($reflectItem) { |
|
298 | + }, function() use ($reflectItem) { |
|
299 | 299 | return array( |
300 | 300 | 'year' => $reflectItem |
301 | 301 | ); |
@@ -327,4 +327,4 @@ discard block |
||
327 | 327 | $debug = ''; |
328 | 328 | } |
329 | 329 | |
330 | -return $debug . $out; |
|
330 | +return $debug.$out; |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | $activeReflectTPL = APIHelpers::getkey($params, 'activeReflectTPL', '@CODE: <li><span>[+title+]</span></li>'); |
52 | 52 | |
53 | -list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function () { |
|
53 | +list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function (){ |
|
54 | 54 | return array('m-Y', '%m-%Y', array('DLReflect', 'validateMonth')); |
55 | -}, function () { |
|
55 | +}, function (){ |
|
56 | 56 | return array('Y', '%Y', array('DLReflect', 'validateYear')); |
57 | 57 | }); |
58 | 58 | $tmp = $originalDate = date($dateFormat); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $totalReflects = array(); |
182 | 182 | } |
183 | 183 | $totalReflects = new DLCollection($modx, $totalReflects); |
184 | -$totalReflects = $totalReflects->filter(function ($el) { |
|
184 | +$totalReflects = $totalReflects->filter(function ($el){ |
|
185 | 185 | return !empty($el['id']); |
186 | 186 | }); |
187 | 187 | /** Добавляем активную дату в коллекцию */ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $totalReflects->add(array('id' => $originalCurrentReflect), $originalCurrentReflect); |
196 | 196 | } |
197 | 197 | /** Сортируем даты по возрастанию */ |
198 | -$totalReflects->sort(function ($a, $b) use ($dateFormat) { |
|
198 | +$totalReflects->sort(function ($a, $b) use ($dateFormat){ |
|
199 | 199 | $aDate = DateTime::createFromFormat($dateFormat, $a['id']); |
200 | 200 | $bDate = DateTime::createFromFormat($dateFormat, $b['id']); |
201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $activeReflect, |
208 | 208 | $originalDate, |
209 | 209 | $dateFormat |
210 | -) { |
|
210 | +){ |
|
211 | 211 | $aDate = DateTime::createFromFormat($dateFormat, $val['id']); |
212 | 212 | if (is_null($activeReflect)) { |
213 | 213 | $activeReflect = $originalDate; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | $sortDir = APIHelpers::getkey($params, 'sortDir', 'ASC'); |
269 | 269 | /** Сортируем результатирующий список */ |
270 | -$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat) { |
|
270 | +$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat){ |
|
271 | 271 | $aDate = DateTime::createFromFormat($dateFormat, $a); |
272 | 272 | $bDate = DateTime::createFromFormat($dateFormat, $b); |
273 | 273 | $out = false; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | foreach ($outReflects as $reflectItem) { |
288 | 288 | $tpl = (!is_null($activeReflect) && $activeReflect == $reflectItem) ? $activeReflectTPL : $reflectTPL; |
289 | 289 | |
290 | - $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI) { |
|
290 | + $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI){ |
|
291 | 291 | list($vMonth, $vYear) = explode('-', $reflectItem, 2); |
292 | 292 | |
293 | 293 | return array( |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | 'monthName' => $DLAPI->getMsg('months.' . (int)$vMonth), |
296 | 296 | 'year' => $vYear, |
297 | 297 | ); |
298 | - }, function () use ($reflectItem) { |
|
298 | + }, function () use ($reflectItem){ |
|
299 | 299 | return array( |
300 | 300 | 'year' => $reflectItem |
301 | 301 | ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $docgrp = implode(",", $docgrp); |
39 | 39 | } |
40 | 40 | $alias = parent::TableAlias; |
41 | - $where = ($this->modx->isFrontend() ? "`{$alias}`.`privateweb`=0" : "1='{$_SESSION['mgrRole']}' OR {$alias}.`privatemgr`=0") . (!$docgrp ? "" : " OR `{$this->tableAlias}`.`document_group` IN ({$docgrp})"); |
|
41 | + $where = ($this->modx->isFrontend() ? "`{$alias}`.`privateweb`=0" : "1='{$_SESSION['mgrRole']}' OR {$alias}.`privatemgr`=0").(!$docgrp ? "" : " OR `{$this->tableAlias}`.`document_group` IN ({$docgrp})"); |
|
42 | 42 | |
43 | 43 | return "($where)"; |
44 | 44 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function get_join() |
50 | 50 | { |
51 | - $join = 'LEFT JOIN ' . $this->DocLister->getTable('document_groups', |
|
52 | - $this->tableAlias) . ' ON `' . $this->tableAlias . '`.`document`=`' . parent::TableAlias . '`.`id`'; |
|
51 | + $join = 'LEFT JOIN '.$this->DocLister->getTable('document_groups', |
|
52 | + $this->tableAlias).' ON `'.$this->tableAlias.'`.`document`=`'.parent::TableAlias.'`.`id`'; |
|
53 | 53 | |
54 | 54 | return $join; |
55 | 55 | } |
@@ -219,7 +219,7 @@ |
||
219 | 219 | $tbl_site_tmplvars = $this->DocLister->getTable('site_tmplvars'); |
220 | 220 | $fields = 'id,name,default_text as value,display,display_params,type'; |
221 | 221 | $implodeTvId = implode(',', $tvId); |
222 | - $rs = $this->DocLister->dbQuery("SELECT {$fields} FROM {$tbl_site_tmplvars} WHERE id IN({$implodeTvId})"); |
|
222 | + $rs = $this->DocLister->dbQuery("select {$fields} FROM {$tbl_site_tmplvars} WHERE id IN({$implodeTvId})"); |
|
223 | 223 | $rows = $this->modx->db->makeArray($rs); |
224 | 224 | $out = array(); |
225 | 225 | foreach ($rows as $item) { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $tvPrefix = $this->_TVprefix; |
116 | 116 | |
117 | 117 | foreach ($rows as $item) { |
118 | - $out[$item['contentid']][$tvPrefix . $tv[$item['tmplvarid']]] = $item['value']; |
|
118 | + $out[$item['contentid']][$tvPrefix.$tv[$item['tmplvarid']]] = $item['value']; |
|
119 | 119 | } |
120 | 120 | $tmp = explode(",", $this->DocLister->sanitarIn($IDs, ',', false)); |
121 | 121 | foreach ($tmp as $item) { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $out = array_unique($tmp); |
168 | 168 | $tmp = array(); |
169 | 169 | foreach ($out as $item) { |
170 | - $tmp[] = $this->_TVprefix . $item; |
|
170 | + $tmp[] = $this->_TVprefix.$item; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } else { |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function renderTV($iddoc, $tvname, $tvval, $param) |
188 | 188 | { |
189 | - include_once MODX_MANAGER_PATH . "includes/tmplvars.format.inc.php"; |
|
190 | - include_once MODX_MANAGER_PATH . "includes/tmplvars.commands.inc.php"; |
|
189 | + include_once MODX_MANAGER_PATH."includes/tmplvars.format.inc.php"; |
|
190 | + include_once MODX_MANAGER_PATH."includes/tmplvars.commands.inc.php"; |
|
191 | 191 | |
192 | 192 | return getTVDisplayFormat($tvname, $tvval, $param['display'], $param['display_params'], $param['type'], $iddoc, |
193 | 193 | ''); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $rows = $this->modx->db->makeArray($rs); |
227 | 227 | $out = array(); |
228 | 228 | foreach ($rows as $item) { |
229 | - $out[$this->_TVprefix . $item['name']] = $item; |
|
229 | + $out[$this->_TVprefix.$item['name']] = $item; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | return $out; |
@@ -265,20 +265,20 @@ discard block |
||
265 | 265 | $item = explode(" ", trim($item), 2); |
266 | 266 | if (isset($TVnames[$item[0]])) { |
267 | 267 | $exists = $this->DocLister->checkTableAlias($item[0], $this->tvValuesTable()); |
268 | - $prefix = 'dltv_' . $item[0] . '_' . ($i + 1); |
|
268 | + $prefix = 'dltv_'.$item[0].'_'.($i + 1); |
|
269 | 269 | $prefix = $this->storeTable ? $this->DocLister->TableAlias($item[0], $this->tvValuesTable(), |
270 | 270 | $prefix) : $prefix; |
271 | 271 | if (!$exists) { |
272 | - $table .= " LEFT JOIN " . $this->DocLister->getTable($this->tvValuesTable(), $prefix) . " |
|
273 | - on `" . $prefix . "`.`contentid`=`c`.`id` AND `" . $prefix . "`.`tmplvarid`=" . $TVnames[$item[0]]; |
|
272 | + $table .= " LEFT JOIN ".$this->DocLister->getTable($this->tvValuesTable(), $prefix)." |
|
273 | + on `" . $prefix."`.`contentid`=`c`.`id` AND `".$prefix."`.`tmplvarid`=".$TVnames[$item[0]]; |
|
274 | 274 | } |
275 | 275 | if (in_array($item[0], $withDefault)) { |
276 | 276 | $exists = $this->DocLister->checkTableAlias($item[0], "site_tmplvars"); |
277 | 277 | $dPrefix = $this->storeTable ? $this->DocLister->TableAlias($item[0], "site_tmplvars", |
278 | - 'd_' . $prefix) : 'd_' . $prefix; |
|
278 | + 'd_'.$prefix) : 'd_'.$prefix; |
|
279 | 279 | if (!$exists) { |
280 | - $table .= " LEFT JOIN " . $this->DocLister->getTable("site_tmplvars", |
|
281 | - $dPrefix) . " on `" . $dPrefix . "`.`id` = " . $TVnames[$item[0]]; |
|
280 | + $table .= " LEFT JOIN ".$this->DocLister->getTable("site_tmplvars", |
|
281 | + $dPrefix)." on `".$dPrefix."`.`id` = ".$TVnames[$item[0]]; |
|
282 | 282 | } |
283 | 283 | $field = "IFNULL(`{$prefix}`.`value`, `{$dPrefix}`.`default_text`)"; |
284 | 284 | } else { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | $item = implode(" ", $item); |
290 | 290 | } |
291 | - $sort = "ORDER BY " . implode(",", $matches); |
|
291 | + $sort = "ORDER BY ".implode(",", $matches); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | return array($table, $sort); |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | * Обработка TV параметров перед выводом |
11 | 11 | * |
12 | 12 | */ |
13 | -class tv_DL_Extender extends extDocLister |
|
14 | -{ |
|
13 | +class tv_DL_Extender extends extDocLister |
|
14 | +{ |
|
15 | 15 | /** |
16 | 16 | * @var mixed|string |
17 | 17 | */ |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * @param DocLister $DocLister |
33 | 33 | * @param $name |
34 | 34 | */ |
35 | - public function __construct($DocLister, $name) |
|
36 | - { |
|
35 | + public function __construct($DocLister, $name) |
|
36 | + { |
|
37 | 37 | parent::__construct($DocLister, $name); |
38 | - if (!isset($this->modx->_TVnames)) { |
|
38 | + if (!isset($this->modx->_TVnames)) { |
|
39 | 39 | $this->modx->_TVnames = array(); |
40 | 40 | } |
41 | 41 | $this->tvValuesTable = $this->DocLister->getCFGDef('tvValuesTable', $this->tvValuesTable()); |
@@ -45,26 +45,26 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @return bool |
47 | 47 | */ |
48 | - protected function run() |
|
49 | - { |
|
48 | + protected function run() |
|
49 | + { |
|
50 | 50 | return true; |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @return mixed|string |
55 | 55 | */ |
56 | - public function tvValuesTable() |
|
57 | - { |
|
56 | + public function tvValuesTable() |
|
57 | + { |
|
58 | 58 | return $this->tvValuesTable; |
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @return mixed |
63 | 63 | */ |
64 | - public function getTVnames() |
|
65 | - { |
|
64 | + public function getTVnames() |
|
65 | + { |
|
66 | 66 | $out = array(); |
67 | - foreach ($this->modx->_TVnames as $name => $tv) { |
|
67 | + foreach ($this->modx->_TVnames as $name => $tv) { |
|
68 | 68 | $out[$name] = $tv['id']; |
69 | 69 | } |
70 | 70 | |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | * @param bool $reload |
76 | 76 | * @return mixed |
77 | 77 | */ |
78 | - public function getAllTV_Name($reload = false) |
|
79 | - { |
|
80 | - if (empty($this->modx->_TVnames) || $reload) { |
|
78 | + public function getAllTV_Name($reload = false) |
|
79 | + { |
|
80 | + if (empty($this->modx->_TVnames) || $reload) { |
|
81 | 81 | $from = $this->DocLister->getTable('site_tmplvars'); |
82 | 82 | $rs = $this->DocLister->dbQuery("SELECT `id`, `name`, `type` FROM {$from}"); |
83 | 83 | $rows = $this->modx->db->makeArray($rs); |
84 | 84 | |
85 | - foreach ($rows as $item) { |
|
85 | + foreach ($rows as $item) { |
|
86 | 86 | $this->modx->_TVnames[$item['name']] = array( |
87 | 87 | "id" => $item['id'], |
88 | 88 | "type" => $item['type'] |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @param $tvlist |
99 | 99 | * @return array |
100 | 100 | */ |
101 | - public function getTVList($IDs, $tvlist) |
|
102 | - { |
|
101 | + public function getTVList($IDs, $tvlist) |
|
102 | + { |
|
103 | 103 | $out = array(); |
104 | 104 | $tv = $this->getTVid($tvlist); |
105 | - if (empty($tv)) { |
|
105 | + if (empty($tv)) { |
|
106 | 106 | return $out; |
107 | 107 | } |
108 | 108 | $tvId = array_keys($tv); |
@@ -114,24 +114,24 @@ discard block |
||
114 | 114 | $rows = $this->modx->db->makeArray($rs); |
115 | 115 | $tvPrefix = $this->_TVprefix; |
116 | 116 | |
117 | - foreach ($rows as $item) { |
|
117 | + foreach ($rows as $item) { |
|
118 | 118 | $out[$item['contentid']][$tvPrefix . $tv[$item['tmplvarid']]] = $item['value']; |
119 | 119 | } |
120 | 120 | $tmp = explode(",", $this->DocLister->sanitarIn($IDs, ',', false)); |
121 | - foreach ($tmp as $item) { |
|
122 | - if (!isset($out[$item])) { |
|
121 | + foreach ($tmp as $item) { |
|
122 | + if (!isset($out[$item])) { |
|
123 | 123 | $out[$item] = array(); |
124 | 124 | }; |
125 | 125 | } |
126 | 126 | $renderTV = $this->getListRenderTV(); |
127 | 127 | $tvDef = $this->loadTVDefault($tvId); |
128 | 128 | $TVkeys = array_keys($tvDef); |
129 | - foreach ($out as $itemid => $item) { |
|
130 | - foreach ($TVkeys as $name) { |
|
131 | - if (!isset($out[$itemid][$name])) { |
|
129 | + foreach ($out as $itemid => $item) { |
|
130 | + foreach ($TVkeys as $name) { |
|
131 | + if (!isset($out[$itemid][$name])) { |
|
132 | 132 | $out[$itemid][$name] = $tvDef[$name]['value']; |
133 | 133 | } |
134 | - if (in_array($name, $renderTV) || $renderTV == array("*")) { |
|
134 | + if (in_array($name, $renderTV) || $renderTV == array("*")) { |
|
135 | 135 | $out[$itemid][$name] = $this->renderTV($itemid, $name, $out[$itemid][$name], $tvDef[$name]); |
136 | 136 | } |
137 | 137 | } |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * @return mixed|string |
145 | 145 | */ |
146 | - public function getTVprefix() |
|
147 | - { |
|
146 | + public function getTVprefix() |
|
147 | + { |
|
148 | 148 | $tvPrefix = $this->DocLister->getCFGDef('tvPrefix', 'tv'); |
149 | - if (!empty($tvPrefix)) { |
|
149 | + if (!empty($tvPrefix)) { |
|
150 | 150 | $tvPrefix .= '.'; |
151 | 151 | } |
152 | 152 | |
@@ -156,21 +156,21 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * @return array|mixed |
158 | 158 | */ |
159 | - public function getListRenderTV() |
|
160 | - { |
|
159 | + public function getListRenderTV() |
|
160 | + { |
|
161 | 161 | $tmp = $this->DocLister->getCFGDef('renderTV', ''); |
162 | - if ($tmp != '' && $tmp != '*') { |
|
162 | + if ($tmp != '' && $tmp != '*') { |
|
163 | 163 | $tmp = explode(",", $tmp); |
164 | - if (in_array("*", $tmp)) { |
|
164 | + if (in_array("*", $tmp)) { |
|
165 | 165 | $tmp = array("*"); |
166 | - } else { |
|
166 | + } else { |
|
167 | 167 | $out = array_unique($tmp); |
168 | 168 | $tmp = array(); |
169 | - foreach ($out as $item) { |
|
169 | + foreach ($out as $item) { |
|
170 | 170 | $tmp[] = $this->_TVprefix . $item; |
171 | 171 | } |
172 | 172 | } |
173 | - } else { |
|
173 | + } else { |
|
174 | 174 | $tmp = array($tmp); |
175 | 175 | } |
176 | 176 | |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | * @param $param |
185 | 185 | * @return mixed |
186 | 186 | */ |
187 | - public function renderTV($iddoc, $tvname, $tvval, $param) |
|
188 | - { |
|
187 | + public function renderTV($iddoc, $tvname, $tvval, $param) |
|
188 | + { |
|
189 | 189 | include_once MODX_MANAGER_PATH . "includes/tmplvars.format.inc.php"; |
190 | 190 | include_once MODX_MANAGER_PATH . "includes/tmplvars.commands.inc.php"; |
191 | 191 | |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | * @param $tvlist |
198 | 198 | * @return array |
199 | 199 | */ |
200 | - public function getTVid($tvlist) |
|
201 | - { |
|
202 | - if (!empty($tvlist) && is_scalar($tvlist)) { |
|
200 | + public function getTVid($tvlist) |
|
201 | + { |
|
202 | + if (!empty($tvlist) && is_scalar($tvlist)) { |
|
203 | 203 | $tvlist = explode(",", $tvlist); |
204 | 204 | } |
205 | 205 | $out = array(); |
206 | - foreach ($tvlist as $tv) { |
|
206 | + foreach ($tvlist as $tv) { |
|
207 | 207 | $tv = trim($tv); |
208 | - if (isset($this->modx->_TVnames[$tv])) { |
|
208 | + if (isset($this->modx->_TVnames[$tv])) { |
|
209 | 209 | $out[$this->modx->_TVnames[$tv]['id']] = $tv; |
210 | 210 | } |
211 | 211 | } |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | * @param $tvId |
218 | 218 | * @return array |
219 | 219 | */ |
220 | - public function loadTVDefault($tvId) |
|
221 | - { |
|
220 | + public function loadTVDefault($tvId) |
|
221 | + { |
|
222 | 222 | $tbl_site_tmplvars = $this->DocLister->getTable('site_tmplvars'); |
223 | 223 | $fields = 'id,name,default_text as value,display,display_params,type'; |
224 | 224 | $implodeTvId = implode(',', $tvId); |
225 | 225 | $rs = $this->DocLister->dbQuery("SELECT {$fields} FROM {$tbl_site_tmplvars} WHERE id IN({$implodeTvId})"); |
226 | 226 | $rows = $this->modx->db->makeArray($rs); |
227 | 227 | $out = array(); |
228 | - foreach ($rows as $item) { |
|
228 | + foreach ($rows as $item) { |
|
229 | 229 | $out[$this->_TVprefix . $item['name']] = $item; |
230 | 230 | } |
231 | 231 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @param $name |
237 | 237 | * @return string |
238 | 238 | */ |
239 | - public function addTVSortWithDefault($name) |
|
240 | - { |
|
239 | + public function addTVSortWithDefault($name) |
|
240 | + { |
|
241 | 241 | $dTV = explode(',', $this->DocLister->getCFGDef('tvSortWithDefault', '')); |
242 | 242 | $dTV[] = $name; |
243 | 243 | $tvList = implode(",", array_unique($dTV)); |
@@ -251,37 +251,37 @@ discard block |
||
251 | 251 | * @param $sort |
252 | 252 | * @return array |
253 | 253 | */ |
254 | - public function injectSortByTV($table, $sort) |
|
255 | - { |
|
256 | - if (preg_match("/^ORDER BY (.*)/", $sort, $match)) { |
|
254 | + public function injectSortByTV($table, $sort) |
|
255 | + { |
|
256 | + if (preg_match("/^ORDER BY (.*)/", $sort, $match)) { |
|
257 | 257 | $TVnames = $this->getTVnames(); |
258 | - if (!is_array($TVnames)) { |
|
258 | + if (!is_array($TVnames)) { |
|
259 | 259 | $TVnames = array(); |
260 | 260 | } |
261 | 261 | $matches = explode(",", $match[1]); |
262 | 262 | $sortType = explode(",", $this->DocLister->getCFGDef('tvSortType')); |
263 | 263 | $withDefault = explode(",", $this->DocLister->getCFGDef('tvSortWithDefault')); |
264 | - foreach ($matches as $i => &$item) { |
|
264 | + foreach ($matches as $i => &$item) { |
|
265 | 265 | $item = explode(" ", trim($item), 2); |
266 | - if (isset($TVnames[$item[0]])) { |
|
266 | + if (isset($TVnames[$item[0]])) { |
|
267 | 267 | $exists = $this->DocLister->checkTableAlias($item[0], $this->tvValuesTable()); |
268 | 268 | $prefix = 'dltv_' . $item[0] . '_' . ($i + 1); |
269 | 269 | $prefix = $this->storeTable ? $this->DocLister->TableAlias($item[0], $this->tvValuesTable(), |
270 | 270 | $prefix) : $prefix; |
271 | - if (!$exists) { |
|
271 | + if (!$exists) { |
|
272 | 272 | $table .= " LEFT JOIN " . $this->DocLister->getTable($this->tvValuesTable(), $prefix) . " |
273 | 273 | on `" . $prefix . "`.`contentid`=`c`.`id` AND `" . $prefix . "`.`tmplvarid`=" . $TVnames[$item[0]]; |
274 | 274 | } |
275 | - if (in_array($item[0], $withDefault)) { |
|
275 | + if (in_array($item[0], $withDefault)) { |
|
276 | 276 | $exists = $this->DocLister->checkTableAlias($item[0], "site_tmplvars"); |
277 | 277 | $dPrefix = $this->storeTable ? $this->DocLister->TableAlias($item[0], "site_tmplvars", |
278 | 278 | 'd_' . $prefix) : 'd_' . $prefix; |
279 | - if (!$exists) { |
|
279 | + if (!$exists) { |
|
280 | 280 | $table .= " LEFT JOIN " . $this->DocLister->getTable("site_tmplvars", |
281 | 281 | $dPrefix) . " on `" . $dPrefix . "`.`id` = " . $TVnames[$item[0]]; |
282 | 282 | } |
283 | 283 | $field = "IFNULL(`{$prefix}`.`value`, `{$dPrefix}`.`default_text`)"; |
284 | - } else { |
|
284 | + } else { |
|
285 | 285 | $field = "`{$prefix}`.`value`"; |
286 | 286 | } |
287 | 287 | $item[0] = $this->DocLister->changeSortType($field, isset($sortType[$i]) ? $sortType[$i] : null); |
@@ -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 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | $where = sqlHelper::trimLogicalOp($where); |
297 | 297 | |
298 | - $where = "WHERE {$where}"; |
|
298 | + $where = "where {$where}"; |
|
299 | 299 | $whereArr = array(); |
300 | 300 | if (!$this->getCFGDef('showNoPublish', 0)) { |
301 | 301 | $whereArr[] = "c.deleted=0 AND c.published=1"; |
@@ -388,15 +388,15 @@ discard block |
||
388 | 388 | |
389 | 389 | if ($this->getCFGDef('showNoPublish', 0)) { |
390 | 390 | if ($where != '') { |
391 | - $where = "WHERE {$where}"; |
|
391 | + $where = "where {$where}"; |
|
392 | 392 | } else { |
393 | 393 | $where = ''; |
394 | 394 | } |
395 | 395 | } else { |
396 | 396 | if ($where != '') { |
397 | - $where = "WHERE {$where} AND "; |
|
397 | + $where = "where {$where} AND "; |
|
398 | 398 | } else { |
399 | - $where = "WHERE {$where} "; |
|
399 | + $where = "where {$where} "; |
|
400 | 400 | } |
401 | 401 | $where .= "c.deleted=0 AND c.published=1"; |
402 | 402 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | |
411 | 411 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0)); |
412 | 412 | |
413 | - $rs = $this->dbQuery("SELECT {$fields} FROM {$tbl_site_content} {$where} {$group} {$sort} {$limit}"); |
|
413 | + $rs = $this->dbQuery("select {$fields} FROM {$tbl_site_content} {$where} {$group} {$sort} {$limit}"); |
|
414 | 414 | |
415 | 415 | while ($item = $this->modx->db->getRow($rs)) { |
416 | 416 | $out[$item['id']] = $item; |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | $tbl_site_content = $this->getTable('site_content', 'c'); |
437 | 437 | $sanitarInIDs = $this->sanitarIn($id); |
438 | 438 | if ($this->getCFGDef('showNoPublish', 0)) { |
439 | - $where = "WHERE {$where} c.parent IN ({$sanitarInIDs}) AND c.isfolder=1"; |
|
439 | + $where = "where {$where} c.parent IN ({$sanitarInIDs}) AND c.isfolder=1"; |
|
440 | 440 | } else { |
441 | - $where = "WHERE {$where} c.parent IN ({$sanitarInIDs}) AND c.deleted=0 AND c.published=1 AND c.isfolder=1"; |
|
441 | + $where = "where {$where} c.parent IN ({$sanitarInIDs}) AND c.deleted=0 AND c.published=1 AND c.isfolder=1"; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | $rs = $this->dbQuery("SELECT id FROM {$tbl_site_content} {$where}"); |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
529 | 529 | |
530 | 530 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
531 | - $rs = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " . |
|
531 | + $rs = $this->dbQuery("select {$fields} FROM " . $from . " " . $where . " " . |
|
532 | 532 | $group . " " . |
533 | 533 | $sort . " " . |
534 | 534 | $this->LimitSQL($this->getCFGDef('queryLimit', 0)) |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if (!$item[$date] && $date == 'pub_date' && isset($item['createdon'])) { |
142 | 142 | $date = 'createdon'; |
143 | 143 | } |
144 | - $_date = is_numeric($item[$date]) && $item[$date] == (int)$item[$date] ? $item[$date] : strtotime($item[$date]); |
|
144 | + $_date = is_numeric($item[$date]) && $item[$date] == (int) $item[$date] ? $item[$date] : strtotime($item[$date]); |
|
145 | 145 | if ($_date !== false) { |
146 | 146 | $_date = $_date + $this->modx->config['server_offset_time']; |
147 | 147 | $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | if ($this->getCFGDef('contentPlaceholder', 0) !== 0) { |
174 | 174 | $this->toPlaceholders($tmp, 1, |
175 | - "item[" . $i . "]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
175 | + "item[".$i."]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
176 | 176 | } |
177 | 177 | $out .= $tmp; |
178 | 178 | if (next($this->_docs) !== false) { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if (!$row[$date] && $date == 'pub_date' && isset($row['createdon'])) { |
227 | 227 | $date = 'createdon'; |
228 | 228 | } |
229 | - $_date = is_numeric($row[$date]) && $row[$date] == (int)$row[$date] ? $row[$date] : strtotime($row[$date]); |
|
229 | + $_date = is_numeric($row[$date]) && $row[$date] == (int) $row[$date] ? $row[$date] : strtotime($row[$date]); |
|
230 | 230 | if ($_date !== false) { |
231 | 231 | $_date = $_date + $this->modx->config['server_offset_time']; |
232 | 232 | $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $row['title'] = empty($row['menutitle']) ? $row['pagetitle'] : $row['menutitle']; |
243 | 243 | } |
244 | 244 | } |
245 | - if ((bool)$this->getCFGDef('makeUrl', 1) && (array('1') == $fields || in_array('url',$fields)) |
|
245 | + if ((bool) $this->getCFGDef('makeUrl', 1) && (array('1') == $fields || in_array('url', $fields)) |
|
246 | 246 | ) { |
247 | 247 | if (isset($row['type']) && $row['type'] == 'reference' && isset($row['content'])) { |
248 | 248 | $row['url'] = is_numeric($row['content']) ? $this->modx->makeUrl($row['content'], '', '', |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $q_true = $q_true ? $q_true : $this->getCFGDef('idType', 'parents') == 'parents'; |
282 | 282 | $where = $this->getCFGDef('addWhereList', ''); |
283 | 283 | $where = sqlHelper::trimLogicalOp($where); |
284 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
284 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
285 | 285 | if ($where != '' && $this->_filters['where'] != '') { |
286 | 286 | $where .= " AND "; |
287 | 287 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | if (!$this->getCFGDef('showNoPublish', 0)) { |
293 | 293 | $whereArr[] = "c.deleted=0 AND c.published=1"; |
294 | 294 | } |
295 | - else{ |
|
295 | + else { |
|
296 | 296 | $q_true = 1; |
297 | 297 | } |
298 | 298 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | case 'parents': |
304 | 304 | switch ($this->getCFGDef('showParent', '0')) { |
305 | 305 | case '-1': |
306 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")"; |
|
306 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.")"; |
|
307 | 307 | break; |
308 | 308 | case 0: |
309 | 309 | $tmpWhere = "c.parent IN ({$sanitarInIDs}) AND c.id NOT IN({$sanitarInIDs})"; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } |
316 | 316 | if (($addDocs = $this->getCFGDef('documents', '')) != '') { |
317 | 317 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
318 | - $whereArr[] = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))"; |
|
318 | + $whereArr[] = "((".$tmpWhere.") OR c.id IN({$addDocs}))"; |
|
319 | 319 | } else { |
320 | 320 | $whereArr[] = $tmpWhere; |
321 | 321 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | break; |
327 | 327 | } |
328 | 328 | } |
329 | - $from = $tbl_site_content . " " . $this->_filters['join']; |
|
329 | + $from = $tbl_site_content." ".$this->_filters['join']; |
|
330 | 330 | $where = sqlHelper::trimLogicalOp($where); |
331 | 331 | |
332 | 332 | $q_true = $q_true ? $q_true : trim($where) != 'WHERE'; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id')); |
345 | 345 | |
346 | 346 | $q_true = $q_true ? $q_true : $group != ''; |
347 | - if ( $q_true ){ |
|
347 | + if ($q_true) { |
|
348 | 348 | $maxDocs = $this->getCFGDef('maxDocs', 0); |
349 | 349 | $limit = $maxDocs > 0 ? $this->LimitSQL($this->getCFGDef('maxDocs', 0)) : ''; |
350 | 350 | $rs = $this->dbQuery("SELECT count(*) FROM (SELECT count(*) FROM {$from} {$where} {$group} {$limit}) as `tmp`"); |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | $where = $this->getCFGDef('addWhereList', ''); |
370 | 370 | $where = sqlHelper::trimLogicalOp($where); |
371 | 371 | |
372 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
372 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
373 | 373 | $where = sqlHelper::trimLogicalOp($where); |
374 | 374 | |
375 | 375 | $tbl_site_content = $this->getTable('site_content', 'c'); |
376 | 376 | if ($sanitarInIDs != "''") { |
377 | - $where .= ($where ? " AND " : "") . "c.id IN ({$sanitarInIDs}) AND"; |
|
377 | + $where .= ($where ? " AND " : "")."c.id IN ({$sanitarInIDs}) AND"; |
|
378 | 378 | } |
379 | 379 | $where = sqlHelper::trimLogicalOp($where); |
380 | 380 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $fields = $this->getCFGDef('selectFields', 'c.*'); |
398 | 398 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
399 | 399 | $sort = $this->SortOrderSQL("if(c.pub_date=0,c.createdon,c.pub_date)"); |
400 | - list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], |
|
400 | + list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content.' '.$this->_filters['join'], |
|
401 | 401 | $sort); |
402 | 402 | |
403 | 403 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0)); |
@@ -479,21 +479,21 @@ discard block |
||
479 | 479 | $tbl_site_content = $this->getTable('site_content', 'c'); |
480 | 480 | |
481 | 481 | $sort = $this->SortOrderSQL("if(c.pub_date=0,c.createdon,c.pub_date)"); |
482 | - list($from, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], $sort); |
|
482 | + list($from, $sort) = $this->injectSortByTV($tbl_site_content.' '.$this->_filters['join'], $sort); |
|
483 | 483 | $sanitarInIDs = $this->sanitarIn($this->IDs); |
484 | 484 | |
485 | 485 | $tmpWhere = null; |
486 | 486 | if ($sanitarInIDs != "''") { |
487 | 487 | switch ($this->getCFGDef('showParent', '0')) { |
488 | 488 | case '-1': |
489 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")"; |
|
489 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.")"; |
|
490 | 490 | break; |
491 | 491 | case 0: |
492 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ") AND c.id NOT IN(" . $sanitarInIDs . ")"; |
|
492 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.") AND c.id NOT IN(".$sanitarInIDs.")"; |
|
493 | 493 | break; |
494 | 494 | case 1: |
495 | 495 | default: |
496 | - $tmpWhere = "(c.parent IN (" . $sanitarInIDs . ") OR c.id IN({$sanitarInIDs}))"; |
|
496 | + $tmpWhere = "(c.parent IN (".$sanitarInIDs.") OR c.id IN({$sanitarInIDs}))"; |
|
497 | 497 | break; |
498 | 498 | } |
499 | 499 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | if (empty($tmpWhere)) { |
503 | 503 | $tmpWhere = "c.id IN({$addDocs})"; |
504 | 504 | } else { |
505 | - $tmpWhere = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))"; |
|
505 | + $tmpWhere = "((".$tmpWhere.") OR c.id IN({$addDocs}))"; |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | if (!empty($tmpWhere)) { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $where[] = "c.deleted=0 AND c.published=1"; |
513 | 513 | } |
514 | 514 | if (!empty($where)) { |
515 | - $where = "WHERE " . implode(" AND ", $where); |
|
515 | + $where = "WHERE ".implode(" AND ", $where); |
|
516 | 516 | } else { |
517 | 517 | $where = ''; |
518 | 518 | } |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
521 | 521 | |
522 | 522 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
523 | - $rs = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " . |
|
524 | - $group . " " . |
|
525 | - $sort . " " . |
|
523 | + $rs = $this->dbQuery("SELECT {$fields} FROM ".$from." ".$where." ". |
|
524 | + $group." ". |
|
525 | + $sort." ". |
|
526 | 526 | $this->LimitSQL($this->getCFGDef('queryLimit', 0)) |
527 | 527 | ); |
528 | 528 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $type = trim($type); |
545 | 545 | switch (strtoupper($type)) { |
546 | 546 | case 'TVDATETIME': |
547 | - $field = "STR_TO_DATE(" . $field . ",'%d-%m-%Y %H:%i:%s')"; |
|
547 | + $field = "STR_TO_DATE(".$field.",'%d-%m-%Y %H:%i:%s')"; |
|
548 | 548 | break; |
549 | 549 | default: |
550 | 550 | $field = parent::changeSortType($field, $type); |
@@ -291,8 +291,7 @@ discard block |
||
291 | 291 | $whereArr = array(); |
292 | 292 | if (!$this->getCFGDef('showNoPublish', 0)) { |
293 | 293 | $whereArr[] = "c.deleted=0 AND c.published=1"; |
294 | - } |
|
295 | - else{ |
|
294 | + } else { |
|
296 | 295 | $q_true = 1; |
297 | 296 | } |
298 | 297 | |
@@ -344,13 +343,12 @@ discard block |
||
344 | 343 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id')); |
345 | 344 | |
346 | 345 | $q_true = $q_true ? $q_true : $group != ''; |
347 | - if ( $q_true ){ |
|
346 | + if ( $q_true ) { |
|
348 | 347 | $maxDocs = $this->getCFGDef('maxDocs', 0); |
349 | 348 | $limit = $maxDocs > 0 ? $this->LimitSQL($this->getCFGDef('maxDocs', 0)) : ''; |
350 | 349 | $rs = $this->dbQuery("SELECT count(*) FROM (SELECT count(*) FROM {$from} {$where} {$group} {$limit}) as `tmp`"); |
351 | 350 | $out = $this->modx->db->getValue($rs); |
352 | - } |
|
353 | - else { |
|
351 | + } else { |
|
354 | 352 | $out = count($this->IDs); |
355 | 353 | } |
356 | 354 | } |
@@ -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 |