if (empty($_POST["return_value"])) { $form_error = true; array_push($error, "return_" . xl('Need to enter a Return Value') . "!"); } if (empty($_POST["description"])) { $form_error = true; array_push($error, "description_" . xl('Need to enter a description') . "!"); } else { if (!ctype_alpha(str_replace(' ', '', $_POST["description"]))) { $form_error = true; array_push($error, "description_" . xl('Please only use alphabetic characters') . "!"); } } //process if data is valid if (!$form_error) { acl_add($_POST["title"], $_POST["identifier"], $_POST["return_value"], $_POST["description"]); echo "<?xml version=\"1.0\"?>\n" . "<response>\n" . "\t<success>SUCCESS</success>\n" . "</response>\n"; } else { //$form_error = true, so return errors echo error_xml($error); } } if ($_POST["action"] == "remove") { //validate form data $form_error = false; if (empty($_POST["title"])) { $form_error = true; array_push($error, "aclTitle_" . xl('Need to enter title') . "!"); } if ($_POST["title"] == "Administrators") { $form_error = true;
DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, new ACLRuleConflictError()); exit(1); } // Take a look if we already have that rule. $found = false; foreach ($acl as $record) { if (($record['group'] === null && $new_group === null || $record['group'] == $new_group) && ($record['board'] === null && $new_board === null || $record['board'] == $new_board) && ($record['thread'] === null && $new_thread === null || $record['thread'] == $new_thread) && ($record['post'] === null && $new_post === null || $record['post'] == $new_post)) { acl_edit($new_group, $new_board, $new_thread, $new_post, $new_view, $new_change, $new_moderate); $reload_acl = true; $found = true; } } if (!$found) { acl_add($new_group, $new_board, $new_thread, $new_post, $new_view, $new_change, $new_moderate); $reload_acl = true; } } // Change rule. foreach ($acl as $record) { $v = "view_{$record['group']}_{$record['board']}_{$record['thread']}_{$record['post']}"; $c = "change_{$record['group']}_{$record['board']}_{$record['thread']}_{$record['post']}"; $m = "moderate_{$record['group']}_{$record['board']}_{$record['thread']}_{$record['post']}"; // View permission changed. if ($record['view'] == 1 && !isset($_POST[$v])) { // View permission removed. acl_edit($record['group'], $record['board'], $record['thread'], $record['post'], 0, 0, 0); $reload_acl = true; continue; }