本文整理汇总了PHP中S::int方法的典型用法代码示例。如果您正苦于以下问题:PHP S::int方法的具体用法?PHP S::int怎么用?PHP S::int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::int方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveModesData
function saveModesData($uid, $data, $conf)
{
$array = array();
foreach ($data as $key => $value) {
$this->_cacheService->set($this->_getKeyForUserMode($uid, $key), array('num' => S::isArray($conf[$key]) ? S::int($conf[$key]['num']) : $conf[$key], 'value' => $value), S::isArray($conf[$key]) && isset($conf[$key]['expire']) ? S::int($conf[$key]['expire']) : 608400);
}
}
示例2: getThreadAndTmsgByThreadId
/**
* 获取帖子基本信息和详细信息
*
* @param int $threadId 帖子id
* @return array
*/
function getThreadAndTmsgByThreadId($threadId)
{
$threadId = S::int($threadId);
if ($threadId < 1) {
return false;
}
if (!$this->checkMemcache()) {
return $this->_getThreadAndTmsgByThreadIdNoCache($threadId);
}
$threadKey = $this->_getKeyForThread($threadId);
$tmsgKey = $this->_getKeyForTmsg($threadId);
//* $result = $this->_cacheService->get(array($threadKey, $tmsgKey));
//* $thread = isset($result[$threadKey]) ? $result[$threadKey] : false;
//* $tmsg = isset($result[$tmsgKey]) ? $result[$tmsgKey] : false;
$thread = $this->_cacheService->get($threadKey);
$tmsg = $this->_cacheService->get($tmsgKey);
if ($thread === false) {
$thread = $this->_getThreadNoCache($threadId);
$this->_cacheService->set($threadKey, $thread);
}
if ($tmsg === false) {
$tmsg = $this->_getTmsgNoCache($threadId);
$this->_cacheService->set($tmsgKey, $tmsg);
}
return $thread && $tmsg ? array_merge($thread, $tmsg) : array();
}
示例3: getBbsInfoById
/**
* 从缓存获取一条bbsinfo记录
*
* @param int $id
* @return array
*/
function getBbsInfoById($id)
{
$id = S::int($id);
if ($id < 1) {
return false;
}
$key = $this->_getBbsInfoKeyById($id);
if (!($bbsInfo = $this->_cacheService->get($key))) {
$bbsInfo = $this->_getBbsInfoByIdNoCache($id);
$bbsInfo && $this->_cacheService->set($key, $bbsInfo);
}
return $bbsInfo;
}
示例4: getBbsInfoById
function getBbsInfoById($id)
{
$id = S::int($id);
if ($id < 1) {
return false;
}
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_bbsinfo');
return $_cacheService->getBbsInfoById($id);
}
$bbsInfoDb = $this->_getBbsInfoDB();
return $bbsInfoDb->get($id);
}
示例5: getByModes
/**
* 获取用户模块缓存数据
* @param $uid int 用户id
* @param $modes array 获取模块数据及数量 array('article' => 1, 'write' => 2, ...)或数组 array('aritcle' => array('num'=>1,'expire'=>1234))
* return array
*/
function getByModes($uid, $modes)
{
$array = array();
$query = $this->_db->query("SELECT type,num,value FROM " . $this->_tableName . " WHERE uid=" . S::sqlEscape($uid) . ' AND type IN(' . S::sqlImplode(array_keys($modes)) . ') AND expire>' . S::sqlEscape($this->now, false));
while ($rt = $this->_db->fetch_array($query)) {
$num = S::isArray($modes[$rt['type']]) ? S::int($modes[$rt['type']]['num']) : $modes[$rt['type']];
if ($num < $rt['num']) {
$array[$rt['type']] = PwArraySlice($this->_unserialize($rt['value']), 0, $num, true);
} elseif ($num == $rt['num']) {
$array[$rt['type']] = $this->_unserialize($rt['value']);
}
}
return $array;
}
示例6: getPingsByThreadId
/**
* 获取评分基本信息
*
* @param int $threadId 帖子id
* @param array $ping_logs 积分日志数组
* @return array
*/
function getPingsByThreadId($threadId, $ping_logs, $pingpage = null)
{
$threadId = S::int($threadId);
if ($threadId < 1 || !$this->checkMemcache()) {
return false;
}
$pinglogKey = $this->_getPinglogKey($threadId);
$pinglogSourceKey = $this->_getPinglogSourceKey($threadId);
$result = $this->_cacheService->get($pinglogKey);
if ($result === false || $this->_cacheService->get($pinglogSourceKey) != $ping_logs) {
$pingService = L::loadClass("ping", 'forum');
$result = $pingService->getPingLogs($threadId, $ping_logs, $pingpage);
$this->_cacheService->set($pinglogSourceKey, $ping_logs);
$this->_cacheService->set($pinglogKey, $result);
}
return $result;
}
示例7: getFirstPostsByTid
function getFirstPostsByTid($postTable, $tid, $limit, $offset)
{
$tid = S::int($tid);
if ($tid < 1) {
return false;
}
if (!$this->checkMemcache()) {
return $this->_getFirstPostNoCache($postTable, $tid, $limit, $offset);
}
$key = $this->_getPostsKey($tid, $limit);
$result = $this->_cacheService->get($key);
if ($result === false) {
$result = $this->_getFirstPostNoCache($postTable, $tid, $limit, $offset);
$this->_cacheService->set($key, $result);
if (count($result) < $offset) {
$this->_cacheService->set($this->_getPostsLastKey($tid), $limit, false);
}
}
return $result;
}
示例8: getMemberTagsByUserid
/**
* 根据一个用户id获取用户标签
*
* @param int $uid 用户id
* @return array
*/
function getMemberTagsByUserid($userId)
{
$userId = S::int($userId);
if ($userId < 1) {
return false;
}
$key = $this->_getMemberTagsKey($userId);
$result = $this->_cacheService->get($key);
if ($result === false) {
$memberTagsService = L::loadClass('memberTagsService', 'user');
$result = $memberTagsService->getMemberTagsByUidFromDB($userId);
$result = $result ? $result : array();
$this->_cacheService->set($key, $result);
}
return $result;
}
示例9: gets
function gets($behavior, $num)
{
$query = $this->_db->query("SELECT * FROM " . $this->_tableName . " WHERE behavior =" . S::int($behavior) . $this->_Limit(0, $num));
return $this->_getAllResultFromQuery($query);
}
示例10: _parseLimit
/**
* 私有解析分页语句
* @param $offset
* @param $row_count
*/
function _parseLimit($limits)
{
$offset = S::int($limits[0]);
$row_count = S::int($limits[1]);
return $offset >= 0 && $row_count > 0 ? " LIMIT " . $offset . "," . $row_count : '';
}
示例11: todayFansUpdate
/**
* today fans order
*
* @param int $uid
* @return
*/
function todayFansUpdate($uid)
{
global $tdtime, $timestamp;
if (!$uid) {
return false;
}
$eid = $this->db->get_value("SELECT eid FROM pw_elements WHERE type='todayfans' AND id=" . S::int($uid));
if ($eid) {
$this->db->update("UPDATE pw_elements SET value=value+1 WHERE eid=" . S::int($eid));
} else {
$count = $this->db->get_value("SELECT COUNT(*) AS count FROM pw_attention WHERE friendid=" . S::int($uid) . " AND joindate>" . S::int($tdtime));
$this->updatelist[] = array('todayfans', 'fans', $uid, $count, $timestamp, '0');
$this->updatetype['todayfans'] = 1;
}
return true;
}
示例12: setTpcStatusByThreadIds
function setTpcStatusByThreadIds($tids, $mask)
{
$this->_db->update("UPDATE {$this->_tableName} SET tpcstatus=tpcstatus & " . S::int($mask) . " WHERE tid IN(" . S::sqlImplode($tids) . ")");
}
示例13: getUserByUid
/**
* 获取用户信息
*
* @global DB $db
* @param int $uid
* @return array
*/
function getUserByUid($uid)
{
$uid = S::int($uid);
if ($uid < 1) {
return false;
}
if (perf::checkMemcache()) {
$_cacheService = Perf::getCacheService();
$detail = $_cacheService->get('member_all_uid_' . $uid);
if ($detail && in_array(SCR, array('index', 'read', 'thread', 'post'))) {
$_singleRight = $_cacheService->get('member_singleright_uid_' . $uid);
$detail = $_singleRight === false ? false : (array) $detail + (array) $_singleRight;
}
if ($detail) {
return $detail && $detail['groupid'] != 0 && isset($detail['md.uid']) ? $detail : false;
}
$cache = perf::gatherCache('pw_members');
if (in_array(SCR, array('index', 'read', 'thread', 'post'))) {
$detail = $cache->getMembersAndMemberDataAndSingleRightByUserId($uid);
} else {
$detail = $cache->getAllByUserId($uid, true, true);
}
return $detail && $detail['groupid'] != 0 && isset($detail['md.uid']) ? $detail : false;
} else {
global $db;
$sqladd = $sqltab = '';
if (in_array(SCR, array('index', 'read', 'thread', 'post'))) {
$sqladd = SCR == 'post' ? ',md.postcheck,sr.visit,sr.post,sr.reply' : (SCR == 'read' ? ',sr.visit,sr.reply' : ',sr.visit');
$sqltab = "LEFT JOIN pw_singleright sr ON m.uid=sr.uid";
}
$detail = $db->get_one("SELECT m.uid,m.username,m.password,m.safecv,m.email,m.bday,m.oicq,m.groupid,m.memberid,m.groups,m.icon,m.regdate,m.honor,m.timedf,m.style,m.datefm,m.t_num,m.p_num,m.yz,m.newpm,m.userstatus,m.shortcut,m.medals,m.gender,md.lastmsg,md.postnum,md.rvrc,md.money,md.credit,md.currency,md.lastvisit,md.thisvisit,md.onlinetime,md.lastpost,md.todaypost,md.monthpost,md.onlineip,md.uploadtime,md.uploadnum,md.starttime,md.pwdctime,md.monoltime,md.digests,md.f_num,md.creditpop,md.jobnum,md.lastgrab,md.follows,md.fans,md.newfans,md.newreferto,md.newcomment,md.punch,md.bubble,md.newnotice,md.newrequest,md.shafa {$sqladd} FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid {$sqltab} WHERE m.uid=" . S::sqlEscape($uid) . " AND m.groupid<>'0' AND md.uid IS NOT NULL");
return $detail;
}
}
示例14: empty
if ($_POST['step'] == 2) {
S::gp(array('host', 'port', 'isopen', 'rank', 'group', 'tindex', 'tcindex', 'pindex', 'dindex', 'dcindex', 'cmsindex', 'weiboindex', 'wordsegment_mode', 'sync_data'));
empty($host) && adminmsg("抱歉,服务器主机不能为空");
empty($port) && adminmsg("抱歉,服务器端口不能为空");
$isopen = isset($isopen) ? $isopen : 0;
if ($isopen) {
$errormsg = testSockopen($host, $port);
if ($errormsg[0] != 1) {
adminmsg($errormsg[1]);
}
}
$sync_data = (array) $sync_data;
if ($sync_data && array_diff($sync_data, array('sync_threads', 'sync_posts', 'sync_diarys', 'sync_members'))) {
showMsg("抱歉,实时操作记录类型不存在");
}
$sphinxData = array('isopen' => $isopen, 'host' => $host, 'port' => $port, 'rank' => trim($rank), 'group' => trim($group), 'tindex' => trim($tindex), 'tcindex' => trim($tcindex), 'pindex' => trim($pindex), 'dindex' => trim($dindex), 'dcindex' => trim($dcindex), 'cmsindex' => trim($cmsindex), 'weiboindex' => trim($weiboindex), 'wordsegment_mode' => S::int($wordsegment_mode), 'sync' => $sync_data);
setConfig('db_sphinx', $sphinxData);
updatecache_c();
adminmsg("operate_success");
} else {
$ajax = S::getGP('ajax');
if ($ajax == 1 && strtolower($pwServer['REQUEST_METHOD']) == 'post') {
S::gp(array('host', 'port'));
$errormsg = testSockopen($host, $port);
showError($errormsg[1]);
}
$baseUrl = EncodeUrl($basename);
$default = $sphinxSearch->_getSphinxDefaults();
$configure = $db_sphinx ? $db_sphinx : $default;
/*兼容*/
foreach ($default as $k => $v) {
示例15: getUserNameByUserId
/**
* 根据用户id获取用户名
*
* @param int $userId 用户id
* @return string|null
*/
function getUserNameByUserId($userId)
{
$userId = S::int($userId);
if ($userId < 1) {
return false;
}
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_members');
return $_cacheService->getUserNameByUserId($userId);
}
if (!($data = $this->get($userId))) {
return null;
}
return $data['username'];
}