@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function get($id) |
49 | 49 | { |
50 | - if ((int)$id > 0) { |
|
51 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id; |
|
50 | + if ((int) $id > 0) { |
|
51 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id; |
|
52 | 52 | if (!$result = $this->db->query($sql)) { |
53 | 53 | return false; |
54 | 54 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // $faq->setError($this->db->error()); |
165 | 165 | |
166 | 166 | |
167 | - trigger_error('Class ' . $faq . ' could not be saved ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING); |
|
167 | + trigger_error('Class '.$faq.' could not be saved '.__FILE__.' at line '.__LINE__, E_USER_WARNING); |
|
168 | 168 | |
169 | 169 | return false; |
170 | 170 | } |
@@ -230,26 +230,26 @@ discard block |
||
230 | 230 | { |
231 | 231 | $ret = []; |
232 | 232 | $limit = $start = 0; |
233 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq'); |
|
233 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq'); |
|
234 | 234 | |
235 | 235 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
236 | 236 | $whereClause = $criteria->renderWhere(); |
237 | 237 | |
238 | 238 | if ('WHERE ()' !== $whereClause) { |
239 | - $sql .= ' ' . $criteria->renderWhere(); |
|
239 | + $sql .= ' '.$criteria->renderWhere(); |
|
240 | 240 | if (!empty($notNullFields)) { |
241 | 241 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
242 | 242 | } |
243 | 243 | } elseif (!empty($notNullFields)) { |
244 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
244 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
245 | 245 | } |
246 | 246 | if ('' != $criteria->getSort()) { |
247 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
247 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
248 | 248 | } |
249 | 249 | $limit = $criteria->getLimit(); |
250 | 250 | $start = $criteria->getStart(); |
251 | 251 | } elseif (!empty($notNullFields)) { |
252 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
252 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | //echo "<br>" . $sql . "<br>"; |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | $faq->assignVars($myrow); |
269 | 269 | |
270 | 270 | if (!$id_as_key) { |
271 | - $ret[] =& $faq; |
|
271 | + $ret[] = & $faq; |
|
272 | 272 | } else { |
273 | - $ret[$myrow['faqid']] =& $faq; |
|
273 | + $ret[$myrow['faqid']] = & $faq; |
|
274 | 274 | } |
275 | 275 | unset($faq); |
276 | 276 | } |
@@ -310,26 +310,26 @@ discard block |
||
310 | 310 | faq.modulelink AS modulelink, |
311 | 311 | faq.contextpage AS contextpage, |
312 | 312 | faq.exacturl AS exacturl |
313 | - FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid '; |
|
313 | + FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid '; |
|
314 | 314 | |
315 | 315 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
316 | 316 | $whereClause = $criteria->renderWhere(); |
317 | 317 | |
318 | 318 | if ('WHERE ()' !== $whereClause) { |
319 | - $sql .= ' ' . $criteria->renderWhere(); |
|
319 | + $sql .= ' '.$criteria->renderWhere(); |
|
320 | 320 | if (!empty($notNullFields)) { |
321 | 321 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
322 | 322 | } |
323 | 323 | } elseif (!empty($notNullFields)) { |
324 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
324 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
325 | 325 | } |
326 | 326 | if ('' != $criteria->getSort()) { |
327 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
327 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
328 | 328 | } |
329 | 329 | $limit = $criteria->getLimit(); |
330 | 330 | $start = $criteria->getStart(); |
331 | 331 | } elseif (!empty($notNullFields)) { |
332 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
332 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | //echo "<br>" . $sql . "<br>"; |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | $faq->assignVars($myrow); |
348 | 348 | |
349 | 349 | if (!$id_as_key) { |
350 | - $ret[] =& $faq; |
|
350 | + $ret[] = & $faq; |
|
351 | 351 | } else { |
352 | - $ret[$myrow['faqid']] =& $faq; |
|
352 | + $ret[$myrow['faqid']] = & $faq; |
|
353 | 353 | } |
354 | 354 | unset($faq); |
355 | 355 | } |
@@ -379,19 +379,19 @@ discard block |
||
379 | 379 | */ |
380 | 380 | public function getCount($criteria = null, $notNullFields = '') |
381 | 381 | { |
382 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq'); |
|
382 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq'); |
|
383 | 383 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
384 | 384 | $whereClause = $criteria->renderWhere(); |
385 | 385 | if ('WHERE ()' !== $whereClause) { |
386 | - $sql .= ' ' . $criteria->renderWhere(); |
|
386 | + $sql .= ' '.$criteria->renderWhere(); |
|
387 | 387 | if (!empty($notNullFields)) { |
388 | 388 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
389 | 389 | } |
390 | 390 | } elseif (!empty($notNullFields)) { |
391 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
391 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
392 | 392 | } |
393 | 393 | } elseif (!empty($notNullFields)) { |
394 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
394 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | //echo "<br>" . $sql . "<br>"; |
@@ -425,11 +425,11 @@ discard block |
||
425 | 425 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
426 | 426 | |
427 | 427 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
428 | - $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
428 | + $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
429 | 429 | |
430 | 430 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
431 | 431 | $grantedFaq = new \CriteriaCompo(); |
432 | - $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
432 | + $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
433 | 433 | // If user is anonymous, check if the FAQ allow partialview |
434 | 434 | if (!is_object($xoopsUser)) { |
435 | 435 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | */ |
477 | 477 | public function getFaqsCountByStatus() |
478 | 478 | { |
479 | - $sql = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status'; |
|
479 | + $sql = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status'; |
|
480 | 480 | $result = $this->db->query($sql); |
481 | 481 | if (!$result) { |
482 | 482 | return []; |
@@ -546,11 +546,11 @@ discard block |
||
546 | 546 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
547 | 547 | |
548 | 548 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
549 | - $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
549 | + $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
550 | 550 | |
551 | 551 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
552 | 552 | $grantedFaq = new \CriteriaCompo(); |
553 | - $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
553 | + $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
554 | 554 | // If user is anonymous, check if the FAQ allow partialview |
555 | 555 | if (!is_object($xoopsUser)) { |
556 | 556 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
@@ -559,9 +559,9 @@ discard block |
||
559 | 559 | |
560 | 560 | if (isset($categoryid) && (-1 != $categoryid)) { |
561 | 561 | if (is_array($categoryid)) { |
562 | - $criteriaCategory = new \Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN'); |
|
562 | + $criteriaCategory = new \Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN'); |
|
563 | 563 | } else { |
564 | - $criteriaCategory = new \Criteria('categoryid', (int)$categoryid); |
|
564 | + $criteriaCategory = new \Criteria('categoryid', (int) $categoryid); |
|
565 | 565 | } |
566 | 566 | } |
567 | 567 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $criteria->setStart($start); |
603 | 603 | $criteria->setSort($sort); |
604 | 604 | $criteria->setOrder($order); |
605 | - $ret =& $this->getObjects($criteria, false, $notNullFields); |
|
605 | + $ret = & $this->getObjects($criteria, false, $notNullFields); |
|
606 | 606 | |
607 | 607 | return $ret; |
608 | 608 | } |
@@ -687,11 +687,11 @@ discard block |
||
687 | 687 | |
688 | 688 | if ($totalFaqs > 0) { |
689 | 689 | --$totalFaqs; |
690 | - mt_srand((double)microtime() * 1000000); |
|
690 | + mt_srand((double) microtime() * 1000000); |
|
691 | 691 | $entrynumber = mt_rand(0, $totalFaqs); |
692 | 692 | $faq = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields); |
693 | 693 | if ($faq) { |
694 | - $ret =& $faq[0]; |
|
694 | + $ret = & $faq[0]; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | |
@@ -722,10 +722,10 @@ discard block |
||
722 | 722 | $httphost = $_SERVER['HTTP_HOST']; |
723 | 723 | $querystring = $_SERVER['QUERY_STRING']; |
724 | 724 | if ('' != $querystring) { |
725 | - $querystring = '?' . $querystring; |
|
725 | + $querystring = '?'.$querystring; |
|
726 | 726 | } |
727 | - $currenturl = $http . $httphost . $phpself . $querystring; |
|
728 | - $fullcontexturl = XOOPS_URL . '/' . $iValue->contextpage(); |
|
727 | + $currenturl = $http.$httphost.$phpself.$querystring; |
|
728 | + $fullcontexturl = XOOPS_URL.'/'.$iValue->contextpage(); |
|
729 | 729 | switch ($iValue->modulelink()) { |
730 | 730 | case '': |
731 | 731 | $display = false; |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | } |
745 | 745 | break; |
746 | 746 | default: |
747 | - if (false === strpos($currenturl, XOOPS_URL . '/modules/')) { |
|
747 | + if (false === strpos($currenturl, XOOPS_URL.'/modules/')) { |
|
748 | 748 | $display = false; |
749 | 749 | } else { |
750 | 750 | if (false === strpos($currenturl, $iValue->modulelink())) { |
@@ -756,19 +756,19 @@ discard block |
||
756 | 756 | break; |
757 | 757 | } |
758 | 758 | if ($display) { |
759 | - $randomFaqs[] =& $faqsObj[$i]; |
|
759 | + $randomFaqs[] = & $faqsObj[$i]; |
|
760 | 760 | } |
761 | 761 | } |
762 | 762 | } |
763 | 763 | |
764 | 764 | if (count($randomFaqs) > $limit) { |
765 | - mt_srand((float)microtime() * 10000000); |
|
765 | + mt_srand((float) microtime() * 10000000); |
|
766 | 766 | $rand_keys = array_rand($randomFaqs, $limit); |
767 | 767 | for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) { |
768 | - $ret[] =& $randomFaqs[$rand_keys[$j]]; |
|
768 | + $ret[] = & $randomFaqs[$rand_keys[$j]]; |
|
769 | 769 | } |
770 | 770 | } else { |
771 | - $ret =& $randomFaqs; |
|
771 | + $ret = & $randomFaqs; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | return $ret; |
@@ -786,14 +786,14 @@ discard block |
||
786 | 786 | /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */ |
787 | 787 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
788 | 788 | $items = $smartPermHandler->getPermissions('item'); |
789 | - $faqclause = ' AND faqid IN (' . implode(',', $items) . ')'; |
|
789 | + $faqclause = ' AND faqid IN ('.implode(',', $items).')'; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | $sql = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);"; |
793 | - $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;'; |
|
794 | - $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;"; |
|
795 | - $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp |
|
796 | - WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;'; |
|
793 | + $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;'; |
|
794 | + $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;"; |
|
795 | + $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp |
|
796 | + WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;'; |
|
797 | 797 | /* |
798 | 798 | //Old implementation |
799 | 799 | $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")." |
@@ -808,14 +808,14 @@ discard block |
||
808 | 808 | $this->db->queryF('UNLOCK TABLES;'); |
809 | 809 | $this->db->queryF('DROP TABLE tmp;'); |
810 | 810 | if (!$result) { |
811 | - trigger_error('Error in getLastPublishedByCat SQL: ' . $error); |
|
811 | + trigger_error('Error in getLastPublishedByCat SQL: '.$error); |
|
812 | 812 | |
813 | 813 | return $ret; |
814 | 814 | } |
815 | 815 | while ($row = $this->db->fetchArray($result)) { |
816 | 816 | $faq = new Smartfaq\Faq(); |
817 | 817 | $faq->assignVars($row); |
818 | - $ret[$row['categoryid']] =& $faq; |
|
818 | + $ret[$row['categoryid']] = & $faq; |
|
819 | 819 | unset($faq); |
820 | 820 | } |
821 | 821 | |
@@ -830,9 +830,9 @@ discard block |
||
830 | 830 | */ |
831 | 831 | public function deleteAll($criteria = null) |
832 | 832 | { |
833 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq'); |
|
833 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq'); |
|
834 | 834 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
835 | - $sql .= ' ' . $criteria->renderWhere(); |
|
835 | + $sql .= ' '.$criteria->renderWhere(); |
|
836 | 836 | } |
837 | 837 | if (!$this->db->query($sql)) { |
838 | 838 | return false; |
@@ -853,10 +853,10 @@ discard block |
||
853 | 853 | **/ |
854 | 854 | public function updateAll($fieldname, $fieldvalue, $criteria = null) |
855 | 855 | { |
856 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
857 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause; |
|
856 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
857 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause; |
|
858 | 858 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
859 | - $sql .= ' ' . $criteria->renderWhere(); |
|
859 | + $sql .= ' '.$criteria->renderWhere(); |
|
860 | 860 | } |
861 | 861 | if (!$this->db->queryF($sql)) { |
862 | 862 | return false; |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | */ |
872 | 872 | public function updateCounter($faqid) |
873 | 873 | { |
874 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid; |
|
874 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid; |
|
875 | 875 | if ($this->db->queryF($sql)) { |
876 | 876 | return true; |
877 | 877 | } else { |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | $criteriaKeywords = new \CriteriaCompo(); |
928 | 928 | foreach ($queryarray as $iValue) { |
929 | 929 | $criteriaKeyword = new \CriteriaCompo(); |
930 | - $criteriaKeyword->add(new \Criteria('faq.question', '%' . $iValue . '%', 'LIKE'), 'OR'); |
|
931 | - $criteriaKeyword->add(new \Criteria('answer.answer', '%' . $iValue . '%', 'LIKE'), 'OR'); |
|
930 | + $criteriaKeyword->add(new \Criteria('faq.question', '%'.$iValue.'%', 'LIKE'), 'OR'); |
|
931 | + $criteriaKeyword->add(new \Criteria('answer.answer', '%'.$iValue.'%', 'LIKE'), 'OR'); |
|
932 | 932 | $criteriaKeywords->add($criteriaKeyword, $andor); |
933 | 933 | unset($criteriaKeyword); |
934 | 934 | } |
@@ -947,9 +947,9 @@ discard block |
||
947 | 947 | if (!$faqsGranted) { |
948 | 948 | return $ret; |
949 | 949 | } |
950 | - $grantedCategories = new \Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
950 | + $grantedCategories = new \Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
951 | 951 | $grantedFaq = new \CriteriaCompo(); |
952 | - $grantedFaq->add(new \Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
952 | + $grantedFaq->add(new \Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
953 | 953 | // If user is anonymous, check if the FAQ allow partialview |
954 | 954 | if (!is_object($xoopsUser)) { |
955 | 955 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
@@ -995,15 +995,15 @@ discard block |
||
995 | 995 | $criteria->setSort('faq.datesub'); |
996 | 996 | $criteria->setOrder('DESC'); |
997 | 997 | |
998 | - $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_answers') . ' AS answer ON faq.faqid = answer.faqid'; |
|
998 | + $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM '.$this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_answers').' AS answer ON faq.faqid = answer.faqid'; |
|
999 | 999 | |
1000 | 1000 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
1001 | 1001 | $whereClause = $criteria->renderWhere(); |
1002 | 1002 | |
1003 | 1003 | if ('WHERE ()' !== $whereClause) { |
1004 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1004 | + $sql .= ' '.$criteria->renderWhere(); |
|
1005 | 1005 | if ('' != $criteria->getSort()) { |
1006 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
1006 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
1007 | 1007 | } |
1008 | 1008 | $limit = $criteria->getLimit(); |
1009 | 1009 | $start = $criteria->getStart(); |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | while (false !== ($myrow = $this->db->fetchArray($result))) { |
1027 | 1027 | $faq = new Smartfaq\Faq(); |
1028 | 1028 | $faq->assignVars($myrow); |
1029 | - $ret[] =& $faq; |
|
1029 | + $ret[] = & $faq; |
|
1030 | 1030 | unset($faq); |
1031 | 1031 | } |
1032 | 1032 | |
@@ -1042,20 +1042,20 @@ discard block |
||
1042 | 1042 | { |
1043 | 1043 | global $xoopsUser; |
1044 | 1044 | $ret = []; |
1045 | - $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1046 | - if ((int)$cat_id > 0) { |
|
1047 | - $sql .= ' WHERE categoryid = ' . (int)$cat_id; |
|
1048 | - $sql .= ' AND status IN (' . implode(',', $status) . ')'; |
|
1045 | + $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq'); |
|
1046 | + if ((int) $cat_id > 0) { |
|
1047 | + $sql .= ' WHERE categoryid = '.(int) $cat_id; |
|
1048 | + $sql .= ' AND status IN ('.implode(',', $status).')'; |
|
1049 | 1049 | } else { |
1050 | - $sql .= ' WHERE status IN (' . implode(',', $status) . ')'; |
|
1050 | + $sql .= ' WHERE status IN ('.implode(',', $status).')'; |
|
1051 | 1051 | if (!Smartfaq\Utility::userIsAdmin()) { |
1052 | 1052 | /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */ |
1053 | 1053 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
1054 | 1054 | $items = $smartPermHandler->getPermissions('item'); |
1055 | 1055 | if (is_object($xoopsUser)) { |
1056 | - $sql .= ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1056 | + $sql .= ' AND faqid IN ('.implode(',', $items).')'; |
|
1057 | 1057 | } else { |
1058 | - $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)'; |
|
1058 | + $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)'; |
|
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | } |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | return $ret; |
1069 | 1069 | } |
1070 | 1070 | while ($row = $this->db->fetchArray($result)) { |
1071 | - $ret[$row['categoryid']] = (int)$row['count']; |
|
1071 | + $ret[$row['categoryid']] = (int) $row['count']; |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | return $ret; |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function get($id = null, $fields = null) |
50 | 50 | { |
51 | - if ((int)$id > 0) { |
|
52 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
51 | + if ((int) $id > 0) { |
|
52 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id; |
|
53 | 53 | if (!$result = $this->db->query($sql)) { |
54 | 54 | return false; |
55 | 55 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | { |
178 | 178 | $ret = []; |
179 | 179 | $limit = $start = 0; |
180 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers'); |
|
180 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers'); |
|
181 | 181 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
182 | - $sql .= ' ' . $criteria->renderWhere(); |
|
182 | + $sql .= ' '.$criteria->renderWhere(); |
|
183 | 183 | if ('' != $criteria->getSort()) { |
184 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
184 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
185 | 185 | } |
186 | 186 | $limit = $criteria->getLimit(); |
187 | 187 | $start = $criteria->getStart(); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $answer = new Smartfaq\Answer(); |
196 | 196 | $answer->assignVars($myrow); |
197 | 197 | if (!$id_as_key) { |
198 | - $ret[] =& $answer; |
|
198 | + $ret[] = & $answer; |
|
199 | 199 | } else { |
200 | 200 | $ret[$myrow['answerid']] = $answer; |
201 | 201 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $criteria->setOrder($order); |
266 | 266 | $criteria->setLimit($limit); |
267 | 267 | $criteria->setStart($start); |
268 | - $ret =& $this->getObjects($criteria); |
|
268 | + $ret = & $this->getObjects($criteria); |
|
269 | 269 | |
270 | 270 | return $ret; |
271 | 271 | } |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function getCount(\CriteriaElement $criteria = null) |
280 | 280 | { |
281 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
281 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
282 | 282 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
283 | - $sql .= ' ' . $criteria->renderWhere(); |
|
283 | + $sql .= ' '.$criteria->renderWhere(); |
|
284 | 284 | } |
285 | 285 | $result = $this->db->query($sql); |
286 | 286 | if (!$result) { |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function getCountByFAQ($criteria = null) |
301 | 301 | { |
302 | - $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
302 | + $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
303 | 303 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
304 | - $sql .= ' ' . $criteria->renderWhere(); |
|
305 | - $sql .= ' ' . $criteria->getGroupby(); |
|
304 | + $sql .= ' '.$criteria->renderWhere(); |
|
305 | + $sql .= ' '.$criteria->getGroupby(); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | //echo "<br>$sql<br>"; |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) |
331 | 331 | { |
332 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers'); |
|
332 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers'); |
|
333 | 333 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
334 | - $sql .= ' ' . $criteria->renderWhere(); |
|
334 | + $sql .= ' '.$criteria->renderWhere(); |
|
335 | 335 | } |
336 | 336 | if (!$this->db->query($sql)) { |
337 | 337 | return false; |
@@ -351,10 +351,10 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function updateAll($fieldname, $fieldvalue, \CriteriaElement $criteria = null, $force = false) |
353 | 353 | { |
354 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
355 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause; |
|
354 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
355 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause; |
|
356 | 356 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
357 | - $sql .= ' ' . $criteria->renderWhere(); |
|
357 | + $sql .= ' '.$criteria->renderWhere(); |
|
358 | 358 | } |
359 | 359 | //echo "<br>" . $sql . "<br>"; |
360 | 360 | if (!$this->db->queryF($sql)) { |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | public function getLastPublishedByFaq($faqids) |
372 | 372 | { |
373 | 373 | $ret = []; |
374 | - $sql = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . ' |
|
375 | - WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . Constants::SF_AN_STATUS_APPROVED . ' GROUP BY faqid'; |
|
374 | + $sql = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').' |
|
375 | + WHERE faqid IN (' . implode(',', $faqids).') AND status = '.Constants::SF_AN_STATUS_APPROVED.' GROUP BY faqid'; |
|
376 | 376 | $result = $this->db->query($sql); |
377 | 377 | if (!$result) { |
378 | 378 | return $ret; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | while ($row = $this->db->fetchArray($result)) { |
381 | 381 | $answer = new Smartfaq\Answer(); |
382 | 382 | $answer->assignVars($row); |
383 | - $ret[$row['faqid']] =& $answer; |
|
383 | + $ret[$row['faqid']] = & $answer; |
|
384 | 384 | unset($answer); |
385 | 385 | } |
386 | 386 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
14 | 14 | |
15 | -require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
15 | +require_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Class Uploader |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
29 | 29 | |
30 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php'; |
|
31 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php'; |
|
32 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhiddentoken.php'; |
|
33 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php'; |
|
34 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php'; |
|
35 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php'; |
|
30 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; |
|
31 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php'; |
|
32 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhiddentoken.php'; |
|
33 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php'; |
|
34 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php'; |
|
35 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php'; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Renders a form for setting module specific group permissions |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | // $this->XoopsForm($title, 'groupperm_form', XOOPS_URL.'/modules/system/admin/groupperm.php', 'post'); GIJ |
85 | 85 | parent::__construct($title, 'groupperm_form', '', 'post'); |
86 | - $this->_modid = (int)$modid; |
|
86 | + $this->_modid = (int) $modid; |
|
87 | 87 | $this->_permName = $permname; |
88 | 88 | $this->_permDesc = $permdesc; |
89 | 89 | $this->addElement(new \XoopsFormHidden('modid', $this->_modid)); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | } |
163 | 163 | $gpermHandler = xoops_getHandler('groupperm'); |
164 | 164 | $memberHandler = xoops_getHandler('member'); |
165 | - $glist =& $memberHandler->getGroupList(); |
|
165 | + $glist = & $memberHandler->getGroupList(); |
|
166 | 166 | foreach (array_keys($glist) as $i) { |
167 | 167 | // get selected item id(s) for each group |
168 | 168 | $selected = $gpermHandler->getItemIds($this->_permName, $i, $this->_modid); |
169 | - $ele = new Smartfaq\GroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
169 | + $ele = new Smartfaq\GroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected); |
|
170 | 170 | $ele->setOptionTree($this->_itemTree); |
171 | 171 | |
172 | 172 | foreach ($this->_appendix as $key => $append) { |
@@ -193,18 +193,18 @@ discard block |
||
193 | 193 | $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
194 | 194 | $this->addElement($tray); |
195 | 195 | |
196 | - $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br>'; |
|
197 | - $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
198 | - $elements =& $this->getElements(); |
|
196 | + $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br>'; |
|
197 | + $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
198 | + $elements = & $this->getElements(); |
|
199 | 199 | foreach (array_keys($elements) as $i) { |
200 | 200 | if (!is_object($elements[$i])) { |
201 | 201 | $ret .= $elements[$i]; |
202 | 202 | } elseif (!$elements[$i]->isHidden()) { |
203 | - $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
203 | + $ret .= "<tr valign='top' align='left'><td class='head'>".$elements[$i]->getCaption(); |
|
204 | 204 | if ('' != $elements[$i]->getDescription()) { |
205 | - $ret .= '<br><br><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
205 | + $ret .= '<br><br><span style="font-weight: normal;">'.$elements[$i]->getDescription().'</span>'; |
|
206 | 206 | } |
207 | - $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
207 | + $ret .= "</td>\n<td class='even'>\n".$elements[$i]->render()."\n</td></tr>\n"; |
|
208 | 208 | } else { |
209 | 209 | $ret .= $elements[$i]->render(); |
210 | 210 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | public function get($id) |
47 | 47 | { |
48 | 48 | $false = false; |
49 | - if ((int)$id > 0) { |
|
50 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories') . ' WHERE categoryid=' . $id; |
|
49 | + if ((int) $id > 0) { |
|
50 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories').' WHERE categoryid='.$id; |
|
51 | 51 | if (!$result = $this->db->query($sql)) { |
52 | 52 | return $false; |
53 | 53 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | // Deleteing the sub categories |
152 | - $subcats =& $this->getCategories(0, 0, $category->categoryid()); |
|
152 | + $subcats = & $this->getCategories(0, 0, $category->categoryid()); |
|
153 | 153 | foreach ($subcats as $subcat) { |
154 | 154 | $this->delete($subcat); |
155 | 155 | } |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | { |
187 | 187 | $ret = []; |
188 | 188 | $limit = $start = 0; |
189 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories'); |
|
189 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories'); |
|
190 | 190 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
191 | - $sql .= ' ' . $criteria->renderWhere(); |
|
191 | + $sql .= ' '.$criteria->renderWhere(); |
|
192 | 192 | if ('' != $criteria->getSort()) { |
193 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
193 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
194 | 194 | } |
195 | 195 | $limit = $criteria->getLimit(); |
196 | 196 | $start = $criteria->getStart(); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
248 | 248 | |
249 | 249 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
250 | - $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
250 | + $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
251 | 251 | } |
252 | 252 | $criteria->setStart($start); |
253 | 253 | $criteria->setLimit($limit); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
287 | 287 | |
288 | 288 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
289 | - $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
289 | + $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | $criteria->add(new \Criteria('f.status', Constants::SF_STATUS_OPENED)); |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | |
296 | 296 | $ret = []; |
297 | 297 | $limit = $start = 0; |
298 | - $sql = 'SELECT DISTINCT c.categoryid, c.parentid, c.name, c.description, c.total, c.weight, c.created FROM ' . $this->db->prefix('smartfaq_categories') . ' AS c INNER JOIN ' . $this->db->prefix('smartfaq_faq') . ' AS f ON c.categoryid = f.categoryid'; |
|
298 | + $sql = 'SELECT DISTINCT c.categoryid, c.parentid, c.name, c.description, c.total, c.weight, c.created FROM '.$this->db->prefix('smartfaq_categories').' AS c INNER JOIN '.$this->db->prefix('smartfaq_faq').' AS f ON c.categoryid = f.categoryid'; |
|
299 | 299 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
300 | - $sql .= ' ' . $criteria->renderWhere(); |
|
300 | + $sql .= ' '.$criteria->renderWhere(); |
|
301 | 301 | if ('' != $criteria->getSort()) { |
302 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
302 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
303 | 303 | } |
304 | 304 | $limit = $criteria->getLimit(); |
305 | 305 | $start = $criteria->getStart(); |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | */ |
329 | 329 | public function getCount($criteria = null) |
330 | 330 | { |
331 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_categories'); |
|
331 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_categories'); |
|
332 | 332 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
333 | - $sql .= ' ' . $criteria->renderWhere(); |
|
333 | + $sql .= ' '.$criteria->renderWhere(); |
|
334 | 334 | } |
335 | 335 | $result = $this->db->query($sql); |
336 | 336 | if (!$result) { |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
359 | 359 | |
360 | 360 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
361 | - $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
361 | + $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
@@ -382,16 +382,16 @@ discard block |
||
382 | 382 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
383 | 383 | |
384 | 384 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
385 | - $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
385 | + $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
389 | 389 | $criteria->add(new \Criteria('f.status', Constants::SF_STATUS_OPENED)); |
390 | 390 | |
391 | - $sql = 'SELECT COUNT(c.categoryid) FROM ' . $this->db->prefix('smartfaq_categories') . ' AS c INNER JOIN ' . $this->db->prefix('smartfaq_faq') . ' AS f ON c.categoryid = f.categoryid'; |
|
391 | + $sql = 'SELECT COUNT(c.categoryid) FROM '.$this->db->prefix('smartfaq_categories').' AS c INNER JOIN '.$this->db->prefix('smartfaq_faq').' AS f ON c.categoryid = f.categoryid'; |
|
392 | 392 | |
393 | 393 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
394 | - $sql .= ' ' . $criteria->renderWhere(); |
|
394 | + $sql .= ' '.$criteria->renderWhere(); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | $result = $this->db->query($sql); |
@@ -409,16 +409,16 @@ discard block |
||
409 | 409 | */ |
410 | 410 | public function getSubCats($categories) |
411 | 411 | { |
412 | - $criteria = new \CriteriaCompo(new \Criteria('parentid', '(' . implode(',', array_keys($categories)) . ')'), 'IN'); |
|
412 | + $criteria = new \CriteriaCompo(new \Criteria('parentid', '('.implode(',', array_keys($categories)).')'), 'IN'); |
|
413 | 413 | $ret = []; |
414 | 414 | if (!Smartfaq\Utility::userIsAdmin()) { |
415 | 415 | /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */ |
416 | 416 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
417 | 417 | |
418 | 418 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
419 | - $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
419 | + $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
420 | 420 | } |
421 | - $subcats =& $this->getObjects($criteria, true); |
|
421 | + $subcats = & $this->getObjects($criteria, true); |
|
422 | 422 | foreach ($subcats as $subcat_id => $subcat) { |
423 | 423 | $ret[$subcat->getVar('parentid')][$subcat->getVar('categoryid')] = $subcat; |
424 | 424 | } |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function deleteAll($criteria = null) |
436 | 436 | { |
437 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories'); |
|
437 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_categories'); |
|
438 | 438 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
439 | - $sql .= ' ' . $criteria->renderWhere(); |
|
439 | + $sql .= ' '.$criteria->renderWhere(); |
|
440 | 440 | } |
441 | 441 | if (!$this->db->query($sql)) { |
442 | 442 | return false; |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | **/ |
459 | 459 | public function updateAll($fieldname, $fieldvalue, \CriteriaElement $criteria = null) |
460 | 460 | { |
461 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
462 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_categories') . ' SET ' . $set_clause; |
|
461 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
462 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_categories').' SET '.$set_clause; |
|
463 | 463 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
464 | - $sql .= ' ' . $criteria->renderWhere(); |
|
464 | + $sql .= ' '.$criteria->renderWhere(); |
|
465 | 465 | } |
466 | 466 | if (!$this->db->queryF($sql)) { |
467 | 467 | return false; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | */ |
22 | 22 | |
23 | -require_once __DIR__ . '/../../include/common.php'; |
|
23 | +require_once __DIR__.'/../../include/common.php'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Class Configurator |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | class Configurator |
29 | 29 | { |
30 | 30 | public $uploadFolders = []; |
31 | - public $blankFiles = []; |
|
31 | + public $blankFiles = []; |
|
32 | 32 | public $templateFolders = []; |
33 | 33 | public $oldFiles = []; |
34 | 34 | public $oldFolders = []; |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | $capsDirName = strtoupper($moduleDirName); |
44 | 44 | $this->name = 'Module Configurator'; |
45 | 45 | $this->uploadFolders = [ |
46 | - constant($capsDirName . '_UPLOAD_PATH'), |
|
47 | - constant($capsDirName . '_UPLOAD_PATH') . '/content', |
|
48 | - constant($capsDirName . '_UPLOAD_PATH') . '/images', |
|
49 | - constant($capsDirName . '_UPLOAD_PATH') . '/images/category', |
|
50 | - constant($capsDirName . '_UPLOAD_PATH') . '/images/thumbnails', |
|
46 | + constant($capsDirName.'_UPLOAD_PATH'), |
|
47 | + constant($capsDirName.'_UPLOAD_PATH').'/content', |
|
48 | + constant($capsDirName.'_UPLOAD_PATH').'/images', |
|
49 | + constant($capsDirName.'_UPLOAD_PATH').'/images/category', |
|
50 | + constant($capsDirName.'_UPLOAD_PATH').'/images/thumbnails', |
|
51 | 51 | ]; |
52 | 52 | $this->blankFiles = [ |
53 | - constant($capsDirName . '_UPLOAD_PATH'), |
|
54 | - constant($capsDirName . '_UPLOAD_PATH') . '/images/category', |
|
55 | - constant($capsDirName . '_UPLOAD_PATH') . '/images/thumbnails', |
|
53 | + constant($capsDirName.'_UPLOAD_PATH'), |
|
54 | + constant($capsDirName.'_UPLOAD_PATH').'/images/category', |
|
55 | + constant($capsDirName.'_UPLOAD_PATH').'/images/thumbnails', |
|
56 | 56 | ]; |
57 | 57 | |
58 | 58 | $this->templateFolders = [ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | '/templates/admin/' |
62 | 62 | |
63 | 63 | ]; |
64 | - $this->oldFiles = [ |
|
64 | + $this->oldFiles = [ |
|
65 | 65 | '/class/request.php', |
66 | 66 | '/class/registry.php', |
67 | 67 | '/class/utilities.php', |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | '/include/functions.php', |
71 | 71 | '/ajaxrating.txt' |
72 | 72 | ]; |
73 | - $this->oldFolders = [ |
|
73 | + $this->oldFolders = [ |
|
74 | 74 | '/images', |
75 | 75 | '/css', |
76 | 76 | '/js', |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | //check for minimum XOOPS version |
38 | 38 | $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
39 | 39 | if (null === $requiredVer) { |
40 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
40 | + $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string |
|
41 | 41 | } |
42 | - $success = true; |
|
42 | + $success = true; |
|
43 | 43 | |
44 | 44 | if (version_compare($currentVer, $requiredVer, '<')) { |
45 | - $success = false; |
|
46 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
45 | + $success = false; |
|
46 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | return $success; |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | // check for minimum PHP version |
64 | 64 | $success = true; |
65 | 65 | $verNum = PHP_VERSION; |
66 | - $reqVer =& $module->getInfo('min_php'); |
|
66 | + $reqVer = & $module->getInfo('min_php'); |
|
67 | 67 | if (false !== $reqVer && '' !== $reqVer) { |
68 | 68 | if (version_compare($verNum, $reqVer, '<')) { |
69 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
69 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
70 | 70 | $success = false; |
71 | 71 | } |
72 | 72 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | require_once $GLOBALS['xoops']->path('class/template.php'); |
71 | 71 | $breadcrumbTpl = new \XoopsTpl(); |
72 | 72 | $breadcrumbTpl->assign('breadcrumb', $this->bread); |
73 | - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
73 | + $html = $breadcrumbTpl->fetch('db:'.$this->dirname.'_common_breadcrumb.tpl'); |
|
74 | 74 | unset($breadcrumbTpl); |
75 | 75 | |
76 | 76 | return $html; |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | // $sql .= " WHERE metakey='version' LIMIT 1"; |
35 | 35 | // $query = $GLOBALS['xoopsDB']->query($sql); |
36 | 36 | // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
37 | - $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n"; |
|
37 | + $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>".constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO')."</legend>\n"; |
|
38 | 38 | $html .= "<div style='padding: 8px;'>\n"; |
39 | 39 | // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n"; |
40 | 40 | // $html .= "<br>\n"; |
41 | 41 | // $html .= "<br>\n"; |
42 | - $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n"; |
|
42 | + $html .= '<div>'.constant('CO_'.$moduleDirNameUpper.'_SPHPINI')."</div>\n"; |
|
43 | 43 | $html .= "<ul>\n"; |
44 | 44 | // |
45 | - $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
46 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
45 | + $gdlib = function_exists('gd_info') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>'; |
|
46 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib; |
|
47 | 47 | if (function_exists('gd_info')) { |
48 | 48 | if (true === ($gdlib = gd_info())) { |
49 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
49 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>'; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | // |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
57 | 57 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
58 | 58 | // |
59 | - $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
60 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
59 | + $downloads = ini_get('file_uploads') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>'; |
|
60 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads; |
|
61 | 61 | // |
62 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n"; |
|
63 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n"; |
|
64 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n"; |
|
62 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: blue;">'.ini_get('upload_max_filesize')."</span></b>\n"; |
|
63 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: blue;">'.ini_get('post_max_size')."</span></b>\n"; |
|
64 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: blue;">'.ini_get('memory_limit')."</span></b>\n"; |
|
65 | 65 | $html .= "</ul>\n"; |
66 | 66 | $html .= "<ul>\n"; |
67 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
|
67 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH."</b>\n"; |
|
68 | 68 | $html .= "</ul>\n"; |
69 | 69 | $html .= "<br>\n"; |
70 | - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; |
|
70 | + $html .= constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC')."\n"; |
|
71 | 71 | $html .= '</div>'; |
72 | 72 | $html .= '</fieldset><br>'; |
73 | 73 |