⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forums.inc.php

📁 Discuz功能源码(开源)
💻 PHP
📖 第 1 页 / 共 5 页
字号:
						$fupselect .= "<option value=\"$forum1[fid]\" $selected>$forum1[name]</option>\n";
						foreach($fups as $forum2) {
							if($forum2['type'] == 'forum' && $forum2['fup'] == $forum1['fid']) {
								$selected = $forum2['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
								$fupselect .= "<option value=\"$forum2[fid]\" $selected>&nbsp; &gt; $forum2[name]</option>\n";
							}
						}
					}
				}
				foreach($fups as $forum0) {
					if($forum0['type'] == 'forum' && $forum0['fup'] == 0) {
						$selected = $forum0['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
						$fupselect .= "<option value=\"$forum0[fid]\" $selected>$forum0[name]</option>\n";
					}
				}
			}
			$fupselect .= '</select>';

			$groups = array();
			$query = $db->query("SELECT groupid, grouptitle FROM {$tablepre}usergroups");
			while($group = $db->fetch_array($query)) {
				$groups[] = $group;
			}

			$styleselect = "<select name=\"styleidnew\"><option value=\"0\">$lang[use_default]</option>";
			$query = $db->query("SELECT styleid, name FROM {$tablepre}styles");
			while($style = $db->fetch_array($query)) {
				$styleselect .= "<option value=\"$style[styleid]\" ".
					($style['styleid'] == $forum['styleid'] ? 'selected="selected"' : NULL).
					">$style[name]</option>\n";
			}
			$styleselect .= '</select>';

			if($forum['autoclose']) {
				$forum['autoclosetime'] = abs($forum['autoclose']);
				$forum['autoclose'] = $forum['autoclose'] / abs($forum['autoclose']);
			}

			$viewaccess = $postaccess = $replyaccess = $getattachaccess = $postattachaccess = '';

			$query = $db->query("SELECT m.username, a.* FROM {$tablepre}access a LEFT JOIN {$tablepre}members m USING (uid) WHERE a.fid='$fid'");
			while($access = $db->fetch_array($query)) {
				$member = ", <a href=\"$BASESCRIPT?action=members&operation=access&uid=$access[uid]\" target=\"_blank\">$access[username]</a>";
				$viewaccess .= $access['allowview'] > 0 ? $member : NULL;
				$postaccess .= $access['allowpost'] > 0  ? $member : NULL;
				$replyaccess .= $access['allowreply'] > 0  ? $member : NULL;
				$getattachaccess .= $access['allowgetattach'] > 0  ? $member : NULL;
				$postattachaccess .= $access['allowpostattach'] > 0  ? $member : NULL;
			}
			unset($member);

			$forum['typemodels'] = unserialize($forum['typemodels']);

                	if($forum['threadtypes']) {
				$forum['threadtypes'] = unserialize($forum['threadtypes']);
				$forum['threadtypes']['status'] = 1;
			} else {
				$forum['threadtypes'] = array('status' => 0, 'required' => 0, 'listable' => 0, 'prefix' => 0, 'options' => array());
			}

			if($forum['threadsorts']) {
				$forum['threadsorts'] = unserialize($forum['threadsorts']);
				$forum['threadsorts']['status'] = 1;
			} else {
				$forum['threadsorts'] = array('status' => 0, 'required' => 0, 'listable' => 0, 'prefix' => 0, 'options' => array());
			}

			$typeselect = $sortselect = '';
			$typemodelid = array();

			$query = $db->query("SELECT * FROM {$tablepre}threadtypes ORDER BY displayorder");
			while($type = $db->fetch_array($query)) {
				$typemodelid[] = $type['modelid'];
				$typeselected = array();
				$enablechecked = '';

				$keysort = $type['special'] ? 'threadsorts' : 'threadtypes';
				if(isset($forum[$keysort]['flat'][$type['typeid']])) {
					$enablechecked = ' checked="checked"';
					$typeselected[1] = ' selected="selected"';
				} elseif(isset($forum[$keysort]['selectbox'][$type['typeid']])) {
					$enablechecked = ' checked="checked"';
					$typeselected[2] = ' selected="selected"';
				} else {
					$typeselected[1] = ' selected="selected"';
				}

				$showtype = TRUE;
				if($type['special'] && !@include_once DISCUZ_ROOT.'./forumdata/cache/threadsort_'.$type['typeid'].'.php') {
					$showtype = FALSE;
				}
				if(!$type['special']) {
					$typeselect .= showtablerow('', array('class="td25"'), array(
						'<input type="checkbox" name="threadtypesnew[options][enable]['.$type['typeid'].']" value="1" class="checkbox"'.$enablechecked.' />',
						$type['name'],
						$type['description'],
						"<select name=\"threadtypesnew[options][{$type[typeid]}]\"><option value=\"1\" $typeselected[1]>$lang[forums_edit_threadtypes_use_cols]</option><option value=\"2\" $typeselected[2]>$lang[forums_edit_threadtypes_use_choice]</option></select>",
					), TRUE);
				} else {
					$typeselected[3] = $forum['threadsorts']['show'][$type['typeid']] ? ' checked="checked"' : '';
					$sortselect .= $showtype ? showtablerow('', array('class="td25"'), array(
						'<input type="checkbox" name="threadsortsnew[options][enable]['.$type['typeid'].']" value="1" class="checkbox"'.$enablechecked.' />',
						$type['name'],
						$type['description'],
						"<select name=\"threadsortsnew[options][{$type[typeid]}]\"><option value=\"1\" $typeselected[1]>$lang[forums_edit_threadtypes_use_cols]</option><option value=\"2\" $typeselected[2]>$lang[forums_edit_threadtypes_use_choice]</option></select>",
						"<input class=\"checkbox\" type=\"checkbox\" name=\"threadsortsnew[options][show][{$type[typeid]}]\" value=\"3\" $typeselected[3] />"
					), TRUE) : '';
				}
			}

			$typeselect = $typeselect ? $typeselect : showtablerow('', array('class="td25"'), $lang['forums_edit_threadtypes_nonexistence'], TRUE);
			$sortselect = $sortselect ? $sortselect : showtablerow('', array('class="td25"'), $lang['forums_edit_threadsorts_nonexistence'], TRUE);

                	$num = 0;
                	$typemodelshow = FALSE;
                	$typemodelselect = '<ul class="nofloat" onmouseover="altStyle(this);">';
			$query = $db->query("SELECT * FROM {$tablepre}typemodels ORDER BY displayorder");
			while($model = $db->fetch_array($query)) {
				$num++;
				$modelchecked = $forum['typemodels'][$model['id']] ? 'checked' : '';
				if(in_array($model['id'], $typemodelid)) {
					$typemodelshow = TRUE;
					$typemodelselect .=  "<li".($modelchecked ? ' class="checked"' : '')."><input class=\"checkbox\" type=\"checkbox\" name=\"typemodel[]\" value=\"$model[id]\" $modelchecked>$model[name]</li>";
				}
       			}
       			$typemodelselect .= '</ul>';

			$forum['postcredits'] = $forum['postcredits'] ? unserialize($forum['postcredits']) : array();
			$forum['replycredits'] = $forum['replycredits'] ? unserialize($forum['replycredits']) : array();
			$forum['digestcredits'] = $forum['digestcredits'] ? unserialize($forum['digestcredits']) : array();
			$forum['postattachcredits'] = $forum['postattachcredits'] ? unserialize($forum['postattachcredits']) : array();
			$forum['getattachcredits'] = $forum['getattachcredits'] ? unserialize($forum['getattachcredits']) : array();
			$simplebin = sprintf('%08b', $forum['simple']);
			$forum['defaultorderfield'] = bindec(substr($simplebin, 0, 2));
			$forum['defaultorder'] = ($forum['simple'] & 32) ? 1 : 0;
			$forum['subforumsindex'] = bindec(substr($simplebin, 3, 2));
			$forum['subforumsindex'] = $forum['subforumsindex'] == 0 ? -1 : ($forum['subforumsindex'] == 2 ? 0 : 1);
			$forum['simple'] = $forum['simple'] & 1;
			$forum['modrecommend'] = $forum['modrecommend'] ? unserialize($forum['modrecommend']) : '';
			$forum['formulaperm'] = unserialize($forum['formulaperm']);$forum['formulaperm'] = $forum['formulaperm'][0];

			showtagheader('div', 'basic', $anchor == 'basic');
			showtableheader('forums_edit_basic', 'nobottom');
			showsetting('forums_edit_basic_name', 'namenew', $forum['name'], 'text');
			showsetting('forums_edit_basic_scheme', '', '', $projectselect);
			showsetting('forums_edit_basic_display', 'statusnew', $forum['status'], 'radio');
			showsetting('forums_edit_basic_up', '', '', $fupselect);
			showsetting('forums_edit_basic_redirect', 'redirectnew', $forum['redirect'], 'text');
			showsetting('forums_edit_basic_icon', 'iconnew', $forum['icon'], 'text');
			showsetting('forums_edit_basic_description', 'descriptionnew', html2bbcode($forum['description']), 'textarea');
			showsetting('forums_edit_basic_rules', 'rulesnew', html2bbcode($forum['rules']), 'textarea');
			showsetting('forums_edit_basic_keyword', 'keywordsnew', $forum['keywords'], 'text');
			showtablefooter();
			showtagfooter('div');

			showtagheader('div', 'extend', $anchor == 'extend');
			showtableheader('forums_edit_extend', 'nobottom');
			showsetting('forums_edit_extend_style', '', '', $styleselect);
			showsetting('forums_edit_extend_sub_horizontal', 'forumcolumnsnew', $forum['forumcolumns'], 'text');
			showsetting('forums_edit_extend_subforumsindex', array('subforumsindexnew', array(
				array(-1, $lang['default']),
				array(1, $lang['yes']),
				array(0, $lang['no'])
			), 1), $forum['subforumsindex'], 'mradio');
			showsetting('forums_edit_extend_simple', 'simplenew', $forum['simple'], 'radio');
			showsetting('forums_edit_extend_recommend_top', 'allowglobalsticknew', $forum['allowglobalstick'], 'radio');
			showsetting('forums_edit_extend_defaultorderfield', array('defaultorderfieldnew', array(
					array(0, $lang['forums_edit_extend_order_lastpost']),
					array(1, $lang['forums_edit_extend_order_starttime']),
					array(2, $lang['forums_edit_extend_order_replies']),
					array(3, $lang['forums_edit_extend_order_views'])
			)), $forum['defaultorderfield'], 'mradio');
			showsetting('forums_edit_extend_defaultorder', array('defaultordernew', array(
					array(0, $lang['forums_edit_extend_order_desc']),
					array(1, $lang['forums_edit_extend_order_asc'])
			)), $forum['defaultorder'], 'mradio');
			showsetting('forums_edit_extend_threadcache', 'threadcachesnew', $forum['threadcaches'], 'text');
			showsetting('forums_edit_extend_edit_rules', 'alloweditrulesnew', $forum['alloweditrules'], 'radio');
			if($sideselect) {
				showsetting('forums_edit_extend_sideselect', '', '', $sideselect[0]);
			}
			showsetting('forums_edit_extend_recommend', 'modrecommendnew[open]', $forum['modrecommend']['open'], 'radio', '', 1);
			showsetting('forums_edit_extend_recommend_sort', array('modrecommendnew[sort]', array(
				array(1, $lang['forums_edit_extend_recommend_sort_auto']),
				array(0, $lang['forums_edit_extend_recommend_sort_manual']),
				array(2, $lang['forums_edit_extend_recommend_sort_mix']))), $forum['modrecommend']['sort'], 'mradio');
			showsetting('forums_edit_extend_recommend_orderby', array('modrecommendnew[orderby]', array(
				array(0, $lang['forums_edit_extend_recommend_orderby_dateline']),
				array(1, $lang['forums_edit_extend_recommend_orderby_lastpost']),
				array(2, $lang['forums_edit_extend_recommend_orderby_views']),
				array(3, $lang['forums_edit_extend_recommend_orderby_replies']),
				array(4, $lang['forums_edit_extend_recommend_orderby_digest']))), $forum['modrecommend']['orderby'], 'mradio');
			showsetting('forums_edit_extend_recommend_num', 'modrecommendnew[num]', $forum['modrecommend']['num'], 'text');
			showsetting('forums_edit_extend_recommend_maxlength', 'modrecommendnew[maxlength]', $forum['modrecommend']['maxlength'], 'text');
			showsetting('forums_edit_extend_recommend_cachelife', 'modrecommendnew[cachelife]', $forum['modrecommend']['cachelife'], 'text');
			showsetting('forums_edit_extend_recommend_dateline', 'modrecommendnew[dateline]', $forum['modrecommend']['dateline'], 'text');
			showtablefooter();
			showtagfooter('div');

			showtagheader('div', 'posts', $anchor == 'posts');
			showtableheader('forums_edit_posts', 'nobottom');
			showsetting('forums_edit_posts_modposts', array('modnewpostsnew', array(
				array(0, $lang['none']),
				array(1, $lang['forums_edit_posts_modposts_threads']),
				array(2, $lang['forums_edit_posts_modposts_posts'])
			)), $forum['modnewposts'], 'mradio');
			showsetting('forums_edit_posts_alloweditpost', 'alloweditpostnew', $forum['alloweditpost'], 'radio');
			showsetting('forums_edit_posts_recyclebin', 'recyclebinnew', $forum['recyclebin'], 'radio');
			showsetting('forums_edit_posts_html', 'allowhtmlnew', $forum['allowhtml'], 'radio');
			showsetting('forums_edit_posts_bbcode', 'allowbbcodenew', $forum['allowbbcode'], 'radio');
			showsetting('forums_edit_posts_imgcode', 'allowimgcodenew', $forum['allowimgcode'], 'radio');
			showsetting('forums_edit_posts_mediacode', 'allowmediacodenew', $forum['allowmediacode'], 'radio');
			showsetting('forums_edit_posts_smilies', 'allowsmiliesnew', $forum['allowsmilies'], 'radio');
			showsetting('forums_edit_posts_jammer', 'jammernew', $forum['jammer'], 'radio');
			showsetting('forums_edit_posts_anonymous', 'allowanonymousnew', $forum['allowanonymous'], 'radio');
			showsetting('forums_edit_posts_disablewatermark', 'disablewatermarknew', $forum['disablewatermark'], 'radio');

			if($_DCACHE['settings']['uc']['addfeed']) {
				showsetting('forums_edit_posts_allowfeed', 'allowfeednew', $forum['allowfeed'], 'radio');
			}

			if($tagstatus) {
				showsetting('forums_edit_posts_tagstatus', array('allowtagnew', array(
					array(0, $lang['forums_edit_posts_tagstatus_none']),
					array(1, $lang['forums_edit_posts_tagstatus_use']),
					array(2, $lang['forums_edit_posts_tagstatus_quired'])
				)), $forum['allowtag'], 'mradio');
			}

			showsetting('forums_edit_posts_allowpostspecial', array('allowpostspecialnew', array(
				$lang['thread_poll'],
				$lang['thread_trade'],
				$lang['thread_reward'],
				$lang['thread_activity'],
				$lang['thread_debate'],
				$lang['thread_video']
			)), $forum['allowpostspecial'], 'binmcheckbox');
			showsetting('forums_edit_posts_allowspecialonly', 'allowspecialonlynew', $forum['allowspecialonly'], 'radio');
			if(!empty($tradetypes) && is_array($tradetypes)) {
				$forum['tradetypes'] = $forum['tradetypes'] == '' ? -1 : unserialize($forum['tradetypes']);
				$tradetypeselect = '';
				foreach($tradetypes as $typeid => $typename) {
					$tradetypeselect .= '<input class="checkbox" type="checkbox" name="tradetypesnew[]" value="'.$typeid.'" '.($forum['tradetypes'] == -1 || @in_array($typeid, $forum['tradetypes']) ? 'checked' : '').'> '.$typename.'<br />';
				}
				showsetting('forums_edit_posts_trade_type', '', '', $tradetypeselect);
			}
			showsetting('forums_edit_posts_autoclose', array('autoclosenew', array(
				array(0, $lang['forums_edit_posts_autoclose_none'], array('autoclose_time' => 'none')),
				array(1, $lang['forums_edit_posts_autoclose_dateline'], array('autoclose_time' => '')),
				array(-1, $lang['forums_edit_posts_autoclose_lastpost'], array('autoclose_time' => ''))
			)), $forum['autoclose'], 'mradio');
			showtagheader('tbody', 'autoclose_time', $forum['autoclose'], 'sub');
			showsetting('forums_edit_posts_autoclose_time', 'autoclosetimenew', $forum['autoclosetime'], 'text');
			showtagfooter('tbody');
			showsetting('forums_edit_posts_attach_ext', 'attachextensionsnew', $forum['attachextensions'], 'text');
			showtablefooter();
			showtagfooter('div');


			showtagheader('div', 'credits', $anchor == 'credits');
			showtableheader('forums_edit_credits', 'nobottom');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -