本文整理汇总了PHP中user_is_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP user_is_logged_in函数的具体用法?PHP user_is_logged_in怎么用?PHP user_is_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_is_logged_in函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: dynamic_menu_content
function dynamic_menu_content()
{
$cache_name = user_is_logged_in() ? 'logged_in_' . $_SESSION['class'] : 'guest';
if (cache_start($cache_name, CONFIG_CACHE_TIME_DYNAMIC, CONST_CACHE_DYNAMIC_MENU_GROUP)) {
$entries = db_query_fetch_all('SELECT
title,
internal_page,
permalink,
url,
visibility
FROM
dynamic_menu
WHERE
' . (user_is_logged_in() ? 'min_user_class <= ' . $_SESSION['class'] . ' AND (visibility = "private" OR visibility = "both")' : 'visibility = "public" OR visibility = "both"') . '
ORDER BY priority DESC');
foreach ($entries as $entry) {
echo '
<li>
<a href="', $entry['internal_page'] ? CONFIG_SITE_URL . 'content?show=' . $entry['permalink'] : htmlspecialchars($entry['url']), '">', htmlspecialchars($entry['title']), '</a>
</li>
';
}
cache_end($cache_name, CONST_CACHE_DYNAMIC_MENU_GROUP);
}
}
开发者ID:janglapuk,项目名称:mellivora,代码行数:25,代码来源:dynamic.inc.php
示例2: hasCategory
/**
* Decide whether block displays may include category information.
*
* @return int
* One of the BlockLatest::DISPLAY_* constants.
*/
public function hasCategory()
{
switch ($this->getDisplayPolicy()) {
// Display only for admin.
case static::DISPLAY_ADMIN:
$ret = $GLOBALS['user']->uid == 1;
break;
// Display for all authenticated users.
// Display for all authenticated users.
case static::DISPLAY_AUTH:
$ret = user_is_logged_in();
break;
// Always display.
// Always display.
case static::DISPLAY_ALWAYS:
$ret = TRUE;
break;
// BlockLatest::DISPLAY_NEVER and any other value.
// BlockLatest::DISPLAY_NEVER and any other value.
default:
$ret = FALSE;
break;
}
return $ret;
}
开发者ID:agroknow,项目名称:agreri,代码行数:31,代码来源:BlockLatest.php
示例3: basetpl_process_page
/**
* Implements theme_process_page().
*/
function basetpl_process_page(&$variables)
{
global $base_path;
// show/hide breadcrumb
$variables['show_breadcrumb'] = TRUE;
// var theme_path
$variables['theme_path'] = $base_path . path_to_theme();
// var site_info
$variables['site_info'] = $variables['logo'] || $variables['site_name'] || $variables['site_slogan'] ? TRUE : FALSE;
// check if page is system page
$variables['system_page'] = isset($variables['node']) ? FALSE : TRUE;
// backend
if (user_is_logged_in() && path_is_admin(current_path())) {
$variables['site_info'] = FALSE;
$variables['system_page'] = TRUE;
foreach (element_children($variables['page']) as $region) {
if ($region != 'content') {
$variables['page'][$region] = FALSE;
}
}
}
// show/hide page title
$variables['title'] = $variables['system_page'] ? $variables['title'] : FALSE;
// add robots to head
if (theme_get_setting('robots') == 1) {
$robots = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'robots', 'content' => 'noindex,nofollow'));
drupal_add_html_head($robots, 'robots');
}
}
开发者ID:bert-bruggeman,项目名称:e2e_themes,代码行数:32,代码来源:page.inc.php
示例4: blackberry_2016_status_messages
function blackberry_2016_status_messages($variables)
{
$display = $variables['display'];
$output = '';
$status_heading = array('status' => t('Status message'), 'error' => t('Error message'), 'warning' => t('Warning message'));
foreach (drupal_get_messages($display) as $type => $messages) {
// skip all error/warning messages for anonymous users
if (!user_is_logged_in() && $type == 'PHP') {
} else {
$output .= '<div class="alert alert-block alert-' . $type . '"><div class="container"><div class="row"><div class="col-xs-12">';
if (!empty($status_heading[$type])) {
$output .= '<h2 class="element-invisible">' . $status_heading[$type] . '</h2>';
}
if (count($messages) > 1) {
$output .= '<ul>';
foreach ($messages as $message) {
$output .= ' <li>' . $message . '</li>';
}
$output .= '</ul>';
} else {
$output .= $messages[0];
}
$output .= '</div></div></div><a class="close" data-dismiss="alert" href="#">×</a></div>';
}
}
return $output;
}
开发者ID:jamesbeat,项目名称:blackberry_2016,代码行数:27,代码来源:template.php
示例5: thearchivetheme_process_page
function thearchivetheme_process_page(&$vars)
{
$usernav = '';
if (user_is_logged_in()) {
global $user;
$node = menu_get_object();
$ar = array();
if ($node) {
$nid = $node->nid;
if (user_access('update collection')) {
$ar[] = '<a href="collection/edit/' . $nid . '">編輯</a>';
}
if (user_access('update collection')) {
$ar[] = '<a href="collection/update/file/' . $nid . '">更新數位檔</a>';
}
if (user_access('update collection') && editcol_is_video_collection($nid)) {
$ar[] = '<a href="collection/upload/video_icons/' . $nid . '">自定影片圖示</a>';
}
if (user_access('delete collection')) {
$ar[] = '<a href="collection/delete/' . $nid . '">刪除</a>';
}
}
if (user_access('control panel')) {
$ar[] = '<a href="/control_panel/1">Control Panel</a>';
}
$ar[] = 'Login as ' . $user->name;
$ar[] = '<a href="/user/logout">Log out</a>';
$usernav = '<div class="row">' . implode(' | ', $ar) . '</div>';
}
$vars['usernav'] = $usernav;
}
开发者ID:318io,项目名称:318-io,代码行数:31,代码来源:template.php
示例6: removeEvent
/**
* @function removeEvent
* Returns interface for removing an event
*/
public function removeEvent()
{
$explodedpath = explode("/", current_path());
$event_id = $this->clearContent($explodedpath[1]);
if (!user_is_logged_in() || !$this->event->isAuthorized($event_id, $this->user_id)) {
drupal_access_denied();
drupal_exit();
}
if (isset($_POST['submit'])) {
$this->event->removeEvent($event_id);
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
drupal_set_message(t('Das Event wurde gelöscht.'));
header("Location: " . $base_url . "/events");
// Und "Tschö mit ö..."!
} else {
$pathThisFile = $_SERVER['REQUEST_URI'];
return '<div class="callout row">
<h4><strong>' . t('Möchten Sie dieses Event wirklich löschen?') . '</strong></h4><br />
<form action=' . $pathThisFile . ' method="POST" enctype="multipart/form-data">
<input name="event_id" type="hidden" id="eventEIDInput" value="' . $event_id . '" />
<a class="secondary button" href="javascript:history.go(-1)">Abbrechen</a>
<input type="submit" class="button" id="eventSubmit" name="submit" value="Löschen">
</form></div>';
}
}
开发者ID:JuliAne,项目名称:easteasteast,代码行数:31,代码来源:eventprofil.php
示例7: __construct
/**
* Constructor to generically set up the user id condition if
* there is a current user.
*
* @param $connection
*/
function __construct($connection)
{
parent::__construct($connection);
if (user_is_logged_in()) {
global $user;
$this->useridCondition($user->name);
}
}
开发者ID:bogdy2p,项目名称:wpal,代码行数:14,代码来源:MyRestRemoteSelectQuery.class.php
示例8: hook_rest_server_execute_errors_alter
/**
* Alter error messages right before delivering.
*
* @param array $errors
* Array of following properties:
* 'code' -- error code
* 'header_message' -- message that will be returned in Status header
* 'body_data' -- data returned in the body of the response
* You can alter 'header_message' and 'body_data' in your hook implementations.
* @param type $controller
* Executed controller.
* @param type $arguments
* Arguments of the controller.
*/
function hook_rest_server_execute_errors_alter(&$error, $controller, $arguments)
{
$error_code = $error['code'];
if (user_is_logged_in() && $error_code == 401) {
global $user;
$error['header_message'] = '403 ' . t('Access denied for user @user', array('@user' => $user->name));
}
}
开发者ID:eroslover,项目名称:drupal7,代码行数:22,代码来源:rest_server.api.php
示例9: analytics_portal_preprocess_html
function analytics_portal_preprocess_html(&$vars, $hook)
{
if (drupal_is_front_page() && !user_is_logged_in()) {
// If the content type's machine name is "my_machine_name" the file
// name will be "page--my-machine-name.tpl.php".
$vars['theme_hook_suggestions'][] = 'html__custom';
}
}
开发者ID:hoqkhanh,项目名称:analytics_portal,代码行数:8,代码来源:template.php
示例10: __construct
public function __construct($uid)
{
if (user_is_logged_in() == FALSE && !defined('OS_POKER_SCRIPT')) {
throw new Exception('Forbidden (User must be logged in)');
}
if ($this->Load($uid) == FALSE) {
throw new Exception('Invalid UID');
}
}
开发者ID:jakob-stoeck,项目名称:os_poker,代码行数:9,代码来源:user.class.php
示例11: dmi_preprocess_menu_link
function dmi_preprocess_menu_link(&$variables)
{
if ($variables['theme_hook_original'] == 'menu_link__menu_topmenu') {
$logged_in = user_is_logged_in();
if ($variables['element']['#title'] == "login" && $logged_in) {
$variables['element']['#title'] = t('Uw account');
}
}
}
开发者ID:akapivo,项目名称:www.dmi.be,代码行数:9,代码来源:template.php
示例12: hook_raven_user_alter
/**
* Provide user information for logging.
*
* @param array $user_info
* A reference to array of user account info.
*/
function hook_raven_user_alter(array &$user_info)
{
global $user;
if (user_is_logged_in()) {
$user_info['id'] = $user->uid;
$user_info['name'] = $user->name;
$user_info['email'] = $user->mail;
$user_info['roles'] = implode(', ', $user->roles);
}
}
开发者ID:seefood,项目名称:ssd,代码行数:16,代码来源:raven.api.php
示例13: hook_commons_utility_links
/**
* Define utility links.
*
* This hook allows modules to register utility links for the functionality that
* they provide. For example, a social integration module could use it to
* register a "Find Friends" utility link which points to a page where the
* current user can search for other site users that they have connected with on
* social networks such as Twitter or Facebook.
*
* @return
* An associative array of utility links whose keys are used as its CSS class.
* Each link should be itself an array, with the same elements used in
* theme_links(), except for the addition of a 'weight' element that is used
* for ordering the links.
*
* For a detailed usage example, see commons_utility_links.module.
*
* @see theme_links()
* @see hook_commons_utility_links_alter()
*/
function hook_commons_utility_links()
{
$links = array();
if (user_is_logged_in()) {
global $user;
$account = $user;
$links['find_fiends'] = array('href' => 'user/' . $account->uid . '/find_friends', 'title' => t('Find friends'));
}
return $links;
}
开发者ID:drupalicus,项目名称:drupal-commons,代码行数:30,代码来源:commons_utility_links.api.php
示例14: send_cache_headers
function send_cache_headers($identifier, $lifetime, $group = 'default')
{
header('Cache-Control: ' . (user_is_logged_in() ? 'private' : 'public') . ', max-age=' . $lifetime);
$path = CONST_PATH_CACHE . 'cache_' . $group . '_' . $identifier;
if (file_exists($path)) {
$time_modified = filemtime($path);
header('Last-Modified: ' . gmdate('D, d M Y H:i:s ', $time_modified) . 'GMT');
header('Expires: ' . gmdate('D, d M Y H:i:s ', $time_modified + $lifetime) . 'GMT');
}
}
开发者ID:azizjonm,项目名称:ctf-engine,代码行数:10,代码来源:cache.inc.php
示例15: adminlte_preprocess_page
/**
* Implement hook_preprocess_page()
*/
function adminlte_preprocess_page(&$vars, $hook)
{
global $user;
global $base_url;
$vars['front_page'] = $base_url;
$theme_path = drupal_get_path('theme', 'adminlte');
// Fontawesome 4.5.0
drupal_add_css('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css', array('type' => 'external', 'scope' => 'header'));
// Ionicons 2.0.1
drupal_add_css('https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css', array('type' => 'external', 'scope' => 'header'));
// jQuery 2.2.3
drupal_add_js($theme_path . '/plugins/jQuery/jQuery-2.2.3.min.js', array('type' => 'file', 'scope' => 'footer'));
// Bootstrap 3.3.5
drupal_add_js($theme_path . '/bootstrap/js/bootstrap.min.js', array('type' => 'file', 'scope' => 'footer'));
// jQuery UI
drupal_add_js('https://code.jquery.com/ui/1.11.4/jquery-ui.min.js', array('type' => 'external', 'scope' => 'footer'));
// FastClick
drupal_add_js($theme_path . '/plugins/fastclick/fastclick.min.js', array('type' => 'file', 'scope' => 'footer'));
// AdminLTE App
drupal_add_js($theme_path . '/dist/js/app.min.js', array('type' => 'file', 'scope' => 'footer'));
// Moment
drupal_add_js('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js', array('type' => 'external', 'scope' => 'footer'));
// Fullcalendar
drupal_add_js($theme_path . '/plugins/fullcalendar/fullcalendar.min.js', array('type' => 'file', 'scope' => 'footer'));
// Additional js for theme.
drupal_add_js($theme_path . '/assets/js/script.js', array('type' => 'file', 'scope' => 'footer'));
$vars['logout'] = '/user/logout';
$vars['profile'] = 'user/' . $user->uid;
$roles = end($user->roles);
$vars['role'] = ucfirst($roles);
reset($user->roles);
// Check if user is login
if (user_is_logged_in()) {
$account = user_load($user->uid);
$avatar_uri = drupal_get_path('theme', 'adminlte') . '/img/avatar.png';
$alt = t("@user's picture", array('@user' => format_username($user)));
// Display profile picture.
if (!empty($account->picture)) {
$user_picture = theme('image_style', array('style_name' => 'thumbnail', 'path' => $account->picture->uri, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => 'img-circle')));
$user_picture_m = theme('image_style', array('style_name' => 'thumbnail', 'path' => $account->picture->uri, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => 'user-image')));
} else {
$user_picture_config = array('style_name' => 'thumbnail', 'path' => $avatar_uri, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => 'img-circle'));
$user_picture_m_config = array('style_name' => 'thumbnail', 'path' => $avatar_uri, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => 'user-image'));
$user_picture = adminlte_image_style($user_picture_config);
$user_picture_m = adminlte_image_style($user_picture_m_config);
}
// Assign profile picture in variables.
$vars['avatar'] = $user_picture;
$vars['avatarsm'] = $user_picture_m;
// Display history of member.
$vars['history'] = 'Member for ' . format_interval(time() - $user->created);
// Display username or you can change this to set the fullname of user login.
$vars['fullname'] = $account->name;
}
}
开发者ID:umandalroald,项目名称:adminlte,代码行数:58,代码来源:template.php
示例16: __construct
function __construct($action)
{
parent::__construct();
$explodedpath = explode('/', current_path());
$this->akteur_id = $this->clearContent($explodedpath[1]);
if (!user_is_logged_in() || $action == 'update' && !$this->akteurExists($this->akteur_id)) {
drupal_access_denied();
drupal_exit();
}
// Sollen die Werte im Anschluss gespeichert oder geupdatet werden?
if ($action == 'update') {
$this->target = 'update';
}
}
开发者ID:JuliAne,项目名称:easteasteast,代码行数:14,代码来源:akteurformular.php
示例17: cignaglobal_css_alter
/**
* Implements hook_css_alter().
*/
function cignaglobal_css_alter(&$css)
{
$theme_path = drupal_get_path('theme', 'cignaglobal');
// Remove css core and contrib modules.
if (!user_is_logged_in()) {
foreach ($css as $key => $css_style_info) {
if (strpos($key, 'sites/all/modules/contrib') !== FALSE || strpos($key, 'modules/system') !== FALSE || strpos($key, 'modules/field') !== FALSE) {
unset($css[$key]);
}
}
}
// Remove the overrides.css.
$overrides = drupal_get_path('theme', 'bootstrap') . '/css/overrides.css';
if (isset($css[$overrides])) {
unset($css[$overrides]);
}
// Remove bootstrap css from cdn (we still want cdn js).
$bootstrap_cdn = theme_get_setting('bootstrap_cdn');
if ($bootstrap_cdn) {
// Add CDN.
if (theme_get_setting('bootstrap_bootswatch')) {
$cdn = '//netdna.bootstrapcdn.com/bootswatch/' . $bootstrap_cdn . '/' . theme_get_setting('bootstrap_bootswatch') . '/bootstrap.min.css';
} else {
$cdn = '//netdna.bootstrapcdn.com/bootstrap/' . $bootstrap_cdn . '/css/bootstrap.min.css';
}
unset($css[$cdn]);
}
// Drop styles.min.css and iestyles.min.css if a landing page.
$node = menu_get_object('node');
if (is_object($node) && isset($node->type) && $node->type == 'landing_page') {
return;
}
// Temporary method of adding brand awareness landing page styling.
$landing_page_urls = function_exists('cigna_lp_menu_keys') ? cigna_lp_menu_keys() : array();
if (in_array(current_path(), $landing_page_urls)) {
$style = $theme_path . '/css/landing--brand.min.css';
$css[$style] = array('data' => $style, 'type' => 'file', 'scope' => 'header', 'every_page' => FALSE, 'media' => 'all', 'preprocess' => TRUE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => 1000);
return;
}
// Work out if on broker pages.
$is_broker_page = is_broker_page();
// Add styles.min.css, else brokerstyle.min.css if on broker pages.
$style = !$is_broker_page ? $theme_path . '/css/style.min.css' : $theme_path . '/css/brokerstyle.min.css';
$css[$style] = array('data' => $style, 'type' => 'file', 'scope' => 'header', 'every_page' => FALSE, 'media' => 'all', 'preprocess' => TRUE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => 1000);
// Add iestyles.min.css.
$style = $theme_path . '/css/iestyles.min.css';
$css[$style] = array('data' => $style, 'type' => 'file', 'every_page' => TRUE, 'media' => 'all', 'preprocess' => FALSE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => FALSE), 'weight' => 1001);
}
开发者ID:kymunr,项目名称:DrupalProject,代码行数:51,代码来源:css.php
示例18: bear_skin_preprocess_html
/**
* Implements template_preprocess_html().
* 1. Adds path variables.
* 2. Include bear skin theme options in Drupal's JS object
* 3. Include a CSS class on the body tag if the site uses sticky footer
*/
function bear_skin_preprocess_html(&$variables, $hook)
{
// Add variables and paths needed for HTML5 and responsive support.
$variables['base_path'] = base_path();
$variables['path_to_bear_skin'] = drupal_get_path('theme', 'bear_skin');
$variables['skip_link_anchor'] = 'main-content';
// put some settings into javascript
drupal_add_js(array('bear_skin' => array('stickyFooter' => (bool) theme_get_setting('sticky_footer'), 'stickyNavbar' => (bool) theme_get_setting('sticky_navbar'), 'stickyNavbarHeight' => (int) theme_get_setting('sticky_navbar_height'), 'userMenu' => (bool) theme_get_setting('user_menu'), 'userLoggedIn' => (bool) user_is_logged_in())), 'setting');
// if the sticky footer option is selected, set a class
if (theme_get_setting('sticky_footer')) {
$variables['classes_array'][] = 'with-sticky-footer';
}
// include the selected language
global $language;
$variables['language'] = $language->language;
}
开发者ID:bruria1,项目名称:forum-yad-vashem,代码行数:22,代码来源:template.php
示例19: sca_responsive_preprocess_page
/**
* Implements hook_preprocess_page().
*
* @see page.tpl.php
*/
function sca_responsive_preprocess_page(&$variables)
{
// Add information about the number of sidebars.
if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
$variables['content_column_class'] = ' class="main-content col-md-4 col-lg-6 col-md-push-4 col-lg-push-3"';
} elseif (!empty($variables['page']['sidebar_first'])) {
$variables['content_column_class'] = ' class="main-content col-md-8 col-lg-9"';
} elseif (!empty($variables['page']['sidebar_second'])) {
$variables['content_column_class'] = ' class="main-content col-md-8 col-lg-9 col-md-pull-4 col-lg-pull-3"';
} else {
// $variables['content_column_class'] = ' class="main-content container ss"';
}
if (!isset($variables['logged_in'])) {
$variables['logged_in'] = user_is_logged_in();
}
}
开发者ID:saulelis,项目名称:sca_responsive,代码行数:21,代码来源:template.php
示例20: bear_coat_preprocess_page
function bear_coat_preprocess_page(&$variables)
{
global $user;
if (!user_is_logged_in()) {
$variables['loginpopup'] = "<div style='display:none'>";
$variables['loginpopup'] .= "<div id='login-popup' class='ui modal login'> <i class='close icon'></i><div class='header'>\n User Login</div>";
// PRINT THE ERROR MESSAGES
$variables['loginpopup'] .= theme('status_messages', array('display' => 'error'));
$login = drupal_get_form('user_login');
$variables['loginpopup'] .= drupal_render($login);
$variables['loginpopup'] .= "</div>";
$variables['loginpopup'] .= "</div>";
$variables['loginpopup'] .= "<a class='loginpopup item floated in' href='#'><i class='setting icon'></i> Login</a>";
} else {
$variables['loginpopup'] = "<a class='loginpopup item floated out' href='/user/logout'><i class='setting icon'></i> Logout</a>";
}
}
开发者ID:sunnythink79,项目名称:bear-skin,代码行数:17,代码来源:template.php
注:本文中的user_is_logged_in函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论