コード例 #1
0
$bin = new Binaries();
$id = 0;
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
    case 'submit':
        if ($_POST["groupname"] == "") {
            $page->smarty->assign('error', "Group must be a valid usenet group");
            break;
        }
        if ($_POST["regex"] == "") {
            $page->smarty->assign('error', "Regex cannot be empty");
            break;
        }
        if ($_POST["id"] == "") {
            $bin->addBlacklist($_POST);
        } else {
            $ret = $bin->updateBlacklist($_POST);
        }
        header("Location:" . WWW_TOP . "/binaryblacklist-list.php");
        break;
    case 'addtest':
        if (isset($_GET['regex']) && isset($_GET['groupname'])) {
            $r = array('groupname' => $_GET['groupname'], 'regex' => $_GET['regex'], 'ordinal' => '1', 'status' => '1');
            $page->smarty->assign('regex', $r);
        }
        break;
    case 'view':
    default:
        if (isset($_GET["id"])) {
            $page->title = "Binary Black/Whitelist Edit";