本文整理汇总了PHP中checkformulacredits函数的典型用法代码示例。如果您正苦于以下问题:PHP checkformulacredits函数的具体用法?PHP checkformulacredits怎么用?PHP checkformulacredits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkformulacredits函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bindec
$settingnew['editoroptions'] = bindec($settingnew['defaulteditormode'] . $settingnew['allowswitcheditor'] . $settingnew['simplemode']);
}
if (isset($settingnew['myrecorddays'])) {
$settingnew['myrecorddays'] = intval($settingnew['myrecorddays']) > 0 ? intval($settingnew['myrecorddays']) : 30;
}
if (!empty($settingnew['thumbstatus']) && !function_exists('imagejpeg')) {
$settingnew['thumbstatus'] = 0;
}
if (!empty($settingnew['memory'])) {
foreach ($settingnew['memory'] as $k => $v) {
$settingnew['memory'][$k] = array('enable' => !empty($settingnew['memory'][$k]['enable']) ? 1 : 0, 'ttl' => min(3600 * 24, max(30, intval($settingnew['memory'][$k]['ttl']))));
}
$settingnew['memory'] = addslashes(serialize($settingnew['memory']));
}
if (isset($settingnew['creditsformula']) && isset($settingnew['extcredits']) && isset($settingnew['initcredits']) && isset($settingnew['creditstrans']) && isset($settingnew['creditstax'])) {
if (!checkformulacredits($settingnew['creditsformula'])) {
cpmsg('setting_creditsformula_invalid', '', 'error');
}
$extcreditsarray = array();
if (is_array($settingnew['extcredits'])) {
foreach ($settingnew['extcredits'] as $key => $value) {
if ($value['available'] && !$value['title']) {
cpmsg('setting_credits_title_invalid', '', 'error');
}
$extcreditsarray[$key] = array('img' => dhtmlspecialchars(dstripslashes($value['img'])), 'title' => dhtmlspecialchars(dstripslashes($value['title'])), 'unit' => dhtmlspecialchars(dstripslashes($value['unit'])), 'ratio' => $value['ratio'] > 0 ? (double) $value['ratio'] : 0, 'available' => $value['available'], 'showinthread' => $value['showinthread'], 'allowexchangein' => $value['allowexchangein'], 'allowexchangeout' => $value['allowexchangeout']);
$settingnew['initcredits'][$key] = intval($settingnew['initcredits'][$key]);
}
}
for ($si = 0; $si < 11; $si++) {
$creditstransi = $si > 0 && !$settingnew['creditstrans'][$si] ? $settingnew['creditstrans'][0] : $settingnew['creditstrans'][$si];
if ($creditstransi && empty($settingnew['extcredits'][$creditstransi]['available']) && $settingnew['creditstrans'][$si] != -1) {
示例2: build_cache_setting
function build_cache_setting()
{
global $_G;
$table = 'common_setting';
$skipkeys = array('posttableids', 'siteuniqueid', 'mastermobile', 'closedreason', 'creditsnotify', 'backupdir', 'custombackup', 'jswizard', 'maxonlines', 'modreasons', 'newsletter', 'postno', 'postnocustom', 'customauthorinfo', 'domainwhitelist', 'ipregctrl', 'ipverifywhite', 'fastsmiley', 'defaultdoing', 'profilegroup');
$serialized = array('reginput', 'memory', 'search', 'creditspolicy', 'ftp', 'secqaa', 'ec_credit', 'qihoo', 'spacedata', 'infosidestatus', 'uc', 'indexhot', 'relatedtag', 'sitemessage', 'uchome', 'heatthread', 'recommendthread', 'disallowfloat', 'allowviewuserthread', 'advtype', 'click', 'card', 'rewritestatus', 'rewriterule', 'privacy', 'focus', 'forumkeys', 'article_tags', 'verify', 'seotitle', 'seodescription', 'seokeywords', 'domain', 'ranklist', 'seccodedata', 'inviteconfig', 'advexpiration', 'allowpostcomment', 'mobile', 'connect');
$data = array();
$query = DB::query("SELECT * FROM " . DB::table($table) . " WHERE skey NOT IN(" . dimplode($skipkeys) . ')');
while ($setting = DB::fetch($query)) {
if ($setting['skey'] == 'extcredits') {
if (is_array($setting['svalue'] = unserialize($setting['svalue']))) {
foreach ($setting['svalue'] as $key => $value) {
if ($value['available']) {
unset($setting['svalue'][$key]['available']);
} else {
unset($setting['svalue'][$key]);
}
}
}
} elseif ($setting['skey'] == 'creditsformula') {
if (!checkformulacredits($setting['svalue'])) {
$setting['svalue'] = '$member[\'extcredits1\']';
} else {
$setting['svalue'] = preg_replace("/(friends|doings|blogs|albums|polls|sharings|digestposts|posts|threads|oltime|extcredits[1-8])/", "\$member['\\1']", $setting['svalue']);
}
} elseif ($setting['skey'] == 'maxsmilies') {
$setting['svalue'] = $setting['svalue'] <= 0 ? -1 : $setting['svalue'];
} elseif ($setting['skey'] == 'threadsticky') {
$setting['svalue'] = explode(',', $setting['svalue']);
} elseif ($setting['skey'] == 'attachdir') {
$setting['svalue'] = preg_replace("/\\.asp|\\0/i", '0', $setting['svalue']);
$setting['svalue'] = str_replace('\\', '/', substr($setting['svalue'], 0, 2) == './' ? DISCUZ_ROOT . $setting['svalue'] : $setting['svalue']);
$setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : '';
} elseif ($setting['skey'] == 'attachurl') {
$setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : '';
} elseif ($setting['skey'] == 'onlinehold') {
$setting['svalue'] = $setting['svalue'] * 60;
} elseif (in_array($setting['skey'], $serialized)) {
$setting['svalue'] = @unserialize($setting['svalue']);
if ($setting['skey'] == 'search') {
foreach ($setting['svalue'] as $key => $val) {
foreach ($val as $k => $v) {
$setting['svalue'][$key][$k] = max(0, intval($v));
}
}
}
if ($setting['skey'] == 'ftp') {
$setting['svalue']['attachurl'] .= substr($setting['svalue']['attachurl'], -1, 1) != '/' ? '/' : '';
}
}
$_G['setting'][$setting['skey']] = $data[$setting['skey']] = $setting['svalue'];
}
DB::free_result($query);
$data['newusergroupid'] = DB::result_first("SELECT groupid FROM " . DB::table('common_usergroup') . " WHERE creditshigher<=" . intval($data['initcredits']) . " AND " . intval($data['initcredits']) . "<creditslower LIMIT 1");
if ($data['srchhotkeywords']) {
$data['srchhotkeywords'] = explode("\n", $data['srchhotkeywords']);
}
if ($data['search']) {
$searchstatus = 0;
foreach ($data['search'] as $item) {
if ($item['status']) {
$searchstatus = 1;
break;
}
}
if (!$searchstatus) {
$data['search'] = array();
}
}
$data['creditspolicy'] = array_merge($data['creditspolicy'], get_cachedata_setting_creditspolicy());
if ($data['heatthread']['iconlevels']) {
$data['heatthread']['iconlevels'] = explode(',', $data['heatthread']['iconlevels']);
arsort($data['heatthread']['iconlevels']);
} else {
$data['heatthread']['iconlevels'] = array();
}
if ($data['verify']) {
foreach ($data['verify'] as $key => $value) {
if ($value['available'] && !empty($value['icon'])) {
$icourl = parse_url($value['icon']);
if (!$icourl['host'] && !file_exists($value['icon'])) {
$data['verify'][$key]['icon'] = $data['attachurl'] . 'common/' . $value['icon'];
}
}
}
}
if ($data['recommendthread']['status']) {
if ($data['recommendthread']['iconlevels']) {
$data['recommendthread']['iconlevels'] = explode(',', $data['recommendthread']['iconlevels']);
arsort($data['recommendthread']['iconlevels']);
} else {
$data['recommendthread']['iconlevels'] = array();
}
} else {
$data['recommendthread'] = array('allow' => 0);
}
if ($data['commentnumber'] && !$data['allowpostcomment']) {
$data['commentnumber'] = 0;
}
if (!empty($data['ftp'])) {
//.........这里部分代码省略.........
示例3: build_cache_setting
function build_cache_setting() {
global $_G;
$skipkeys = array('posttableids', 'mastermobile', 'masterqq', 'masteremail', 'closedreason',
'creditsnotify', 'backupdir', 'custombackup', 'jswizard', 'maxonlines', 'modreasons', 'newsletter',
'postno', 'postnocustom', 'customauthorinfo', 'domainwhitelist', 'ipregctrl',
'ipverifywhite', 'fastsmiley', 'defaultdoing', 'antitheftsetting',
);
$serialized = array('reginput', 'memory', 'search', 'creditspolicy', 'ftp', 'secqaa', 'ec_credit', 'qihoo', 'spacedata',
'infosidestatus', 'uc', 'indexhot', 'relatedtag', 'sitemessage', 'uchome', 'heatthread', 'recommendthread',
'disallowfloat', 'allowviewuserthread', 'advtype', 'click', 'card', 'rewritestatus', 'rewriterule', 'privacy', 'focus',
'forumkeys', 'article_tags', 'verify', 'seotitle', 'seodescription', 'seokeywords', 'domain', 'ranklist', 'my_search_data',
'seccodedata', 'inviteconfig', 'advexpiration', 'allowpostcomment', /*(IN_MOBILE)*/ 'mobile', 'connect', 'upgrade', 'patch', 'strongpw',
'posttable_info', 'threadtable_info', 'profilegroup', 'antitheft', 'makehtml', 'guestviewthumb', 'grid', 'guesttipsinthread'
);
$data = array();
foreach(C::t('common_setting')->fetch_all_not_key($skipkeys) as $setting) {
if($setting['skey'] == 'extcredits') {
if(is_array($setting['svalue'] = dunserialize($setting['svalue']))) {
foreach($setting['svalue'] as $key => $value) {
if($value['available']) {
unset($setting['svalue'][$key]['available']);
} else {
unset($setting['svalue'][$key]);
}
}
}
} elseif($setting['skey'] == 'creditsformula') {
if(!checkformulacredits($setting['svalue'])) {
$setting['svalue'] = '$member[\'extcredits1\']';
} else {
$setting['svalue'] = preg_replace("/(friends|doings|blogs|albums|polls|sharings|digestposts|posts|threads|oltime|extcredits[1-8])/", "\$member['\\1']", $setting['svalue']);
}
} elseif($setting['skey'] == 'maxsmilies') {
$setting['svalue'] = $setting['svalue'] <= 0 ? -1 : $setting['svalue'];
} elseif($setting['skey'] == 'threadsticky') {
$setting['svalue'] = explode(',', $setting['svalue']);
} elseif($setting['skey'] == 'attachdir') {
$setting['svalue'] = preg_replace("/\.asp|\\0/i", '0', $setting['svalue']);
$setting['svalue'] = str_replace('\\', '/', substr($setting['svalue'], 0, 2) == './' ? DISCUZ_ROOT.$setting['svalue'] : $setting['svalue']);
$setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : '';
} elseif($setting['skey'] == 'attachurl') {
$setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : '';
} elseif($setting['skey'] == 'onlinehold') {
$setting['svalue'] = $setting['svalue'] * 60;
} elseif(in_array($setting['skey'], $serialized)) {
$setting['svalue'] = @dunserialize($setting['svalue'], $setting['skey']);
if($setting['skey'] == 'search') {
foreach($setting['svalue'] as $key => $val) {
foreach($val as $k => $v) {
$setting['svalue'][$key][$k] = max(0, intval($v));
}
}
} elseif($setting['skey'] == 'ftp') {
$setting['svalue']['attachurl'] .= substr($setting['svalue']['attachurl'], -1, 1) != '/' ? '/' : '';
} elseif($setting['skey'] == 'inviteconfig') {
$setting['svalue']['invitecodeprompt'] = stripslashes($setting['svalue']['invitecodeprompt']);
} elseif($setting['skey'] == 'profilegroup') {
$profile_settings = C::t('common_member_profile_setting')->fetch_all_by_available(1);
foreach($setting['svalue'] as $key => $val) {
$temp = array();
foreach($profile_settings as $pval) {
if(in_array($pval['fieldid'], $val['field'])) {
$temp[$pval['fieldid']] = $pval['fieldid'];
}
}
foreach($val['field'] as $fieldid) {
if(!in_array($fieldid, $temp)) {
$temp[$fieldid] = $fieldid;
}
}
$setting['svalue'][$key]['field'] = $temp;
}
C::t('common_setting')->update('profilegroup', $setting['svalue']);
}
}
$_G['setting'][$setting['skey']] = $data[$setting['skey']] = $setting['svalue'];
}
$usergroup = C::t('common_usergroup')->fetch_by_credits($data['initcredits'], '');
$data['newusergroupid'] = $usergroup['groupid'];
$data['buyusergroupexists'] = C::t('common_usergroup')->buyusergroup_exists();
if($data['srchhotkeywords']) {
$data['srchhotkeywords'] = explode("\n", $data['srchhotkeywords']);
}
if($data['search']) {
$searchstatus = 0;
foreach($data['search'] as $item) {
if($item['status']) {
$searchstatus = 1;
break;
}
}
if(!$searchstatus) {
$data['search'] = array();
}
//.........这里部分代码省略.........