public function setConfig($type) { if ($type == 2) { $this->aOptions['step'] = array('1' => '隐蔽', '2' => '泥木', '3' => '油漆', '4' => '安装', '5' => '软装', '6' => '竣工'); $this->formConfig = insertArray($this->formConfig, 'fid', array('step' => array('选择阶段', 'select', array('all')))); //$this->listConfig = insertArray($this->listConfig, 'fid', array('step' => '阶段')); } if ($type == 3 || $type == 4) { return ture; //$this->aOptions['type'] = array('3' => '效果图','4'=>'平面图'); //$this->formConfig = insertArray($this->formConfig, 'fid', array('type' =>array('选择类型','select',array('all')))); } }
sendMail($row[0], $sub, $msg, $admin_email, $admin_email); } } while ($row = db_sendMails(1, $Tu, $Ts)); } } //Email admin if allowed if (isset($emailadmposts) and $emailadmposts == 1 and $user_id != 1) { sendMail($admin_email, $sub, $msg, $admin_email, $admin_email); } //Insert user into email notifies if allowed if (isset($_POST['CheckSendMail']) and emailCheckBox() != '' and substr(emailCheckBox(), 0, 8) != '<!--U-->') { $ae = db_simpleSelect(0, $Ts, 'count(*)', 'user_id', '=', $user_id, '', '', 'topic_id', '=', $topic); $ae = $ae[0]; if ($ae == 0) { $topic_id = $topic; insertArray(array('user_id', 'topic_id'), $Ts); } } } //inserted post successfully } else { $errorMSG = $l_antiSpam; $correctErr = $backErrorLink; $title .= $l_antiSpam; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } } else { $errorMSG = $l_forbidden; $correctErr = $backErrorLink;
function sort_scores($scores) { $sorted_scores = array(); $count = count($scores); if (!isset($scores)) { return $sorted_scores; } foreach ($scores as $score) { $inserted = false; for ($i = 0; $i < count($sorted_scores); $i++) { $sorted_score = $sorted_scores[$i]; $decimal_score = elgg_golfscore_get_decimal_score($score->esc_adjustment_total_score, $score->course_rating, $score->course_slope); $sorted_decimal_score = elgg_golfscore_get_decimal_score($sorted_score->esc_adjustment_total_score, $sorted_score->course_rating, $sorted_score->course_slope); if ($sorted_decimal_score > $decimal_score) { insertArray($sorted_scores, $score, $i); $inserted = true; break; } } if (!$inserted) { insertArray($sorted_scores, $score, count($sorted_scores)); } } return $sorted_scores; }
/** * 查询user列表 */ function sphinx_search2($cl, $index, $cond, $sort, $page, $pagesize, $code = 0, $offset) { global $memcached, $user_arr, $isdispmore, $isresult; $max_total = 600; $user = null; $total_found = 0; $pagenum = ceil($max_total / $pagesize); //分页数 $usersArr_unused = array(); $usersArr_used = array(); $user2 = array(); if ($page == $pagenum) { //如果是最后一页,显示指定的条数 $limit = $max_total % $pagesize; } else { //其他情况显示规定条数 $limit = $pagesize; } //$code != 0;降低查询条件 if ($code > 0) { //删除一个条件,如果属性条件都去掉则return false; $cond = DelAttr($cond, $index); //如果没有可删减的条件则返回false if (!is_array($cond) || empty($cond) || $cond == false) { return array(); } } //查询条件加缓存 $cond_str = md5(serialize($cond)); $cond_key = $user_arr['uid'] . '_' . $cond_str; $old_search = $memcached->get($cond_key); if (isset($old_search['total']) && $old_search['total'] < $offset) { if (!$old_search['total']) { $isresult = false; } $user = sphinx_search2($cl, $index, $cond, $sort, $page, $pagesize, $code + 1, $offset - $old_search['total']); } else { $rs = $cl->getResultOfReset($cond, array($offset, $pagesize), $sort); if (isset($rs['total_found']) && $rs['total_found']) { //有查询的结果 $total_found = $rs['total_found']; $rs_matches = $rs['matches']; $cond_arr = array('cond' => $cond, 'total' => $total_found); $memcached->set($cond_key, $cond_arr, false, 3600); if (!empty($rs_matches) && count($rs_matches) == 0) { //查询出0个 $user = sphinx_search2($cl, $index, $cond, $sort, $page, $pagesize, $code + 1, $offset); } elseif (!empty($rs_matches) && count($rs_matches) == $pagesize) { //查询的数目正好 //$user = $cl -> getIds(); //高级,钻石,城市之星靠前,普通和全权会员交叉显示,全权会员按照使用日期降序排序(1)*****begin****************** $cond2 = $cond; //最大600查询 if ($total_found > $max_total) { $total_found = $max_total; } //$rs=$cl -> getResultOfReset($cond2,array(0,$total_found),$sort); $users = $cl->getIdSidUType(); $user = $userGeneral = $userAdvance = array(); foreach ($users as $key => $val) { $user[] = $val['id']; //全部会员UID if ($val['s_cid'] < 40) { $userAdvance[] = $val['id']; //高级以上会员UID } else { if ($val['usertype'] != 3) { $userGeneral[] = $val['id']; } //普通会员UID } } //按照同样的数量搜索出全权会员 foreach ($cond2 as $k => $v) { if ('usertype' == $v[0]) { unset($cond2[$k]); break; } } // print_r($cond); $cond2[] = array('usertype', '3', false); //$rs2 = $cl -> getResultOfReset($cond2,array(0,$total_found),$sort); // $total_found2=$rs2['total_found']; $rs2 = $cl->getResultOfReset($cond2, array($offset, $pagesize), $sort); $total_found2 = $rs2['total_found']; $usersArr_collect = $cl->getIds(); // print_r($usersArr_collect); if (!empty($usersArr_collect) && count($usersArr_collect > 0)) { $userstr_collect = implode(',', $usersArr_collect); } else { $userstr_collect = 0; } //使用未过期的全权显示 $usetime = time() - 3888000; $sql = "select uid,action_time from web_full_log where uid in ({$userstr_collect}) order by action_time desc"; //全权会员首次使用时间降序排列 $result = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); // print_r($result); $usersArr_used = array(); if (!empty($result)) { foreach ($result as $val) { if (empty($val['action_time'])) { continue; } if ($val['action_time'] > $usetime) { $usersArr_used[] = $val['uid']; } else { $ka = array_search($val['uid'], $usersArr_collect); if ($ka) { unset($usersArr_collect[$ka]); } } } } $usersArr_unused = substractArr($usersArr_collect, $usersArr_used); $usersArr_collect2 = array_merge($usersArr_unused, $usersArr_used); $total_found2 = sizeof($usersArr_collect2); if ($total_found + $total_found2 > $max_total) { $total_found = $max_total; } else { $total_found = $total_found + $total_found2; } $userGeneral = insertArray($userGeneral, $usersArr_collect2); //普通会员中插入全权会员 $user2 = array_merge($userAdvance, $userGeneral); if (count($user2 > $max_total)) { //$user2=array_slice($user2,0,$max_total); $user2 = array_slice($user2, 0, $pagesize); } //$user2=array_slice($user2,$offset,$pagesize); $user = array_unique($user2); //高级,钻石,城市之星靠前,普通和全权会员交叉显示,全权会员按照使用日期降序排序(1)*****end****************** } else { //查询数据少了 $user = $cl->getIds(); if ($isdispmore) { $user_other = sphinx_search2($cl, $index, $cond, $sort, $page, $pagesize - count($user), $code + 1, 0); if (is_array($user_other) && !empty($user_other)) { $user = array_merge($user, $user_other); } } } } elseif (!$rs) { //无查询结果 if ($code == 0) { $isresult = false; } //无结果的话,需要缓存这次按照这个条件查询能查询出的总数 $old_search = $memcached->get($cond_key); if (isset($old_search['total']) && $old_search['total']) { $rs['total_found'] = $old_search['total']; } else { $rs = $cl->getResultOfReset($cond, null, $sort); if (!isset($rs['total_found']) || !$rs['total_found']) { $rs['total_found'] = 0; } $total_found = $rs['total_found']; if (isset($rs_matches)) { $rs_matches = $rs['matches']; } $cond_arr = array('cond' => $cond, 'total' => $total_found); $memcached->set($cond_key, $cond_arr, false, 3600); } if ($offset - $rs['total_found'] > 0) { $pro_offset = $offset - $rs['total_found']; } else { $pro_offset = 0; } $user = sphinx_search2($cl, $index, $cond, $sort, $page, $pagesize, $code + 1, $pro_offset); } } return $user; }
$case = 'lower'; } elseif ($DB == 'mssql') { $case = 'lcase'; } if (db_simpleSelect(0, $Tu, $dbUserId, $dbUserId, '=', 1) and !db_simpleSelect(0, $Tu, $dbUserId, $case . "({$dbUserSheme['username'][1]})", '=', strtolower(${$dbUserSheme['username'][1]})) and !db_simpleSelect(0, $Tu, $dbUserId, $dbUserSheme['user_email'][1], '=', ${$dbUserSheme['user_email'][1]}) and ${$dbUserSheme['username'][1]} != $admin_usr and ${$dbUserSheme['user_email'][1]} != $admin_email) { $act = 'reg'; require $pathToFiles . 'bb_func_checkusr.php'; if ($correct == 0) { ${$dbUserDate} = 'now()'; ${$dbUserSheme['user_password'][1]} = md5(${$dbUserSheme['user_password'][1]}); if (isset($registerInactiveUsers) and $registerInactiveUsers) { ${$dbUserAct} = 0; } else { ${$dbUserAct} = 1; } $ins = insertArray(array($dbUserSheme['username'][1], $dbUserDate, $dbUserSheme['user_password'][1], $dbUserSheme['user_email'][1], $dbUserSheme['user_icq'][1], $dbUserSheme['user_website'][1], $dbUserSheme['user_occ'][1], $dbUserSheme['user_from'][1], $dbUserSheme['user_interest'][1], $dbUserSheme['user_viewemail'][1], $dbUserSheme['user_sorttopics'][1], $dbUserSheme['language'][1], $dbUserAct, $dbUserSheme['user_custom1'][1], $dbUserSheme['user_custom2'][1], $dbUserSheme['user_custom3'][1]), $Tu); if ($ins == 0) { if (($emailusers == 1 or isset($closeRegister) and $closeRegister == 1) and $genEmailDisable != 1) { $emailMsg = ParseTpl(makeUp('email_user_register')); $sub = explode('SUBJECT>>', $emailMsg); $sub = explode('<<', $sub[1]); $emailMsg = trim($sub[1]); $sub = $sub[0]; sendMail(${$dbUserSheme['user_email'][2]}, $sub, $emailMsg, $admin_email, $admin_email); } if ($emailadmin == 1 and $genEmailDisable != 1) { $emailMsg = ParseTpl(makeUp('email_admin_userregister')); $sub = explode('SUBJECT>>', $emailMsg); $sub = explode('<<', $sub[1]); $emailMsg = trim($sub[1]); $sub = $sub[0];
if ($antiSpam = db_simpleSelect(0, $Tp, 'count(*)', $fields[0], '=', $fields[1], '', '', 'now()-post_time', '<', $postRange)) { $antiSpam = $antiSpam[0]; } else { $antiSpam = 1; } } if ($user_id == 1 or $antiSpam == 0) { $topic_title = $topicTitle; $topic_poster = $user_id; $topic_poster_name = $user_usr; $topic_time = 'now()'; $forum_id = $forum; $topic_status = 0; $topic_last_post_id = 0; $posts_count = 0; $dll = insertArray(array('topic_title', 'topic_poster', 'topic_poster_name', 'topic_time', 'forum_id', 'topic_status', 'topic_last_post_id', 'posts_count'), $Tt); if ($dll == 0) { //fire an event require_once 'geograph/event.class.php'; new Event(EVENT_NEWTOPIC, $insres); $topic = $insres; db_forumTopics($forum, $Tt, $Tf); require $pathToFiles . 'bb_func_pthread.php'; } else { $errorMSG = $l_mysql_error; $correctErr = $backErrorLink; $title .= $l_mysql_error; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; }
$warning = ''; $banip = isset($_GET['banip']) ? $_GET['banip'] : ''; $text2 = ParseTpl(makeUp('admin_banusr1')); break; case 'banUsr2': $warning = ''; foreach ($_POST as $key => $val) { ${$key} = htmlspecialchars(trim($val), ENT_QUOTES); } if (preg_match("/^[0-9.+]+\$/", $banip) and trim($banip) != '0') { $thisIp = $banip; $thisIpMask = array($banip, $banip); if (db_ipCheck($thisIp, $thisIpMask, $user_id)) { $warning = $l_IpExists; } else { $fs = insertArray(array('banip', 'banreason'), $Tb); $warning = $fs == 0 ? $l_IpBanned : $l_mysql_error; } $text2 = makeUp('admin_panel'); } else { $warning = $l_incorrectIp; $text2 = makeUp('admin_banusr1'); } $text2 = ParseTpl($text2); break; case 'deleteban1': $warning = ''; $banipID = ''; $bannedIPs = ''; if ($banned = db_simpleSelect(0, $Tb, 'id,banip,banreason', '', '', '', 'banip')) { do {
break; case 'banUsr1': $warning = ''; $banip = isset($_GET['banip']) ? $_GET['banip'] : ''; $text2 = ParseTpl(makeUp('admin_banusr1')); break; case 'banUsr2': $warning = ''; $banip = isset($_POST['banip']) ? $_POST['banip'] : ''; if (preg_match("/^[0-9.+]+\$/", $banip) and trim($banip) != 0) { $thisIp = $banip; $thisIpMask = array($banip, $banip); if (db_ipCheck($thisIp, $thisIpMask, $user_id)) { $warning = $l_IpExists; } else { $fs = insertArray(array('banip'), $Tb); $warning = $fs == 0 ? $l_IpBanned : $l_mysql_error; } $text2 = makeUp('admin_panel'); } else { $warning = $l_incorrectIp; $text2 = makeUp('admin_banusr1'); } $text2 = ParseTpl($text2); break; case 'deleteban1': $warning = ''; $banipID = ''; $bannedIPs = ''; if ($banned = db_simpleSelect(0, $Tb, 'id,banip', '', '', '', 'banip')) { do {
if (isset($dbUserSheme[$k])) { $insa[] = $dbUserSheme[$k][1]; } } foreach ($dbUserSheme as $k => $v) { if (strstr($k, 'user_custom') and isset($_POST[$v[2]]) and $_POST[$v[2]] != '') { $insa[] = $v[1]; } } //plugins... foreach ($moDBValue as $mk => $mv) { if (in_array($mk, $insa) and isset(${$mk})) { ${$mk} = $mv; } } $inss = insertArray($insa, $Tu); if ($inss == 0) { if (($emailusers > 0 or isset($closeRegister) and $closeRegister == 1) and $genEmailDisable != 1) { if (!isset($reply_to_email)) { $reply_to_email = $admin_email; } if ($emailusers == 2 and $lng = ${$dbUserSheme['language'][2]} and file_exists($pathToFiles . 'templates/email_user_register_' . $lng . '.txt')) { } else { $lng = $langOrig; } $emailMsg = ParseTpl(makeUp('email_user_register_' . $lng)); $sub = explode('SUBJECT>>', $emailMsg); $sub = explode('<<', $sub[1]); $emailMsg = trim($sub[1]); $sub = $sub[0]; sendMail(${$dbUserSheme['user_email'][2]}, $sub, $emailMsg, $reply_to_email, $reply_to_email);