| @@ 233-256 (lines=24) @@ | ||
| 230 | * @param integer $commentId Comment id |
|
| 231 | * @return boolean |
|
| 232 | */ |
|
| 233 | public function deleteComment($recordId, $commentId) |
|
| 234 | { |
|
| 235 | if (!is_int($recordId) && !is_int($commentId)) { |
|
| 236 | return false; |
|
| 237 | } |
|
| 238 | ||
| 239 | $query = sprintf(" |
|
| 240 | DELETE FROM |
|
| 241 | %sfaqcomments |
|
| 242 | WHERE |
|
| 243 | id = %d |
|
| 244 | AND |
|
| 245 | id_comment = %d", |
|
| 246 | PMF_Db::getTablePrefix(), |
|
| 247 | $recordId, |
|
| 248 | $commentId |
|
| 249 | ); |
|
| 250 | ||
| 251 | if (!$this->config->getDb()->query($query)) { |
|
| 252 | return false; |
|
| 253 | } |
|
| 254 | ||
| 255 | return true; |
|
| 256 | } |
|
| 257 | ||
| 258 | /** |
|
| 259 | * Returns the number of comments of each FAQ record as an array |
|
| @@ 826-845 (lines=20) @@ | ||
| 823 | * @param integer $userId User ID |
|
| 824 | * @return boolean |
|
| 825 | */ |
|
| 826 | public function removeFromAllGroups($userId) |
|
| 827 | { |
|
| 828 | if ($userId <= 0 || !is_numeric($userId)) { |
|
| 829 | return false; |
|
| 830 | } |
|
| 831 | ||
| 832 | $delete = sprintf(" |
|
| 833 | DELETE FROM |
|
| 834 | %sfaquser_group |
|
| 835 | WHERE |
|
| 836 | user_id = %d", |
|
| 837 | PMF_Db::getTablePrefix(), |
|
| 838 | $userId); |
|
| 839 | ||
| 840 | $res = $this->config->getDb()->query($delete); |
|
| 841 | if (!$res) { |
|
| 842 | return false; |
|
| 843 | } |
|
| 844 | return true; |
|
| 845 | } |
|
| 846 | ||
| 847 | /** |
|
| 848 | * getUserGroupRights |
|
| @@ 899-918 (lines=20) @@ | ||
| 896 | * @param integer $groupId Group ID |
|
| 897 | * @return boolean |
|
| 898 | */ |
|
| 899 | public function refuseAllGroupRights($groupId) |
|
| 900 | { |
|
| 901 | if ($groupId <= 0 || !is_numeric($groupId)) { |
|
| 902 | return false; |
|
| 903 | } |
|
| 904 | ||
| 905 | $delete = sprintf(" |
|
| 906 | DELETE FROM |
|
| 907 | %sfaqgroup_right |
|
| 908 | WHERE |
|
| 909 | group_id = %d", |
|
| 910 | PMF_Db::getTablePrefix(), |
|
| 911 | $groupId); |
|
| 912 | ||
| 913 | $res = $this->config->getDb()->query($delete); |
|
| 914 | if (!$res) { |
|
| 915 | return false; |
|
| 916 | } |
|
| 917 | return true; |
|
| 918 | } |
|
| 919 | ||
| 920 | /** |
|
| 921 | * Returns the name of the group $groupId. |
|
| @@ 958-978 (lines=21) @@ | ||
| 955 | * @param integer $groupId Group ID |
|
| 956 | * @return bool |
|
| 957 | */ |
|
| 958 | public function removeAllUsersFromGroup($groupId) |
|
| 959 | { |
|
| 960 | if ($groupId <= 0 or !is_numeric($groupId)) { |
|
| 961 | return false; |
|
| 962 | } |
|
| 963 | ||
| 964 | // remove all user from group |
|
| 965 | $delete = sprintf(" |
|
| 966 | DELETE FROM |
|
| 967 | %sfaquser_group |
|
| 968 | WHERE |
|
| 969 | group_id = %d", |
|
| 970 | PMF_Db::getTablePrefix(), |
|
| 971 | $groupId); |
|
| 972 | ||
| 973 | $res = $this->config->getDb()->query($delete); |
|
| 974 | if (!$res) { |
|
| 975 | return false; |
|
| 976 | } |
|
| 977 | return true; |
|
| 978 | } |
|
| 979 | } |
|