$template->display("addmessageform.tpl"); } elseif ($action == "add") { // check if the user is allowed to add messages if (!$userpermissions["messages"]["add"]) { $errtxt = $langfile["nopermission"]; $noperm = $langfile["accessdenied"]; $template->assign("errortext", "<h2>{$errtxt}</h2><br>{$noperm}"); $template->display("error.tpl"); die; } // add message $themsg = $msg->add($id, $title, $message, $userid, $username, 0, $milestone); if ($themsg) { if ($thefiles > 0) { // attach existing file $msg->attachFile($thefiles, $themsg); } elseif ($thefiles == 0 and $numfiles > 0) { // if upload files are set, upload and attach $msg->attachFile(0, $themsg, $id); } if ($settings["mailnotify"]) { $sendto = getArrayVal($_POST, "sendto"); $usr = (object) new project(); $users = $usr->getProjectMembers($id, 10000); if ($sendto[0] == "all") { $sendto = $users; $sendto = reduceArray($sendto); } elseif ($sendto[0] == "none") { $sendto = array(); } foreach ($users as $user) {