예제 #1
0
파일: news.php 프로젝트: renduples/alibtob
    } 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);
setvar("Items", $news->findAll("*", null, $conditions, "id DESC ", $page->firstcount, $page->displaypg));
uaAssign(array("ByPages" => $page->pagenav, "Newstypes" => $newstype->getCacheTypes()));
template($tpl_file);