@@ 241-264 (lines=24) @@ | ||
238 | * |
|
239 | * @return bool |
|
240 | */ |
|
241 | public function deleteComment($recordId, $commentId) |
|
242 | { |
|
243 | if (!is_int($recordId) && !is_int($commentId)) { |
|
244 | return false; |
|
245 | } |
|
246 | ||
247 | $query = sprintf(' |
|
248 | DELETE FROM |
|
249 | %sfaqcomments |
|
250 | WHERE |
|
251 | id = %d |
|
252 | AND |
|
253 | id_comment = %d', |
|
254 | Db::getTablePrefix(), |
|
255 | $recordId, |
|
256 | $commentId |
|
257 | ); |
|
258 | ||
259 | if (!$this->config->getDb()->query($query)) { |
|
260 | return false; |
|
261 | } |
|
262 | ||
263 | return true; |
|
264 | } |
|
265 | ||
266 | /** |
|
267 | * Returns the number of comments of each FAQ record as an array. |
@@ 481-502 (lines=22) @@ | ||
478 | * @param int $sectionId |
|
479 | * @return bool |
|
480 | */ |
|
481 | public function removeAllGroupsFromSection($sectionId) |
|
482 | { |
|
483 | if ($sectionId <= 0 || !is_numeric($sectionId)) { |
|
484 | return false; |
|
485 | } |
|
486 | ||
487 | $delete = sprintf(' |
|
488 | DELETE FROM |
|
489 | %sfaqsection_group |
|
490 | WHERE |
|
491 | section_id = %d', |
|
492 | DB::getTablePrefix(), |
|
493 | $sectionId |
|
494 | ); |
|
495 | ||
496 | $res = $this->config->getDb()->query($delete); |
|
497 | if (!$res) { |
|
498 | return false; |
|
499 | } |
|
500 | ||
501 | return true; |
|
502 | } |
|
503 | ||
504 | /** |
|
505 | * Removes a group $groupId from the section $sectionId. |
|
@@ 691-711 (lines=21) @@ | ||
688 | * @param int $groupId |
|
689 | * @return bool |
|
690 | */ |
|
691 | public function removeGroupFromAllSections($groupId) |
|
692 | { |
|
693 | if ($groupId < 1 || !is_numeric($groupId)) { |
|
694 | return false; |
|
695 | } |
|
696 | ||
697 | $delete = sprintf(' |
|
698 | DELETE FROM |
|
699 | %sfaqsection_group |
|
700 | WHERE |
|
701 | group_id = %s', |
|
702 | DB::getTablePrefix(), |
|
703 | $groupId |
|
704 | ); |
|
705 | ||
706 | $res = $this->config->getDb()->query($delete); |
|
707 | if (!$res) { |
|
708 | return false; |
|
709 | } |
|
710 | return true; |
|
711 | } |
|
712 | ||
713 | /** |
|
714 | * Returns an array that contains the IDs of all rights the user |
|
@@ 880-898 (lines=19) @@ | ||
877 | * @param int $categoryId |
|
878 | * @return bool |
|
879 | */ |
|
880 | public function removeCategoryFromAllSections($categoryId) |
|
881 | { |
|
882 | if (!is_numeric($categoryId) || $categoryId < 1) { |
|
883 | return false; |
|
884 | } |
|
885 | $delete = sprintf(' |
|
886 | DELETE FROM |
|
887 | %sfaqsection_category |
|
888 | WHERE |
|
889 | category_id = %d', |
|
890 | DB::getTablePrefix(), |
|
891 | $categoryId |
|
892 | ); |
|
893 | $res = $this->config->getDb()->query($delete); |
|
894 | if (!$res) { |
|
895 | return false; |
|
896 | } |
|
897 | return true; |
|
898 | } |
|
899 | ||
900 | /** |
|
901 | * Adds a new news $newsId to the section $sectionId. |
|
@@ 998-1016 (lines=19) @@ | ||
995 | * @param int $newsId |
|
996 | * @return bool |
|
997 | */ |
|
998 | public function removeNewsFromAllSections($newsId) |
|
999 | { |
|
1000 | if (!is_numeric($newsId) || $newsId < 1) { |
|
1001 | return false; |
|
1002 | } |
|
1003 | $delete = sprintf(' |
|
1004 | DELETE FROM |
|
1005 | %sfaqsection_news |
|
1006 | WHERE |
|
1007 | news_id = %d', |
|
1008 | DB::getTablePrefix(), |
|
1009 | $newsId |
|
1010 | ); |
|
1011 | $res = $this->config->getDb()->query($delete); |
|
1012 | if (!$res) { |
|
1013 | return false; |
|
1014 | } |
|
1015 | return true; |
|
1016 | } |
|
1017 | ||
1018 | } |
|
1019 |
@@ 876-896 (lines=21) @@ | ||
873 | * |
|
874 | * @return bool |
|
875 | */ |
|
876 | public function removeFromAllGroups($userId) |
|
877 | { |
|
878 | if ($userId <= 0 || !is_numeric($userId)) { |
|
879 | return false; |
|
880 | } |
|
881 | ||
882 | $delete = sprintf(' |
|
883 | DELETE FROM |
|
884 | %sfaquser_group |
|
885 | WHERE |
|
886 | user_id = %d', |
|
887 | Db::getTablePrefix(), |
|
888 | $userId); |
|
889 | ||
890 | $res = $this->config->getDb()->query($delete); |
|
891 | if (!$res) { |
|
892 | return false; |
|
893 | } |
|
894 | ||
895 | return true; |
|
896 | } |
|
897 | ||
898 | /** |
|
899 | * Returns an array that contains the IDs of all rights the user |
|
@@ 951-971 (lines=21) @@ | ||
948 | * |
|
949 | * @return bool |
|
950 | */ |
|
951 | public function refuseAllGroupRights($groupId) |
|
952 | { |
|
953 | if ($groupId <= 0 || !is_numeric($groupId)) { |
|
954 | return false; |
|
955 | } |
|
956 | ||
957 | $delete = sprintf(' |
|
958 | DELETE FROM |
|
959 | %sfaqgroup_right |
|
960 | WHERE |
|
961 | group_id = %d', |
|
962 | Db::getTablePrefix(), |
|
963 | $groupId); |
|
964 | ||
965 | $res = $this->config->getDb()->query($delete); |
|
966 | if (!$res) { |
|
967 | return false; |
|
968 | } |
|
969 | ||
970 | return true; |
|
971 | } |
|
972 | ||
973 | /** |
|
974 | * Returns the name of the group $groupId. |
|
@@ 1014-1035 (lines=22) @@ | ||
1011 | * |
|
1012 | * @return bool |
|
1013 | */ |
|
1014 | public function removeAllUsersFromGroup($groupId) |
|
1015 | { |
|
1016 | if ($groupId <= 0 or !is_numeric($groupId)) { |
|
1017 | return false; |
|
1018 | } |
|
1019 | ||
1020 | // remove all user from group |
|
1021 | $delete = sprintf(' |
|
1022 | DELETE FROM |
|
1023 | %sfaquser_group |
|
1024 | WHERE |
|
1025 | group_id = %d', |
|
1026 | Db::getTablePrefix(), |
|
1027 | $groupId); |
|
1028 | ||
1029 | $res = $this->config->getDb()->query($delete); |
|
1030 | if (!$res) { |
|
1031 | return false; |
|
1032 | } |
|
1033 | ||
1034 | return true; |
|
1035 | } |
|
1036 | } |
|
1037 |