static function saveMessage($text, $securitygroup_id) { //if no security group id then must be admin. Otherwise, make sure the user is a member of the group global $current_user; if (empty($securitygroup_id) && !is_admin($current_user)) { return; } $message = new SecurityGroupMessage(); if (empty($text)) { return; } // || !$feed->ACLAccess('save', true) )return; $text = strip_tags($text); $message->name = ''; $message->description = $text; $message->securitygroup_id = $securitygroup_id; $message->save(); }
function saveMessage() { //admins should be able to set a global message to All otherwise any other message must be attached to a group if (!empty($_REQUEST['description'])) { $text = htmlspecialchars($_REQUEST['description']); $securitygroup_id = htmlspecialchars($_REQUEST['securitygroup_id']); //allow for bold and italic user tags //$text = preg_replace('/&lt;(\/*[bi])&gt;/i','<$1>', $text); SecurityGroupMessage::saveMessage($text, $securitygroup_id); } }