コード例 #1
0
ファイル: year.php プロジェクト: gauravsaxena21/simantz
$o->cur_symbol = $cur_symbol;
$isactive = $_POST['isactive'];
$o->isAdmin = $xoopsUser->isAdmin();
$o->createdby = $xoopsUser->getVar('uid');
$o->updatedby = $xoopsUser->getVar('uid');
if ($isactive == "Y" or $isactive == "on") {
    $o->isactive = 'Y';
} else {
    $o->isactive = 'N';
}
switch ($action) {
    case "create":
        // if the token is exist and not yet expired
        $log->showLog(4, "Accessing create record event, with year name={$o->year_name}");
        if ($s->check(false, $token, "CREATE_RCE")) {
            if ($o->insertYear()) {
                $latest_id = $o->getLatestYearID();
                redirect_header("year.php", $pausetime, "Your data is saved, the new id={$latest_id}. Redirect to create new year.");
            } else {
                $log->showLog(1, "Can't create year '{$o->year_name}', please verified your data!");
                $token = $s->createToken($tokenlife, "CREATE_RCE");
                $o->getInputForm("new", -1, $token);
                $o->showYearTable();
            }
        } else {
            // if the token is not valid or the token is expired, it back to previous form with previous inputed data
            $log->showLog(1, "Can't create year '{$o->year_name}' due to token expired!");
            $token = $s->createToken($tokenlife, "CREATE_RCE");
            $o->getInputForm("new", -1, $token);
            $o->showYearTable();
        }