コード例 #1
0
ファイル: spread.php プロジェクト: reboxhost/phpb2b
$page = new Pages();
$tpl_file = "spread";
$conditions = "member_id=" . $the_memberid;
if (isset($_POST['save'])) {
    pb_submit_check('save');
    $record = $vals = array();
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    $vals['keyword_name'] = $_POST['spread']['keyword_name'];
    $vals['title'] = $_POST['spread']['title'];
    $vals['target_url'] = $_POST['spread']['target_url'];
    $vals['content'] = $_POST['spread']['content'];
    if (!empty($id)) {
        unset($vals['created']);
        $updated = $spread->save($vals, "update", $id, null, $conditions);
    } else {
        $vals['created'] = $time_stamp;
        //default one week
        $vals['expiration'] = 7 * 86400 + $time_stamp;
        if (!empty($_POST['exp_date'])) {
            $vals['expiration'] = strtotime($_POST['exp_date']);
        }
        $vals['member_id'] = $the_memberid;
        $vals['status'] = 0;
        $updated = $spread->save($vals);
    }
    if (!$updated) {
        flash("action_failed");
    } else {
        flash("success", '', 0);
コード例 #2
0
ファイル: spread.php プロジェクト: reboxhost/phpb2b
$conditions = array();
setvar("CheckStatus", cache_read('typeoption', 'check_status'));
if (isset($_POST['do'])) {
    $do = trim($_POST['do']);
    if ($do == "spread") {
        if (isset($_POST['id'])) {
            $id = intval($_POST['id']);
        }
        $vals = array();
        $vals = $_POST['data']['spread'];
        $vals['expiration'] = 7 * 86400 + $time_stamp;
        if (!empty($_POST['exp_date'])) {
            $vals['expiration'] = strtotime($_POST['exp_date']);
        }
        if (!empty($id)) {
            $result = $spread->save($vals, "update", $id);
        } else {
            $vals['created'] = $time_stamp;
            $result = $spread->save($vals);
        }
        if (!$result) {
            flash();
        } else {
            flash('success', 'spread.php');
        }
    }
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);