public function Approve() { $va_errors = array(); $pa_comment_ids = $this->request->getParameter('comment_id', pArray); $ps_mode = $this->request->getParameter('mode', pString); if (is_array($pa_comment_ids) && sizeof($pa_comment_ids) > 0) { foreach ($pa_comment_ids as $vn_comment_id) { $t_comment = new ca_item_comments($vn_comment_id); if (!$t_comment->getPrimaryKey()) { $va_errors[] = _t("The comment does not exist"); break; } if (!$t_comment->moderate($this->request->getUserID())) { $va_errors[] = _t("Could not approve comment"); break; } } if (sizeof($va_errors) > 0) { $this->notification->addNotification(implode("; ", $va_errors), __NOTIFICATION_TYPE_ERROR__); } else { $this->notification->addNotification(_t("Your comments have been approved"), __NOTIFICATION_TYPE_INFO__); } } else { $this->notification->addNotification(_t("Please use the checkboxes to select comments for approval"), __NOTIFICATION_TYPE_WARNING__); } switch ($ps_mode) { case "list": $this->ListUnmoderated(); break; # ----------------------- # ----------------------- case "search": $this->Index(); break; # ----------------------- # ----------------------- case "dashboard": $this->response->setRedirect(caNavUrl($this->request, "", "Dashboard", "Index")); break; # ----------------------- } }