예제 #1
0
// データベース更新などがからむ処理
if ($action == "insert") {
    // Ticket Check
    if (!$xoopsGTicket->check()) {
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
    }
    // 新規登録
    $sql = "INSERT INTO {$cal->cat_table} SET ";
    $cols = array("weight" => "I:N:0", "ismenuitem" => "I:N:0", "cat_title" => "255:J:1", "cat_desc" => "A:J:0", "pid" => "I:N:0");
    $sql .= $cal->get_sql_set($cols);
    if (!mysql_query($sql, $conn)) {
        die(mysql_error());
    }
    rebuild_cat_tree($cal->cat_table);
    $mes = urlencode(_AM_MB_CAT_INSERTED);
    $cal->redirect("done=inserted&mes={$mes}");
    exit;
} else {
    if ($action == "update" && $_POST['cid'] > 0) {
        // Ticket Check
        if (!$xoopsGTicket->check()) {
            redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
        }
        // 更新
        $cid = intval($_POST['cid']);
        $sql = "UPDATE {$cal->cat_table} SET ";
        $cols = array("weight" => "I:N:0", "ismenuitem" => "I:N:0", "cat_title" => "255:J:1", "cat_desc" => "A:J:0", "pid" => "I:N:0");
        $sql .= $cal->get_sql_set($cols) . "WHERE cid='{$cid}'";
        if (!mysql_query($sql, $conn)) {
            die(mysql_error());
        }
예제 #2
0
    }
    // レコードの承認
    $whr = "";
    foreach ($_POST['ids'] as $id) {
        $whr .= "id={$id} OR rrule_pid={$id} OR ";
    }
    $sql = "UPDATE {$cal->table} SET admission=1 WHERE {$whr} 0";
    if (!mysql_query($sql, $conn)) {
        echo mysql_error();
    } else {
        $mes = urlencode(_AM_MES_ADMITTED);
    }
    foreach ($_POST['ids'] as $id) {
        $cal->notify_new_event($id);
    }
    $cal->redirect("cid={$cid}&num={$num}&tz={$tz}&done=admitted&mes={$mes}");
    exit;
} else {
    if (isset($_POST['delete'])) {
        // Ticket Check
        if (!$xoopsGTicket->check()) {
            redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
        }
        // レコードの削除
        if (isset($_POST['ids']) && is_array($_POST['ids'])) {
            $whr = "";
            foreach ($_POST['ids'] as $id) {
                $whr .= "id={$id} OR rrule_pid={$id} OR ";
                xoops_comment_delete($xoopsModule->mid(), $id);
            }
            $sql = "DELETE FROM {$cal->table} WHERE ({$whr} 0) AND (rrule_pid=0 OR rrule_pid=id)";
        $tzoffset = ($userTZ - $serverTZ) * 3600;
        $tzdisp = ($userTZ >= 0 ? "+" : "-") . sprintf("%02d:%02d", abs($userTZ), abs($userTZ) * 60 % 60);
        $tzoptions = str_replace("'y'>", "'y' selected='selected'>", $tzoptions);
        break;
}
// データベース更新などがからむ処理
if (isset($_POST['http_import']) && !empty($_POST['import_uri'])) {
    // Ticket Check
    if (!$xoopsGTicket->check()) {
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
    }
    // httpコネクション経由またはローカルファイルのiCalendarインポート
    list($records, $calname, $tmpname) = explode(":", $cal->import_ics_via_fopen($_POST['import_uri'], false), 3);
    if ($records <= 0) {
        $mes = urlencode("{$calname} : {$tmpname}");
        $cal->redirect("done=error&mes={$mes}");
        exit;
    } else {
        $mes = urlencode(sprintf("{$records} " . _AM_FMT_IMPORTED, $calname));
        $cal->redirect("done=imported&mes={$mes}");
        exit;
    }
} else {
    if (isset($_POST['local_import']) && isset($_FILES['user_ics']['tmp_name']) && is_readable($_FILES['user_ics']['tmp_name'])) {
        // Ticket Check
        if (!$xoopsGTicket->check()) {
            redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
        }
        // ファイルアップロードによるiCalendarインポート
        list($records, $calname, $tmpname) = explode(":", $cal->import_ics_via_upload('user_ics'), 3);
        if ($records <= 0) {
예제 #4
0
            $whr .= "id={$id} OR rrule_pid={$id} OR ";
            xoops_comment_delete($xoopsModule->mid(), $id);
        }
        $sql = "DELETE FROM {$cal->table} WHERE ({$whr} 0) AND (rrule_pid=0 OR rrule_pid=id)";
        mysql_query($sql, $conn);
        $records = mysql_affected_rows($conn);
        $sql = "DELETE FROM {$cal->table} WHERE {$whr} 0 ";
        if (!mysql_query($sql, $conn)) {
            echo mysql_error();
        } else {
            $mes = urlencode("{$records} " . _AM_MES_DELETED);
        }
    } else {
        $mes = "";
    }
    $cal->redirect("cid={$cid}&num={$num}&tz={$tz}&done=deleted&mes={$mes}");
    exit;
} else {
    if (isset($_POST['addlink']) && isset($_POST['ids']) && is_array($_POST['ids']) && $_POST['cid'] > 0) {
        // Ticket Check
        if (!$xoopsGTicket->check()) {
            redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
        }
        // カテゴリーへのリンク追加
        $cid = intval($_POST['cid']);
        $cid4sql = sprintf("%05d,", $cid);
        $whr = "";
        foreach ($_POST['ids'] as $id) {
            $whr .= "id={$id} OR rrule_pid={$id} OR ";
        }
        $sql = "UPDATE {$cal->table} SET categories=CONCAT(categories,'{$cid4sql}') WHERE ({$whr} 0) AND categories NOT LIKE '%{$cid4sql}%'";