本文整理汇总了PHP中session::item方法的典型用法代码示例。如果您正苦于以下问题:PHP session::item方法的具体用法?PHP session::item怎么用?PHP session::item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session
的用法示例。
在下文中一共展示了session::item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatDate
public static function formatDate($time = '', $format = 'stamp', $usa = true, $offset = 0, $dst = null)
{
$usa = config::item('time_euro', 'system') ? false : true;
$offset = session::item('time_zone') * 60 * 60;
$dst = date('i') ? 3600 : 0;
return parent::formatDate($time, $format, $usa, $offset, $dst);
}
示例2: confirm
public function confirm($action = '')
{
// Do we have necessary data?
if (input::get('oauth_token') && input::get('oauth_verifier')) {
// Get temporary access token
$this->initialize(session::item('twitter', 'remote_connect', 'token'), session::item('twitter', 'remote_connect', 'secret'));
$access = $this->twitter->getAccessToken(input::get('oauth_verifier'));
// Do we have temporary token?
if ($access) {
// Get saved token
$token = $this->getToken(0, $access['user_id']);
// Do we have saved token or are we logging in?
if ($token || $action == 'login' && $token) {
$this->users_model->login($token['user_id']);
router::redirect(session::item('slug') . '#home');
} elseif (!$token || $action == 'signup') {
// Get user data
$this->initialize($access['oauth_token'], $access['oauth_token_secret']);
$user = $this->getUser($access['user_id']);
// Do we have user data?
if ($user && isset($user->id)) {
$connection = array('name' => 'twitter', 'twitter_id' => $user->id, 'token' => $access['oauth_token'], 'secret' => $access['oauth_token_secret']);
session::set(array('connection' => $connection), '', 'remote_connect');
$account = array('username' => isset($user->name) ? $user->name : '');
session::set(array('account' => $account), '', 'signup');
router::redirect('users/signup#account');
}
}
}
}
router::redirect('users/login');
}
示例3: getPictures
public static function getPictures($params = array())
{
if (!session::permission('users_groups_browse', 'users') && !session::permission('users_types_browse', 'users')) {
return '';
}
loader::model('pictures/pictures');
$template = isset($params['template']) ? $params['template'] : 'pictures/helpers/pictures';
$user = isset($params['user']) && $params['user'] ? $params['user'] : array();
$userID = $user ? $user['user_id'] : (isset($params['user_id']) ? $params['user_id'] : 0);
$params['albums'] = true;
if ($userID) {
$params['join_columns'][] = '`p`.`user_id`=' . $userID;
}
if (!$userID || $userID != session::item('user_id')) {
if ($userID) {
$params['privacy'] = $userID;
} else {
$params['join_columns'][] = '`a`.`public`=1';
$params['join_columns'][] = '`u`.`verified`=1';
$params['join_columns'][] = '`u`.`active`=1';
$params['join_columns'][] = '`u`.`group_id` IN (' . implode(',', session::permission('users_groups_browse', 'users')) . ')';
$params['join_columns'][] = '`u`.`type_id` IN (' . implode(',', session::permission('users_types_browse', 'users')) . ')';
}
}
$params['limit'] = isset($params['limit']) ? $params['limit'] : 10;
$params['order'] = isset($params['order']) ? $params['order'] : '';
$pictures = codebreeder::instance()->pictures_model->getPictures('in_list', $params['join_columns'], array(), $params['order'], $params['limit'], $params);
view::assign(array('pictures' => $pictures, 'user' => $user, 'params' => $params), '', $template);
return view::load($template, array(), 1);
}
示例4: set
public function set($plugin, $keyword, $replace = array(), $pageTitle = true)
{
if (!($data = $this->cache->item('core_meta_tags_' . $plugin . '_' . session::item('language')))) {
$data = array();
$result = $this->db->query("SELECT * FROM `:prefix:core_meta_tags` WHERE `plugin`=?", array($plugin))->result();
foreach ($result as $tags) {
$data[$tags['keyword']]['title'] = $tags['meta_title_' . session::item('language')];
$data[$tags['keyword']]['description'] = $tags['meta_description_' . session::item('language')];
$data[$tags['keyword']]['keywords'] = $tags['meta_keywords_' . session::item('language')];
}
$this->cache->set('core_meta_tags_' . $plugin . '_' . session::item('language'), $data, 60 * 60 * 24 * 30);
}
foreach ($replace as $section => $array) {
foreach ($array as $k => $v) {
$k = '[' . $section . '.' . $k . ']';
if (is_array($v)) {
$v = count($v) == 1 ? current($v) : implode(',', $v);
}
$data[$keyword]['title'] = utf8::str_replace($k, $v, $data[$keyword]['title']);
$data[$keyword]['description'] = utf8::str_replace($k, $v, $data[$keyword]['description']);
$data[$keyword]['keywords'] = utf8::str_replace($k, $v, $data[$keyword]['keywords']);
}
}
if (isset($data[$keyword])) {
if ($pageTitle) {
view::setTitle($data[$keyword]['title']);
} else {
view::setMetaTitle($data[$keyword]['title']);
}
view::setMetaDescription($data[$keyword]['description']);
view::setMetaKeywords($data[$keyword]['keywords']);
}
}
示例5: invoices
public function invoices()
{
// Get page
$page = is_numeric(input::get('page')) && input::get('page') > 0 ? input::get('page') : 1;
// Parameters
$params = array('join_columns' => array('`t`.`user_id`=' . session::item('user_id')));
// Process query string
$qstring = $this->parseQuerystring(config::item('invoices_per_page', 'billing'), session::item('total_transactions'));
// Get invoices
$invoices = array();
if (session::item('total_transactions')) {
$invoices = $this->transactions_model->getTransactions($params['join_columns'], '', $qstring['limit']);
} else {
view::setInfo(__('no_invoices_user', 'billing_transactions'));
}
// Set pagination
$config = array('base_url' => config::siteURL('billing/invoices?'), 'total_items' => session::item('total_transactions'), 'items_per_page' => config::item('invoices_per_page', 'billing'), 'current_page' => $page, 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('invoices' => $invoices, 'pagination' => $pagination));
// Set title
view::setTitle(__('invoices', 'billing_transactions'));
// Load view
view::load('billing/invoices');
}
示例6: _authUser
protected function _authUser()
{
// Create rules
$rules = array('email' => array('label' => __('email', 'users'), 'rules' => array('trim', 'required', 'max_length' => 255, 'callback__is_valid_login')), 'password' => array('label' => __('password', 'users'), 'rules' => array('trim', 'required', 'min_length' => 4, 'max_length' => 128)), 'remember' => array('label' => __('remember_me', 'users'), 'rules' => 'intval'));
// Assign rules
validate::setRules($rules);
// Validate fields
if (!validate::run()) {
return false;
}
// Get user
if (!($user = $this->users_model->getUser(input::post('email'), false, false))) {
validate::setFieldError('email', __((strpos(input::post('email'), '@') === false ? 'username' : 'email') . '_invalid', 'users_signup'));
return false;
}
// Verify password
if (!$this->users_model->verifyPassword(input::post('password'), $user['password'], $user['user_id'])) {
validate::setFieldError('password', __('password_invalid', 'users_signup'));
return false;
}
// Is email verified?
if (!$user['verified']) {
view::setError(__('user_not_verified', 'users_signup'));
return false;
}
// Is account active?
if (!$user['active'] || $user['group_id'] == config::item('group_cancelled_id', 'users')) {
view::setError(__('user_not_active', 'users_signup'));
return false;
}
// Log the user in
$this->users_model->login($user['user_id'], input::post('remember'), $user);
router::redirect(config::item('login_redirect', 'users') == 'profile' ? session::item('slug') : config::item('login_redirect', 'users'));
}
示例7: getBlockedUser
public static function getBlockedUser($userID, $self = false)
{
if (!users_helper::isLoggedin()) {
return false;
} elseif ($userID == session::item('user_id')) {
return false;
}
return codebreeder::instance()->users_blocked_model->getUser($userID, $self);
}
示例8: getTypes
public function getTypes($escape = true)
{
// Get user types
$types = $this->db->query("SELECT * FROM `:prefix:users_types` ORDER BY order_id ASC")->result();
foreach ($types as $index => $type) {
$types[$index]['name'] = $escape ? text_helper::entities($type['name_' . session::item('language')]) : $type['name_' . session::item('language')];
}
return $types;
}
示例9: __construct
public function __construct()
{
parent::__construct();
// Is user logged in?
if (users_helper::isLoggedin() && strtolower(uri::segment(3)) != 'out') {
router::redirect(session::item('slug'));
}
loader::model('users/authentication', array(), 'users_authentication_model');
}
示例10: getPlans
public function getPlans($active = true, $escape = true)
{
// Get plans
$plans = $this->db->query("SELECT * FROM `:prefix:billing_plans` " . ($active ? "WHERE `active`=1" : "") . " ORDER BY `order_id` ASC")->result();
foreach ($plans as $index => $plan) {
$plans[$index]['name'] = $escape ? text_helper::entities($plan['name_' . session::item('language')]) : $plan['name_' . session::item('language')];
$plans[$index]['description'] = $escape ? text_helper::entities($plan['description_' . session::item('language')]) : $plan['description_' . session::item('language')];
}
return $plans;
}
示例11: getFriend
public function getFriend($userID, $active = true)
{
if (($user = config::item('u' . $userID, '_users_cache_friends')) === false) {
$user = $this->db->query("SELECT `user_id`, `friend_id`, `post_date`, `active`\n\t\t\t\tFROM `:prefix:users_friends`\n\t\t\t\tWHERE (`user_id`=? AND `friend_id`=? OR `user_id`=? AND `friend_id`=?) LIMIT 1", array(session::item('user_id'), $userID, $userID, session::item('user_id')))->row();
config::set(array('u' . $userID => $user), '', '_users_cache_friends');
}
if ($active && (!isset($user['active']) || !$user['active'])) {
return array();
}
return $user;
}
示例12: usersSettingsPrivacyOptions
public function usersSettingsPrivacyOptions($settings, $user = array())
{
if (config::item('timeline_active', 'timeline') && isset($settings['privacy_timeline'])) {
$settings['privacy_timeline']['items']['timeline_classified_post'] = __('timeline_classified_post', 'users_privacy');
$settings['privacy_timeline']['rules']['callback__parse_config_array']['items'][] = 'timeline_classified_post';
if ($user && (!isset($user['config']['timeline_classified_post']) || $user['config']['timeline_classified_post']) || !$user && (session::item('timeline_classified_post', 'config') === false || session::item('timeline_classified_post', 'config'))) {
$settings['privacy_timeline']['value']['timeline_classified_post'] = 1;
}
}
return $settings;
}
示例13: getPages
public function getPages($parentID, $fields = false, $columns = array(), $items = array(), $order = false, $params = array())
{
// Sorting
if (!$order) {
$order = '`p`.`data_title_' . session::item('language') . '` ASC';
$order = '`p`.`order_id` ASC';
}
// Get pages
$pages = $this->fields_model->getRows('page', false, $fields, $columns, $items, $order, 1000, $params);
return $pages;
}
示例14: usersSettingsNotificationsOptions
public function usersSettingsNotificationsOptions($settings, $user = array())
{
if (config::item('messages_active', 'messages')) {
$settings['general']['items']['notify_messages'] = __('notify_messages', 'users_notifications');
$settings['general']['rules']['callback__parse_config_array']['items'][] = 'notify_messages';
if ($user && (!isset($user['config']['notify_messages']) || $user['config']['notify_messages']) || !$user && (session::item('notify_messages', 'config') === false || session::item('notify_messages', 'config'))) {
$settings['general']['value']['notify_messages'] = 1;
}
}
return $settings;
}
示例15: getUser
public function getUser($userID, $self = false)
{
if (($user = config::item('u' . $userID, '_users_cache_blacklist')) === false) {
$user = $this->db->query("SELECT `user_id`, `blocked_id`, `post_date`\n\t\t\t\tFROM `:prefix:users_blocked`\n\t\t\t\tWHERE `user_id`=? AND `blocked_id`=? " . (!$self ? "OR `user_id`=? AND `blocked_id`=?" : "") . " LIMIT 1", array(session::item('user_id'), $userID, $userID, session::item('user_id')))->row();
if (!$self) {
config::set(array('u' . $userID => $user), '', '_users_cache_blacklist');
}
}
if ($self && (!isset($user['user_id']) || $user['blocked_id'] != $userID)) {
return array();
}
return $user;
}