本文整理汇总了PHP中S类的典型用法代码示例。如果您正苦于以下问题:PHP S类的具体用法?PHP S怎么用?PHP S使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了S类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
global $platal, $globals;
$nom = S::v('prenom') . ' ' . S::v('nom');
$mail = $this->user->bestEmail();
$sig = $nom . ' (' . S::v('promo') . ')';
Banana::$msgedit_headers['X-Org-Mail'] = $this->user->forlifeEmail();
// Tree color
$req = XDB::query('SELECT tree_unread, tree_read
FROM forum_profiles
WHERE uid= {?}', $this->user->id());
if (!(list($unread, $read) = $req->fetchOneRow())) {
$unread = 'o';
$read = 'dg';
}
Banana::$tree_unread = $unread;
Banana::$tree_read = $read;
// Build user profile
Banana::$profile['headers']['From'] = "{$nom} <{$mail}>";
Banana::$profile['headers']['Organization'] = make_Organization();
Banana::$profile['signature'] = $sig;
// Page design
Banana::$page->killPage('forums');
Banana::$page->killPage('subscribe');
// Run Banana
return parent::run();
}
示例2: getCardData
/**
* 组装小名片数据
*
* @param int $uid 用户ID
* @param int $winduid 当前用户id
* @param bool $username 用户名
* @return array
*/
function getCardData($uid, $winduid, $username)
{
extract(pwCache::getData(R_P . "data/bbscache/level.php", false));
if ($uid < 1 && !trim($username) || $username == '游客' || $username == '匿名') {
return array('username' => '游客', 'memtitle' => $ltitle[2]);
}
$userService = L::loadClass('UserService', 'user');
if ($uid) {
$userInfo = $userService->get($uid, true, true);
} elseif ($username) {
$userInfo = $userService->getByUserName($username, true, true);
}
if (!S::isArray($userInfo)) {
return array();
}
require_once R_P . 'require/showimg.php';
list($faceimage) = showfacedesign($userInfo['icon'], 1, 's');
$userInfo['groupid'] == '-1' && ($userInfo['groupid'] = $userInfo['memberid']);
!array_key_exists($userInfo['groupid'], (array) $lpic) && ($userInfo['groupid'] = 8);
$online = checkOnline($userInfo['thisvisit']);
$onlineRead = $online ? getOnlineViewing($userInfo['uid'], $userInfo['username']) : array();
$user = array('mine' => $userInfo['uid'] == $winduid || !$winduid ? 0 : 1, 'uid' => $userInfo['uid'], 'username' => $userInfo['username'], 'icon' => $faceimage, 'memtitle' => $ltitle[$userInfo['groupid']], 'genderClass' => $userInfo['gender'], 'viewTid' => isset($onlineRead['tid']) && $onlineRead['tid'] ? $onlineRead['tid'] : '', 'viewFid' => isset($onlineRead['fid']) && $onlineRead['fid'] ? $onlineRead['fid'] : '', 'online' => $online ? 1 : 0);
$user['medals'] = getMedalsByUid($userInfo['uid']);
// 勋章
$memberTagsService = L::loadClass('memberTagsService', 'user');
$user['memberTags'] = $memberTagsService->makeClassTags($memberTagsService->getMemberTagsByUid($userInfo['uid']));
//标签
$attentionSerivce = L::loadClass('Attention', 'friend');
/* @var $attentionSerivce PW_Attention */
$user['attention'] = $attentionSerivce->isFollow($winduid, $userInfo['uid']) ? 1 : 0;
//关注
return $user;
}
示例3: _getSearchSQL
function _getSearchSQL($array)
{
if ($array['username']) {
return ' AND username=' . S::sqlEscape($array['username']);
}
return ' ';
}
示例4: 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();
}
示例5: initCurrUpload
function initCurrUpload($key, $value)
{
list($t, $i) = explode('_', $key);
$arr = array('id' => intval($i), 'attname' => $t, 'name' => S::escapeChar($value['name']), 'size' => intval($value['size']), 'type' => 'zip', 'ifthumb' => 0, 'fileuploadurl' => '');
$arr['ext'] = strtolower(substr(strrchr($arr['name'], '.'), 1));
return $arr;
}
示例6: getNewData
/**
* 获得最新公告
* @param int $num
*/
function getNewData($num)
{
global $timestamp;
$num = (int) $num;
$query = $this->_db->query("SELECT * FROM {$this->_tableName} WHERE ifopen = '1' AND \n\t\t\tstartdate <= " . S::sqlEscape($timestamp) . " AND enddate=0 OR enddate>" . S::sqlEscape($timestamp) . " ORDER BY aid DESC LIMIT 0,{$num}");
return $this->_getAllResultFromQuery($query);
}
示例7: _cookData
/**
*
* 数据处理
* @param int $fid
* @return
*/
function _cookData($data)
{
if (!S::isArray($data)) {
return array();
}
require_once R_P . 'require/showimg.php';
foreach ($data as $k => $v) {
$tem = array();
$tem['url'] = USER_URL . $v['uid'];
$tem['title'] = $v['username'];
$tem['value'] = $v['uid'];
if (array_key_exists('icon', $v)) {
$pic = showfacedesign($v['icon'], true, 's');
if (is_array($pic)) {
$tem['image'] = $pic[0];
} else {
$tem['image'] = '';
}
} else {
$tem['image'] = '';
}
$tem['addition'] = $v;
$userInfo[] = $tem;
}
return $userInfo;
}
示例8: vote
function vote($readvote)
{
global $db, $votetype, $ifview, $votedb, $votesum, $action, $viewvoter, $tid, $admincheck, $vote_close;
$votearray = unserialize($readvote['voteopts']);
$votetype = $readvote['mostvotes'] > 1 ? 'checkbox' : 'radio';
$votesum = 0;
$votedb = $voter = array();
$ifview = $viewvoter == 'yes' ? 'no' : 'yes';
foreach ($votearray as $option) {
$votesum += $option[1];
}
if ($viewvoter == 'yes') {
$query = $db->query("SELECT username,vote FROM pw_voter WHERE tid=" . S::sqlEscape($tid) . " LIMIT 500");
while ($rt = $db->fetch_array($query)) {
$voter[$rt['vote']][] = $rt[username];
}
}
foreach ($votearray as $key => $value) {
$vote = array();
$vote['percent'] = $votesum ? round(100 * $value[1] / $votesum, 2) : 0;
if ($readvote['previewable'] == 0 || $readvote['havevote'] || $vote_close) {
$vote['width'] = floor(500 * $value[1] / ($votesum + 1));
$vote['num'] = $value[1];
} else {
$vote['width'] = 0;
$vote['num'] = '*';
}
$vote['name'] = $value[0];
$vote['voter'] = $voter[$key];
$votedb[$key] = $vote;
}
}
示例9: IsCandidate
public static function IsCandidate(User $user, $candidate)
{
if (!$user->checkPerms(User::PERM_MAIL)) {
return false;
}
return S::v('no_redirect');
}
示例10: update
function update($uploaddb)
{
$fieldService = L::loadClass('ActivityField', 'activity');
if ($this->tid) {
$defaultAttach = $userAttach = array();
foreach ($uploaddb as $key => $value) {
if ($value['id']) {
$attach = array();
$attach = $fieldService->getField($value['id']);
$this->attachs[$attach['fieldname']] = $value['fileuploadurl'];
if ($attach['fieldname'] && $attach['ifdel'] == 1) {
$userAttach[$attach['fieldname']] = $value['fileuploadurl'];
} elseif ($attach['fieldname'] && !$attach['ifdel']) {
$defaultAttach[$attach['fieldname']] = $value['fileuploadurl'];
}
}
}
$defaultValueTableName = getActivityValueTableNameByActmid();
$userDefinedValueTableName = getActivityValueTableNameByActmid($this->actmid, 1, 1);
if ($defaultAttach) {
$this->db->update("UPDATE {$defaultValueTableName} SET " . S::sqlSingle($defaultAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
}
if ($userAttach) {
$this->db->update("UPDATE {$userDefinedValueTableName} SET " . S::sqlSingle($userAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
}
} else {
foreach ($uploaddb as $key => $value) {
$this->attachs['fileuploadurl'] = $value['fileuploadurl'];
}
}
return true;
}
示例11: smarty_function_grpvisibility
function smarty_function_grpvisibility($params, &$smarty)
{
$user = $params['user'];
$group = $params['group'];
$grpcoll = $user->groupVisibility($group);
$visigroup = $grpcoll->count() == 1 ? $grpcoll->first() : null;
// if $user is session user, see which visibility option is enabled
$flagselect = '';
if (S::user()->isMe($user)) {
$possib = $user->getAvailVisibilities($group);
$flagoptions = array();
foreach ($possib as $gid => $title) {
$flagoption = '<option value="' . $gid . '"';
if ($visigroup != null && $visigroup->id() == $gid) {
$flagoption .= ' selected';
}
$flagoption .= '>visible par ' . $title . '</option>';
$flagoptions[] = $flagoption;
}
$flagselect = '<select class="visiselect" name="visibility-' . $user->id() . '-' . $group->id() . '">' . implode($flagoptions) . '</select>';
}
// Get color & title
list($color, $title) = User::visibilitiesColInfo($grpcoll);
return '<form class="visicontainer" id="visiflag-' . $user->id() . '-' . $group->id() . '">' . '<div class="visiflag ' . $color . ' click" title="' . $title . '"></div>' . $flagselect . '</form>';
}
示例12: display
function display()
{
header("Content-Type: application/x-shockwave-flash");
$this->beginMovie();
$num = strlen($this->codes);
if ($num > 0) {
$this->imageWidth = floor($this->frameWidth / $num);
$this->imageHeight = $this->frameHeight;
$X1 = $Y1 = 0;
$X2 = $this->imageWidth * 20;
$Y2 = $this->imageHeight * 20;
$imgpath = $GLOBALS['imgdir'] . '/ck/flash/';
for ($i = 0; $i < strlen($this->codes); $i++) {
$file = $imgpath . strtolower($this->codes[$i]) . '.jpg';
$image = $this->defineBitmapJPEG($file);
$CharacterInfo = $this->defineRectangleBitmap($X1, $Y1, $X2, $Y2, $this->imageWidth, false, false, 0, 0, 0, 0, 'c', $image, true, null);
$characterdepth = $this->easyPlaceObject($CharacterInfo['charid']);
$X1 += $this->imageWidth * 20;
$X2 += $this->imageWidth * 20;
}
$this->endFrame();
S::filter();
}
$this->endMovie();
print $this->getMovie();
exit;
}
示例13: smarty_block_canEdit
function smarty_block_canEdit($params, $content, &$smarty, &$repeat)
{
$group = $params['target']->group();
if (S::user()->hasRights($group, Rights::admin()) || S::user()->isWeb()) {
return $content;
}
}
示例14: syncredit
function syncredit($arr)
{
if (is_array($arr)) {
foreach ($arr as $uid => $setv) {
$updateMemberData = array();
foreach ($setv as $cid => $value) {
if (is_numeric($cid)) {
$value = intval($value);
/**
$this->db->pw_update(
"SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
"UPDATE pw_membercredit SET value=" . S::sqlEscape($value) . ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
"INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value))
);
**/
$this->db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $cid), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $value)));
} elseif (in_array($cid, array('money', 'rvrc', 'credit', 'currency'))) {
$cid == 'rvrc' && ($value *= 10);
$updateMemberData[$cid] = intval($value);
}
}
if ($updateMemberData) {
$userService = L::loadClass('UserService', 'user');
/* @var $userService PW_UserService */
$userService->update($uid, array(), $updateMemberData);
}
}
}
return new ApiResponse(1);
}
示例15: getTucoolForums
/**
* »ñÈ¡¿ªÆôͼ¿áµÄ°æ¿é
* @return array
*/
function getTucoolForums()
{
$tucoolForums = array();
$fids = $this->getAllForumIds();
$forumsDao = $this->getForumsDao();
$forumSets = $forumsDao->getForumSetsByFids($fids);
if ($forumSets) {
foreach ($forumSets as $k => $v) {
$forumset = array();
$v = @unserialize($v['forumset']);
if (!$v['iftucool']) {
continue;
}
$forumset['tucoolpic'] = intval($v['tucoolpic']);
S::isArray($forumset) && ($tucoolForums[$k] = $forumset);
}
}
if ($tucoolForums) {
$forums = $forumsDao->getFormusByFids(array_keys($tucoolForums), 'fid,name');
foreach ($forums as $k => $v) {
$tucoolForums[$k] = array_merge($tucoolForums[$k], $v);
}
}
return $tucoolForums;
}