示例#1
0
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);
    }
}
示例#2
0
 /**
  * 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;
 }
示例#3
0
/**
 * 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');
    }
}
示例#4
0
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;
}
示例#5
0
文件: template.php 项目: 318io/318-io
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;
}
示例#6
0
    /**
     * @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>';
        }
    }
 /**
  * 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);
     }
 }
示例#8
0
/**
 * 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));
    }
}
示例#9
0
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';
    }
}
示例#10
0
 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');
     }
 }
示例#11
0
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');
        }
    }
}
示例#12
0
文件: raven.api.php 项目: seefood/ssd
/**
 * 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);
    }
}
/**
 * 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;
}
示例#14
0
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');
    }
}
示例#15
0
/**
 * 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;
    }
}
示例#16
0
 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';
     }
 }
示例#17
0
/**
 * 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);
}
示例#18
0
/**
 * 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;
}
示例#19
0
/**
 * 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();
    }
}
示例#20
0
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>";
    }
}
示例#21
0
/**
 * Implements template_preprocess_html().
 */
function druiot_preprocess_html(&$variables)
{
    // Redefine body classes.
    $variables['classes_array'] = array();
    $element_children = element_children($variables['page']['sidebar_right']);
    if (!empty($element_children)) {
        $variables['classes_array'][] = 'sidebar-right';
        if (drupal_is_front_page()) {
            $variables['classes_array'][] = 'frontpage';
        }
    } else {
        $variables['classes_array'][] = 'no-sidebar';
    }
    if (user_is_logged_in()) {
        $variables['classes_array'][] = 'registered';
    } else {
        $variables['classes_array'][] = 'anonymous';
    }
}
示例#22
0
/**
 * Implements theme_preprocess_html().
 */
function subtpl_preprocess_html(&$variables, $hook)
{
    // add body frontpage class
    if (!empty($variables['page']['content']['system_main']['nodes'])) {
        $node = reset($variables['page']['content']['system_main']['nodes']);
        if ($node['#bundle'] == 'frontpage' && !drupal_is_front_page()) {
            $variables['classes_array'][] = 'frontpage';
        }
    }
    // add stylesheet for logged in users & login pages
    if (user_is_logged_in() || arg(0) == 'user') {
        drupal_add_css(path_to_theme() . '/less/system.less', array('group' => CSS_DEFAULT, 'weight' => 98));
    }
    // add stylesheet for admin backend
    if (user_is_logged_in() && path_is_admin(current_path())) {
        drupal_add_css(path_to_theme() . '/less/admin.less', array('group' => CSS_DEFAULT, 'weight' => 99));
    }
    // add google webfont
    drupal_add_css('https://fonts.googleapis.com/css?family=Titillium+Web:400,300,300italic,400italic,600,600italic,700,700italic,900', array('type' => 'external'));
}
示例#23
0
/**
 * Implements hook_preprocess_page
 *
 * @param $vars
 */
function hmsop2015_preprocess_page(&$vars)
{
    //    print_r($vars);
    // Remove the default system message
    unset($vars['page']['content']['system_main']['default_message']);
    // Non-authenticated users are required to login
    if (!user_is_logged_in()) {
        unset($vars['page']['content']['system_main']['main']);
        $vars['main_menu'] = '';
    } else {
        // Main menu
        $main_menu = $vars['main_menu'];
        $vars['main_menu'] = theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('nav', 'navbar-nav')), 'heading' => null));
        // Search form
        $search_form = drupal_get_form('search_block_form');
        $vars['search_form'] = drupal_render($search_form);
    }
    // Add the infobar, if permitted
    $infobar = '';
    if (user_access('access content')) {
        $infobar = theme('infobar');
    }
    $vars['page']['infobar'] = $infobar;
    // Test if the Search form & results are present (i.e. on the Search page)
    if (!empty($vars['page']['content']['system_main']['search_form']) && !empty($vars['page']['content']['system_main']['search_results'])) {
        // Wrap in a container
        $vars['page']['content']['system_main']['search_form']['#prefix'] = '<div class="hmsop-search"><div class="container">';
        $vars['page']['content']['system_main']['search_results']['#suffix'] = '</div></div>';
        // Test for empty results and show a message if needed
        if (isset($vars['page']['content']['system_main']['search_results']['#markup']) && empty($vars['page']['content']['system_main']['search_results']['#markup'])) {
            $vars['page']['content']['system_main']['search_results']['#markup'] = t('Use the Keywords field to search for content.');
        }
    }
    // Test if the Comment reply parent and form are present (i.e. on a Comment Reply page)
    if (!empty($vars['page']['content']['system_main']['comment_parent']) && !empty($vars['page']['content']['system_main']['comment_form'])) {
        // Wrap in a container
        $vars['page']['content']['system_main']['comment_parent']['#prefix'] = '<div class="container"><div class="hmsop-form hmsop-form-comment_reply"><div class="page-header"><h1 id="page-name">' . t('Comment Reply') . '</h1></div>';
        $vars['page']['content']['system_main']['comment_form']['#suffix'] = '</div></div>';
    }
}
示例#24
0
/**
 * Implements theme_js_alter().
 */
function basetpl_js_alter(&$javascript)
{
    unset($javascript['sites/all/modules/views_bulk_operations/js/views_bulk_operations.js']);
    unset($javascript['modules/user/user.permissions.js']);
    if (!user_is_logged_in() && !path_is_admin(current_path())) {
        unset($javascript['sites/all/modules/linkit/js/linkit.js']);
        unset($javascript['sites/all/modules/linkit/editors/ckeditor/linkitDialog.js']);
        unset($javascript['misc/progress.js']);
        unset($javascript['misc/ui/jquery.ui.core.min.js']);
        unset($javascript['misc/ui/jquery.ui.button.min.js']);
        unset($javascript['misc/ui/jquery.ui.widget.min.js']);
        unset($javascript['misc/ui/jquery.ui.dialog.min.js']);
        unset($javascript['misc/ui/jquery.ui.mouse.min.js']);
        unset($javascript['misc/ui/jquery.ui.draggable.min.js']);
        unset($javascript['misc/ui/jquery.ui.position.min.js']);
        unset($javascript['misc/ui/jquery.ui.resizable.min.js']);
        unset($javascript['misc/tableheader.js']);
        unset($javascript['sites/all/modules/views/js/jquery.ui.dialog.patch.js']);
        unset($javascript['sites/all/modules/iframe/iframe.js']);
        unset($javascript['modules/contextual/contextual.js']);
    }
}
示例#25
0
 function __construct($action = false)
 {
     parent::__construct();
     $explodedpath = explode('/', current_path());
     $this->event_id = $this->clearContent($explodedpath[1]);
     $this->event = new events();
     $this->tagsHelper = new tags();
     $this->adressHelper = new adressen();
     // Sollen die Werte im Anschluss gespeichert oder geupdatet werden?
     if ($action == 'update') {
         $this->target = 'update';
         if (!user_is_logged_in() || !$this->event->isAuthorized($this->event_id, $this->user_id)) {
             drupal_access_denied();
             drupal_exit();
         }
     } else {
         if (!user_is_logged_in()) {
             drupal_access_denied();
             drupal_exit();
         }
     }
 }
示例#26
0
/**
 * Override or insert variables into the page templates.
 *
 *   An array of variables to pass to the theme template.
 *
 * @param $vars
 * @param $hook
 *
 * The name of the template being rendered ("page" in this case.)
 */
function xeros_theme_preprocess_page(&$vars, $hook)
{
    // Select all the companies and all the child locations and add to page
    // as array or JSON object
    $user = user_load($vars["user"]->uid);
    if (isset($user->field_company['und'][0]['target_id'])) {
        $company = node_load($user->field_company['und'][0]['target_id']);
        $user->company = array('id' => $company->nid, 'name' => $company->title);
    }
    if (isset($user->field_location['und'][0]['target_id'])) {
        $location = node_load($user->field_location['und'][0]['target_id']);
        $user->location = array('id' => $location->nid, 'name' => $location->title);
    }
    unset($user->pass);
    drupal_add_js('var context = context || {}; context.user = '******'type' => 'inline', 'scope' => 'footer', 'weight' => 1));
    if (user_is_logged_in()) {
        $s = xeros_get_companies($vars);
        drupal_add_js('context.companies = ' . json_encode($s), array('type' => 'inline', 'scope' => 'footer', 'weight' => 1));
        $vars['user']->show_admin_bar = 1;
    } else {
        $vars['user']->show_admin_bar = 0;
    }
}
示例#27
0
function onelogin_saml_acs()
{
    global $user;
    // If a user initiates a login while they are already logged in, simply send them to their profile.
    if (user_is_logged_in() && !user_is_anonymous()) {
        drupal_goto('user/' . $user->uid);
    } else {
        if (isset($_POST['SAMLResponse']) && !empty($_POST['SAMLResponse'])) {
            $auth = initialize_saml();
            $auth->processResponse();
            $errors = $auth->getErrors();
            if (!empty($errors)) {
                drupal_set_message("There was at least one error processing the SAML Response" . implode("<br>", $errors), 'error', FALSE);
                drupal_goto('');
            }
            onelogin_saml_auth($auth);
        } else {
            drupal_set_message("No SAML Response found.", 'error', FALSE);
            drupal_goto('');
        }
    }
    drupal_goto('user/' . $user->uid);
}
示例#28
0
function bootstork_preprocess_page(&$variables, $hook)
{
    if ($node = menu_get_object()) {
        $nid = $node->nid;
    }
    if (isset($variables['node']->type) && $nid != '3082' && $nid != '3084') {
        //the two splash pages are excluded.
        // this function makes content type templates possible
        $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
    }
    if (arg(0) == 'user') {
        // This function sets custom page titles for the user pages
        switch (arg(1)) {
            case NULL:
                if (!user_is_logged_in()) {
                    drupal_set_title(t('Log in'));
                }
                break;
            case 'dispensary':
                drupal_set_title(t('Register as a Dispensary Admin'));
                // this doesn't work for some reason
                break;
            case 'register':
                drupal_set_title(t('Register'));
                break;
            case 'password':
                drupal_set_title(t('Request new password'));
                break;
            case 'login':
                drupal_set_title(t('Log in'));
                break;
        }
    }
    //loads jquery.cookie site wide
    drupal_add_library('system', 'jquery.cookie');
}
示例#29
0
    /**
     *  @function removeAkteur()
     *  Removes an Akteur from DB
     *  TODO: t()!!! 
     */
    public function removeAkteur()
    {
        if (!user_is_logged_in() || !$this->isAuthorized($this->akteur_id)) {
            drupal_access_denied();
            drupal_exit();
        }
        if (isset($_POST['submit'])) {
            $this->__removeAkteur($this->akteur_id);
            if (session_status() == PHP_SESSION_NONE) {
                session_start();
            }
            drupal_set_message(t('Der Akteur wurde gelöscht.'));
            header('Location: ' . $base_url . '/akteure');
        } else {
            $pathThisFile = $_SERVER['REQUEST_URI'];
            return '<div class="callout row">
 <h3>Möchten Sie den Akteur wirklich löschen?</h3><br />
 <form action="#" method="POST" enctype="multipart/form-data">
   <a class="secondary button" href="javascript:history.go(-1)">Abbrechen</a>
   <input type="submit" class="button" id="akteurSubmit" name="submit" value="Löschen">
 </form>
 </div>';
        }
    }
示例#30
0
 /**
  * Get currently logged in user uf id.
  *
  * @return int $userID logged in user uf id.
  */
 public function getLoggedInUfID()
 {
     $ufID = NULL;
     if (function_exists('user_is_logged_in') && user_is_logged_in() && function_exists('user_uid_optional_to_arg')) {
         $ufID = user_uid_optional_to_arg(array());
     }
     return $ufID;
 }