@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $filename = 'open_category.php'; |
| 167 | 167 | } |
| 168 | 168 | if ($withAllLink) { |
| 169 | - $ret = "<a href='" . XOOPS_URL . '/modules/smartfaq/' . $filename . '?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>'; |
|
| 169 | + $ret = "<a href='".XOOPS_URL.'/modules/smartfaq/'.$filename.'?categoryid='.$this->categoryid()."'>".$this->name().'</a>'; |
|
| 170 | 170 | } else { |
| 171 | 171 | $ret = $this->name(); |
| 172 | 172 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | exit; |
| 180 | 180 | } |
| 181 | 181 | $parentid = $parentObj->parentid(); |
| 182 | - $ret = $parentObj->getCategoryPath(true, $open) . ' > ' . $ret; |
|
| 182 | + $ret = $parentObj->getCategoryPath(true, $open).' > '.$ret; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return $ret; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $tags = []; |
| 237 | 237 | $tags['MODULE_NAME'] = $myts->htmlSpecialChars($smartModule->getVar('name')); |
| 238 | 238 | $tags['CATEGORY_NAME'] = $this->name(); |
| 239 | - $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid(); |
|
| 239 | + $tags['CATEGORY_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid(); |
|
| 240 | 240 | |
| 241 | 241 | $notificationHandler = xoops_getHandler('notification'); |
| 242 | 242 | $notificationHandler->triggerEvent('global_faq', 0, 'category_created', $tags); |
@@ -252,9 +252,9 @@ discard block |
||
| 252 | 252 | $category['categoryid'] = $this->categoryid(); |
| 253 | 253 | $category['name'] = $this->name(); |
| 254 | 254 | if (false !== $open) { |
| 255 | - $category['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/open_category.php?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>'; |
|
| 255 | + $category['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/open_category.php?categoryid='.$this->categoryid()."'>".$this->name().'</a>'; |
|
| 256 | 256 | } else { |
| 257 | - $category['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>'; |
|
| 257 | + $category['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$this->name().'</a>'; |
|
| 258 | 258 | } |
| 259 | 259 | $category['total'] = $this->getVar('faqcount'); |
| 260 | 260 | $category['description'] = $this->description(); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | //Verifies that a MySQL table exists |
| 23 | 23 | $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection(); |
| 24 | 24 | $realname = $xoopsDB->prefix($table); |
| 25 | - $sql = 'SHOW TABLES FROM ' . XOOPS_DB_NAME; |
|
| 25 | + $sql = 'SHOW TABLES FROM '.XOOPS_DB_NAME; |
|
| 26 | 26 | $ret = $xoopsDB->queryF($sql); |
| 27 | 27 | while (list($m_table) = $xoopsDB->fetchRow($ret)) { |
| 28 | 28 | if ($m_table == $realname) { |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | public function getExistingFieldsArray() |
| 164 | 164 | { |
| 165 | 165 | global $xoopsDB; |
| 166 | - $result = $xoopsDB->queryF('SHOW COLUMNS FROM ' . $this->name()); |
|
| 166 | + $result = $xoopsDB->queryF('SHOW COLUMNS FROM '.$this->name()); |
|
| 167 | 167 | while ($existing_field = $xoopsDB->fetchArray($result)) { |
| 168 | 168 | $fields[$existing_field['Field']] = $existing_field['Type']; |
| 169 | 169 | if ('YES' !== $existing_field['Null']) { |
| 170 | 170 | $fields[$existing_field['Field']] .= ' NOT NULL'; |
| 171 | 171 | } |
| 172 | 172 | if ($existing_field['Extra']) { |
| 173 | - $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
| 173 | + $fields[$existing_field['Field']] .= ' '.$existing_field['Extra']; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -246,9 +246,9 @@ discard block |
||
| 246 | 246 | $query = sprintf('INSERT INTO %s VALUES ("%s")', $this->name(), $data); |
| 247 | 247 | $ret = $xoopsDB->queryF($query); |
| 248 | 248 | if (!$ret) { |
| 249 | - echo ' ' . sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()) . '<br>'; |
|
| 249 | + echo ' '.sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()).'<br>'; |
|
| 250 | 250 | } else { |
| 251 | - echo ' ' . sprintf(_SDU_MSG_ADD_DATA, $this->name()) . '<br>'; |
|
| 251 | + echo ' '.sprintf(_SDU_MSG_ADD_DATA, $this->name()).'<br>'; |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | $ret = $xoopsDB->queryF($query); |
| 415 | 415 | if (!$ret) { |
| 416 | - echo ' ' . sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()) . '<br>'; |
|
| 416 | + echo ' '.sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()).'<br>'; |
|
| 417 | 417 | } else { |
| 418 | - echo ' ' . sprintf(_SDU_MSG_CREATE_TABLE, $this->name()) . '<br>'; |
|
| 418 | + echo ' '.sprintf(_SDU_MSG_CREATE_TABLE, $this->name()).'<br>'; |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | return $ret; |
@@ -434,11 +434,11 @@ discard block |
||
| 434 | 434 | $query = sprintf('DROP TABLE %s', $this->name()); |
| 435 | 435 | $ret = $xoopsDB->queryF($query); |
| 436 | 436 | if (!$ret) { |
| 437 | - echo ' ' . sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()) . '<br>'; |
|
| 437 | + echo ' '.sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()).'<br>'; |
|
| 438 | 438 | |
| 439 | 439 | return false; |
| 440 | 440 | } else { |
| 441 | - echo ' ' . sprintf(_SDU_MSG_DROP_TABLE, $this->name()) . '<br>'; |
|
| 441 | + echo ' '.sprintf(_SDU_MSG_DROP_TABLE, $this->name()).'<br>'; |
|
| 442 | 442 | |
| 443 | 443 | return true; |
| 444 | 444 | } |
@@ -462,9 +462,9 @@ discard block |
||
| 462 | 462 | $ret = $ret && $xoopsDB->queryF($query); |
| 463 | 463 | if ($alteredField['showerror']) { |
| 464 | 464 | if (!$ret) { |
| 465 | - echo ' ' . sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()) . '<br>'; |
|
| 465 | + echo ' '.sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()).'<br>'; |
|
| 466 | 466 | } else { |
| 467 | - echo ' ' . sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()) . '<br>'; |
|
| 467 | + echo ' '.sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()).'<br>'; |
|
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | } |
@@ -488,9 +488,9 @@ discard block |
||
| 488 | 488 | //echo $query; |
| 489 | 489 | $ret = $ret && $xoopsDB->queryF($query); |
| 490 | 490 | if (!$ret) { |
| 491 | - echo ' ' . sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()) . '<br>'; |
|
| 491 | + echo ' '.sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()).'<br>'; |
|
| 492 | 492 | } else { |
| 493 | - echo ' ' . sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()) . '<br>'; |
|
| 493 | + echo ' '.sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()).'<br>'; |
|
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | 496 | |
@@ -513,9 +513,9 @@ discard block |
||
| 513 | 513 | $query = sprintf('UPDATE %s SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']); |
| 514 | 514 | $ret = $ret && $xoopsDB->queryF($query); |
| 515 | 515 | if (!$ret) { |
| 516 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>'; |
|
| 516 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>'; |
|
| 517 | 517 | } else { |
| 518 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>'; |
|
| 518 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>'; |
|
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | |
@@ -538,9 +538,9 @@ discard block |
||
| 538 | 538 | //echo $query."<br>"; |
| 539 | 539 | $ret = $ret && $xoopsDB->queryF($query); |
| 540 | 540 | if (!$ret) { |
| 541 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>'; |
|
| 541 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>'; |
|
| 542 | 542 | } else { |
| 543 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>'; |
|
| 543 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>'; |
|
| 544 | 544 | } |
| 545 | 545 | } |
| 546 | 546 | |
@@ -564,9 +564,9 @@ discard block |
||
| 564 | 564 | |
| 565 | 565 | $ret = $ret && $xoopsDB->queryF($query); |
| 566 | 566 | if (!$ret) { |
| 567 | - echo ' ' . sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()) . '<br>'; |
|
| 567 | + echo ' '.sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()).'<br>'; |
|
| 568 | 568 | } else { |
| 569 | - echo ' ' . sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()) . '<br>'; |
|
| 569 | + echo ' '.sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()).'<br>'; |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | { |
| 72 | 72 | $ret = false; |
| 73 | 73 | $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
| 74 | - $class = '\\XoopsModules\\' . ucfirst(strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; |
|
| 74 | + $class = '\\XoopsModules\\'.ucfirst(strtolower(basename(dirname(__DIR__)))).'\\'.$name.'Handler'; |
|
| 75 | 75 | $ret = new $class($db); |
| 76 | 76 | return $ret; |
| 77 | 77 | } |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | if ($faq->isNew()) { |
| 95 | 95 | $sql = sprintf( |
| 96 | 96 | 'INSERT INTO %s (faqid, categoryid, question, howdoi, diduno, uid, datesub, `status`, counter, weight, html, smiley, xcodes, cancomment, comments, notifypub, modulelink, contextpage, exacturl, partialview) VALUES (NULL, %u, %s, %s, %s, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %s, %s, %u, %u)', |
| 97 | - $this->db->prefix('smartfaq_faq'), |
|
| 97 | + $this->db->prefix('smartfaq_faq'), |
|
| 98 | 98 | $categoryid, |
| 99 | 99 | $this->db->quoteString($question), |
| 100 | 100 | $this->db->quoteString($howdoi), |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public function get($id) |
| 49 | 49 | { |
| 50 | 50 | if ((int)$id > 0) { |
| 51 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id; |
|
| 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,7 +559,7 @@ 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 | 564 | $criteriaCategory = new \Criteria('categoryid', (int)$categoryid); |
| 565 | 565 | } |
@@ -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 | } |
@@ -691,7 +691,7 @@ discard block |
||
| 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,7 +756,7 @@ 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 | } |
@@ -765,10 +765,10 @@ discard block |
||
| 765 | 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'); |
|
| 1045 | + $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq'); |
|
| 1046 | 1046 | if ((int)$cat_id > 0) { |
| 1047 | - $sql .= ' WHERE categoryid = ' . (int)$cat_id; |
|
| 1048 | - $sql .= ' AND status IN (' . implode(',', $status) . ')'; |
|
| 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 | } |
@@ -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 |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $sql = sprintf( |
| 93 | 93 | 'INSERT INTO %s (parentid, name, description, total, weight, created) VALUES (%u, %s, %s, %u, %u, %u)', |
| 94 | 94 | $this->db->prefix('smartfaq_categories'), |
| 95 | - $parentid, |
|
| 95 | + $parentid, |
|
| 96 | 96 | $this->db->quoteString($name), |
| 97 | 97 | $this->db->quoteString($description), |
| 98 | 98 | $total, |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | 'UPDATE %s SET parentid = %u, name = %s, description = %s, total = %s, weight = %u, created = %u WHERE categoryid = %u', |
| 105 | 105 | $this->db->prefix('smartfaq_categories'), |
| 106 | 106 | $parentid, |
| 107 | - $this->db->quoteString($name), |
|
| 107 | + $this->db->quoteString($name), |
|
| 108 | 108 | $this->db->quoteString($description), |
| 109 | 109 | $total, |
| 110 | 110 | $weight, |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $false = false; |
| 49 | 49 | if ((int)$id > 0) { |
| 50 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories') . ' WHERE categoryid=' . $id; |
|
| 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; |