예제 #1
0
파일: news.php 프로젝트: renduples/alibtob
    if (!empty($_POST['require_membertype']) && !in_array(0, $_POST['require_membertype'])) {
        $reses = implode(",", $_POST['require_membertype']);
        $vals['require_membertype'] = $reses;
    } elseif (!empty($_POST['require_membertype'])) {
        $vals['require_membertype'] = 0;
    }
    $vals['tag_ids'] = $tag->setTagId($_POST['data']['tag']);
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        if (!empty($_FILES['pic']['name'])) {
            $attachment->rename_file = "news-" . $id;
            $attachment->insert_new = false;
            $attachment->upload_process();
            $vals['picture'] = $attachment->file_full_url;
        }
        $result = $news->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        if (!empty($_FILES['pic']['name'])) {
            $attachment->rename_file = "news-" . ($news->getMaxId() + 1);
            $attachment->upload_process();
            $vals['picture'] = $attachment->file_full_url;
        }
        $result = $news->save($vals);
    }
    if (!$result) {
        flash();
    }
}
$amount = $news->findCount(null, $conditions);
$page->setPagenav($amount);