@@ -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 (false !== (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 (false !== ($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 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function get($id = null, $fields = null) |
50 | 50 | { |
51 | 51 | if ((int)$id > 0) { |
52 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
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 (false !== ($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 |
@@ -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 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | // $faq->setError($this->db->error()); |
163 | 163 | |
164 | 164 | |
165 | - trigger_error('Class ' . $faq . ' could not be saved ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING); |
|
165 | + trigger_error('Class '.$faq.' could not be saved '.__FILE__.' at line '.__LINE__, E_USER_WARNING); |
|
166 | 166 | |
167 | 167 | return false; |
168 | 168 | } |
@@ -228,26 +228,26 @@ discard block |
||
228 | 228 | { |
229 | 229 | $ret = []; |
230 | 230 | $limit = $start = 0; |
231 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq'); |
|
231 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq'); |
|
232 | 232 | |
233 | 233 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
234 | 234 | $whereClause = $criteria->renderWhere(); |
235 | 235 | |
236 | 236 | if ('WHERE ()' !== $whereClause) { |
237 | - $sql .= ' ' . $criteria->renderWhere(); |
|
237 | + $sql .= ' '.$criteria->renderWhere(); |
|
238 | 238 | if (!empty($notNullFields)) { |
239 | 239 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
240 | 240 | } |
241 | 241 | } elseif (!empty($notNullFields)) { |
242 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
242 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
243 | 243 | } |
244 | 244 | if ('' != $criteria->getSort()) { |
245 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
245 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
246 | 246 | } |
247 | 247 | $limit = $criteria->getLimit(); |
248 | 248 | $start = $criteria->getStart(); |
249 | 249 | } elseif (!empty($notNullFields)) { |
250 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
250 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | //echo "<br>" . $sql . "<br>"; |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | $faq->assignVars($myrow); |
267 | 267 | |
268 | 268 | if (!$id_as_key) { |
269 | - $ret[] =& $faq; |
|
269 | + $ret[] = & $faq; |
|
270 | 270 | } else { |
271 | - $ret[$myrow['faqid']] =& $faq; |
|
271 | + $ret[$myrow['faqid']] = & $faq; |
|
272 | 272 | } |
273 | 273 | unset($faq); |
274 | 274 | } |
@@ -308,26 +308,26 @@ discard block |
||
308 | 308 | faq.modulelink AS modulelink, |
309 | 309 | faq.contextpage AS contextpage, |
310 | 310 | faq.exacturl AS exacturl |
311 | - FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid '; |
|
311 | + FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid '; |
|
312 | 312 | |
313 | 313 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
314 | 314 | $whereClause = $criteria->renderWhere(); |
315 | 315 | |
316 | 316 | if ('WHERE ()' !== $whereClause) { |
317 | - $sql .= ' ' . $criteria->renderWhere(); |
|
317 | + $sql .= ' '.$criteria->renderWhere(); |
|
318 | 318 | if (!empty($notNullFields)) { |
319 | 319 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
320 | 320 | } |
321 | 321 | } elseif (!empty($notNullFields)) { |
322 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
322 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
323 | 323 | } |
324 | 324 | if ('' != $criteria->getSort()) { |
325 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
325 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
326 | 326 | } |
327 | 327 | $limit = $criteria->getLimit(); |
328 | 328 | $start = $criteria->getStart(); |
329 | 329 | } elseif (!empty($notNullFields)) { |
330 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
330 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | //echo "<br>" . $sql . "<br>"; |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | $faq->assignVars($myrow); |
346 | 346 | |
347 | 347 | if (!$id_as_key) { |
348 | - $ret[] =& $faq; |
|
348 | + $ret[] = & $faq; |
|
349 | 349 | } else { |
350 | - $ret[$myrow['faqid']] =& $faq; |
|
350 | + $ret[$myrow['faqid']] = & $faq; |
|
351 | 351 | } |
352 | 352 | unset($faq); |
353 | 353 | } |
@@ -377,19 +377,19 @@ discard block |
||
377 | 377 | */ |
378 | 378 | public function getCount($criteria = null, $notNullFields = '') |
379 | 379 | { |
380 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq'); |
|
380 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq'); |
|
381 | 381 | if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { |
382 | 382 | $whereClause = $criteria->renderWhere(); |
383 | 383 | if ('WHERE ()' !== $whereClause) { |
384 | - $sql .= ' ' . $criteria->renderWhere(); |
|
384 | + $sql .= ' '.$criteria->renderWhere(); |
|
385 | 385 | if (!empty($notNullFields)) { |
386 | 386 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
387 | 387 | } |
388 | 388 | } elseif (!empty($notNullFields)) { |
389 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
389 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
390 | 390 | } |
391 | 391 | } elseif (!empty($notNullFields)) { |
392 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
392 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | //echo "<br>" . $sql . "<br>"; |
@@ -423,11 +423,11 @@ discard block |
||
423 | 423 | $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission'); |
424 | 424 | |
425 | 425 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
426 | - $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
426 | + $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
427 | 427 | |
428 | 428 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
429 | 429 | $grantedFaq = new \CriteriaCompo(); |
430 | - $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
430 | + $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
431 | 431 | // If user is anonymous, check if the FAQ allow partialview |
432 | 432 | if (!is_object($xoopsUser)) { |
433 | 433 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | */ |
475 | 475 | public function getFaqsCountByStatus() |
476 | 476 | { |
477 | - $sql = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status'; |
|
477 | + $sql = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status'; |
|
478 | 478 | $result = $this->db->query($sql); |
479 | 479 | if (!$result) { |
480 | 480 | return []; |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission'); |
545 | 545 | |
546 | 546 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
547 | - $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
547 | + $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
548 | 548 | |
549 | 549 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
550 | 550 | $grantedFaq = new \CriteriaCompo(); |
551 | - $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
551 | + $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
552 | 552 | // If user is anonymous, check if the FAQ allow partialview |
553 | 553 | if (!is_object($xoopsUser)) { |
554 | 554 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | if (isset($categoryid) && (-1 != $categoryid)) { |
559 | 559 | if (is_array($categoryid)) { |
560 | - $criteriaCategory = new \Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN'); |
|
560 | + $criteriaCategory = new \Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN'); |
|
561 | 561 | } else { |
562 | 562 | $criteriaCategory = new \Criteria('categoryid', (int)$categoryid); |
563 | 563 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | $criteria->setStart($start); |
601 | 601 | $criteria->setSort($sort); |
602 | 602 | $criteria->setOrder($order); |
603 | - $ret =& $this->getObjects($criteria, false, $notNullFields); |
|
603 | + $ret = & $this->getObjects($criteria, false, $notNullFields); |
|
604 | 604 | |
605 | 605 | return $ret; |
606 | 606 | } |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $entrynumber = mt_rand(0, $totalFaqs); |
690 | 690 | $faq = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields); |
691 | 691 | if ($faq) { |
692 | - $ret =& $faq[0]; |
|
692 | + $ret = & $faq[0]; |
|
693 | 693 | } |
694 | 694 | } |
695 | 695 | |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | $httphost = $_SERVER['HTTP_HOST']; |
721 | 721 | $querystring = $_SERVER['QUERY_STRING']; |
722 | 722 | if ('' != $querystring) { |
723 | - $querystring = '?' . $querystring; |
|
723 | + $querystring = '?'.$querystring; |
|
724 | 724 | } |
725 | - $currenturl = $http . $httphost . $phpself . $querystring; |
|
726 | - $fullcontexturl = XOOPS_URL . '/' . $iValue->contextpage(); |
|
725 | + $currenturl = $http.$httphost.$phpself.$querystring; |
|
726 | + $fullcontexturl = XOOPS_URL.'/'.$iValue->contextpage(); |
|
727 | 727 | switch ($iValue->modulelink()) { |
728 | 728 | case '': |
729 | 729 | $display = false; |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | } |
743 | 743 | break; |
744 | 744 | default: |
745 | - if (false === strpos($currenturl, XOOPS_URL . '/modules/')) { |
|
745 | + if (false === strpos($currenturl, XOOPS_URL.'/modules/')) { |
|
746 | 746 | $display = false; |
747 | 747 | } else { |
748 | 748 | if (false === strpos($currenturl, $iValue->modulelink())) { |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | break; |
755 | 755 | } |
756 | 756 | if ($display) { |
757 | - $randomFaqs[] =& $faqsObj[$i]; |
|
757 | + $randomFaqs[] = & $faqsObj[$i]; |
|
758 | 758 | } |
759 | 759 | } |
760 | 760 | } |
@@ -763,10 +763,10 @@ discard block |
||
763 | 763 | mt_srand((float)microtime() * 10000000); |
764 | 764 | $rand_keys = array_rand($randomFaqs, $limit); |
765 | 765 | for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) { |
766 | - $ret[] =& $randomFaqs[$rand_keys[$j]]; |
|
766 | + $ret[] = & $randomFaqs[$rand_keys[$j]]; |
|
767 | 767 | } |
768 | 768 | } else { |
769 | - $ret =& $randomFaqs; |
|
769 | + $ret = & $randomFaqs; |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | return $ret; |
@@ -784,14 +784,14 @@ discard block |
||
784 | 784 | /** @var Smartfaq\PermissionHandler $smartPermHandler */ |
785 | 785 | $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission'); |
786 | 786 | $items = $smartPermHandler->getPermissions('item'); |
787 | - $faqclause = ' AND faqid IN (' . implode(',', $items) . ')'; |
|
787 | + $faqclause = ' AND faqid IN ('.implode(',', $items).')'; |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | $sql = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);"; |
791 | - $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;'; |
|
792 | - $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;"; |
|
793 | - $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp |
|
794 | - WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;'; |
|
791 | + $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;'; |
|
792 | + $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;"; |
|
793 | + $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp |
|
794 | + WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;'; |
|
795 | 795 | /* |
796 | 796 | //Old implementation |
797 | 797 | $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")." |
@@ -806,14 +806,14 @@ discard block |
||
806 | 806 | $this->db->queryF('UNLOCK TABLES;'); |
807 | 807 | $this->db->queryF('DROP TABLE tmp;'); |
808 | 808 | if (!$result) { |
809 | - trigger_error('Error in getLastPublishedByCat SQL: ' . $error); |
|
809 | + trigger_error('Error in getLastPublishedByCat SQL: '.$error); |
|
810 | 810 | |
811 | 811 | return $ret; |
812 | 812 | } |
813 | 813 | while (false !== ($row = $this->db->fetchArray($result))) { |
814 | 814 | $faq = new Smartfaq\Faq(); |
815 | 815 | $faq->assignVars($row); |
816 | - $ret[$row['categoryid']] =& $faq; |
|
816 | + $ret[$row['categoryid']] = & $faq; |
|
817 | 817 | unset($faq); |
818 | 818 | } |
819 | 819 | |
@@ -828,9 +828,9 @@ discard block |
||
828 | 828 | */ |
829 | 829 | public function deleteAll($criteria = null) |
830 | 830 | { |
831 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq'); |
|
831 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq'); |
|
832 | 832 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
833 | - $sql .= ' ' . $criteria->renderWhere(); |
|
833 | + $sql .= ' '.$criteria->renderWhere(); |
|
834 | 834 | } |
835 | 835 | if (!$this->db->query($sql)) { |
836 | 836 | return false; |
@@ -851,10 +851,10 @@ discard block |
||
851 | 851 | **/ |
852 | 852 | public function updateAll($fieldname, $fieldvalue, $criteria = null) |
853 | 853 | { |
854 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
855 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause; |
|
854 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
855 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause; |
|
856 | 856 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
857 | - $sql .= ' ' . $criteria->renderWhere(); |
|
857 | + $sql .= ' '.$criteria->renderWhere(); |
|
858 | 858 | } |
859 | 859 | if (!$this->db->queryF($sql)) { |
860 | 860 | return false; |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | */ |
870 | 870 | public function updateCounter($faqid) |
871 | 871 | { |
872 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid; |
|
872 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid; |
|
873 | 873 | if ($this->db->queryF($sql)) { |
874 | 874 | return true; |
875 | 875 | } else { |
@@ -921,12 +921,12 @@ discard block |
||
921 | 921 | $criteriaUser->add(new \Criteria('answer.uid', $userid), 'OR'); |
922 | 922 | } |
923 | 923 | |
924 | - if (! empty($queryarray)) { |
|
924 | + if (!empty($queryarray)) { |
|
925 | 925 | $criteriaKeywords = new \CriteriaCompo(); |
926 | 926 | foreach ($queryarray as $iValue) { |
927 | 927 | $criteriaKeyword = new \CriteriaCompo(); |
928 | - $criteriaKeyword->add(new \Criteria('faq.question', '%' . $iValue . '%', 'LIKE'), 'OR'); |
|
929 | - $criteriaKeyword->add(new \Criteria('answer.answer', '%' . $iValue . '%', 'LIKE'), 'OR'); |
|
928 | + $criteriaKeyword->add(new \Criteria('faq.question', '%'.$iValue.'%', 'LIKE'), 'OR'); |
|
929 | + $criteriaKeyword->add(new \Criteria('answer.answer', '%'.$iValue.'%', 'LIKE'), 'OR'); |
|
930 | 930 | $criteriaKeywords->add($criteriaKeyword, $andor); |
931 | 931 | unset($criteriaKeyword); |
932 | 932 | } |
@@ -945,9 +945,9 @@ discard block |
||
945 | 945 | if (empty($faqsGranted)) { |
946 | 946 | return $ret; |
947 | 947 | } |
948 | - $grantedCategories = new \Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
948 | + $grantedCategories = new \Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
949 | 949 | $grantedFaq = new \CriteriaCompo(); |
950 | - $grantedFaq->add(new \Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
950 | + $grantedFaq->add(new \Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
951 | 951 | // If user is anonymous, check if the FAQ allow partialview |
952 | 952 | if (!is_object($xoopsUser)) { |
953 | 953 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
@@ -993,15 +993,15 @@ discard block |
||
993 | 993 | $criteria->setSort('faq.datesub'); |
994 | 994 | $criteria->setOrder('DESC'); |
995 | 995 | |
996 | - $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'; |
|
996 | + $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'; |
|
997 | 997 | |
998 | 998 | if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
999 | 999 | $whereClause = $criteria->renderWhere(); |
1000 | 1000 | |
1001 | 1001 | if ('WHERE ()' !== $whereClause) { |
1002 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1002 | + $sql .= ' '.$criteria->renderWhere(); |
|
1003 | 1003 | if ('' != $criteria->getSort()) { |
1004 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
1004 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
1005 | 1005 | } |
1006 | 1006 | $limit = $criteria->getLimit(); |
1007 | 1007 | $start = $criteria->getStart(); |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | while (false !== ($myrow = $this->db->fetchArray($result))) { |
1025 | 1025 | $faq = new Smartfaq\Faq(); |
1026 | 1026 | $faq->assignVars($myrow); |
1027 | - $ret[] =& $faq; |
|
1027 | + $ret[] = & $faq; |
|
1028 | 1028 | unset($faq); |
1029 | 1029 | } |
1030 | 1030 | |
@@ -1040,20 +1040,20 @@ discard block |
||
1040 | 1040 | { |
1041 | 1041 | global $xoopsUser; |
1042 | 1042 | $ret = []; |
1043 | - $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1043 | + $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq'); |
|
1044 | 1044 | if ((int)$cat_id > 0) { |
1045 | - $sql .= ' WHERE categoryid = ' . (int)$cat_id; |
|
1046 | - $sql .= ' AND status IN (' . implode(',', $status) . ')'; |
|
1045 | + $sql .= ' WHERE categoryid = '.(int)$cat_id; |
|
1046 | + $sql .= ' AND status IN ('.implode(',', $status).')'; |
|
1047 | 1047 | } else { |
1048 | - $sql .= ' WHERE status IN (' . implode(',', $status) . ')'; |
|
1048 | + $sql .= ' WHERE status IN ('.implode(',', $status).')'; |
|
1049 | 1049 | if (!Smartfaq\Utility::userIsAdmin()) { |
1050 | 1050 | /** @var Smartfaq\PermissionHandler $smartPermHandler */ |
1051 | 1051 | $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission'); |
1052 | 1052 | $items = $smartPermHandler->getPermissions('item'); |
1053 | 1053 | if (is_object($xoopsUser)) { |
1054 | - $sql .= ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1054 | + $sql .= ' AND faqid IN ('.implode(',', $items).')'; |
|
1055 | 1055 | } else { |
1056 | - $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)'; |
|
1056 | + $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)'; |
|
1057 | 1057 | } |
1058 | 1058 | } |
1059 | 1059 | } |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -require_once __DIR__ . '/../../../include/cp_header.php'; |
|
9 | +require_once __DIR__.'/../../../include/cp_header.php'; |
|
10 | 10 | |
11 | -$op = 'go';//'start'; |
|
11 | +$op = 'go'; //'start'; |
|
12 | 12 | |
13 | 13 | if (isset($_POST['op']) && ('go' === $_POST['op'])) { |
14 | 14 | $op = $_POST['op']; |
15 | 15 | } |
16 | 16 | |
17 | 17 | if ('start' === $op) { |
18 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
18 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
19 | 19 | |
20 | 20 | xoops_cp_header(); |
21 | 21 | |
@@ -44,41 +44,41 @@ discard block |
||
44 | 44 | |
45 | 45 | echo " <title>{module title}</title>\r\n"; |
46 | 46 | |
47 | - $resultC = $xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('smartfaq_categories')); |
|
47 | + $resultC = $xoopsDB->queryF('SELECT * FROM '.$xoopsDB->prefix('smartfaq_categories')); |
|
48 | 48 | while (false !== ($arrC = $xoopsDB->fetchArray($resultC))) { |
49 | 49 | extract($arrC, EXTR_PREFIX_ALL, 'c'); |
50 | 50 | |
51 | 51 | echo " <qandadiv ID=\"c$c_categoryid\" Revision=\"$c_created\">\r\n"; |
52 | - echo ' <title>' . encodeText($c_name) . "</title>\r\n"; |
|
53 | - echo ' <para>' . encodeText($c_description) . "</para>\r\n"; |
|
52 | + echo ' <title>'.encodeText($c_name)."</title>\r\n"; |
|
53 | + echo ' <para>'.encodeText($c_description)."</para>\r\n"; |
|
54 | 54 | |
55 | - $resultQ = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('smartfaq_faq') . " where categoryid=$c_categoryid"); |
|
55 | + $resultQ = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('smartfaq_faq')." where categoryid=$c_categoryid"); |
|
56 | 56 | while (false !== ($arrQ = $xoopsDB->fetchArray($resultQ))) { |
57 | 57 | extract($arrQ, EXTR_PREFIX_ALL, 'q'); |
58 | 58 | |
59 | - echo " <qandaentry ID=\"q$q_faqid\" Revision=\"$q_datesub\" Condition=\"$q_html $q_smiley $q_xcodes\" XrefLabel=\"$q_modulelink $q_contextpage\" Vendor=\"" . getUserFullName($q_uid) . "\">\r\n"; |
|
59 | + echo " <qandaentry ID=\"q$q_faqid\" Revision=\"$q_datesub\" Condition=\"$q_html $q_smiley $q_xcodes\" XrefLabel=\"$q_modulelink $q_contextpage\" Vendor=\"".getUserFullName($q_uid)."\">\r\n"; |
|
60 | 60 | echo " <question>\r\n"; |
61 | - echo ' <para>' . encodeText($q_question) . "</para>\r\n"; |
|
61 | + echo ' <para>'.encodeText($q_question)."</para>\r\n"; |
|
62 | 62 | if (!empty($q_howdoi)) { |
63 | 63 | echo " <note Conformance=\"howdoi\">\r\n"; |
64 | 64 | echo " <title>{'How do I' from language file}</title>\r\n"; |
65 | - echo ' <para>' . encodeText($q_howdoi) . "</para>\r\n"; |
|
65 | + echo ' <para>'.encodeText($q_howdoi)."</para>\r\n"; |
|
66 | 66 | echo " </note>\r\n"; |
67 | 67 | } |
68 | 68 | if (!empty($q_diduno)) { |
69 | 69 | echo " <note Conformance=\"diduno\">\r\n"; |
70 | 70 | echo " <title>{'Did you know' from language file}</title>\r\n"; |
71 | - echo ' <para>' . encodeText($q_diduno) . "</para>\r\n"; |
|
71 | + echo ' <para>'.encodeText($q_diduno)."</para>\r\n"; |
|
72 | 72 | echo " </note>\r\n"; |
73 | 73 | } |
74 | 74 | echo " </question>\r\n"; |
75 | 75 | |
76 | - $resultA = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('smartfaq_answers') . " where answerid=$q_answerid"); |
|
76 | + $resultA = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('smartfaq_answers')." where answerid=$q_answerid"); |
|
77 | 77 | while (false !== ($arrA = $xoopsDB->fetchArray($resultA))) { |
78 | 78 | extract($arrA, EXTR_PREFIX_ALL, 'a'); |
79 | 79 | |
80 | - echo " <answer ID=\"a$a_answerid\" Revision=\"$a_datesub\" Vendor=\"" . getUserFullName($a_uid) . "\">\r\n"; |
|
81 | - echo ' <para>' . encodeText($a_answer) . "</para>\r\n"; |
|
80 | + echo " <answer ID=\"a$a_answerid\" Revision=\"$a_datesub\" Vendor=\"".getUserFullName($a_uid)."\">\r\n"; |
|
81 | + echo ' <para>'.encodeText($a_answer)."</para>\r\n"; |
|
82 | 82 | echo " </answer>\r\n"; |
83 | 83 | } |
84 | 84 | $xoopsDB->freeRecordSet($resultA); |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | use XoopsModules\Smartfaq; |
16 | 16 | use XoopsModules\Smartfaq\Constants; |
17 | 17 | |
18 | -require_once __DIR__ . '/../../../include/cp_header.php'; |
|
19 | -require_once __DIR__ . '/mygrouppermform.php'; |
|
20 | -require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; |
|
18 | +require_once __DIR__.'/../../../include/cp_header.php'; |
|
19 | +require_once __DIR__.'/mygrouppermform.php'; |
|
20 | +require_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
|
21 | 21 | //require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/include/functions.php'; |
22 | 22 | |
23 | -$xoops_system_path = XOOPS_ROOT_PATH . '/modules/system'; |
|
23 | +$xoops_system_path = XOOPS_ROOT_PATH.'/modules/system'; |
|
24 | 24 | |
25 | 25 | // language files |
26 | 26 | $language = $xoopsConfig['language']; |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | |
31 | 31 | // to prevent from notice that constants already defined |
32 | 32 | $error_reporting_level = error_reporting(0); |
33 | -require_once __DIR__ . '/../../system/constants.php'; |
|
34 | -require_once __DIR__ . "/../../language/$language/admin.php"; |
|
35 | -require_once __DIR__ . "/../../language/$language/admin/blocksadmin.php"; |
|
33 | +require_once __DIR__.'/../../system/constants.php'; |
|
34 | +require_once __DIR__."/../../language/$language/admin.php"; |
|
35 | +require_once __DIR__."/../../language/$language/admin/blocksadmin.php"; |
|
36 | 36 | //require_once __DIR__ . '/../include/functions.php'; |
37 | 37 | error_reporting($error_reporting_level); |
38 | 38 | |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | |
46 | 46 | // check $xoopsModule |
47 | 47 | if (!is_object($xoopsModule)) { |
48 | - redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
48 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // check access right (needs system_admin of BLOCK) |
52 | 52 | $syspermHandler = xoops_getHandler('groupperm'); |
53 | 53 | if (!$syspermHandler->checkRight('system_admin', XOOPS_SYSTEM_BLOCK, $xoopsUser->getGroups())) { |
54 | - redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
54 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // get blocks owned by the module |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | |
79 | 79 | // displaying TH |
80 | 80 | Smartfaq\Utility::collapsableBar('toptable', 'toptableicon'); |
81 | - echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . _AM_SF_BLOCKS . '</h3>'; |
|
81 | + echo "<img id='toptableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> "._AM_SF_BLOCKS.'</h3>'; |
|
82 | 82 | echo "<div id='toptable'>"; |
83 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_BLOCKSTXT . '</span>'; |
|
83 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_BLOCKSTXT.'</span>'; |
|
84 | 84 | |
85 | 85 | echo " |
86 | 86 | <form action='admin.php' name='blockadmin' method='post'> |
87 | 87 | <table width='100%' class='outer' cellpadding='4' cellspacing='1'> |
88 | 88 | <tr valign='middle'> |
89 | - <th>" . _AM_TITLE . "</th> |
|
90 | - <th align='center' nowrap='nowrap'>" . _AM_SF_POSITION . "</th> |
|
91 | - <th align='center'>" . _AM_WEIGHT . "</th> |
|
92 | - <th align='center'>" . _AM_VISIBLEIN . "</th> |
|
93 | - <th align='center'>" . _AM_BCACHETIME . "</th> |
|
94 | - <th align='center'>" . _AM_ACTION . "</th> |
|
89 | + <th>" . _AM_TITLE."</th> |
|
90 | + <th align='center' nowrap='nowrap'>" . _AM_SF_POSITION."</th> |
|
91 | + <th align='center'>" . _AM_WEIGHT."</th> |
|
92 | + <th align='center'>" . _AM_VISIBLEIN."</th> |
|
93 | + <th align='center'>" . _AM_BCACHETIME."</th> |
|
94 | + <th align='center'>" . _AM_ACTION."</th> |
|
95 | 95 | </tr>\n"; |
96 | 96 | |
97 | 97 | // blocks displaying loop |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | // target modules |
143 | 143 | $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
144 | - $result = $db->query('SELECT module_id FROM ' . $db->prefix('block_module_link') . " WHERE block_id='$bid'"); |
|
144 | + $result = $db->query('SELECT module_id FROM '.$db->prefix('block_module_link')." WHERE block_id='$bid'"); |
|
145 | 145 | $selected_mids = []; |
146 | 146 | while (false !== (list($selected_mid) = $db->fetchRow($result))) { |
147 | 147 | $selected_mids[] = (int)$selected_mid; |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | $myts = \MyTextSanitizer::getInstance(); |
159 | 159 | foreach ($module_list as $mid => $mname) { |
160 | 160 | if (in_array($mid, $selected_mids)) { |
161 | - $module_options .= "<option value='$mid' selected>" . $myts->displayTarea($mname) . "</option>\n"; |
|
161 | + $module_options .= "<option value='$mid' selected>".$myts->displayTarea($mname)."</option>\n"; |
|
162 | 162 | } else { |
163 | - $module_options .= "<option value='$mid'>" . $myts->displayTarea($mname) . "</option>\n"; |
|
163 | + $module_options .= "<option value='$mid'>".$myts->displayTarea($mname)."</option>\n"; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | <td class='foot' align='center' colspan='6'> |
221 | 221 | <input type='hidden' name='fct' value='blocksadmin'> |
222 | 222 | <input type='hidden' name='op' value='order'> |
223 | - <input type='submit' name='submit' value='" . _SUBMIT . "'> |
|
223 | + <input type='submit' name='submit' value='" . _SUBMIT."'> |
|
224 | 224 | </td> |
225 | 225 | </tr> |
226 | 226 | </table> |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | . "</h3><div id='bottomtable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
249 | 249 | . _AM_SF_GROUPSINFO |
250 | 250 | . '</span>'); |
251 | - $form->addAppendix('module_admin', $xoopsModule->mid(), $xoopsModule->name() . ' ' . _AM_ACTIVERIGHTS); |
|
252 | - $form->addAppendix('module_read', $xoopsModule->mid(), $xoopsModule->name() . ' ' . _AM_ACCESSRIGHTS); |
|
251 | + $form->addAppendix('module_admin', $xoopsModule->mid(), $xoopsModule->name().' '._AM_ACTIVERIGHTS); |
|
252 | + $form->addAppendix('module_read', $xoopsModule->mid(), $xoopsModule->name().' '._AM_ACCESSRIGHTS); |
|
253 | 253 | foreach ($item_list as $item_id => $item_name) { |
254 | 254 | $form->addItem($item_id, $myts->displayTarea($item_name)); |
255 | 255 | } |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | if (!empty($_POST['submit'])) { |
261 | - include __DIR__ . '/mygroupperm.php'; |
|
261 | + include __DIR__.'/mygroupperm.php'; |
|
262 | 262 | require_once "$xoops_system_path/language/$language/admin.php"; |
263 | - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/myblocksadmin.php', 1, _AM_DBUPDATED); |
|
263 | + redirect_header(XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/admin/myblocksadmin.php', 1, _AM_DBUPDATED); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | xoops_cp_header(); |
267 | 267 | if (file_exists('./mymenu.php')) { |
268 | - include __DIR__ . '/mymenu.php'; |
|
268 | + include __DIR__.'/mymenu.php'; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | list_blocks(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | use XoopsModules\Smartfaq; |
15 | 15 | use XoopsModules\Smartfaq\Constants; |
16 | 16 | |
17 | -require_once __DIR__ . '/admin_header.php'; |
|
17 | +require_once __DIR__.'/admin_header.php'; |
|
18 | 18 | |
19 | 19 | $importFromModuleName = 'XoopsFAQ'; |
20 | 20 | $scriptname = 'xoopsfaq.php'; |
@@ -27,33 +27,33 @@ discard block |
||
27 | 27 | |
28 | 28 | if ('start' === $op) { |
29 | 29 | xoops_cp_header(); |
30 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
30 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
31 | 31 | |
32 | - $result = $xoopsDB->queryF('SELECT count(*) FROM ' . $xoopsDB->prefix('xoopsfaq_categories')); |
|
32 | + $result = $xoopsDB->queryF('SELECT count(*) FROM '.$xoopsDB->prefix('xoopsfaq_categories')); |
|
33 | 33 | list($totalCat) = $xoopsDB->fetchRow($result); |
34 | 34 | |
35 | 35 | Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon'); |
36 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName) . '</h3>'; |
|
36 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> ".sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName).'</h3>'; |
|
37 | 37 | echo "<div id='bottomtable'>"; |
38 | 38 | |
39 | 39 | if (0 == $totalCat) { |
40 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_IMPORT_NO_CATEGORY . '</span>'; |
|
40 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_IMPORT_NO_CATEGORY.'</span>'; |
|
41 | 41 | } else { |
42 | - require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
42 | + require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
43 | 43 | |
44 | - $result = $xoopsDB->queryF('SELECT count(*) FROM ' . $xoopsDB->prefix('xoopsfaq_contents')); |
|
44 | + $result = $xoopsDB->queryF('SELECT count(*) FROM '.$xoopsDB->prefix('xoopsfaq_contents')); |
|
45 | 45 | list($totalFAQ) = $xoopsDB->fetchRow($result); |
46 | 46 | |
47 | 47 | if (0 == $totalFAQ) { |
48 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_SF_IMPORT_MODULE_FOUND_NO_FAQ, $importFromModuleName, $totalCat) . '</span>'; |
|
48 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.sprintf(_AM_SF_IMPORT_MODULE_FOUND_NO_FAQ, $importFromModuleName, $totalCat).'</span>'; |
|
49 | 49 | } else { |
50 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_SF_IMPORT_MODULE_FOUND, $importFromModuleName, $totalCat, $totalFAQ) . '</span>'; |
|
50 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.sprintf(_AM_SF_IMPORT_MODULE_FOUND, $importFromModuleName, $totalCat, $totalFAQ).'</span>'; |
|
51 | 51 | |
52 | - $form = new \XoopsThemeForm(_AM_SF_IMPORT_SETTINGS, 'import_form', XOOPS_URL . '/modules/smartfaq/admin/' . $scriptname); |
|
52 | + $form = new \XoopsThemeForm(_AM_SF_IMPORT_SETTINGS, 'import_form', XOOPS_URL.'/modules/smartfaq/admin/'.$scriptname); |
|
53 | 53 | |
54 | 54 | // Categories to be imported |
55 | 55 | $cat_cbox = new \XoopsFormCheckBox(sprintf(_AM_SF_IMPORT_CATEGORIES, $importFromModuleName), 'import_category', -1); |
56 | - $result = $xoopsDB->queryF('SELECT c.category_id, c.category_title, count(q.contents_id) FROM ' . $xoopsDB->prefix('xoopsfaq_categories') . ' AS c, ' . $xoopsDB->prefix('xoopsfaq_contents') . ' AS q WHERE c.category_id=q.category_id GROUP BY c.category_id ORDER BY category_order'); |
|
56 | + $result = $xoopsDB->queryF('SELECT c.category_id, c.category_title, count(q.contents_id) FROM '.$xoopsDB->prefix('xoopsfaq_categories').' AS c, '.$xoopsDB->prefix('xoopsfaq_contents').' AS q WHERE c.category_id=q.category_id GROUP BY c.category_id ORDER BY category_order'); |
|
57 | 57 | |
58 | 58 | while (false !== (list($cid, $cat_title, $count) = $xoopsDB->fetchRow($result))) { |
59 | 59 | $cat_cbox->addOption($cid, "$cat_title ($count)<br\>"); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ob_end_clean(); |
69 | 69 | |
70 | 70 | // Auto-Approve |
71 | - $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_AUTOAPPROVE, 'autoaprove', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '')); |
|
71 | + $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_AUTOAPPROVE, 'autoaprove', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.'')); |
|
72 | 72 | |
73 | 73 | // Submitted and answered by |
74 | 74 | $memberHandler = xoops_getHandler('member'); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $form->addElement($user_select); |
82 | 82 | |
83 | 83 | // Q&As can be commented? |
84 | - $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '')); |
|
84 | + $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.'')); |
|
85 | 85 | |
86 | 86 | $group_list = $memberHandler->getGroupList(); |
87 | 87 | $groups_selected = []; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | if ('go' === $op) { |
108 | - require_once __DIR__ . '/admin_header.php'; |
|
108 | + require_once __DIR__.'/admin_header.php'; |
|
109 | 109 | |
110 | 110 | $import_category = (isset($_POST['import_category']) ? $_POST['import_category'] : null); |
111 | 111 | if (!$import_category) { |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | xoops_cp_header(); |
116 | 116 | |
117 | 117 | Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon'); |
118 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName) . '</h3>'; |
|
118 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> ".sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName).'</h3>'; |
|
119 | 119 | echo "<div id='bottomtable'>"; |
120 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_IMPORT_RESULT . '</span>'; |
|
120 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_IMPORT_RESULT.'</span>'; |
|
121 | 121 | |
122 | 122 | $cnt_imported_cat = 0; |
123 | 123 | $cnt_imported_faq = 0; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | echo "Can Comment: $cancomment<br>"; |
147 | 147 | echo "Auto aprove: $autoaprove<br>";*/ |
148 | 148 | |
149 | - $resultCat = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('xoopsfaq_categories') . " where category_id in ($import_category_list) order by category_order"); |
|
149 | + $resultCat = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('xoopsfaq_categories')." where category_id in ($import_category_list) order by category_order"); |
|
150 | 150 | |
151 | 151 | while (false !== ($arrCat = $xoopsDB->fetchArray($resultCat))) { |
152 | 152 | extract($arrCat, EXTR_PREFIX_ALL, 'xcat'); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $categoryObj->setVar('name', $xcat_category_title); |
161 | 161 | |
162 | 162 | if (!$categoryObj->store(false)) { |
163 | - echo sprintf(_AM_SF_IMPORT_CATEGORY_ERROR, $xcat_name) . '<br>'; |
|
163 | + echo sprintf(_AM_SF_IMPORT_CATEGORY_ERROR, $xcat_name).'<br>'; |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | |
169 | 169 | ++$cnt_imported_cat; |
170 | 170 | |
171 | - echo sprintf(_AM_SF_IMPORT_CATEGORY_SUCCESS, $xcat_category_title) . "<br\>"; |
|
171 | + echo sprintf(_AM_SF_IMPORT_CATEGORY_SUCCESS, $xcat_category_title)."<br\>"; |
|
172 | 172 | |
173 | - $resultFAQ = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('xoopsfaq_contents') . " where category_id=$xcat_category_id order by contents_order"); |
|
173 | + $resultFAQ = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('xoopsfaq_contents')." where category_id=$xcat_category_id order by contents_order"); |
|
174 | 174 | while (false !== ($arrFAQ = $xoopsDB->fetchArray($resultFAQ))) { |
175 | 175 | extract($arrFAQ, EXTR_PREFIX_ALL, 'xfaq'); |
176 | 176 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $faqObj->setVar('cancomment', $cancomment); |
199 | 199 | |
200 | 200 | if (!$faqObj->store(false)) { |
201 | - echo sprintf(' ' . _AM_SF_IMPORT_FAQ_ERROR, $xfaq_contents_title) . '<br>'; |
|
201 | + echo sprintf(' '._AM_SF_IMPORT_FAQ_ERROR, $xfaq_contents_title).'<br>'; |
|
202 | 202 | continue; |
203 | 203 | } else { |
204 | 204 | $answerObj->setVar('faqid', $faqObj->faqid()); |
@@ -207,10 +207,10 @@ discard block |
||
207 | 207 | $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED); |
208 | 208 | |
209 | 209 | if (!$answerObj->store()) { |
210 | - echo sprintf(' ' . _AM_SF_IMPORT_FAQ_ERROR) . '<br>'; |
|
210 | + echo sprintf(' '._AM_SF_IMPORT_FAQ_ERROR).'<br>'; |
|
211 | 211 | continue; |
212 | 212 | } else { |
213 | - echo ' ' . sprintf(_AM_SF_IMPORTED_QUESTION, $faqObj->question(50)) . '<br>'; |
|
213 | + echo ' '.sprintf(_AM_SF_IMPORTED_QUESTION, $faqObj->question(50)).'<br>'; |
|
214 | 214 | ++$cnt_imported_faq; |
215 | 215 | } |
216 | 216 | } |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | echo 'Done.<br>'; |
223 | - echo sprintf(_AM_SF_IMPORTED_CATEGORIES, $cnt_imported_cat) . '<br>'; |
|
224 | - echo sprintf(_AM_SF_IMPORTED_QUESTIONS, $cnt_imported_faq) . '<br>'; |
|
223 | + echo sprintf(_AM_SF_IMPORTED_CATEGORIES, $cnt_imported_cat).'<br>'; |
|
224 | + echo sprintf(_AM_SF_IMPORTED_QUESTIONS, $cnt_imported_faq).'<br>'; |
|
225 | 225 | |
226 | 226 | exit(); |
227 | 227 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | use XoopsModules\Smartfaq; |
14 | 14 | use XoopsModules\Smartfaq\Constants; |
15 | 15 | |
16 | -require_once __DIR__ . '/admin_header.php'; |
|
16 | +require_once __DIR__.'/admin_header.php'; |
|
17 | 17 | |
18 | 18 | $importFromModuleName = 'WF-FAQ'; |
19 | 19 | $scriptname = 'wffaq.php'; |
@@ -25,33 +25,33 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | if ('start' === $op) { |
28 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
28 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
29 | 29 | xoops_cp_header(); |
30 | - $result = $xoopsDB->queryF('SELECT count(*) FROM ' . $xoopsDB->prefix('faqcategories')); |
|
30 | + $result = $xoopsDB->queryF('SELECT count(*) FROM '.$xoopsDB->prefix('faqcategories')); |
|
31 | 31 | list($totalCat) = $xoopsDB->fetchRow($result); |
32 | 32 | |
33 | 33 | Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon'); |
34 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName) . '</h3>'; |
|
34 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> ".sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName).'</h3>'; |
|
35 | 35 | echo "<div id='bottomtable'>"; |
36 | 36 | |
37 | 37 | if (0 == $totalCat) { |
38 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_IMPORT_NO_CATEGORY . '</span>'; |
|
38 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_IMPORT_NO_CATEGORY.'</span>'; |
|
39 | 39 | } else { |
40 | - require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
40 | + require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
41 | 41 | |
42 | - $result = $xoopsDB->queryF('SELECT count(*) FROM ' . $xoopsDB->prefix('faqtopics')); |
|
42 | + $result = $xoopsDB->queryF('SELECT count(*) FROM '.$xoopsDB->prefix('faqtopics')); |
|
43 | 43 | list($totalFAQ) = $xoopsDB->fetchRow($result); |
44 | 44 | |
45 | 45 | if (0 == $totalFAQ) { |
46 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_SF_IMPORT_MODULE_FOUND_NO_FAQ, $importFromModuleName, $totalCat) . '</span>'; |
|
46 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.sprintf(_AM_SF_IMPORT_MODULE_FOUND_NO_FAQ, $importFromModuleName, $totalCat).'</span>'; |
|
47 | 47 | } else { |
48 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_SF_IMPORT_MODULE_FOUND, $importFromModuleName, $totalCat, $totalFAQ) . '</span>'; |
|
48 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.sprintf(_AM_SF_IMPORT_MODULE_FOUND, $importFromModuleName, $totalCat, $totalFAQ).'</span>'; |
|
49 | 49 | |
50 | - $form = new \XoopsThemeForm(_AM_SF_IMPORT_SETTINGS, 'import_form', XOOPS_URL . '/modules/smartfaq/admin/' . $scriptname); |
|
50 | + $form = new \XoopsThemeForm(_AM_SF_IMPORT_SETTINGS, 'import_form', XOOPS_URL.'/modules/smartfaq/admin/'.$scriptname); |
|
51 | 51 | |
52 | 52 | // Categories to be imported |
53 | 53 | $cat_cbox = new \XoopsFormCheckBox(sprintf(_AM_SF_IMPORT_CATEGORIES, $importFromModuleName), 'import_category', -1); |
54 | - $result = $xoopsDB->queryF('SELECT c.catID, c.name, count(t.topicID) FROM ' . $xoopsDB->prefix('faqcategories') . ' AS c, ' . $xoopsDB->prefix('faqtopics') . ' AS t WHERE c.catID=t.catID GROUP BY t.catID ORDER BY c.weight'); |
|
54 | + $result = $xoopsDB->queryF('SELECT c.catID, c.name, count(t.topicID) FROM '.$xoopsDB->prefix('faqcategories').' AS c, '.$xoopsDB->prefix('faqtopics').' AS t WHERE c.catID=t.catID GROUP BY t.catID ORDER BY c.weight'); |
|
55 | 55 | while (false !== (list($cid, $cat_title, $count) = $xoopsDB->fetchRow($result))) { |
56 | 56 | $cat_cbox->addOption($cid, "$cat_title ($count)<br\>"); |
57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ob_end_clean(); |
66 | 66 | |
67 | 67 | // Auto-Approve |
68 | - $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_AUTOAPPROVE, 'autoaprove', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '')); |
|
68 | + $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_AUTOAPPROVE, 'autoaprove', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.'')); |
|
69 | 69 | |
70 | 70 | // Submitted and answered by |
71 | 71 | $memberHandler = xoops_getHandler('member'); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $form->addElement($user_select); |
79 | 79 | |
80 | 80 | // Q&As can be commented? |
81 | - $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '')); |
|
81 | + $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.'')); |
|
82 | 82 | $group_list = $memberHandler->getGroupList(); |
83 | 83 | $groups_selected = []; |
84 | 84 | $groups_checkbox = new \XoopsFormCheckBox(_AM_SF_IMPORT_PERMISSIONS, 'groups_read'); |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | redirect_header($scriptname, 2, _AM_SF_NOCATSELECTED); |
108 | 108 | } |
109 | 109 | |
110 | - require_once __DIR__ . '/admin_header.php'; |
|
110 | + require_once __DIR__.'/admin_header.php'; |
|
111 | 111 | xoops_cp_header(); |
112 | 112 | |
113 | 113 | Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon'); |
114 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName) . '</h3>'; |
|
114 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> ".sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName).'</h3>'; |
|
115 | 115 | echo "<div id='bottomtable'>"; |
116 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_IMPORT_RESULT . '</span>'; |
|
116 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_IMPORT_RESULT.'</span>'; |
|
117 | 117 | |
118 | 118 | $cnt_imported_cat = 0; |
119 | 119 | $cnt_imported_faq = 0; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | echo "Can Comment: $cancomment<br>"; |
143 | 143 | echo "Auto aprove: $autoaprove<br>";*/ |
144 | 144 | |
145 | - $resultCat = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('faqcategories') . " where catID in ($import_category_list) order by weight"); |
|
145 | + $resultCat = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('faqcategories')." where catID in ($import_category_list) order by weight"); |
|
146 | 146 | |
147 | 147 | while (false !== ($arrCat = $xoopsDB->fetchArray($resultCat))) { |
148 | 148 | extract($arrCat, EXTR_PREFIX_ALL, 'wfc'); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $categoryObj->setVar('description', $wfc_description); |
158 | 158 | |
159 | 159 | if (!$categoryObj->store(false)) { |
160 | - echo sprintf(_AM_SF_IMPORT_CATEGORY_ERROR, $xcat_name) . '<br>'; |
|
160 | + echo sprintf(_AM_SF_IMPORT_CATEGORY_ERROR, $xcat_name).'<br>'; |
|
161 | 161 | continue; |
162 | 162 | } |
163 | 163 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | ++$cnt_imported_cat; |
167 | 167 | |
168 | - echo sprintf(_AM_SF_IMPORT_CATEGORY_SUCCESS, $wfc_name) . "<br\>"; |
|
168 | + echo sprintf(_AM_SF_IMPORT_CATEGORY_SUCCESS, $wfc_name)."<br\>"; |
|
169 | 169 | |
170 | - $resultFAQ = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('faqtopics') . " where catID=$wfc_catID order by weight"); |
|
170 | + $resultFAQ = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('faqtopics')." where catID=$wfc_catID order by weight"); |
|
171 | 171 | while (false !== ($arrFAQ = $xoopsDB->fetchArray($resultFAQ))) { |
172 | 172 | extract($arrFAQ, EXTR_PREFIX_ALL, 'wft'); |
173 | 173 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $faqObj->setVar('exacturl', 0); |
200 | 200 | |
201 | 201 | if (!$faqObj->store(false)) { |
202 | - echo sprintf(' ' . _AM_SF_IMPORT_FAQ_ERROR, $wft_question) . '<br>'; |
|
202 | + echo sprintf(' '._AM_SF_IMPORT_FAQ_ERROR, $wft_question).'<br>'; |
|
203 | 203 | continue; |
204 | 204 | } else { |
205 | 205 | $answerObj->setVar('faqid', $faqObj->faqid()); |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED); |
209 | 209 | |
210 | 210 | if (!$answerObj->store()) { |
211 | - echo sprintf(' ' . _AM_SF_IMPORT_FAQ_ERROR) . '<br>'; |
|
211 | + echo sprintf(' '._AM_SF_IMPORT_FAQ_ERROR).'<br>'; |
|
212 | 212 | continue; |
213 | 213 | } else { |
214 | - echo ' ' . sprintf(_AM_SF_IMPORTED_QUESTION, $faqObj->question(50)) . '<br>'; |
|
214 | + echo ' '.sprintf(_AM_SF_IMPORTED_QUESTION, $faqObj->question(50)).'<br>'; |
|
215 | 215 | ++$cnt_imported_faq; |
216 | 216 | } |
217 | 217 | } |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | echo 'Done.<br>'; |
224 | - echo sprintf(_AM_SF_IMPORTED_CATEGORIES, $cnt_imported_cat) . '<br>'; |
|
225 | - echo sprintf(_AM_SF_IMPORTED_QUESTIONS, $cnt_imported_faq) . '<br>'; |
|
224 | + echo sprintf(_AM_SF_IMPORTED_CATEGORIES, $cnt_imported_cat).'<br>'; |
|
225 | + echo sprintf(_AM_SF_IMPORTED_QUESTIONS, $cnt_imported_faq).'<br>'; |
|
226 | 226 | |
227 | 227 | exit(); |
228 | 228 | } |
@@ -26,53 +26,53 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | switch ($op) { |
29 | - case 'default': |
|
30 | - default: |
|
31 | - global $xoopsDB, $xoopsModule; |
|
29 | + case 'default': |
|
30 | + default: |
|
31 | + global $xoopsDB, $xoopsModule; |
|
32 | 32 | |
33 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
34 | - xoops_cp_header(); |
|
35 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | - // View Categories permissions |
|
37 | - $item_list_view = []; |
|
38 | - $block_view = []; |
|
39 | - // echo "<h3 style='color: #2F5376; '>"._AM_SF_PERMISSIONSADMIN."</h3>\n" ; |
|
40 | - Smartfaq\Utility::collapsableBar('toptable', 'toptableicon'); |
|
33 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
34 | + xoops_cp_header(); |
|
35 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | + // View Categories permissions |
|
37 | + $item_list_view = []; |
|
38 | + $block_view = []; |
|
39 | + // echo "<h3 style='color: #2F5376; '>"._AM_SF_PERMISSIONSADMIN."</h3>\n" ; |
|
40 | + Smartfaq\Utility::collapsableBar('toptable', 'toptableicon'); |
|
41 | 41 | |
42 | - $result_view = $xoopsDB->query('SELECT categoryid, name FROM ' . $xoopsDB->prefix('smartfaq_categories') . ' '); |
|
43 | - if ($xoopsDB->getRowsNum($result_view)) { |
|
44 | - while (false !== ($myrow_view = $xoopsDB->fetchArray($result_view))) { |
|
45 | - $item_list_view['cid'] = $myrow_view['categoryid']; |
|
46 | - $item_list_view['title'] = $myrow_view['name']; |
|
47 | - $form_view = new \XoopsGroupPermForm('', $xoopsModule->getVar('mid'), 'category_read', "<img id='toptableicon' src=" |
|
48 | - . XOOPS_URL |
|
49 | - . '/modules/' |
|
50 | - . $xoopsModule->dirname() |
|
51 | - . "/assets/images/icon/close12.gif alt=''></a> " |
|
52 | - . _AM_SF_PERMISSIONSVIEWMAN |
|
53 | - . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
|
54 | - . _AM_SF_VIEW_CATS |
|
55 | - . '</span>', 'admin/permissions.php'); |
|
56 | - $block_view[] = $item_list_view; |
|
57 | - foreach ($block_view as $itemlists) { |
|
58 | - $form_view->addItem($itemlists['cid'], $myts->displayTarea($itemlists['title'])); |
|
42 | + $result_view = $xoopsDB->query('SELECT categoryid, name FROM ' . $xoopsDB->prefix('smartfaq_categories') . ' '); |
|
43 | + if ($xoopsDB->getRowsNum($result_view)) { |
|
44 | + while (false !== ($myrow_view = $xoopsDB->fetchArray($result_view))) { |
|
45 | + $item_list_view['cid'] = $myrow_view['categoryid']; |
|
46 | + $item_list_view['title'] = $myrow_view['name']; |
|
47 | + $form_view = new \XoopsGroupPermForm('', $xoopsModule->getVar('mid'), 'category_read', "<img id='toptableicon' src=" |
|
48 | + . XOOPS_URL |
|
49 | + . '/modules/' |
|
50 | + . $xoopsModule->dirname() |
|
51 | + . "/assets/images/icon/close12.gif alt=''></a> " |
|
52 | + . _AM_SF_PERMISSIONSVIEWMAN |
|
53 | + . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
|
54 | + . _AM_SF_VIEW_CATS |
|
55 | + . '</span>', 'admin/permissions.php'); |
|
56 | + $block_view[] = $item_list_view; |
|
57 | + foreach ($block_view as $itemlists) { |
|
58 | + $form_view->addItem($itemlists['cid'], $myts->displayTarea($itemlists['title'])); |
|
59 | + } |
|
59 | 60 | } |
61 | + echo $form_view->render(); |
|
62 | + } else { |
|
63 | + echo "<img id='toptableicon' src=" |
|
64 | + . XOOPS_URL |
|
65 | + . '/modules/' |
|
66 | + . $xoopsModule->dirname() |
|
67 | + . "/assets/images/icon/close12.gif alt=''></a> " |
|
68 | + . _AM_SF_PERMISSIONSVIEWMAN |
|
69 | + . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
|
70 | + . _AM_SF_NOPERMSSET |
|
71 | + . '</span>'; |
|
60 | 72 | } |
61 | - echo $form_view->render(); |
|
62 | - } else { |
|
63 | - echo "<img id='toptableicon' src=" |
|
64 | - . XOOPS_URL |
|
65 | - . '/modules/' |
|
66 | - . $xoopsModule->dirname() |
|
67 | - . "/assets/images/icon/close12.gif alt=''></a> " |
|
68 | - . _AM_SF_PERMISSIONSVIEWMAN |
|
69 | - . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
|
70 | - . _AM_SF_NOPERMSSET |
|
71 | - . '</span>'; |
|
72 | - } |
|
73 | - echo '</div>'; |
|
73 | + echo '</div>'; |
|
74 | 74 | |
75 | - echo "<br>\n"; |
|
75 | + echo "<br>\n"; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | require_once __DIR__ . '/admin_footer.php'; |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | |
9 | 9 | use XoopsModules\Smartfaq; |
10 | 10 | |
11 | -require_once __DIR__ . '/admin_header.php'; |
|
12 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
11 | +require_once __DIR__.'/admin_header.php'; |
|
12 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php'; |
|
13 | 13 | |
14 | 14 | if (!Smartfaq\Utility::userIsAdmin()) { |
15 | 15 | redirect_header('javascript:history.go(-1)', 1, _NOPERM); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | // echo "<h3 style='color: #2F5376; '>"._AM_SF_PERMISSIONSADMIN."</h3>\n" ; |
40 | 40 | Smartfaq\Utility::collapsableBar('toptable', 'toptableicon'); |
41 | 41 | |
42 | - $result_view = $xoopsDB->query('SELECT categoryid, name FROM ' . $xoopsDB->prefix('smartfaq_categories') . ' '); |
|
42 | + $result_view = $xoopsDB->query('SELECT categoryid, name FROM '.$xoopsDB->prefix('smartfaq_categories').' '); |
|
43 | 43 | if ($xoopsDB->getRowsNum($result_view)) { |
44 | 44 | while (false !== ($myrow_view = $xoopsDB->fetchArray($result_view))) { |
45 | 45 | $item_list_view['cid'] = $myrow_view['categoryid']; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
54 | 54 | . _AM_SF_VIEW_CATS |
55 | 55 | . '</span>', 'admin/permissions.php'); |
56 | - $block_view[] = $item_list_view; |
|
56 | + $block_view[] = $item_list_view; |
|
57 | 57 | foreach ($block_view as $itemlists) { |
58 | 58 | $form_view->addItem($itemlists['cid'], $myts->displayTarea($itemlists['title'])); |
59 | 59 | } |
@@ -75,4 +75,4 @@ discard block |
||
75 | 75 | echo "<br>\n"; |
76 | 76 | } |
77 | 77 | |
78 | -require_once __DIR__ . '/admin_footer.php'; |
|
78 | +require_once __DIR__.'/admin_footer.php'; |
@@ -21,7 +21,7 @@ |
||
21 | 21 | $searchcat = new \XoopsFormSelect(_MD_WB_CATEGORY, 'categoryID', $categoryID); |
22 | 22 | $searchcat->addOption('0', _MD_WB_ALLOFTHEM); |
23 | 23 | |
24 | - $resultcat = $xoopsDB->queryF('SELECT categoryID, name FROM ' . $xoopsDB->prefix('wbcategories') . ' ORDER BY categoryID'); |
|
24 | + $resultcat = $xoopsDB->queryF('SELECT categoryID, name FROM '.$xoopsDB->prefix('wbcategories').' ORDER BY categoryID'); |
|
25 | 25 | |
26 | 26 | while (false !== (list($categoryID, $name) = $xoopsDB->fetchRow($resultcat))) { |
27 | 27 | $searchcat->addOption('categoryID', "$categoryID : $name"); |