当前位置: 首页>>代码示例>>PHP>>正文


PHP session::section方法代码示例

本文整理汇总了PHP中session::section方法的典型用法代码示例。如果您正苦于以下问题:PHP session::section方法的具体用法?PHP session::section怎么用?PHP session::section使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在session的用法示例。


在下文中一共展示了session::section方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: manage

 public function manage()
 {
     // Assign user from session to variable
     $user = session::section('session');
     // Get fields
     $fields = array();
     foreach (config::item('usertypes', 'core', 'keywords') as $categoryID => $keyword) {
         $fields[$categoryID] = $this->fields_model->getFields('users', $categoryID, 'view', 'in_list');
     }
     // Parameters
     $params = array('total' => $user['total_blocked'], 'profiles' => true);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Get blocked users
     $users = array();
     if ($params['total']) {
         $users = $this->users_blocked_model->getUsers(session::item('user_id'), $qstring['order'], $qstring['limit'], $params);
     } else {
         view::setInfo(__('no_blocked_users', 'users_blocked'));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('users/blocked/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('blocked_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'users' => $users, 'fields' => $fields, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('blacklist', 'users'));
     // Load view
     view::load('users/blocked/manage');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:30,代码来源:blocked.php

示例2: manage

 public function manage()
 {
     // Does user have permission to view visitors?
     if (!session::permission('users_visitors_browse', 'users')) {
         view::noAccess();
     }
     // Assign user from session to variable
     $user = session::section('session');
     // Get fields
     $fields = array();
     foreach (config::item('usertypes', 'core', 'keywords') as $categoryID => $keyword) {
         $fields[$categoryID] = $this->fields_model->getFields('users', $categoryID, 'view', 'in_list');
     }
     // Parameters
     $params = array('total' => session::permission('users_visitors_limit', 'users') && session::permission('users_visitors_limit', 'users') < $user['total_visitors'] ? session::permission('users_visitors_limit', 'users') : $user['total_visitors'], 'profiles' => true);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Get visitors
     $visitors = array();
     if ($params['total']) {
         $visitors = $this->users_visitors_model->getVisitors(session::item('user_id'), $qstring['order'], $qstring['limit'], $params);
     } else {
         view::setInfo(__('no_visitors', 'users_visitors'));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('users/visitors/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('visitors_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'visitors' => $visitors, 'fields' => $fields, 'pagination' => $pagination));
     // Dow we have new visitors?
     if (session::item('total_visitors_new')) {
         // Reset new visitors counter
         $this->users_visitors_model->resetCounter();
     }
     // Set title
     view::setTitle(__('my_visitors', 'system_navigation'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('users/visitors/manage', __('users_visitors', 'system_navigation'));
     // Load view
     view::load('users/visitors/manage');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:42,代码来源:visitors.php

示例3: manage

 public function manage()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!session::permission('albums_post', 'pictures')) {
         view::noAccess(session::item('slug'));
     }
     // Assign user from session to variable
     $user = session::section('session');
     // Parameters
     $params = array('select_users' => false, 'join_columns' => array('`a`.`user_id`=' . session::item('user_id')), 'join_items' => array(), 'total' => $user['total_albums']);
     // Process filters
     $params = $this->parseCounters($params, 'manage');
     // Process query string
     $qstring = $this->parseQuerystring(config::item('user_albums_per_page', 'pictures'), $params['max']);
     // Get albums
     $albums = array();
     if ($params['total']) {
         $albums = $this->pictures_albums_model->getAlbums('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit'], $params);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('pictures/albums/manage?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('user_albums_per_page', 'pictures'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'albums' => $albums, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('my_albums', 'system_navigation'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('pictures/manage', __('pictures_albums', 'system_navigation'));
     // Assign actions
     view::setAction('pictures/albums/edit', __('album_new', 'pictures'), array('class' => 'icon-text icon-pictures-albums-new'));
     if (session::permission('albums_search', 'pictures') && ($params['total'] || input::post_get('do_search'))) {
         view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#albums-search\').toggle();return false;'));
     }
     // Load view
     view::load('pictures/albums/manage');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:39,代码来源:albums.php

示例4: confirm

 public function confirm()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // Get URI vars
     $slugID = urldecode(utf8::trim(uri::segment(4)));
     // Do we have a slug ID?
     if ($slugID == '') {
         error::show404();
     }
     // Get user
     if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
         error::show404();
     } elseif ($user['user_id'] == session::item('user_id')) {
         view::setError(__('no_friend_request', 'users_friends'));
         router::redirect($user['slug']);
     }
     // Does friend exist?
     if (!($friend = $this->users_friends_model->getFriend($user['user_id'], false)) || $friend['user_id'] == session::item('user_id')) {
         view::setError(__('no_friend_request', 'users_friends'));
         router::redirect($user['slug']);
     } elseif ($friend['active']) {
         view::setInfo(__('friend_active', 'users_friends'));
         router::redirect($user['slug']);
     }
     // Add friend request
     $this->users_friends_model->confirmRequest($user['user_id']);
     // Create email replacement tags
     $tags = array();
     foreach (session::section('session') as $key => $value) {
         $tags['from.' . $key] = $value;
     }
     $tags = array_merge($tags, $user);
     // Send activation email
     if (!isset($user['config']['notify_friends_accept']) || $user['config']['notify_friends_accept']) {
         loader::library('email');
         $this->email->sendTemplate('users_friend_confirmed', $user['email'], $tags, $user['language_id']);
     }
     // Success
     view::setInfo(__('friend_confirmed', 'users_friends'));
     router::redirect(input::get('page') ? 'users/friends' . (session::item('total_friends_i') > 1 ? '/requests' : '') : $user['slug']);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:44,代码来源:friends.php

示例5: view

 public function view()
 {
     // Get URI vars
     $blogID = (int) uri::segment(3);
     // Get blog
     if (!$blogID || !($blog = $this->blogs_model->getBlog($blogID, 'in_view')) || !$blog['active'] && $blog['user_id'] != session::item('user_id')) {
         error::show404();
     }
     // Is this our own blog?
     if ($blog['user_id'] == session::item('user_id')) {
         // Assign user from session to variable
         $user = session::section('session');
     } else {
         // Get user
         if (!($user = $this->users_model->getUser($blog['user_id'])) || !$user['active'] || !$user['verified']) {
             error::show404();
         }
         // Does user have permission to view this user group/type and view blogs?
         if (!in_array($user['group_id'], session::permission('users_groups_browse', 'users')) || !in_array($user['type_id'], session::permission('users_types_browse', 'users')) || !session::permission('blogs_view', 'blogs')) {
             view::noAccess();
         } elseif (!$this->users_model->getPrivacyAccess($user['user_id'], isset($user['config']['privacy_profile']) ? $user['config']['privacy_profile'] : 1) || !$this->users_model->getPrivacyAccess($user['user_id'], $blog['privacy'])) {
             view::noAccess($user['slug']);
         }
     }
     // Do we have views enabled?
     if (config::item('blog_views', 'blogs')) {
         // Update views counter
         $this->blogs_model->updateViews($blogID);
     }
     // Load ratings
     if (config::item('blog_rating', 'blogs') == 'stars') {
         // Load votes model
         loader::model('comments/votes');
         // Get votes
         $blog['user_vote'] = $this->votes_model->getVote('blog', $blogID);
     } elseif (config::item('blog_rating', 'blogs') == 'likes') {
         // Load likes model
         loader::model('comments/likes');
         // Get likes
         $blog['user_vote'] = $this->likes_model->getLike('blog', $blogID);
     }
     // Assign vars
     view::assign(array('blogID' => $blogID, 'blog' => $blog, 'user' => $user));
     // Set meta tags
     $this->metatags_model->set('blogs', 'blogs_view', array('user' => $user, 'blog' => $blog));
     // Set title
     view::setTitle($blog['data_title'], false);
     // Set trail
     if ($user['user_id'] == session::item('user_id')) {
         view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
         view::setTrail('blogs/manage', __('blogs', 'system_navigation'));
     } else {
         view::setTrail($user['slug'], $user['name']);
         view::setTrail('blogs/user/' . $user['slug_id'], __('blogs', 'system_navigation'));
     }
     // Load view
     view::load('blogs/view');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:58,代码来源:blogs.php

示例6: _saveProfile

 protected function _saveProfile($fields)
 {
     // Validate form fields
     if (!$this->fields_model->validateValues($fields)) {
         return false;
     }
     // Extras
     $extra = array();
     // Save profile
     if (!$this->users_model->saveProfile(session::item('user_id'), session::item('type_id'), session::section('session'), $fields, $extra)) {
         view::setError(__('save_error', 'system'));
         return false;
     }
     // Success
     view::setInfo(__('profile_saved', 'users_profile'));
     router::redirect('users/profile/edit');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:17,代码来源:profile.php

示例7: _saveMessage

 protected function _saveMessage($conversationID, $conversation)
 {
     // Are we allowed to reply?
     if ($conversation['user_id'] == session::item('user_id') && !session::permission('messages_reply', 'messages') || !in_array($conversation['users'][$conversation['user_id']]['group_id'], session::permission('messages_reply', 'messages'))) {
         view::setError(__('no_action', 'system'));
         return false;
     } elseif (config::item('credits_active', 'billing') && session::permission('messages_credits', 'messages') && session::permission('messages_credits', 'messages') > session::item('total_credits')) {
         view::setError(__('no_credits', 'system', array(), array('%' => html_helper::anchor('billing/credits', '\\1'))));
         return false;
     }
     // Create rules
     $rules = array('message' => array('label' => __('message', 'messages'), 'rules' => array('trim', 'required', 'callback__is_messages_delay')));
     // Do we have character limit?
     if (session::permission('messages_characters_limit', 'messages')) {
         $rules['message']['rules']['max_length'] = session::permission('messages_characters_limit', 'messages');
     }
     // Assign rules
     validate::setRules($rules);
     // Validate fields
     if (!validate::run()) {
         return false;
     }
     // Get input data
     $message = input::post('message');
     // Save message
     if (!($messageID = $this->messages_model->saveMessage(0, $conversationID, $message, $conversation['recipients']))) {
         if (!validate::getTotalErrors()) {
             view::setError(__('save_error', 'system'));
         }
         return false;
     }
     // Create email replacement tags
     $tags = array();
     foreach (session::section('session') as $key => $value) {
         $tags['from.' . $key] = $value;
     }
     $tags['conversation_link'] = config::siteURL('messages/view/' . $conversationID);
     // Send new private message email
     loader::library('email');
     foreach ($conversation['users'] as $user) {
         if ($user['user_id'] != session::item('user_id') && (!isset($user['config']['notify_messages']) || $user['config']['notify_messages'])) {
             $this->email->sendTemplate('messages_new', $user['email'], array_merge($tags, $user), $user['language_id']);
         }
     }
     // Success
     view::setInfo(__('message_sent', 'messages'));
     router::redirect('messages/view/' . $conversationID);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:48,代码来源:messages.php

示例8: view

 public function view()
 {
     // Get URI vars
     $pictureID = (int) uri::segment(4);
     // Get picture
     if (!$pictureID || !($picture = $this->classifieds_pictures_model->getPicture($pictureID, 'in_view')) || !$picture['active'] && $picture['user_id'] != session::item('user_id')) {
         error::show404();
     }
     // Get ad
     if (!($ad = $this->classifieds_model->getAd($picture['ad_id'], 'in_view'))) {
         error::show404();
     }
     // Is this our own picture?
     if ($picture['user_id'] == session::item('user_id')) {
         // Assign user from session to variable
         $user = session::section('session');
     } else {
         // Get user
         if (!($user = $this->users_model->getUser($picture['user_id'])) || !$user['active'] || !$user['verified']) {
             error::show404();
         }
     }
     $previousPicture = $nextPicture = array();
     $previousURL = $nextURL = '';
     // Does album have more than 1 active picture?
     if ($ad['total_pictures'] > 1) {
         // Get previous/next pictures
         list($previousPicture, $nextPicture) = $this->classifieds_pictures_model->getPictureSiblings(session::item('user_id'), $picture['ad_id'], $picture['order_id'], $user['user_id'] != session::item('user_id') ? $ad['total_pictures'] : $ad['total_pictures'] + $ad['total_pictures_i']);
         if ($previousPicture) {
             $previousURL = 'classifieds/pictures/view/' . $previousPicture['picture_id'] . '/' . text_helper::slug($previousPicture['data_description'] ? $previousPicture['data_description'] : '', 100);
         }
         if ($nextPicture) {
             $nextURL = 'classifieds/pictures/view/' . $nextPicture['picture_id'] . '/' . text_helper::slug($nextPicture['data_description'] ? $nextPicture['data_description'] : '', 100);
         }
     }
     // Assign vars
     view::assign(array('pictureID' => $pictureID, 'picture' => $picture, 'ad' => $ad, 'user' => $user, 'previousURL' => $previousURL, 'nextURL' => $nextURL));
     // Set meta tags
     $this->metatags_model->set('classifieds', 'classifieds_view', array('user' => $user, 'ad' => $ad, 'picture' => $picture));
     // Set title
     view::setTitle($ad['data_title'] . ($picture['data_description'] ? ' - ' . $picture['data_description'] : ''), false);
     // Set trail
     if ($user['user_id'] == session::item('user_id')) {
         view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
         view::setTrail('classifieds/manage', __('classifieds', 'system_navigation'));
     } else {
         view::setTrail($user['slug'], $user['name']);
         view::setTrail('classifieds/user/' . $user['slug_id'], __('classifieds', 'system_navigation'));
     }
     view::setTrail('classifieds/view/' . $ad['ad_id'] . '/' . text_helper::slug($ad['data_title'], 100), __('ad_view', 'classifieds'), array('side' => true));
     // Assign actions
     view::setAction(false, __('pictures_view_counter', 'classifieds', array('%current' => $picture['order_id'], '%total' => $user['user_id'] != session::item('user_id') ? $ad['total_pictures'] : $ad['total_pictures'] + $ad['total_pictures_i'])));
     // Load view
     view::load('classifieds/pictures/view');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:55,代码来源:pictures.php

示例9: createUserSession

 public function createUserSession($user)
 {
     if (!isset($user['group_id'])) {
         $user = $this->getUser($user['user_id'], false, false);
     }
     if (config::item('devmode', 'system') || !session::permission('group_id', 'system') || session::permission('group_id', 'system') != $user['group_id']) {
         $permissions = $this->getPermissions($user['group_id']);
         $permissions['system']['group_id'] = $user['group_id'];
         foreach ($permissions as $plugin => $permission) {
             session::set($permission, '', 'permissions_' . $plugin);
         }
     }
     if (!session::permission('site_login', 'system')) {
         return false;
     }
     session::set($user);
     if (config::item('devmode', 'system') || !session::item('config_id', 'config')) {
         $config = $this->getUserConfig($user['user_id']);
         session::set($config, '', 'config');
     }
     if (!config::item('template_override', 'system') && (input::get('template') && ($templateID = array_search(input::get('template'), config::item('templates', 'core', 'keywords'))) !== false || session::item('template_custom'))) {
         if (input::get('template')) {
             session::set('template_custom', input::get('template'));
             $template = config::item('templates', 'core', 'keywords', $templateID);
         } else {
             $template = session::item('template_custom');
         }
     } else {
         $template = config::item('templates', 'core', 'keywords', config::item('template_override', 'system') ? config::item('template_id', 'system') : session::item('template_id'));
     }
     if (!config::item('language_override', 'system') && (input::get('language') && ($languageID = array_search(input::get('language'), config::item('languages', 'core', 'keywords'))) !== false || session::item('language_custom'))) {
         if (input::get('language')) {
             session::set('language_custom', input::get('language'));
             $language = config::item('languages', 'core', 'keywords', $languageID);
         } else {
             $language = session::item('language_custom');
         }
     } else {
         $language = config::item('languages', 'core', 'keywords', config::item('language_override', 'system') ? config::item('language_id', 'system') : session::item('language_id'));
     }
     session::set('language', $language);
     session::set('template', $template);
     if (config::item('time_zone_override', 'system')) {
         session::set('time_zone', config::item('time_zone', 'system'));
     }
     language::setLanguage($language);
     $this->bootstrap->update();
     session::set('group_name', text_helper::entities(config::item('usergroups', 'core', $user['group_id'])));
     session::set('type_name', text_helper::entities(config::item('usertypes', 'core', 'names', $user['type_id'])));
     if (config::item('devmode', 'system') || !session::item('profile_id')) {
         $profile = $this->getProfile($user['user_id'], $user['type_id'], 'all');
         if ($user['user_id'] == session::item('user_id')) {
             foreach (session::section('session') as $key => $value) {
                 if (strpos($key, 'data_') === 0) {
                     session::delete($key);
                 }
             }
         }
         session::set($profile);
     }
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:62,代码来源:session.php

示例10: view

 public function view()
 {
     // Get URI vars
     $adID = (int) uri::segment(3);
     // Get ad
     if (!$adID || !($ad = $this->classifieds_model->getAd($adID, 'in_view')) || !$ad['active'] && $ad['user_id'] != session::item('user_id')) {
         error::show404();
     }
     // Is this our own ad?
     if ($ad['user_id'] == session::item('user_id')) {
         // Assign user from session to variable
         $user = session::section('session');
     } else {
         // Get user
         if (!($user = $this->users_model->getUser($ad['user_id'])) || !$user['active'] || !$user['verified']) {
             error::show404();
         }
         // Does user have permission to view this user group/type and view ads?
         if (!in_array($user['group_id'], session::permission('users_groups_browse', 'users')) || !in_array($user['type_id'], session::permission('users_types_browse', 'users')) || !session::permission('ads_view', 'classifieds')) {
             view::noAccess();
         }
     }
     // Do we have views enabled?
     if (config::item('ad_views', 'classifieds')) {
         // Update views counter
         $this->classifieds_model->updateViews($adID);
     }
     // Get fields
     $fields = $this->fields_model->getFields('classifieds', 0, 'view', 'in_view');
     // Load ratings
     if (config::item('ad_rating', 'classifieds') == 'stars') {
         // Load votes model
         loader::model('comments/votes');
         // Get votes
         $ad['user_vote'] = $this->votes_model->getVote('classified_ad', $adID);
     } elseif (config::item('ad_rating', 'classifieds') == 'likes') {
         // Load likes model
         loader::model('comments/likes');
         // Get likes
         $ad['user_vote'] = $this->likes_model->getLike('classified_ad', $adID);
     }
     // Assign vars
     view::assign(array('adID' => $adID, 'ad' => $ad, 'user' => $user));
     // Set meta tags
     $this->metatags_model->set('classifieds', 'classifieds_view', array('user' => $user, 'ad' => $ad));
     // Set title
     view::setTitle($ad['data_title'] . ($ad['post_date'] < date_helper::now() - config::item('ad_expiration', 'classifieds') * 60 * 60 * 24 ? ' - ' . __('ad_expired', 'classifieds') : ''), false);
     // Set trail
     if ($user['user_id'] == session::item('user_id')) {
         view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
         view::setTrail('classifieds/manage', __('classifieds', 'system_navigation'));
     } else {
         view::setTrail($user['slug'], $user['name']);
         view::setTrail('classifieds/user/' . $user['slug_id'], __('classifieds', 'system_navigation'));
     }
     // Assign actions
     if ($user['user_id'] == session::item('user_id')) {
         view::setAction('classifieds/pictures/upload/' . $adID, __('pictures_new', 'classifieds'), array('class' => 'icon-text icon-classifieds-pictures-new', 'data-role' => 'modal', 'data-title' => __('pictures_new', 'classifieds')));
         if ($ad['total_pictures'] + $ad['total_pictures_i'] > 0) {
             view::setAction('classifieds/pictures/index/' . $adID, __('pictures', 'classifieds'), array('class' => 'icon-text icon-classifieds-pictures'));
         }
     }
     // Load view
     view::load('classifieds/view');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:65,代码来源:classifieds.php

示例11: privacy

 public function privacy()
 {
     if (!config::item('privacy_edit', 'users')) {
         error::show404();
     }
     // Create privacy settings
     $settings = array();
     // Filter hook
     $settings = hook::filter('users/settings/privacy/options', $settings, session::section() + array('config' => session::section('config')));
     // Assign vars
     view::assign(array('settings' => $settings));
     // Process form values
     if (input::post('do_save_privacy')) {
         $this->_savePrivacy($settings);
     }
     // Set title
     view::setTitle(__('privacy', 'users'));
     // Load view
     view::load('users/settings/privacy');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:20,代码来源:settings.php

示例12: view

 public function view()
 {
     // Get URI vars
     $pictureID = (int) uri::segment(3);
     // Get picture
     if (!$pictureID || !($picture = $this->pictures_model->getPicture($pictureID, 'in_view')) || !$picture['active'] && $picture['user_id'] != session::item('user_id')) {
         error::show404();
     }
     $pictureID = $picture['picture_id'];
     // Get album
     if (!($album = $this->pictures_albums_model->getAlbum($picture['album_id'], 'in_view'))) {
         error::show404();
     }
     // Is this our own picture?
     if ($picture['user_id'] == session::item('user_id')) {
         // Assign user from session to variable
         $user = session::section('session');
     } else {
         // Get user
         if (!($user = $this->users_model->getUser($picture['user_id'])) || !$user['active'] || !$user['verified']) {
             error::show404();
         }
         // Does user have permission to view this user group/type and view pictures?
         if (!in_array($user['group_id'], session::permission('users_groups_browse', 'users')) || !in_array($user['type_id'], session::permission('users_types_browse', 'users')) || !session::permission('pictures_view', 'pictures')) {
             view::noAccess();
         } elseif (!$this->users_model->getPrivacyAccess($user['user_id'], isset($user['config']['privacy_profile']) ? $user['config']['privacy_profile'] : 1) || !$this->users_model->getPrivacyAccess($user['user_id'], $album['privacy'])) {
             view::noAccess($user['slug']);
         }
     }
     // Do we have views enabled?
     if (config::item('picture_views', 'pictures')) {
         // Update views counter
         $this->pictures_model->updateViews($pictureID);
     }
     $previousPicture = $nextPicture = array();
     $previousURL = $nextURL = '';
     // Does album have more than 1 active picture?
     if ($album['total_pictures'] > 1) {
         // Get previous/next pictures
         list($previousPicture, $nextPicture) = $this->pictures_model->getPictureSiblings(session::item('user_id'), $picture['album_id'], $picture['order_id'], $user['user_id'] != session::item('user_id') ? $album['total_pictures'] : $album['total_pictures'] + $album['total_pictures_i']);
         if ($previousPicture) {
             $previousURL = 'pictures/view/' . $previousPicture['picture_id'] . '/' . text_helper::slug($previousPicture['data_description'] ? $previousPicture['data_description'] : $album['data_title'], 100);
         }
         if ($nextPicture) {
             $nextURL = 'pictures/view/' . $nextPicture['picture_id'] . '/' . text_helper::slug($nextPicture['data_description'] ? $nextPicture['data_description'] : $album['data_title'], 100);
         }
     }
     // Load ratings
     if (config::item('picture_rating', 'pictures') == 'stars') {
         // Load votes model
         loader::model('comments/votes');
         // Get votes
         $picture['user_vote'] = $this->votes_model->getVote('picture', $pictureID);
     } elseif (config::item('picture_rating', 'pictures') == 'likes') {
         // Load likes model
         loader::model('comments/likes');
         // Get likes
         $picture['user_vote'] = $this->likes_model->getLike('picture', $pictureID);
     }
     // Assign vars
     view::assign(array('pictureID' => $pictureID, 'picture' => $picture, 'album' => $album, 'user' => $user, 'previousURL' => $previousURL, 'nextURL' => $nextURL));
     // Set meta tags
     $this->metatags_model->set('pictures', 'pictures_view', array('user' => $user, 'album' => $album, 'picture' => $picture));
     // Set title
     view::setTitle($album['data_title'] . ($picture['data_description'] ? ' - ' . $picture['data_description'] : ''), false);
     // Set trail
     if ($user['user_id'] == session::item('user_id')) {
         view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
         view::setTrail('pictures/manage', __('pictures_albums', 'system_navigation'));
     } else {
         view::setTrail($user['slug'], $user['name']);
         view::setTrail('pictures/user/' . $user['slug_id'], __('pictures_albums', 'system_navigation'));
     }
     view::setTrail('pictures/index/' . $album['album_id'] . '/' . text_helper::slug($album['data_title'], 100), __('album_view', 'pictures'), array('side' => true));
     // Assign actions
     view::setAction(false, __('pictures_view_counter', 'pictures', array('%current' => $picture['order_id'], '%total' => $user['user_id'] != session::item('user_id') ? $album['total_pictures'] : $album['total_pictures'] + $album['total_pictures_i'])));
     // Load view
     view::load('pictures/view');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:79,代码来源:pictures.php


注:本文中的session::section方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。