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

📄 creditwizard.inc.php

📁 论坛代码网增加免费空间业务
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php

/*
	[Discuz!] (C)2001-2007 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$Id: creditwizard.inc.php 13440 2008-04-16 01:10:37Z liuqiang $
*/

if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
        exit('Access Denied');
}

$step = in_array($step, array(1, 2, 3)) ? $step : 1;

$query = $db->query("SELECT * FROM {$tablepre}settings WHERE variable IN ('extcredits', 'initcredits', 'creditspolicy', 'creditsformula', 'creditsformulaexp', 'creditstrans', 'creditstax', 'transfermincredits', 'exchangemincredits', 'maxincperthread', 'maxchargespan')");
while($setting = $db->fetch_array($query)) {
	$$setting['variable'] = $setting['value'];
}
$extcredits = unserialize($extcredits);
$initcredits = explode(',', $initcredits);
$creditspolicy = unserialize($creditspolicy);

cpheader();

if($step == 1) {

	if($resetcredit >= 1 && $resetcredit <= 8) {
		$initcredits[$resetcredit] = intval($initcredits[$resetcredit]);
		if(!submitcheck('confirmed')) {
			cpmsg('creditwizard_resetusercredit_warning', 'admincp.php?action=creditwizard&step=1&resetcredit='.$resetcredit, 'form');
		} else {
			$db->query("UPDATE {$tablepre}members SET extcredits$resetcredit = $initcredits[$resetcredit]", 'UNBUFFERED');
			cpmsg('creditwizard_resetusercredit_ok', 'admincp.php?action=creditwizard&step=1', 'succeed');
		}
		exit;
	}

	if(!$credit) {

		shownav('tools', 'nav_creditwizard');
		showsubmenu('nav_creditwizard', array(
			array('creditwizard_step_menu_1', 'creditwizard&step=1', $step == 1),
			array('creditwizard_step_menu_2', 'creditwizard&step=2', $step == 2),
			array('creditwizard_step_menu_3', 'creditwizard&step=3', $step == 3),
			array('creditwizard_step_menu_4', 'settings&operation=ecommerce&from=creditwizard', 0),
			array('alipay', 'ecommerce&operation=alipay&from=creditwizard', 0),
		));
		showtableheader();
		showsubtitle(array('credits_id', 'credits_title', 'creditwizard_status', ''));

		for($i = 1; $i <= 8; $i++) {
			showtablerow('', array('class="td21"'), array(
				'extcredits'.$i,
				$extcredits[$i]['title'].($i == $creditstrans ? $lang['creditwizard_iscreditstrans'] : ''),
				$extcredits[$i]['available'] ? '<div class="staton">&#x221A;</div>' : '<div class="statoff">-</div>',
				'<a href="admincp.php?action=creditwizard&step=1&credit='.$i.'" class="act">'.$lang['detail'].'</a><a href="admincp.php?action=creditwizard&step=1&resetcredit='.$i.'" class="act">'.$lang['reset'].'</a>'
			));
		}

		showtablefooter();

	} else {

		if(!submitcheck('settingsubmit')) {

			$credit = $credit >=1 && $credit <= 8 ? $credit : 1;
			$type = $type >=1 && $type <= 3 ? $type : 1;
			$typeselected = array($type => ' selected="selected"');
			$typeselect = '<select onchange="location.href=\'admincp.php?action=creditwizard&step=1&credit='.$credit.'&type=\' + this.value"><option value="1"'.$typeselected[1].'>'.$lang['creditwizard_settingtype_global'].'</option><option value="2"'.$typeselected[2].'>'.$lang['creditwizard_settingtype_forum'].'</option><option value="3"'.$typeselected[3].'>'.$lang['creditwizard_settingtype_usergroup'].'</option></select>';
			$creditselect = '<select onchange="location.href=\'admincp.php?action=creditwizard&step=1&type='.$type.'&credit=\' + this.value">';
			for($i = 1;$i <= 8;$i++) {
				$creditselect .= '<option value="'.$i.'"'.($credit == $i ? ' selected="selected"' : '').'>extcredits'.$i.($extcredits[$i]['title'] ? ' ('.$extcredits[$i]['title'].')' : '').'</option>';
			}
			$creditselect .= '</select>';
			$tips = 'creditwizard_settingtype_'.(empty($type) || $type == 1 ? 'global' : ($type == 2 ? 'forum' : ($type == 3 ? 'usergroup' : 'global'))).'_tips';

			shownav('tools', 'nav_creditwizard');
			showsubmenu('<a href="admincp.php?action=creditwizard&step=1">'.$lang['creditwizard_step_menu_1'].'</a> - extcredits'.$credit.($extcredits[$credit]['title'] ? '('.$extcredits[$credit]['title'].')' : ''));
			showtips($tips);
			showformheader("creditwizard&step=1&credit=$credit&type=$type");
			showtableheader();
			showtablerow('', 'class="lineheight" colspan="15"', "$lang[select]: $creditselect $typeselect");

			if($type == 1) {

				showtitle('settings_credits_extended');
				showsetting('creditwizard_credit_title', 'settingsnew[title]', $extcredits[$credit]['title'], 'text');
				showsetting('creditwizard_credits_unit', 'settingsnew[unit]', $extcredits[$credit]['unit'], 'text');
				showsetting('creditwizard_credits_ratio', 'settingsnew[ratio]', $extcredits[$credit]['ratio'], 'text');
				showsetting('creditwizard_credits_init', 'settingsnew[init]', intval($initcredits[$credit]), 'text');
				showsetting('creditwizard_credits_available', 'settingsnew[available]', intval($extcredits[$credit]['available']), 'radio');
				showsetting('creditwizard_credits_show_in_thread', 'settingsnew[showinthread]', intval($extcredits[$credit]['showinthread']), 'radio');
				showsetting('settings_creditwizard_outport', 'settingsnew[allowexchangeout]', intval($extcredits[$credit]['allowexchangeout']), 'radio');
				showsetting('settings_creditwizard_allow_inport', 'settingsnew[allowexchangein]', intval($extcredits[$credit]['allowexchangein']), 'radio');
				showtitle('settings_credits_policy');
				showsetting('settings_credits_policy_post', 'settingsnew[policy_post]', intval($creditspolicy['post'][$credit]), 'text');
				showsetting('settings_credits_policy_reply', 'settingsnew[policy_reply]', intval($creditspolicy['reply'][$credit]), 'text');
				showsetting('settings_credits_policy_digest', 'settingsnew[policy_digest]', intval($creditspolicy['digest'][$credit]), 'text');
				showsetting('settings_credits_policy_postattach', 'settingsnew[policy_postattach]', intval($creditspolicy['postattach'][$credit]), 'text');
				showsetting('settings_credits_policy_getattach', 'settingsnew[policy_getattach]', intval($creditspolicy['getattach'][$credit]), 'text');
				showsetting('settings_credits_policy_search', 'settingsnew[policy_search]', intval($creditspolicy['search'][$credit]), 'text');
				showsetting('settings_credits_policy_promotion_visit', 'settingsnew[policy_promotion_visit]', intval($creditspolicy['promotion_visit'][$credit]), 'text');
				showsetting('settings_credits_policy_promotion_register', 'settingsnew[policy_promotion_register]', intval($creditspolicy['promotion_register'][$credit]), 'text');
				showsetting('settings_credits_policy_tradefinished', 'settingsnew[policy_tradefinished]', intval($creditspolicy['tradefinished'][$credit]), 'text');
				showsetting('settings_credits_policy_votepoll', 'settingsnew[policy_votepoll]', intval($creditspolicy['votepoll'][$credit]), 'text');
				showsetting('settings_credits_policy_lowerlimit', 'settingsnew[lowerlimit]', intval($extcredits[$credit]['lowerlimit']), 'text');
				showtablerow('', 'class="lineheight" colspan="2"', $lang['settings_credits_policy_comment']);
				showsubmit('settingsubmit', 'submit', '<input type="reset" class="btn" name="settingsubmit" value="'.$lang['reset'].'" />');
				showtablefooter();
				showformfooter();

			} elseif($type == 2) {

				require_once DISCUZ_ROOT.'./forumdata/cache/cache_forums.php';
				$fids = implode(',', array_keys($_DCACHE['forums']));
				$query = $db->query("SELECT fid, postcredits, replycredits, getattachcredits, postattachcredits, digestcredits
					FROM {$tablepre}forumfields WHERE fid in ($fids)");
				while($forumcredit = $db->fetch_array($query)) {
					$forumcredit['postcreditsstatus'] = $forumcredit['postcredits'] ? 'checked' : '';
					$forumcredit['postcredits'] = $forumcredit['postcredits'] ? unserialize($forumcredit['postcredits']) : array();
					$forumcredit['postcredits'] = intval($forumcredit['postcredits'][$credit]);
					$forumcredit['replycreditsstatus'] = $forumcredit['replycredits'] ? 'checked' : '';
					$forumcredit['replycredits'] = $forumcredit['replycredits'] ? unserialize($forumcredit['replycredits']) : array();
					$forumcredit['replycredits'] = intval($forumcredit['replycredits'][$credit]);
					$forumcredit['getattachcreditsstatus'] = $forumcredit['getattachcredits'] ? 'checked' : '';
					$forumcredit['getattachcredits'] = $forumcredit['getattachcredits'] ? unserialize($forumcredit['getattachcredits']) : array();
					$forumcredit['getattachcredits'] = intval($forumcredit['getattachcredits'][$credit]);
					$forumcredit['postattachcreditsstatus'] = $forumcredit['postattachcredits'] ? 'checked' : '';
					$forumcredit['postattachcredits'] = $forumcredit['postattachcredits'] ? unserialize($forumcredit['postattachcredits']) : array();
					$forumcredit['postattachcredits'] = intval($forumcredit['postattachcredits'][$credit]);
					$forumcredit['digestcreditsstatus'] = $forumcredit['digestcredits'] ? 'checked' : '';
					$forumcredit['digestcredits'] = $forumcredit['digestcredits'] ? unserialize($forumcredit['digestcredits']) : array();
					$forumcredit['digestcredits'] = intval($forumcredit['digestcredits'][$credit]);
					$forumcredits[$forumcredit['fid']] = $forumcredit;
				}

				$credittable = '';
				foreach($_DCACHE['forums'] as $fid => $forum) {
					if($forum['type'] != 'group') {
						$credittable .= showtablerow('', array('', 'class="td28"', 'class="td28"', 'class="td28"', 'class="td28"', 'class="td28"'), array(
							"<input class=\"checkbox\" title=\"$lang[select_all]\" type=\"checkbox\" name=\"chkallv$fid\" onclick=\"checkAll('value', this.form, $fid, 'chkallv$fid')\">".
							($forum['type'] == 'forum' ? '' : '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;').
							"&nbsp;<a href=\"admincp.php?frames=yes&action=forums&operation=edit&fid=$fid&anchor=credits\" target=\"_blank\">$forum[name]</a>",
							"<input class=\"checkbox\" type=\"checkbox\" name=\"postcreditsstatus[$fid]\" value=\"$fid\" {$forumcredits[$fid][postcreditsstatus]}>&nbsp;<input type=\"text\" class=\"txt\" name=\"postcredits[$fid]\" size=\"2\" value=\"{$forumcredits[$fid][postcredits]}\">",
							"<input class=\"checkbox\" type=\"checkbox\" name=\"replycreditsstatus[$fid]\" value=\"$fid\" {$forumcredits[$fid][replycreditsstatus]}>&nbsp;<input type=\"text\" class=\"txt\" name=\"replycredits[$fid]\" size=\"2\" value=\"{$forumcredits[$fid][replycredits]}\">",
							"<input class=\"checkbox\" type=\"checkbox\" name=\"digestcreditsstatus[$fid]\" value=\"$fid\" {$forumcredits[$fid][digestcreditsstatus]}>&nbsp;<input type=\"text\" class=\"txt\" name=\"digestcredits[$fid]\" size=\"2\" value=\"{$forumcredits[$fid][digestcredits]}\">",
							"<input class=\"checkbox\" type=\"checkbox\" name=\"postattachcreditsstatus[$fid]\" value=\"$fid\" {$forumcredits[$fid][postattachcreditsstatus]}>&nbsp;<input type=\"text\" class=\"txt\" name=\"postattachcredits[$fid]\" size=\"2\" value=\"{$forumcredits[$fid][postattachcredits]}\">",
							"<input class=\"checkbox\" type=\"checkbox\" name=\"getattachcreditsstatus[$fid]\" value=\"$fid\" {$forumcredits[$fid][getattachcreditsstatus]}>&nbsp;<input type=\"text\" class=\"txt\" name=\"getattachcredits[$fid]\" size=\"2\" value=\"{$forumcredits[$fid][getattachcredits]}\">"
						), TRUE);
					}
				}

				showtitle('creditwizard_forum_creditspolicy');

?>
<tr ><td><?=$lang['forum']?></td>
<td><input class="checkbox" type="checkbox" name="chkall1" id="chkall1" onclick="checkAll('prefix', this.form, 'postcreditsstatus', 'chkall1')" /><label for="chkall1"> <?=$lang['forums_edit_postcredits_add']?></label></td>
<td><input class="checkbox" type="checkbox" name="chkall2" id="chkall2" onclick="checkAll('prefix', this.form, 'replycreditsstatus', 'chkall2')" /><label for="chkall2"> <?=$lang['forums_edit_replycredits_add']?></label></td>
<td><input class="checkbox" type="checkbox" name="chkall3" id="chkall3" onclick="checkAll('prefix', this.form, 'digestcreditsstatus', 'chkall3')" /><label for="chkall3"> <?=$lang['settings_credits_policy_digest']?></label></td>
<td><input class="checkbox" type="checkbox" name="chkall4" id="chkall4" onclick="checkAll('prefix', this.form, 'postattachcreditsstatus', 'chkall4')" /><label for="chkall4"> <?=$lang['settings_credits_policy_postattach']?></label></td>
<td><input class="checkbox" type="checkbox" name="chkall5" id="chkall5" onclick="checkAll('prefix', this.form, 'getattachcreditsstatus', 'chkall5')" /><label for="chkall5"> <?=$lang['settings_credits_policy_getattach']?></label></td></tr>

<?
				echo $credittable;
				showsubmit('settingsubmit', 'submit', '<input type="button" class="btn" value="'.$lang['creditwizard_return'].'" onclick="location.href=\'admincp.php?action=creditwizard&step=1\'" /> &nbsp;<input type="reset" class="btn" name="settingsubmit" value="'.$lang['reset'].'" />');
				showtablefooter();
				showformfooter();

			} else {

⌨️ 快捷键说明

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