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

📄 forums.inc.php

📁 Discuz功能源码(开源)
💻 PHP
📖 第 1 页 / 共 5 页
字号:
			echo '<tr ><td>'.$lang['credits_id'].'</td><td>'.$lang['credits_title'].'</td><td>'.$lang['forums_edit_credits_postcredits_add'].'</td><td>'.$lang['forums_edit_credits_replycredits_add'].'</td><td>'.$lang['settings_credits_policy_digest'].'</td><td>'.$lang['settings_credits_policy_postattach'].'</td><td>'.$lang['settings_credits_policy_getattach'].'</td></tr>';
			$customcreditspolicy = '';
			if(is_array($extcredits)) {
				foreach($extcredits as $i => $extcredit) {
					$customcreditspolicy .= showtablerow('', '', array(
        					"extcredits$i",
        					$extcredit['title'],
        					"<input type=\"text\" class=\"txt\" size=\"2\" name=\"postcreditsnew[$i]\" value=\"".$forum['postcredits'][$i]."\" />",
        					"<input type=\"text\" class=\"txt\" size=\"2\" name=\"replycreditsnew[$i]\" value=\"".$forum['replycredits'][$i]."\" />",
        					"<input type=\"text\" class=\"txt\" size=\"2\" name=\"digestcreditsnew[$i]\" value=\"".$forum['digestcredits'][$i]."\" />",
        					"<input type=\"text\" class=\"txt\" size=\"2\" name=\"postattachcreditsnew[$i]\" value=\"".$forum['postattachcredits'][$i]."\" />",
        					"<input type=\"text\" class=\"txt\" size=\"2\" name=\"getattachcreditsnew[$i]\" value=\"".$forum['getattachcredits'][$i]."\" />"
        				), TRUE);
				}
			}
			$customcreditspolicy .= '<tr><td colspan="7">'.$lang['forums_edit_credits_comment'].'</td></tr>';
			echo $customcreditspolicy;
			showtablefooter();
			showtagfooter('div');

			if($allowthreadtypes) {
				echo <<<EOT
<script type="text/JavaScript">
	var rowtypedata = [
		[
			[1,'<input type="checkbox" class="checkbox" name="newenable[]" checked="checked" />', 'td25'],
			[1,'<input type="text" class="txt" name="newname[]" size="15" />'],
			[1,'<input type="text" class="txt" name="newdescription[]" size="15" />'],
			[1,'<select name="newoptions[]"><option value="1" selected="selected">$lang[forums_edit_threadtypes_use_cols]</option><option value="2">$lang[forums_edit_threadtypes_use_choice]</option></select>'],
			[1,'']
		],
	];
</script>
EOT;
				showtagheader('div', 'threadtypes', $anchor == 'threadtypes');

				showtableheader('forums_edit_threadtypes', 'nobottom');
				showsetting('forums_edit_threadtypes_status', array('threadtypesnew[status]', array(
					array(1, $lang['yes'], array('threadtypes_config' => '', 'threadtypes_manage' => '')),
					array(0, $lang['no'], array('threadtypes_config' => 'none', 'threadtypes_manage' => 'none'))
				), TRUE), $forum['threadtypes']['status'], 'mradio');
				showtagheader('tbody', 'threadtypes_config', $forum['threadtypes']['status']);
				showsetting('forums_edit_threadtypes_required', 'threadtypesnew[required]', $forum['threadtypes']['required'], 'radio');
				showsetting('forums_edit_threadtypes_listable', 'threadtypesnew[listable]', $forum['threadtypes']['listable'], 'radio');
				showsetting('forums_edit_threadtypes_prefix', 'threadtypesnew[prefix]', $forum['threadtypes']['prefix'], 'radio');
				showtagfooter('tbody');
				showtablefooter();

				showtagheader('div', 'threadtypes_manage', $forum['threadtypes']['status']);
				showtableheader('', 'noborder fixpadding');
				showsubtitle(array('enable', 'forums_edit_threadtypes_name', 'forums_edit_threadtypes_note', 'forums_edit_threadtypes_showtype', 'forums_edit_threadtypes_show'));
				echo $typeselect;
				echo '<tr><td colspan="6"><div><a href="###" onclick="addrow(this, 0)" class="addtr">'.lang('threadtype_infotypes_add').'</a></div></td></tr>';
				echo '<tr><td class="lineheight" colspan="6">'.$lang['forums_edit_threadtypes_comment'].'</td></tr>';
				showtablefooter();
				showtagfooter('div');

				showtagfooter('div');

				showtagheader('div', 'threadsorts', $anchor == 'threadsorts');

				showtableheader('forums_edit_threadsorts', 'nobottom');
				showsetting('forums_edit_threadsorts_status', array('threadsortsnew[status]', array(
					array(1, $lang['yes'], array('threadsorts_config' => '', 'threadsorts_manage' => '')),
					array(0, $lang['no'], array('threadsorts_config' => 'none', 'threadsorts_manage' => 'none'))
				), TRUE), $forum['threadsorts']['status'], 'mradio');
				showtagheader('tbody', 'threadsorts_config', $forum['threadsorts']['status']);
				showsetting('forums_edit_threadtypes_required', 'threadsortsnew[required]', $forum['threadsorts']['required'], 'radio');
				showsetting('forums_edit_threadtypes_listable', 'threadsortsnew[listable]', $forum['threadsorts']['listable'], 'radio');
				showsetting('forums_edit_threadtypes_prefix', 'threadsortsnew[prefix]', $forum['threadsorts']['prefix'], 'radio');
				if($typemodelshow) {
					showsetting('forums_edit_threadsorts_typemodel', '', '', $typemodelselect);
				}
				showtagfooter('tbody');
				showtablefooter();

				showtagheader('div', 'threadsorts_manage', $forum['threadsorts']['status']);
				showtableheader('', 'noborder fixpadding');
				showsubtitle(array('enable', 'forums_edit_threadtypes_name', 'forums_edit_threadtypes_note', 'forums_edit_threadtypes_showtype', 'forums_edit_threadtypes_show'));
				echo $sortselect;
				showtablefooter();
				showtagfooter('div');

				showtagfooter('div');
			}

			showtagheader('div', 'perm', $anchor == 'perm');
			showtableheader('forums_edit_perm_forum', 'nobottom');
			showsetting('forums_edit_perm_passwd', 'passwordnew', $forum['password'], 'text');
			showtablefooter();
			showtableheader('forums_edit_perm_forum', 'noborder fixpadding');
			showsubtitle(array(
				'',
				'<input class="checkbox" type="checkbox" name="chkall1" onclick="checkAll(\'prefix\', this.form, \'viewperm\', \'chkall1\')" id="chkall1" /><label for="chkall1"> '.$lang['forums_edit_perm_view'].'</label>',
				'<input class="checkbox" type="checkbox" name="chkall2" onclick="checkAll(\'prefix\', this.form, \'postperm\', \'chkall2\')" id="chkall2" /><label for="chkall2"> '.$lang['forums_edit_perm_post'].'</label>',
				'<input class="checkbox" type="checkbox" name="chkall3" onclick="checkAll(\'prefix\', this.form, \'replyperm\', \'chkall3\')" id="chkall3" /><label for="chkall3"> '.$lang['forums_edit_perm_reply'].'</label>',
				'<input class="checkbox" type="checkbox" name="chkall4" onclick="checkAll(\'prefix\', this.form, \'getattachperm\', \'chkall4\')" id="chkall4" /><label for="chkall4"> '.$lang['forums_edit_perm_getattach'].'</label>',
				'<input class="checkbox" type="checkbox" name="chkall5" onclick="checkAll(\'prefix\', this.form, \'postattachperm\', \'chkall5\')" id="chkall5" /><label for="chkall5"> '.$lang['forums_edit_perm_postattach'].'</label>'

			));

			foreach($groups as $group) {
				$colums = array('<input class="checkbox" title="'.$lang['select_all'].'" type="checkbox" name="chkallv'.$group['groupid'].'" onclick="checkAll(\'value\', this.form, '.$group['groupid'].', \'chkallv'.$group['groupid'].'\')" id="chkallv_'.$group['groupid'].'" /><label for="chkallv_'.$group['groupid'].'"> '.$group[grouptitle].'</label>');
				foreach($perms as $perm) {
					$checked = strstr($forum[$perm], "\t$group[groupid]\t") ? 'checked="checked"' : NULL;
					$colums[] = '<input class="checkbox" type="checkbox" name="'.$perm.'[]" value="'.$group['groupid'].'" chkvalue="'.$group['groupid'].'" '.$checked.'>';
				}
				showtablerow('', '', $colums);
			}
			showtablerow('', 'class="lineheight" colspan="6"', $lang['forums_edit_perm_forum_comment']);
			showtablefooter();


			showtableheader('forums_edit_perm_formula', 'noborder fixpadding');
			$formulareplace .= '\'<u>'.$lang['settings_credits_formula_digestposts'].'</u>\',\'<u>'.$lang['settings_credits_formula_posts'].'</u>\',\'<u>'.$lang['settings_credits_formula_oltime'].'</u>\',\'<u>'.$lang['settings_credits_formula_pageviews'].'</u>\'';

?>
<script type="text/JavaScript">

	function isUndefined(variable) {
		return typeof variable == 'undefined' ? true : false;
	}

	function insertunit(text, textend) {
		$('formulapermnew').focus();
		textend = isUndefined(textend) ? '' : textend;
		if(!isUndefined($('formulapermnew').selectionStart)) {
			var opn = $('formulapermnew').selectionStart + 0;
			if(textend != '') {
				text = text + $('formulapermnew').value.substring($('formulapermnew').selectionStart, $('formulapermnew').selectionEnd) + textend;
			}
			$('formulapermnew').value = $('formulapermnew').value.substr(0, $('formulapermnew').selectionStart) + text + $('formulapermnew').value.substr($('formulapermnew').selectionEnd);
		} else if(document.selection && document.selection.createRange) {
			var sel = document.selection.createRange();
			if(textend != '') {
				text = text + sel.text + textend;
			}
			sel.text = text.replace(/\r?\n/g, '\r\n');
			sel.moveStart('character', -strlen(text));
		} else {
			$('formulapermnew').value += text;
		}
		formulaexp();
	}

	var formulafind = new Array('digestposts', 'posts', 'oltime', 'pageviews');
	var formulareplace = new Array(<?php echo $formulareplace?>);
	function formulaexp() {
		var result = $('formulapermnew').value;
<?php

	$extcreditsbtn = '';
	for($i = 1; $i <= 8; $i++) {
		$extcredittitle = $extcredits[$i]['title'] ? $extcredits[$i]['title'] : $lang['settings_credits_formula_extcredits'].$i;
		echo 'result = result.replace(/extcredits'.$i.'/g, \'<u>'.str_replace("'", "\'", $extcredittitle).'</u>\');';
		$extcreditsbtn .= '<a href="###" onclick="insertunit(\'extcredits'.$i.'\')">'.$extcredittitle.'</a> &nbsp;';
	}

	echo 'result = result.replace(/digestposts/g, \'<u>'.$lang['settings_credits_formula_digestposts'].'</u>\');';
	echo 'result = result.replace(/posts/g, \'<u>'.$lang['settings_credits_formula_posts'].'</u>\');';
	echo 'result = result.replace(/oltime/g, \'<u>'.$lang['settings_credits_formula_oltime'].'</u>\');';
	echo 'result = result.replace(/pageviews/g, \'<u>'.$lang['settings_credits_formula_pageviews'].'</u>\');';
	echo 'result = result.replace(/and/g, \'&nbsp;&nbsp;'.$lang['forums_edit_perm_formula_and'].'&nbsp;&nbsp;\');';
	echo 'result = result.replace(/or/g, \'&nbsp;&nbsp;'.$lang['forums_edit_perm_formula_or'].'&nbsp;&nbsp;\');';
	echo 'result = result.replace(/>=/g, \'&ge;\');';
	echo 'result = result.replace(/<=/g, \'&le;\');';

?>
		$('formulapermexp').innerHTML = result;
	}
</script>
<tr><td colspan="2"><div class="extcredits">
<?php echo $extcreditsbtn?><br />
<a href="###" onclick="insertunit(' digestposts ')"><?php echo lang('forums_edit_perm_formula_digestposts')?></a>&nbsp;
<a href="###" onclick="insertunit(' posts ')"><?php echo lang('forums_edit_perm_formula_posts')?></a>&nbsp;
<a href="###" onclick="insertunit(' oltime ')"><?php echo lang('forums_edit_perm_formula_oltime')?></a>&nbsp;
<a href="###" onclick="insertunit(' pageviews ')"><?php echo lang('forums_edit_perm_formula_pageviews')?></a>&nbsp;
<a href="###" onclick="insertunit(' + ')">&nbsp;+&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' - ')">&nbsp;-&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' * ')">&nbsp;*&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' / ')">&nbsp;/&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' > ')">&nbsp;>&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' >= ')">&nbsp;>=&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' < ')">&nbsp;<&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' <= ')">&nbsp;<=&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' = ')">&nbsp;=&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' (', ') ')">&nbsp;(&nbsp;)&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' and ')">&nbsp;<?php echo lang('forums_edit_perm_formula_and')?>&nbsp;</a>&nbsp;
<a href="###" onclick="insertunit(' or ')">&nbsp;<?php echo lang('forums_edit_perm_formula_or')?>&nbsp;</a>&nbsp;<br />
<div id="formulapermexp" class="margintop marginbot diffcolor2"><?php echo $formulapermexp?></div>
</div>
<textarea name="formulapermnew" id="formulapermnew" class="marginbot" style="width:80%" rows="3" onkeyup="formulaexp()"><?php echo dhtmlspecialchars($forum['formulaperm'])?></textarea>
<script type="text/JavaScript">formulaexp()</script>
<br /><span class="smalltxt"><?=$lang['forums_edit_perm_formula_comment']?></span>
<br /><?php echo lang('creditwizard_current_formula_notice')?>
</td></tr>
<?php

			showtablefooter();
			showtagfooter('div');

			showtableheader('', 'notop');
			showsubmit('detailsubmit', 'submit', '', $forum['type'] != 'group' ? '<input type="submit" class="btn" name="saveconfigsubmit" value="'.$lang['saveconf'].'">' : '');
			showtablefooter();

		}

	showformfooter();

	} else {

		if(strlen($namenew) > 50) {
			cpmsg('forums_name_toolong', '', 'error');
		}

		if($formulapermnew && !preg_match("/^(\+|\-|\*|\/|\.|>|<|=|\d|\s|extcredits[1-8]|digestposts|posts|pageviews|oltime|and|or)+$/", $formulapermnew) || !is_null(@eval(preg_replace("/(digestposts|posts|pageviews|oltime|extcredits[1-8])/", "\$\\1", $formulapermnew).';'))) {
			cpmsg('forums_formulaperm_error', '', 'error');
		}

		$formulapermary[0] = $formulapermnew;
		$formulapermary[1] = preg_replace("/(digestposts|posts|pageviews|oltime|extcredits[1-8])/", "\$_DSESSION['\\1']", $formulapermnew);
		$formulapermnew = addslashes(serialize($formulapermary));

		if($type == 'group') {

			if($namenew) {

				if($foruminfosidestatus) {
					$infosidestatusnew = $infosidestatus;
					unset($infosidestatusnew['f'.$fid]);
					$foruminfosidestatus[0] != $infosidestatus[2] && $foruminfosidestatus[0] != '' && $infosidestatusnew['f'.$fid][0] = $foruminfosidestatus[0];
					$foruminfosidestatus['posts'] != $infosidestatus['posts'] && $foruminfosidestatus['posts'] != '' && $infosidestatusnew['f'.$fid]['posts'] = $foruminfosidestatus['posts'];
					if($infosidestatus != $infosidestatusnew) {
						$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('infosidestatus', '".(addslashes(serialize($infosidestatusnew)))."')");
						updatecache('settings');
					}
				}
				$forumcolumnsnew = $forumcolumnsnew > 1 ? intval($forumcolumnsnew) : 0;
				
				$db->query("UPDATE {$tablepre}forums SET name='$namenew',forumcolumns='".$forumcolumnsnew."',status='".intval($statusnew)."' WHERE fid='$fid'");
				updatecache('forums');

				cpmsg('forums_edit_succeed', $BASESCRIPT.'?action=forums', 'succeed');
			} else {
				cpmsg('forums_edit_name_invalid', '', 'error');
			}

		} else {

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

			$extensionarray = array();
			foreach(explode(',', $attachextensionsnew) as $extension) {
				if($extension = trim($extension)) {
					$extensionarray[] = $extension;
				}
			}
			$attachextensionsnew = implode(', ', $extensionarray);

			foreach($perms as $perm) {
				${$perm.'new'} = is_array($$perm) && !empty($$perm) ? "\t".implode("\t", $$perm)."\t" : '';

⌨️ 快捷键说明

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