本文整理汇总了PHP中S::inArray方法的典型用法代码示例。如果您正苦于以下问题:PHP S::inArray方法的具体用法?PHP S::inArray怎么用?PHP S::inArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::inArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRegisterScripts
function getRegisterScripts($complement = 1)
{
$registerFields = $this->customerField->getFieldsByComplement($complement);
if (!S::isArray($registerFields)) {
return false;
}
$scripts = '';
$keep = 20;
foreach ($registerFields as $v) {
$required = $v['required'] == 1 ? '1' : '0';
$tips = '本选项填写有误';
if (S::inArray($v['type'], array($this->customerField->typeMap['input'], $this->customerField->typeMap['textarea']))) {
!$v['maxlen'] && ($v['maxlen'] = 255);
$tips = "最大长度为{$v['maxlen']}字节";
}
$scripts .= <<<EOT
\t\t\tregInfo[{$keep}] \t= new Array(
\t\t\t\t\t\t" ",
\t\t\t\t\t\t"本选项填写有误",
\t\t\t\t\t\t"格式不正确",
\t\t\t\t\t\t"{$tips}",
\t\t\t\t\t\t"{$v['descrip']}"
\t\t\t\t\t);
\t\t\t
EOT;
if ($v['type'] == $this->customerField->typeMap['area']) {
//$scripts .= "var $v[fieldname] = new Element('area_$v[fieldname]',regInfo[$keep],'$v[fieldname]'+'_info',null,$required);";
$scripts .= "extracheck.push(getObj('area_{$v['fieldname']}'));";
$scripts .= "var area_{$v['fieldname']} = new Element('area_{$v['fieldname']}',regInfo[{$keep}],'area_{$v['fieldname']}'+'_info',null,{$required});";
} else {
switch ($v['fieldname']) {
case 'education':
$scripts .= <<<EOT
\t\t\t\t\t\tif(typeof(schoolids) != 'undefined') {
\t\t\t\t\t\t\tfor(i=0; i<schoolids.length;i++){
\t\t\t\t\t\t\t\twindow['schoolname_'+schoolids[i]] = new Element("schoolname_"+schoolids[i],regInfo[{$keep}],"schoolname_"+schoolids[i]+'_info',null,{$required});
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
EOT;
break;
case 'career':
$scripts .= <<<EOT
\t\t\t\t\t\tif(typeof(companyids) != 'undefined') {
\t\t\t\t\t\t\tfor(i=0; i<companyids.length;i++){
\t\t\t\t\t\t\t\twindow['companyname_'+companyids[i]] = new Element("companyname_"+companyids[i],regInfo[{$keep}],"companyname_"+companyids[i]+'_info',null,{$required});
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
EOT;
break;
default:
$scripts .= "var {$v['fieldname']} = new Element('{$v['fieldname']}',regInfo[{$keep}],'{$v['fieldname']}'+'_info',null,{$required});";
$v['type'] == $this->customerField->typeMap['checkbox'] && ($scripts .= "checkboxArray.push('{$v['fieldname']}');");
$v['type'] == $this->customerField->typeMap['radio'] && ($scripts .= "radioArray.push('{$v['fieldname']}');");
}
$keep++;
}
}
return $scripts;
}
示例2: setAudioFormat
/**
* 设置音频格式
* @param $audioFormat 音频格式
* @return bool true-成功, false-失败
*/
function setAudioFormat($audioFormat)
{
if (!S::inArray($audioFormat, array('wav', 'mp3'))) {
return false;
}
$this->_audioFormat = $audioFormat;
return true;
}
示例3: getFieldsByComplement
/**
*
* 根据资料首次填写区域获取字段列表
* @param int $complement
* @return array
*/
function getFieldsByComplement($complement)
{
$complement = (int) $complement;
if (!S::inArray($complement, array(0, 1, 2))) {
return array();
}
$query = $this->_db->query('SELECT * FROM ' . $this->_tableName . ' WHERE complement = ' . S::sqlEscape($complement) . ' AND state = 1 ORDER BY vieworder ASC');
return $this->_getAllResultFromQuery($query, $this->_primaryKey);
}
示例4: checkFields
function checkFields($fieldsData)
{
if (!S::isArray($fieldsData)) {
return array();
}
$fielsdMap = $this->fieldsMap();
$data = array();
foreach ($fieldsData as $k => $v) {
if (!S::inArray($k, $fielsdMap)) {
continue;
}
$data[$k] = $v;
}
return $data;
}
示例5: getReadRight
function getReadRight($user)
{
global $isGM, $isBM, $admincheck, $pwPostHide, $pwSellHide, $pwEncodeHide, $manager, $groupid, $windid;
$pwSystem = array();
if ($user->groupid != 'guest') {
$isGM = S::inArray($windid, $manager);
if (!$isGM) {
$pwSystem = pwRights();
$pwPostHide = $pwSystem['posthide'];
$pwSellHide = $pwSystem['sellhide'];
$pwEncodeHide = $pwSystem['encodehide'];
} else {
$pwPostHide = $pwSellHide = $pwEncodeHide = 1;
}
}
}
示例6: forumcheck
function forumcheck($user, $groupid)
{
if ($this->foruminfo['f_type'] == 'former' && $groupid == 'guest' && $_COOKIE) {
Showmsg('forum_former');
}
$pwdcheck = GetCookie('pwdcheck');
if ($this->foruminfo['password'] != '' && ($groupid == 'guest' || $pwdcheck[$this->fid] != $this->foruminfo['password'] && !S::inArray($user['username'], $GLOBALS['manager']))) {
require_once R_P . 'require/forumpassword.php';
}
if (!$this->allowvisit($user, $groupid)) {
Showmsg('forum_jiami');
}
if (!$this->foruminfo['cms'] && $this->foruminfo['f_type'] == 'hidden' && !$this->foruminfo['allowvisit']) {
Showmsg('forum_hidden');
}
}
示例7: check
function check()
{
global $db_allowupload, $winddb, $groupid, $_G, $windid, $winduid, $manager;
if (empty($this->attach)) {
return 'job_attach_error';
}
if (!$db_allowupload) {
return 'upload_close';
} elseif (!$this->forum->allowupload($winddb, $groupid)) {
return 'upload_forum_right';
} elseif (!$this->forum->foruminfo['allowupload'] && $_G['allowupload'] == 0) {
return 'upload_group_right';
}
if (!($winduid == $this->attach['uid'] || S::inArray($windid, $manager) || pwRights($this->forum->isBM($windid), 'deltpcs', $this->forum->fid))) {
return 'modify_noper';
}
return true;
}
示例8: PwPost
function PwPost(&$forum)
{
global $db, $winddb, $groupid, $_time, $_G, $manager, $windid, $winduid;
$this->db =& $db;
$this->user =& $winddb;
$this->groupid =& $groupid;
$this->hours =& $_time['hours'];
$this->forum =& $forum;
$this->uid =& $winduid;
$this->username =& $windid;
$this->_G =& $_G;
$this->isGM = S::inArray($this->username, $manager);
$this->isBM = $this->forum->isBM($this->username);
$this->admincheck = $this->isGM || $this->isBM;
$this->allowhide = $this->forum->foruminfo['allowhide'] && $this->_G['allowhidden'];
$this->allowsell = $this->forum->foruminfo['allowsell'] && $this->_G['allowsell'];
$this->allowencode = $this->forum->forumset['allowencode'] && $this->_G['allowencode'];
}
示例9: wind_forumcheck
function wind_forumcheck($forum)
{
global $windid, $groupid, $tid, $fid, $skin, $winddb, $manager;
if ($forum['f_type'] == 'former' && $groupid == 'guest' && $_COOKIE) {
Showmsg('forum_former');
}
if (!empty($forum['style']) && file_exists(D_P . "data/style/{$forum['style']}.php")) {
$skin = $forum['style'];
}
$pwdcheck = GetCookie('pwdcheck');
if ($forum['password'] != '' && ($groupid == 'guest' || $pwdcheck[$fid] != $forum['password'] && !S::inArray($windid, $manager))) {
require_once R_P . 'require/forumpw.php';
}
if ($forum['allowvisit'] && !allowcheck($forum['allowvisit'], $groupid, $winddb['groups'], $fid, $winddb['visit'])) {
Showmsg('forum_jiami');
}
if (!$forum['cms'] && $forum['f_type'] == 'hidden' && !$forum['allowvisit']) {
Showmsg('forum_hidden');
}
}
示例10: checkEditPurview
/**
* 检查用户是否有管理文章权限
* @param unknown_type $name
* @param unknown_type $cid
* @return string|string|string|boolean
*/
function checkEditPurview($name, $cid = '')
{
if (isGM($name)) {
return true;
}
if (!$name) {
return false;
}
$cms_editadmin = L::config('cms_editadmin', 'cms_config');
if (!S::isArray($cms_editadmin)) {
return false;
}
if (empty($cid)) {
$_keys = array_keys($cms_editadmin);
foreach ($_keys as $key) {
if (S::inArray($name, $cms_editadmin[$key])) {
return true;
}
}
return false;
}
return S::inArray($name, $cms_editadmin[$cid]);
}
示例11: getAllForum
function getAllForum()
{
$user = $this->getCurrentUser(array('visit', 'post'));
$user->initRight();
$query = $GLOBALS['db']->query("SELECT f.fid,f.name,f.fup,f.type,f.ifsub,f.childid,f.allowvisit,fdata.tpost FROM pw_forums f LEFT JOIN pw_forumdata fdata ON f.fid = fdata.fid WHERE f.ifcms!=2 AND f.cms!='1' ORDER BY f.vieworder,f.fid");
$cates = $forums = $subForums = $secondSubForums = $filerFids = array();
$count = 0;
while ($rt = $GLOBALS['db']->fetch_array($query)) {
$rt['name'] = strip_tags($rt['name']);
if ($rt['type'] == 'category') {
$cates[$rt['fid']] = array('fid' => $rt['fid'], 'forumname' => strip_tags($rt['name']), 'childid' => $rt['childid'], 'type' => $rt['type'], 'todaypost' => '');
} elseif ($rt['type'] == 'forum') {
if (!$user->allowcheck($rt['allowvisit'], $rt['fid'], 'visit')) {
$filerFids[] = $rt['fid'];
continue;
}
$forums[$rt['fup']][$rt['fid']] = array('fid' => $rt['fid'], 'forumname' => strip_tags($rt['name']), 'childid' => $rt['childid'], 'type' => $rt['type'], 'todaypost' => $rt['tpost']);
} elseif ($rt['type'] == 'sub') {
if (S::inArray($rt['fup'], $filerFids)) {
continue;
}
$subForums[$rt['fup']][$rt['fid']] = array('fid' => $rt['fid'], 'forumname' => strip_tags($rt['name']), 'childid' => $rt['childid'], 'type' => $rt['type'], 'todaypost' => '');
} elseif ($rt['type'] == 'sub2') {
if (S::inArray($rt['fup'], $filerFids)) {
continue;
}
$secondSubForums[$rt['fup']][$rt['fid']] = array('fid' => $rt['fid'], 'forumname' => strip_tags($rt['name']), 'childid' => $rt['childid'], 'type' => $rt['type'], 'todaypost' => '');
}
$count++;
}
$result = array();
foreach ($cates as $cateId => $cateInfo) {
$cateInfo['child'] = isset($forums[$cateId]) && $forums[$cateId] ? $this->organizeForums($forums[$cateId], $subForums, $secondSubForums) : array();
$result[] = $cateInfo;
}
return $this->buildResponse(0, array('count' => $count, 'forums' => $result));
}
示例12: foreach
}
foreach ($fidcommend as $key => $value) {
//用于add|update
$vieworder = (int) $order[$key];
if (!S::inArray($key, $fids)) {
$addSQL[$key]['fid'] = $key;
$addSQL[$key]['vieworder'] = $vieworder;
} else {
if ($vieworder !== $forumDB[$key]['vieworder']) {
$updateArr[$key]['vieworder'] = $vieworder;
}
}
}
foreach ($order as $key => $value) {
//用于delect
if (S::inArray($key, $fids)) {
!$fidcommend[$key] && ($delSQL[$key] = $key);
}
}
$addSQL && $db->update("REPLACE INTO pw_searchforum (fid,vieworder) VALUES " . pwSqlMulti($addSQL));
if ($updateArr) {
foreach ($updateArr as $key => $value) {
$value && $db->update("UPDATE pw_searchforum SET " . pwSqlSingle($value) . " WHERE fid=" . pwEscape($key, false));
}
}
$delSQL && $db->update("DELETE FROM pw_searchforum WHERE fid IN(" . pwImplode($delSQL) . ")");
//if ($addSQL || $updateArr || $delSQL) {
updatecache_search();
//}
adminmsg('operate_success', "{$basename}&action=forum");
} elseif ($action == 'statistic') {
示例13: checkEducation
function checkEducation($subject)
{
global $timestamp;
if (!S::isArray($subject)) {
return false;
}
if ($subject['educationlevel'] < 1 || $subject['educationlevel'] > 8) {
return false;
}
$year = get_date($timestamp, 'year');
if ($subject['educationyear'] < $year - 100 || $subject['educationyear'] > $year) {
return false;
}
$schoolService = L::loadClass('SchoolService', 'user');
$schoolInfo = $schoolService->getBySchoolId($subject['schoolid']);
if (!S::isArray($schoolInfo)) {
return false;
}
switch ($schoolInfo['type']) {
case 1:
if ($subject['educationlevel'] > 1) {
return false;
}
break;
case 2:
if (!S::inArray($subject['educationlevel'], array(2, 3))) {
return false;
}
break;
case 3:
if (!S::inArray($subject['educationlevel'], array(4, 5, 6, 7, 8))) {
return false;
}
break;
}
return true;
}
示例14: exit
<?php
!defined('P_W') && exit('Forbidden');
S::gp(array('tid'));
$robbuildService = L::loadClass('RobBuild', 'forum');
$robbuild = $robbuildService->getByTid($tid);
(!S::inArray($windid, $manager) && $robbuild['authorid'] != $winduid || $robbuild['status']) && Showmsg('undefined_action');
$robbuildService->update(array('status' => 2), $tid);
refreshto("read.php?tid={$tid}", 'operate_success');
示例15: Cookie
$onlineService = L::loadClass('OnlineService', 'user');
$userinbbs = $onlineService->countOnlineUser();
$guestinbbs = $onlineService->countOnlineGuest();
Cookie('online_info', $timestamp . "\t" . $userinbbs . "\t" . $guestinbbs);
}
}
if ($last_statistictime == 0 || get_date($timestamp, 'G') - get_date($last_statistictime, 'G') > 1 || $timestamp - $last_statistictime > 3600) {
$stasticsService = L::loadClass('Statistics', 'datanalyse');
$stasticsService->updateOnlineInfo();
}
$usertotal = $guestinbbs + $userinbbs;
if ($db_indexonline) {
S::gp(array('online'));
empty($online) && ($online = GetCookie('online'));
if ($online == 'yes') {
if ($usertotal > 2000 && !S::inArray($windid, $manager)) {
//$online = 'no';
Cookie('online', 'no');
} else {
$index_whosonline = '';
$db_online = intval($db_online);
Cookie('online', $online);
include_once S::escapePath(R_P . "require/online_{$db_online}.php");
}
}
if ($online == 'no') {
Cookie('online', 'no');
}
}
$showgroup = $db_showgroup ? explode(',', $db_showgroup) : array();
// Share union