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

📄 creditwizard.inc.php

📁 Discuz功能源码(开源)
💻 PHP
📖 第 1 页 / 共 3 页
字号:
		if(textend != '') {
			text = text + sel.text + textend;
		}
		sel.text = text.replace(/\r?\n/g, '\r\n');
		sel.moveStart('character', -strlen(text));
	} else {
		$('creditsformulanew').value += text;
	}
	formulaexp();
}

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

		$extcreditsbtn = '';
		for($i = 1; $i <= 8; $i++) {
			$extcredittitle = $extcredits[$i]['available'] ? $extcredits[$i]['title'] : $lang['settings_credits_formula_extcredits'].$i;
			echo 'result = result.replace(/extcredits'.$i.'/g, \'<u>'.$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>\');';

?>
	$('creditsformulaexp').innerHTML = '<u><?=$lang['settings_credits_formula_credits']?></u>=' + result;
}
</script>
<?

		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=ec&from=creditwizard', 0),
			array('ec_alipay', 'ec&operation=alipay&from=creditwizard', 0),
		));
		showtips('creditwizard_tips_formula');
		showformheader('creditwizard&step=2');
		showtableheader();
		showtitle('settings_credits_formula');
		showtablerow('', 'colspan="2"', '<div class="extcredits">'.$extcreditsbtn.'<br /><a href="###" onclick="insertunit(\'digestposts\')">'.$lang['settings_credits_formula_digestposts'].'</a>&nbsp;<a href="###" onclick="insertunit(\'posts\')">'.$lang['settings_credits_formula_posts'].'</a>&nbsp;<a href="###" onclick="insertunit(\'oltime\')">'.$lang['settings_credits_formula_oltime'].'</a>&nbsp;<a href="###" onclick="insertunit(\'pageviews\')">'.$lang['settings_credits_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;)&nbsp;</a></div><div id="creditsformulaexp" class="marginbot diffcolor2">'.$creditsformulaexp.'</div><textarea name="creditsformulanew" id="creditsformulanew" style="width: 80%" rows="3" onkeyup="formulaexp()">'.dhtmlspecialchars($creditsformula).'</textarea>');

		showsubmit('settingsubmit');
		showtablefooter();
		showformfooter();

	} else {

		if(!preg_match("/^([\+\-\*\/\.\d\(\)]|((extcredits[1-8]|digestposts|posts|pageviews|oltime)([\+\-\*\/\(\)]|$)+))+$/", $creditsformulanew) || !is_null(@eval(preg_replace("/(digestposts|posts|pageviews|oltime|extcredits[1-8])/", "\$\\1", $creditsformulanew).';'))) {
			cpmsg('settings_creditsformula_invalid', '', 'error');
		}

		$creditsformulaexpnew = $creditsformulanew;
		foreach(array('digestposts', 'posts', 'oltime', 'pageviews', 'extcredits1', 'extcredits2', 'extcredits3', 'extcredits4', 'extcredits5', 'extcredits6', 'extcredits7', 'extcredits8') as $var) {
			if($extcredits[$creditsid = preg_replace("/^extcredits(\d{1})$/", "\\1", $var)]['available']) {
				$replacement = $extcredits[$creditsid]['title'];
			} else {
				$replacement = $lang['settings_credits_formula_'.$var];
			}
			$creditsformulaexpnew = str_replace($var, '<u>'.$replacement.'</u>', $creditsformulaexpnew);
		}
		$creditsformulaexpnew = addslashes('<u>'.$lang['settings_credits_formula_credits'].'</u>='.$creditsformulaexpnew);

		$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('creditsformula', '".addslashes($creditsformulanew)."')");
		$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('creditsformulaexp', '".addslashes($creditsformulaexpnew)."')");

		updatecache('settings');

		cpmsg('creditwizard_edit_succeed', $BASESCRIPT.'?action=creditwizard&step=2', 'succeed');

	}

} else {

	if(!submitcheck('settingsubmit')) {

		$creditstransselect = '';
		$creditstrans = explode(',', $creditstrans);
		for($i = 0; $i <= 8; $i++) {
			if($i == 0 || $extcredits[$i]['available']) {
				$creditstransselect .= '<option value="'.$i.'" '.($i == intval($creditstrans[0]) ? 'selected' : '').'>'.($i ? 'extcredits'.$i.' ('.$extcredits[$i]['title'].')' : $lang['none']).'</option>';
			}
		}

		function showtextradio($textname, $textvalue, $radioname, $radioes = array()) {
			$a = '<input type="text" class="txt marginbot" name="'.$textname.'" id="'.$textname.'" value="'.$textvalue.'" /><ul style="width: 340px;" onmouseover="altStyle(this);">';
			if(is_array($radioes)) {
				foreach($radioes as $radio) {
					$a .= '<li><input type="radio" name="'.$radioname.'" value="'.$radio[1].'" class="radio" onclick="$(\''.$textname.'\').value = this.value"'.($radio[2] ? ' checked="checked"' : '').' /> '.$radio[0].'</li>';
				}
			}
			$a .= '</ul>';
			return $a;
		}

		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=ec&from=creditwizard', 0),
			array('ec_alipay', 'ec&operation=alipay&from=creditwizard', 0),
		));
		showtips('creditwizard_tips_creditsuse');
		showformheader('creditwizard&step=3');
		showtableheader('creditwizard_step_menu_3');
		showsetting('settings_credits_trans', '', '', '<select onchange="$(\'allowcreditstrans\').style.display = this.value != 0 ? \'\' : \'none\'" name="creditstransnew">'.$creditstransselect.'</select>');
		showsetting('settings_credits_tax', '', '', showtextradio('creditstaxnew', $creditstax, 'creditstaxradio', array(
			array($lang['low'].' (0.01)', '0.01', $creditstax == '0.01'),
			array($lang['middle'].' (0.1)', '0.1', $creditstax == '0.1'),
			array($lang['high'].' (0.5)', '0.5', $creditstax == '0.5')
		)));
		showsetting('settings_credits_minexchange', '', '', showtextradio('exchangemincreditsnew', $exchangemincredits, 'exchangemincreditsradio', array(
			array($lang['low'].' (100)', 100, $exchangemincredits == 100),
			array($lang['middle'].' (1000)', 1000, $exchangemincredits == 1000),
			array($lang['high'].' (5000)', 5000, $exchangemincredits == 5000)
		)));

		showtagheader('tbody', 'allowcreditstrans', $creditstrans);
		showtitle('creditwizard_allowcreditstrans');
		showsetting('settings_credits_mintransfer', '', '', showtextradio('transfermincreditsnew', $transfermincredits, 'transfermincreditsradio', array(
			array($lang['low'].' (100)', 100, $transfermincredits == 100),
			array($lang['middle'].' (1000)', 1000, $transfermincredits == 1000),
			array($lang['high'].' (5000)', 5000, $transfermincredits == 5000)
		)));
		showsetting('settings_credits_maxincperthread', '', '', showtextradio('maxincperthreadnew', $maxincperthread, 'maxincperthreadradio', array(
			array($lang['nolimit'].' (0)', 0, $maxincperthread == 0),
			array($lang['low'].' (10)', 10, $maxincperthread == 10),
			array($lang['middle'].' (50)', 50, $maxincperthread == 50),
			array($lang['high'].' (100)', 100, $maxincperthread == 100)
		)));
		showsetting('settings_credits_maxchargespan', '', '', showtextradio('maxchargespannew', $maxchargespan, 'maxchargespanradio', array(
			array($lang['nolimit'].' (0)', 0, $maxchargespan == 0),
			array($lang['low'].' (5)', 5, $maxchargespan == 5),
			array($lang['middle'].' (24)', 24, $maxchargespan == 24),
			array($lang['high'].' (48)', 48, $maxchargespan == 48)
		)));
		showtagfooter('tbody');

		showsubmit('settingsubmit');
		showtablefooter();
		showformfooter();

	} else {
		if($creditstaxnew < 0 || $creditstaxnew >= 1) {
			$creditstaxnew = 0;
		}
		$creditstrans = explode(',', $creditstrans);
		$creditstrans[0] = (float)$creditstransnew;

		$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('creditstrans', '".implode(',', $creditstrans)."')");
		$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('creditstax', '".((float)$creditstaxnew)."')");
		$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('transfermincredits', '".((float)$transfermincreditsnew)."')");
		$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('exchangemincredits', '".((float)$exchangemincreditsnew)."')");
		$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('maxincperthread', '".((float)$maxincperthreadnew)."')");
		$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('maxchargespan', '".((float)$maxchargespannew)."')");

		updatecache('settings');
		cpmsg('creditwizard_edit_succeed', $BASESCRIPT.'?action=creditwizard&step=3', 'succeed');
	}
}

?>

⌨️ 快捷键说明

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