| @@ 312-329 (lines=18) @@ | ||
| 309 | * |
|
| 310 | * @return bool |
|
| 311 | */ |
|
| 312 | public function deleteGlossaryItem($id) |
|
| 313 | { |
|
| 314 | $query = sprintf(" |
|
| 315 | DELETE FROM |
|
| 316 | %sfaqglossary |
|
| 317 | WHERE |
|
| 318 | id = %d AND lang = '%s'", |
|
| 319 | PMF_Db::getTablePrefix(), |
|
| 320 | (int) $id, |
|
| 321 | $this->config->getLanguage()->getLanguage() |
|
| 322 | ); |
|
| 323 | ||
| 324 | if ($this->config->getDb()->query($query)) { |
|
| 325 | return true; |
|
| 326 | } |
|
| 327 | ||
| 328 | return false; |
|
| 329 | } |
|
| 330 | } |
|
| 331 | ||
| @@ 61-74 (lines=14) @@ | ||
| 58 | * |
|
| 59 | * @return int |
|
| 60 | */ |
|
| 61 | public function getNumberOfEntries() |
|
| 62 | { |
|
| 63 | $query = sprintf(' |
|
| 64 | SELECT |
|
| 65 | id |
|
| 66 | FROM |
|
| 67 | %sfaqadminlog', |
|
| 68 | PMF_Db::getTablePrefix() |
|
| 69 | ); |
|
| 70 | ||
| 71 | return $this->_config->getDb()->numRows( |
|
| 72 | $this->_config->getDb()->query($query) |
|
| 73 | ); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * Returns all data from the adminlog. |
|
| @@ 396-415 (lines=20) @@ | ||
| 393 | * |
|
| 394 | * @return bool |
|
| 395 | */ |
|
| 396 | public function deleteNews($id) |
|
| 397 | { |
|
| 398 | $query = sprintf( |
|
| 399 | "DELETE FROM |
|
| 400 | %sfaqnews |
|
| 401 | WHERE |
|
| 402 | id = %d |
|
| 403 | AND |
|
| 404 | lang = '%s'", |
|
| 405 | PMF_Db::getTablePrefix(), |
|
| 406 | $id, |
|
| 407 | $this->_config->getLanguage()->getLanguage() |
|
| 408 | ); |
|
| 409 | ||
| 410 | if (!$this->_config->getDb()->query($query)) { |
|
| 411 | return false; |
|
| 412 | } |
|
| 413 | ||
| 414 | return true; |
|
| 415 | } |
|
| 416 | } |
|
| 417 | ||
| @@ 273-288 (lines=16) @@ | ||
| 270 | * |
|
| 271 | * @return bool |
|
| 272 | */ |
|
| 273 | public function updateTag(PMF_Entity_Tags $entity) |
|
| 274 | { |
|
| 275 | $query = sprintf(" |
|
| 276 | UPDATE |
|
| 277 | %sfaqtags |
|
| 278 | SET |
|
| 279 | tagging_name = '%s' |
|
| 280 | WHERE |
|
| 281 | tagging_id = %d", |
|
| 282 | PMF_Db::getTablePrefix(), |
|
| 283 | $entity->getName(), |
|
| 284 | $entity->getId() |
|
| 285 | ); |
|
| 286 | ||
| 287 | return $this->_config->getDb()->query($query); |
|
| 288 | } |
|
| 289 | ||
| 290 | /** |
|
| 291 | * Deletes all tags from a given record id. |
|
| @@ 1458-1472 (lines=15) @@ | ||
| 1455 | * |
|
| 1456 | * @return int |
|
| 1457 | */ |
|
| 1458 | public function numParent($parent_id) |
|
| 1459 | { |
|
| 1460 | $query = sprintf(' |
|
| 1461 | SELECT distinct |
|
| 1462 | id |
|
| 1463 | FROM |
|
| 1464 | %sfaqcategories |
|
| 1465 | WHERE |
|
| 1466 | parent_id = %d', |
|
| 1467 | PMF_Db::getTablePrefix(), |
|
| 1468 | $parent_id); |
|
| 1469 | $result = $this->_config->getDb()->query($query); |
|
| 1470 | ||
| 1471 | return $this->_config->getDb()->numRows($result); |
|
| 1472 | } |
|
| 1473 | ||
| 1474 | /** |
|
| 1475 | * Adds the category permissions for users and groups. |
|
| @@ 1124-1139 (lines=16) @@ | ||
| 1121 | * |
|
| 1122 | * @return bool |
|
| 1123 | */ |
|
| 1124 | public function deleteCategoryRelations($record_id, $record_lang) |
|
| 1125 | { |
|
| 1126 | $query = sprintf(" |
|
| 1127 | DELETE FROM |
|
| 1128 | %sfaqcategoryrelations |
|
| 1129 | WHERE |
|
| 1130 | record_id = %d |
|
| 1131 | AND |
|
| 1132 | record_lang = '%s'", |
|
| 1133 | PMF_Db::getTablePrefix(), |
|
| 1134 | $record_id, |
|
| 1135 | $record_lang); |
|
| 1136 | $this->_config->getDb()->query($query); |
|
| 1137 | ||
| 1138 | return true; |
|
| 1139 | } |
|
| 1140 | ||
| 1141 | /** |
|
| 1142 | * Returns an array with all data from a FAQ record. |
|
| @@ 1539-1557 (lines=19) @@ | ||
| 1536 | * |
|
| 1537 | * @return array |
|
| 1538 | */ |
|
| 1539 | public function addNewRevision($record_id, $record_lang) |
|
| 1540 | { |
|
| 1541 | $query = sprintf(" |
|
| 1542 | INSERT INTO |
|
| 1543 | %sfaqdata_revisions |
|
| 1544 | SELECT * FROM |
|
| 1545 | %sfaqdata |
|
| 1546 | WHERE |
|
| 1547 | id = %d |
|
| 1548 | AND |
|
| 1549 | lang = '%s'", |
|
| 1550 | PMF_Db::getTablePrefix(), |
|
| 1551 | PMF_Db::getTablePrefix(), |
|
| 1552 | $record_id, |
|
| 1553 | $record_lang); |
|
| 1554 | $this->_config->getDb()->query($query); |
|
| 1555 | ||
| 1556 | return true; |
|
| 1557 | } |
|
| 1558 | ||
| 1559 | /** |
|
| 1560 | * Returns the keywords of a FAQ record from the ID and language. |
|
| @@ 1750-1767 (lines=18) @@ | ||
| 1747 | * |
|
| 1748 | * @return bool |
|
| 1749 | */ |
|
| 1750 | public function deleteQuestion($questionId) |
|
| 1751 | { |
|
| 1752 | $delete = sprintf(" |
|
| 1753 | DELETE FROM |
|
| 1754 | %sfaqquestions |
|
| 1755 | WHERE |
|
| 1756 | id = %d |
|
| 1757 | AND |
|
| 1758 | lang = '%s'", |
|
| 1759 | PMF_Db::getTablePrefix(), |
|
| 1760 | $questionId, |
|
| 1761 | $this->_config->getLanguage()->getLanguage() |
|
| 1762 | ); |
|
| 1763 | ||
| 1764 | $this->_config->getDb()->query($delete); |
|
| 1765 | ||
| 1766 | return true; |
|
| 1767 | } |
|
| 1768 | ||
| 1769 | /** |
|
| 1770 | * Returns the visibility of a question. |
|
| @@ 1810-1830 (lines=21) @@ | ||
| 1807 | * |
|
| 1808 | * @return bool |
|
| 1809 | */ |
|
| 1810 | public function setVisibilityOfQuestion($questionId, $isVisible) |
|
| 1811 | { |
|
| 1812 | $query = sprintf(" |
|
| 1813 | UPDATE |
|
| 1814 | %sfaqquestions |
|
| 1815 | SET |
|
| 1816 | is_visible = '%s' |
|
| 1817 | WHERE |
|
| 1818 | id = %d |
|
| 1819 | AND |
|
| 1820 | lang = '%s'", |
|
| 1821 | PMF_Db::getTablePrefix(), |
|
| 1822 | $isVisible, |
|
| 1823 | $questionId, |
|
| 1824 | $this->_config->getLanguage()->getLanguage() |
|
| 1825 | ); |
|
| 1826 | ||
| 1827 | $this->_config->getDb()->query($query); |
|
| 1828 | ||
| 1829 | return true; |
|
| 1830 | } |
|
| 1831 | ||
| 1832 | /** |
|
| 1833 | * This function generates a data-set with the mosted voted recors. |
|