コード例 #1
0
ファイル: news.inc.php プロジェクト: hiproz/zhaotaoci.cc
}
$MG['homepage'] && $MG['news_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback');
require DT_ROOT . '/include/post.func.php';
$TYPE = get_type('news-' . $_userid);
require MD_ROOT . '/news.class.php';
$do = new news();
switch ($action) {
    case 'add':
        if ($MG['news_limit']) {
            $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}news WHERE username='******' AND status>0");
            if ($r['num'] >= $MG['news_limit']) {
                dalert(lang($L['limit_add'], array($MG['news_limit'], $r['num'])), 'goback');
            }
        }
        if ($submit) {
            if ($do->pass($post)) {
                $post['username'] = $_username;
                $post['level'] = $post['addtime'] = 0;
                $need_check = $MOD['news_check'] == 2 ? $MG['check'] : $MOD['news_check'];
                $post['status'] = get_status(3, $need_check);
                $do->add($post);
                dmsg($L['op_add_success'], '?status=' . $post['status']);
            } else {
                message($do->errmsg);
            }
        } else {
            foreach ($do->fields as $v) {
                ${$v} = '';
            }
            $content = '';
            $typeid = 0;