| @@ 1489-1503 (lines=15) @@ | ||
| 1486 | * |
|
| 1487 | * @return int |
|
| 1488 | */ |
|
| 1489 | public function numParent($parent_id) |
|
| 1490 | { |
|
| 1491 | $query = sprintf(' |
|
| 1492 | SELECT distinct |
|
| 1493 | id |
|
| 1494 | FROM |
|
| 1495 | %sfaqcategories |
|
| 1496 | WHERE |
|
| 1497 | parent_id = %d', |
|
| 1498 | PMF_Db::getTablePrefix(), |
|
| 1499 | $parent_id); |
|
| 1500 | $result = $this->_config->getDb()->query($query); |
|
| 1501 | ||
| 1502 | return $this->_config->getDb()->numRows($result); |
|
| 1503 | } |
|
| 1504 | ||
| 1505 | /** |
|
| 1506 | * Adds the category permissions for users and groups. |
|
| @@ 1220-1235 (lines=16) @@ | ||
| 1217 | * |
|
| 1218 | * @return bool |
|
| 1219 | */ |
|
| 1220 | public function deleteCategoryRelations($record_id, $record_lang) |
|
| 1221 | { |
|
| 1222 | $query = sprintf(" |
|
| 1223 | DELETE FROM |
|
| 1224 | %sfaqcategoryrelations |
|
| 1225 | WHERE |
|
| 1226 | record_id = %d |
|
| 1227 | AND |
|
| 1228 | record_lang = '%s'", |
|
| 1229 | PMF_Db::getTablePrefix(), |
|
| 1230 | $record_id, |
|
| 1231 | $record_lang); |
|
| 1232 | $this->_config->getDb()->query($query); |
|
| 1233 | ||
| 1234 | return true; |
|
| 1235 | } |
|
| 1236 | ||
| 1237 | /** |
|
| 1238 | * Returns an array with all data from a FAQ record. |
|
| @@ 1665-1683 (lines=19) @@ | ||
| 1662 | * |
|
| 1663 | * @return array |
|
| 1664 | */ |
|
| 1665 | public function addNewRevision($record_id, $record_lang) |
|
| 1666 | { |
|
| 1667 | $query = sprintf(" |
|
| 1668 | INSERT INTO |
|
| 1669 | %sfaqdata_revisions |
|
| 1670 | SELECT * FROM |
|
| 1671 | %sfaqdata |
|
| 1672 | WHERE |
|
| 1673 | id = %d |
|
| 1674 | AND |
|
| 1675 | lang = '%s'", |
|
| 1676 | PMF_Db::getTablePrefix(), |
|
| 1677 | PMF_Db::getTablePrefix(), |
|
| 1678 | $record_id, |
|
| 1679 | $record_lang); |
|
| 1680 | $this->_config->getDb()->query($query); |
|
| 1681 | ||
| 1682 | return true; |
|
| 1683 | } |
|
| 1684 | ||
| 1685 | /** |
|
| 1686 | * Returns the keywords of a FAQ record from the ID and language. |
|
| @@ 1878-1895 (lines=18) @@ | ||
| 1875 | * |
|
| 1876 | * @return bool |
|
| 1877 | */ |
|
| 1878 | public function deleteQuestion($questionId) |
|
| 1879 | { |
|
| 1880 | $delete = sprintf(" |
|
| 1881 | DELETE FROM |
|
| 1882 | %sfaqquestions |
|
| 1883 | WHERE |
|
| 1884 | id = %d |
|
| 1885 | AND |
|
| 1886 | lang = '%s'", |
|
| 1887 | PMF_Db::getTablePrefix(), |
|
| 1888 | $questionId, |
|
| 1889 | $this->_config->getLanguage()->getLanguage() |
|
| 1890 | ); |
|
| 1891 | ||
| 1892 | $this->_config->getDb()->query($delete); |
|
| 1893 | ||
| 1894 | return true; |
|
| 1895 | } |
|
| 1896 | ||
| 1897 | /** |
|
| 1898 | * Returns the visibility of a question. |
|
| @@ 1938-1958 (lines=21) @@ | ||
| 1935 | * |
|
| 1936 | * @return bool |
|
| 1937 | */ |
|
| 1938 | public function setVisibilityOfQuestion($questionId, $isVisible) |
|
| 1939 | { |
|
| 1940 | $query = sprintf(" |
|
| 1941 | UPDATE |
|
| 1942 | %sfaqquestions |
|
| 1943 | SET |
|
| 1944 | is_visible = '%s' |
|
| 1945 | WHERE |
|
| 1946 | id = %d |
|
| 1947 | AND |
|
| 1948 | lang = '%s'", |
|
| 1949 | PMF_Db::getTablePrefix(), |
|
| 1950 | $isVisible, |
|
| 1951 | $questionId, |
|
| 1952 | $this->_config->getLanguage()->getLanguage() |
|
| 1953 | ); |
|
| 1954 | ||
| 1955 | $this->_config->getDb()->query($query); |
|
| 1956 | ||
| 1957 | return true; |
|
| 1958 | } |
|
| 1959 | ||
| 1960 | /** |
|
| 1961 | * This function generates a data-set with the most voted FAQs. |
|
| @@ 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. |
|