コード例 #1
0
ファイル: forum_post.php プロジェクト: Kingson4Wu/php_demo
    $navigation = ' &rsaquo; <a href="forum.php">' . $_G['setting']['navs'][2]['navname'] . '</a> ' . $navigation;
}
periodscheck('postbanperiods');
if ($_G['forum']['password'] && $_G['forum']['password'] != $_G['cookie']['fidpw' . $_G['fid']]) {
    showmessage('forum_passwd', "forum.php?mod=forumdisplay&fid={$_G['fid']}");
}
if (empty($_G['forum']['allowview'])) {
    if (!$_G['forum']['viewperm'] && !$_G['group']['readaccess']) {
        showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
    } elseif ($_G['forum']['viewperm'] && !forumperm($_G['forum']['viewperm'])) {
        showmessagenoperm('viewperm', $_G['fid']);
    }
} elseif ($_G['forum']['allowview'] == -1) {
    showmessage('forum_access_view_disallow');
}
formulaperm($_G['forum']['formulaperm']);
if (!$_G['adminid'] && $_G['setting']['newbiespan'] && (!getuserprofile('lastpost') || TIMESTAMP - getuserprofile('lastpost') < $_G['setting']['newbiespan'] * 3600)) {
    if (TIMESTAMP - DB::result_first("SELECT regdate FROM " . DB::table('common_member') . " WHERE uid='{$_G['uid']}'") < $_G['setting']['newbiespan'] * 3600) {
        showmessage('post_newbie_span', '', array('newbiespan' => $_G['setting']['newbiespan']));
    }
}
$special = $special > 0 && $special < 7 || $special == 127 ? intval($special) : 0;
$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$_G['group']['allowpostattach'] = $_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || !$_G['forum']['postattachperm'] && $_G['group']['allowpostattach'] || $_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm']));
$_G['forum']['allowpostimage'] = isset($_G['forum']['allowpostimage']) ? $_G['forum']['allowpostimage'] : '';
$_G['group']['allowpostimage'] = $_G['forum']['allowpostimage'] != -1 && ($_G['forum']['allowpostimage'] == 1 || !$_G['forum']['postimageperm'] && $_G['group']['allowpostimage'] || $_G['forum']['postimageperm'] && forumperm($_G['forum']['postimageperm']));
$_G['group']['attachextensions'] = $_G['forum']['attachextensions'] ? $_G['forum']['attachextensions'] : $_G['group']['attachextensions'];
if ($_G['group']['attachextensions']) {
    $imgexts = explode(',', str_replace(' ', '', $_G['group']['attachextensions']));
    $imgexts = array_intersect(array('jpg', 'jpeg', 'gif', 'png', 'bmp'), $imgexts);
    $imgexts = implode(', ', $imgexts);
コード例 #2
0
require_once DISCUZ_ROOT.'./include/post.func.php';
require_once DISCUZ_ROOT.'./include/forum.func.php';

if(empty($forum) || $forum['type'] == 'group') {
	wapmsg('forum_nonexistence');
}

if(empty($forum['allowview']) && ((!$forum['viewperm'] && !$readaccess) || ($forum['viewperm'] && !forumperm($forum['viewperm'])))) {
	wapmsg('forum_nopermission');
}

if(empty($bbcodeoff) && !$allowhidecode && preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", preg_replace("/(\[code\].*\[\/code\])/is", '', $message))) {
	wapmsg('post_hide_nopermission');
}

formulaperm($forum['formulaperm']);

if(!$adminid && $newbiespan && (!$lastpost || $timestamp - $lastpost < $newbiespan * 3600)) {
	$regdate = $db->result_first("SELECT regdate FROM {$tablepre}members WHERE uid='$discuz_uid'");
	if($timestamp - $regdate < $newbiespan * 3600) {
		showmessage('post_newbie_span');
	}
}

$postcredits = $forum['postcredits'] ? $forum['postcredits'] : $creditspolicy['post'];
$replycredits = $forum['replycredits'] ? $forum['replycredits'] : $creditspolicy['reply'];

$modnewthreads = (!$allowdirectpost || $allowdirectpost == 1) && ($forum['modnewposts'] || !empty($censormod)) ? 1 : 0;
$modnewreplies = (!$allowdirectpost || $allowdirectpost == 2) && ($forum['modnewposts'] == 2 || !empty($censormod)) ? 1 : 0;

$subject = wapconvert($subject);
コード例 #3
0
ファイル: home_medal.php プロジェクト: Kingson4Wu/php_demo
} elseif ($_G['gp_action'] == 'apply' && submitcheck('medalsubmit')) {
    $medalid = intval($_G['gp_medalid']);
    $_G['forum_formulamessage'] = $_G['forum_usermsg'] = $medalnew = '';
    $medal = DB::fetch_first("SELECT * FROM " . DB::table('forum_medal') . " WHERE medalid='{$medalid}'");
    if (!$medal['type']) {
        showmessage('medal_apply_invalid');
    }
    $medaldetail = DB::fetch_first("SELECT medalid FROM " . DB::table('forum_medallog') . " WHERE uid='{$_G['uid']}' AND medalid='{$medalid}' AND type NOT IN('3', '4')");
    if ($medaldetail['medalid']) {
        showmessage('medal_apply_existence', 'home.php?mod=medal');
    }
    $applysucceed = FALSE;
    $medalpermission = $medal['permission'] ? unserialize($medal['permission']) : '';
    if ($medalpermission[0]) {
        include libfile('function/forum');
        formulaperm(serialize(array('medal' => $medalpermission)), 1);
        if ($_G['forum_formulamessage']) {
            showmessage('medal_permforum_nopermission', 'home.php?mod=medal', array('formulamessage' => $_G['forum_formulamessage'], 'usermsg' => $_G['forum_usermsg']));
        } else {
            $applysucceed = TRUE;
        }
    } else {
        $applysucceed = TRUE;
    }
    if ($applysucceed) {
        if ($medal['type'] == 1) {
            $usermedal = DB::fetch_first("SELECT medals FROM " . DB::table('common_member_field_forum') . " WHERE uid='{$_G['uid']}'");
            $medalnew = $usermedal['medals'] ? $usermedal['medals'] . "\t" . $medal['medalid'] : $medal['medalid'];
            DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET medals='{$medalnew}' WHERE uid='{$_G['uid']}'");
            $medalmessage = 'medal_get_succeed';
        } else {
コード例 #4
0
ファイル: medal.php プロジェクト: BGCX067/f2cont-svn-to-git
            if ($medalpos = strpos($medalid, '|')) {
                $medalid = substr($medalid, 0, $medalpos);
            }
            $medallog['name'] = $_DCACHE['medals'][$medalid]['name'];
            $medallog['image'] = $medallist[$medalid]['image'];
            $medallogs[] = $medallog;
        }
    }
} elseif ($action == 'apply') {
    $medalid = intval($medalid);
    $formulamessage = '';
    $medal = $db->fetch_first("SELECT * FROM {$tablepre}medals WHERE medalid='{$medalid}'");
    if (!$medal['type']) {
        showmessage('medal_required_invalid');
    }
    formulaperm($medal['permission'], 1) && ($medal['permission'] = formulaperm($medal['permission'], 2));
    if (submitcheck('medalsubmit')) {
        $medaldetail = $db->fetch_first("SELECT medalid FROM {$tablepre}medallog WHERE uid='{$discuz_uid}' AND medalid='{$medalid}' AND type NOT IN('3', '4')");
        if ($medaldetail['medalid']) {
            showmessage('medal_apply_existence', 'medal.php');
        } else {
            $expiration = empty($medal['expiration']) ? 0 : $timestamp + $medal['expiration'] * 86400;
            $db->query("INSERT INTO {$tablepre}medallog (uid, medalid, type, dateline, expiration, status) VALUES ('{$discuz_uid}', '{$medalid}', '2', '{$timestamp}', '{$expiration}', '0')");
        }
        showmessage('medal_apply_succeed', 'medal.php');
    }
} elseif ($action == 'log') {
    $medallognum = $db->result_first("SELECT COUNT(*) FROM {$tablepre}medallog WHERE uid='{$discuz_uid}' AND type IN ('0', '1')");
    $multipage = multi($medallognum, $tpp, $page, "medal.php?action=log");
    $query = $db->query("SELECT me.*, m.image FROM {$tablepre}medallog me\r\n\t\t\tLEFT JOIN {$tablepre}medals m USING (medalid)\r\n\t\t\tWHERE me.uid='{$discuz_uid}' AND me.type IN ('0', '1') ORDER BY me.dateline DESC LIMIT {$start_limit},{$tpp}");
    while ($medallog = $db->fetch_array($query)) {
コード例 #5
0
ファイル: medal.php プロジェクト: BGCX262/zyyhong-svn-to-git
	$medalid = intval($medalid);
	$formulamessage = $usermsg = $medalnew = '';
	$medal = $db->fetch_first("SELECT * FROM {$tablepre}medals WHERE medalid='$medalid'");
	if(!$medal['type']) {
		showmessage('medal_apply_invalid');
	}

	$medaldetail = $db->fetch_first("SELECT medalid FROM {$tablepre}medallog WHERE uid='$discuz_uid' AND medalid='$medalid' AND type NOT IN('3', '4')");
	if($medaldetail['medalid']) {
		showmessage('medal_apply_existence', 'medal.php');
	}

	$medalpermission = $medal['permission'] ? unserialize($medal['permission']) : '';
	if($medalpermission[0]) {
		formulaperm($medal['permission'], 1);

		if($formulamessage) {
			showmessage('medal_permforum_nopermission', 'medal.php');
		}

		$usermedal = $db->fetch_first("SELECT medals FROM {$tablepre}memberfields WHERE uid='$discuz_uid'");
		$medalnew = $usermedal['medals'] ? $usermedal['medals']."\t".$medal['medalid'] : $medal['medalid'];
		$db->query("UPDATE {$tablepre}memberfields SET medals='$medalnew' WHERE uid='$discuz_uid'");

		$db->query("INSERT INTO {$tablepre}medallog (uid, medalid, type, dateline, expiration, status) VALUES ('$discuz_uid', '$medalid', '1', '$timestamp', '$expiration', '0')");
		showmessage('medal_get_succeed', 'medal.php');
	} else {
		$expiration = empty($medal['expiration'])? 0 : $timestamp + $medal['expiration'] * 86400;
		$db->query("INSERT INTO {$tablepre}medallog (uid, medalid, type, dateline, expiration, status) VALUES ('$discuz_uid', '$medalid', '2', '$timestamp', '$expiration', '0')");
		showmessage('medal_apply_succeed', 'medal.php');
コード例 #6
0
$page = max(1, intval($page));
$start_limit = $number = ($page - 1) * $waptpp;

if(!empty($fid)) {

	require_once DISCUZ_ROOT.'./include/forum.func.php';

	if(empty($forum)) {
		wapmsg('forum_nonexistence');
	}

	if(($forum['viewperm'] && !forumperm($forum['viewperm']) && !$forum['allowview']) || $forum['redirect'] || $forum['password']) {
		wapmsg('forum_nopermission');
	} elseif($forum['formulaperm']) {
		formulaperm($forum['formulaperm'], 0, TRUE);
	}

	echo 	"<p>".strip_tags($forum['name'])."<br />".
		"<a href=\"index.php?action=post&amp;do=newthread&amp;fid=$forum[fid]\">$lang[post_new]</a> ".
		"<a href=\"index.php?action=forum&amp;do=digest&amp;fid=$forum[fid]\">$lang[digest]</a><br /><br />".
		"$lang[forum_list] <a href=\"index.php?action=forum&amp;fid=$forum[fid]\">$lang[reload]</a><br />";

	$do = !empty($do) ? 'digest' : '';
	$filteradd = $do == 'digest' ? 'AND digest>\'0\'' : '';
	$threadcount = $sdb->result_first("SELECT COUNT(*) FROM {$tablepre}threads WHERE fid='$fid' $filteradd AND displayorder>='0'");

	$thread['prefix'] = '';
	$query = $sdb->query("SELECT * FROM {$tablepre}threads
		WHERE fid='$fid' $filteradd AND displayorder>='0'
		ORDER BY displayorder DESC, lastpost DESC LIMIT $start_limit, $waptpp");