/**
  * Overrides OgSelectionHandler::buildEntityFieldQuery().
  */
 public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $group_type = $this->field['settings']['target_type'];
     // See if the Entity allows for non-member postings
     $user_access = FALSE;
     $event = NULL;
     if ($this->entity && isset($this->entity->og_group_ref[LANGUAGE_NONE][0]['target_id'])) {
         $event = $this->entity->og_group_ref[LANGUAGE_NONE][0]['target_id'];
     } elseif (module_exists('og_context') && isset($_SESSION)) {
         $event = isset($_SESSION['og_context']) ? $_SESSION['og_context'] : og_context('node');
         $event = isset($event['gid']) ? $event['gid'] : NULL;
     }
     if ($event) {
         $user_access = og_user_access('node', $event, "create " . $this->instance['bundle'] . " content") || og_user_access('node', $event, "update own " . $this->instance['bundle'] . " content") || og_user_access('node', $event, "edit any " . $this->instance['bundle'] . " content");
     }
     if (empty($this->instance['field_mode']) || $group_type != 'node' || user_is_anonymous() || !$user_access) {
         return parent::buildEntityFieldQuery($match, $match_operator);
     }
     $handler = EntityReference_SelectionHandler_Generic::getInstance($this->field, $this->instance, $this->entity_type, $this->entity);
     $query = $handler->buildEntityFieldQuery($match, $match_operator);
     // Show only the entities that are active groups.
     $query->fieldCondition(OG_GROUP_FIELD, 'value', 1);
     // Add this property to make sure we will have the {node} table later on in
     // OgCommonsSelectionHandler::entityFieldQueryAlter().
     $query->propertyCondition('nid', 0, '>');
     $query->addMetaData('entityreference_selection_handler', $this);
     // FIXME: http://drupal.org/node/1325628
     unset($query->tags['node_access']);
     $query->addTag('entity_field_access');
     $query->addTag('og');
     return $query;
 }
 public static function getLoggedInAccount()
 {
     if (isset(self::$logged_in_account)) {
         return self::$logged_in_account;
     }
     if (user_is_anonymous()) {
         return NULL;
     }
     global $user;
     self::$logged_in_account = user_load($user->uid);
     return self::$logged_in_account;
 }
Esempio n. 3
0
/**
 * Implements template_preprocess_page().
 */
function bootstrap_preprocess_page(&$variables)
{
    $left_col = array('col-xs-12', 'col-sm-12', 'col-md-12');
    if (isset($variables['page']['sidebar']) && $variables['page']['sidebar']) {
        $left_col = array('col-xs-12', 'col-sm-8', 'col-md-8');
    }
    $breadcrumb_attr = array('id' => 'breadcrumbs', 'class' => array('col-xs-12', 'col-sm-12', 'col-md-12'));
    $left_col_attr = array('id' => 'left-content', 'class' => $left_col, 'role' => 'main');
    $right_col_attr = array('id' => 'right-content', 'class' => array('col-xs-12', 'col-sm-4', 'col-md-3'), 'role' => 'complementary');
    $variables['breadcrumb_attributes_array'] = $breadcrumb_attr;
    $variables['breadcrumb_attributes'] = drupal_attributes($breadcrumb_attr);
    $variables['left_col_attributes'] = drupal_attributes($left_col_attr);
    $variables['right_col_attributes'] = drupal_attributes($right_col_attr);
    global $user;
    $path = current_path();
    if (user_is_anonymous()) {
        switch ($path) {
            case 'user':
            case 'user/login':
                drupal_set_title(t('Log in'));
                $variables['title'] = t('Log in');
                break;
            case 'user/register':
                drupal_set_title(t('Create new account'));
                $variables['title'] = t('Create new account');
                break;
            case 'user/password':
                drupal_set_title(t('Request new password'));
                $variables['title'] = t('Request new password');
                break;
        }
    } else {
        switch ($path) {
            case 'user':
            case 'user/' . $user->uid . '/edit':
                drupal_set_title('My profile');
                break;
            case 'user/' . $user->uid . '/shortcuts':
                drupal_set_title('My shortcuts');
                break;
            case 'user/' . $user->uid . '/devel':
            case 'user/' . $user->uid . '/devel/load':
                drupal_set_title('User devel load');
                break;
            case 'user/' . $user->uid . '/devel/render':
                drupal_set_title('User devel render');
                break;
        }
    }
}
 /**
  * Overrides TicketStateSelectionHandler::buildEntityFieldQuery().
  */
 public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $group_type = $this->field['settings']['target_type'];
     if (empty($this->instance['field_mode']) || $group_type != 'node' || user_is_anonymous()) {
         return parent::buildEntityFieldQuery($match, $match_operator);
     }
     $handler = EntityReference_SelectionHandler_Generic::getInstance($this->field, $this->instance, $this->entity_type, $this->entity);
     $query = $handler->buildEntityFieldQuery($match, $match_operator);
     // Show only the entities that are active groups.
     $query->propertyCondition('active', 1);
     $query->addMetaData('entityreference_selection_handler', $this);
     $query->addTag('entity_field_access');
     return $query;
 }
Esempio n. 5
0
function nesi_bootstrap_menu_link__main_menu(array $variables)
{
    $element = $variables['element'];
    $sub_menu = '';
    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    if ($element['#href'] == 'apply/nojs/create-proposal') {
        if (user_is_anonymous()) {
            $element['#localized_options']['attributes']['data-toggle'] = 'modal';
            $element['#localized_options']['attributes']['data-target'] = '#nesiLoginModal';
            $element['#localized_options']['attributes']['data-remote'] = 'false';
        }
    }
    $element['#attributes']['class'][] = 'menu-' . $element['#original_link']['mlid'];
    $element['#localized_options']['html'] = TRUE;
    $output = l($element['#title'] . '<span>' . $element['#localized_options']['attributes']['title'] . '</span>', $element['#href'], $element['#localized_options']);
    return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
 /**
  * Overrides OgSelectionHandler::buildEntityFieldQuery().
  */
 public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $group_type = $this->field['settings']['target_type'];
     if (empty($this->instance['field_mode']) || $group_type != 'node' || user_is_anonymous()) {
         return parent::buildEntityFieldQuery($match, $match_operator);
     }
     $handler = EntityReference_SelectionHandler_Generic::getInstance($this->field, $this->instance, $this->entity_type, $this->entity);
     $query = $handler->buildEntityFieldQuery($match, $match_operator);
     // Show only the entities that are active groups.
     $query->fieldCondition(OG_GROUP_FIELD, 'value', 1);
     $query->fieldCondition('field_og_subscribe_settings', 'value', 'anyone');
     // Add this property to make sure we will have the {node} table later on in
     // OgCommonsSelectionHandler::entityFieldQueryAlter().
     $query->propertyCondition('nid', 0, '>');
     $query->addMetaData('entityreference_selection_handler', $this);
     // FIXME: http://drupal.org/node/1325628
     unset($query->tags['node_access']);
     $query->addTag('entity_field_access');
     $query->addTag('og');
     return $query;
 }
 /**
  * Overrides OgSelectionHandler::buildEntityFieldQuery().
  */
 public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $group_type = $this->field['settings']['target_type'];
     // See if the Entity allows for non-member postings
     $event_entity_types = cod_events_get_group_content_entity_types();
     if (empty($this->instance['field_mode']) || $group_type != 'node' || user_is_anonymous() || isset($this->instance['bundle']) && !(isset($event_entity_types['node'][$this->instance['bundle']]['non_member']) && user_access("create " . $this->instance['bundle'] . " content"))) {
         return parent::buildEntityFieldQuery($match, $match_operator);
     }
     $handler = EntityReference_SelectionHandler_Generic::getInstance($this->field, $this->instance, $this->entity_type, $this->entity);
     $query = $handler->buildEntityFieldQuery($match, $match_operator);
     // Show only the entities that are active groups.
     $query->fieldCondition(OG_GROUP_FIELD, 'value', 1);
     // Add this property to make sure we will have the {node} table later on in
     // OgCommonsSelectionHandler::entityFieldQueryAlter().
     $query->propertyCondition('nid', 0, '>');
     $query->addMetaData('entityreference_selection_handler', $this);
     // FIXME: http://drupal.org/node/1325628
     unset($query->tags['node_access']);
     $query->addTag('entity_field_access');
     $query->addTag('og');
     return $query;
 }
Esempio n. 8
0
/**
 * Preprocessor for theme('page').
 */
function apigee_devconnect_preprocess_page(&$variables)
{
    $variables['user_reg_setting'] = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
    $menu_tree = menu_tree_output(menu_tree_all_data('main-menu', NULL, 2));
    $variables['primary_nav'] = drupal_render($menu_tree);
    // Custom Search
    $variables['search'] = FALSE;
    if (theme_get_setting('toggle_search') && module_exists('search')) {
        $variables['search'] = drupal_get_form('search_form');
    }
    if (!user_is_anonymous()) {
        # Fix for long user names
        global $user;
        $user_email = $user->mail;
        if (strlen($user_email) > 22) {
            $tmp = str_split($user_email, 16);
            $user_email = $tmp[0] . '&hellip;';
        }
        $variables['truncated_user_email'] = $user_email;
    } else {
        $variables['truncated_user_email'] = '';
    }
}
Esempio n. 9
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);
}
Esempio n. 10
0
/**
 * return rss news feed url
 * @param int $p_project_id
 * @param string $p_username
 * @param bool $p_relative
 * @return string
 */
function rss_get_news_feed_url($p_project_id = null, $p_username = null, $p_relative = true)
{
    if ($p_username === null) {
        $t_username = current_user_get_field('username');
    } else {
        $t_username = $p_username;
    }
    if ($p_project_id === null) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = (int) $p_project_id;
    }
    if ($p_relative) {
        $t_rss_link = '';
    } else {
        $t_rss_link = config_get('path');
    }
    $t_user_id = user_get_id_by_name($t_username);
    // If we have a logged in user then they can be given a 'proper' feed, complete with auth string.
    if (user_is_anonymous($t_user_id)) {
        $t_rss_link .= "news_rss.php";
        if ($t_project_id != ALL_PROJECTS) {
            $t_rss_link .= "?project_id={$t_project_id}";
        }
    } else {
        $t_rss_link .= "news_rss.php?username={$t_username}&key=" . rss_calculate_key($t_user_id);
        if ($t_project_id != ALL_PROJECTS) {
            $t_rss_link .= "&project_id={$t_project_id}";
        }
    }
    return $t_rss_link;
}
Esempio n. 11
0
/**
 * Attempt to login the user with the given password
 * If the user fails validation, false is returned
 * If the user passes validation, the cookies are set and
 * true is returned.  If $p_perm_login is true, the long-term
 * cookie is created.
 * @param string $p_username a prepared username
 * @param string $p_password a prepared password
 * @param bool $p_perm_login whether to create a long-term cookie
 * @return bool indicates if authentication was successful
 * @access public
 */
function auth_attempt_login($p_username, $p_password, $p_perm_login = false)
{
    $t_user_id = user_get_id_by_name($p_username);
    $t_login_method = config_get('login_method');
    if (false === $t_user_id) {
        if (BASIC_AUTH == $t_login_method) {
            $t_auto_create = true;
        } else {
            if (LDAP == $t_login_method && ldap_authenticate_by_username($p_username, $p_password)) {
                $t_auto_create = true;
            } else {
                $t_auto_create = false;
            }
        }
        if ($t_auto_create) {
            # attempt to create the user
            $t_cookie_string = user_create($p_username, md5($p_password));
            if (false === $t_cookie_string) {
                # it didn't work
                return false;
            }
            # ok, we created the user, get the row again
            $t_user_id = user_get_id_by_name($p_username);
            if (false === $t_user_id) {
                # uh oh, something must be really wrong
                # @@@ trigger an error here?
                return false;
            }
        } else {
            return false;
        }
    }
    # check for disabled account
    if (!user_is_enabled($t_user_id)) {
        return false;
    }
    # max. failed login attempts achieved...
    if (!user_is_login_request_allowed($t_user_id)) {
        return false;
    }
    # check for anonymous login
    if (!user_is_anonymous($t_user_id)) {
        # anonymous login didn't work, so check the password
        if (!auth_does_password_match($t_user_id, $p_password)) {
            user_increment_failed_login_count($t_user_id);
            return false;
        }
    }
    # ok, we're good to login now
    # increment login count
    user_increment_login_count($t_user_id);
    user_reset_failed_login_count_to_zero($t_user_id);
    user_reset_lost_password_in_progress_count_to_zero($t_user_id);
    # set the cookies
    auth_set_cookies($t_user_id, $p_perm_login);
    auth_set_tokens($t_user_id);
    return true;
}
Esempio n. 12
0
/**
 * enable monitoring of this bug for the user
 * @param int p_bug_id integer representing bug ids
 * @param int p_user_id integer representing user ids
 * @return true if successful, false if unsuccessful
 * @access public
 * @uses database_api.php
 * @uses history_api.php
 * @uses user_api.php
 */
function bug_monitor($p_bug_id, $p_user_id)
{
    $c_bug_id = (int) $p_bug_id;
    $c_user_id = (int) $p_user_id;
    # Make sure we aren't already monitoring this bug
    if (user_is_monitoring_bug($c_user_id, $c_bug_id)) {
        return true;
    }
    # Don't let the anonymous user monitor bugs
    if (user_is_anonymous($c_user_id)) {
        return false;
    }
    $t_bug_monitor_table = db_get_table('mantis_bug_monitor_table');
    # Insert monitoring record
    $query = 'INSERT INTO ' . $t_bug_monitor_table . '( user_id, bug_id ) VALUES (' . db_param() . ',' . db_param() . ')';
    db_query_bound($query, array($c_user_id, $c_bug_id));
    # log new monitoring action
    history_log_event_special($c_bug_id, BUG_MONITOR, $c_user_id);
    # updated the last_updated date
    bug_update_date($p_bug_id);
    email_monitor_added($p_bug_id, $p_user_id);
    return true;
}
Esempio n. 13
0
/**
 * Implements template_preprocess_page().
 */
function humanitarianresponse_preprocess_page(&$variables) {
  global $theme_path;
  $tree = menu_tree_page_data('main-menu', 1);
  $main_menu_dropdown = menu_tree_output($tree);
  $main_menu_dropdown['#theme_wrappers'] = array();
  $variables['main_menu_dropdown'] = $main_menu_dropdown;
  $variables['hr_tabs'] = array();
  $header_img_path = $theme_path.'/assets/images/headers/general.png';
  if (module_exists('og_context')) {
    $gid = og_context_determine_context('node');
    if (!empty($gid)) {
        $og_group = entity_load('node', array($gid));
        $og_group = $og_group[$gid];
        if ($og_group->type == 'hr_operation') {
          // Salahumanitaria logo
          if ($og_group->nid == 77) { // Nid of the Colombia operation
            $variables['logo'] = '/sites/all/themes/humanitarianresponse/assets/images/salahumanitaria_logo.png';
          }
          if (!empty($og_group->field_operation_type) && !empty($og_group->field_operation_region) && $og_group->field_operation_type[LANGUAGE_NONE][0]['value'] == 'country') {
            // Determine the region of the operation
            $region_id = $og_group->field_operation_region[LANGUAGE_NONE][0]['target_id'];
            $region = entity_load_single('node', $region_id);
            $region_uri = entity_uri('node', $region);
            $region_status = $region->field_operation_status[LANGUAGE_NONE][0]['value'];
            switch ($region_status) {
              case 'active':
                // Add the region to the tabs
                $variables['hr_tabs'][] = l($region->title, $region_uri['path'], $region_uri['options']);
                break;
              case 'inactive':
                break;
              case 'archived':
                break;
            }
          }
        }
        elseif ($og_group->type == 'hr_disaster') {
          $glide = $og_group->field_glide_number[LANGUAGE_NONE][0]['value'];
          if ($glide == 'EP-2014-000041-GIN') {
            $variables['logo'] = '/sites/all/themes/humanitarianresponse/assets/images/unmeer_logo.png';
          }
        }
        elseif ($og_group->type == 'hr_bundle') {
          // Get operation from bundle
          $op_gid = _hr_bundles_get_operation($og_group->nid);
          if (!empty($op_gid)) {
            $operation = entity_load_single('node', $op_gid);
            $op_uri = entity_uri('node', $operation);
            $variables['hr_tabs'][] = l($operation->title, $op_uri['path'], $op_uri['options']);
          }
        }
        $uri = entity_uri('node', $og_group);
        if ($og_group->status) { // Group is published
          $variables['hr_tabs'][] = l($og_group->title, $uri['path'], $uri['options']);
        }
        else {
          $variables['hr_tabs'][] = '<a href="#">'.$og_group->title.'</a>';
        }
        $group_img_path = '/assets/images/headers/'.$og_group->type.'/'.strtolower(str_replace(array(' ','/'), '-', $og_group->title)).'.png';
        if (file_exists(dirname(__FILE__).$group_img_path)) {
          $header_img_path = $theme_path.$group_img_path;
        }
      }
  }

  $variables['og_group_header_image'] = theme('image', array(
    'path' => $header_img_path,
    'alt' => 'Header image',
  ));

  if (user_is_anonymous()) {
    $variables['follow_us_link_href'] = 'user/login';
    $variables['follow_us_link_title'] = t('Login to follow us');
    $variables['follow_us_link_status'] = 'flag';
  }
  else {
    $temp = _humanitarianresponse_flag_follow_us();
    $variables['follow_us_link_href'] = $temp['link_href'];
    $variables['follow_us_link_title'] = $temp['link_title'];
    $variables['follow_us_link_status'] = $temp['link_status'];
  }

  $variables['hr_favorite_spaces'] = _humanitarianresponse_block_render('hr_bookmarks', 'hr_favorite_spaces');
}
Esempio n. 14
0
		<div id="node-<?php 
    echo $entity->nid;
    ?>
" class="col-xs-12 col-md-6 media posdcast">
			<div class="pull-left"><?php 
    list($field) = field_get_items('node', $entity, 'field_image');
    $style = array('path' => $field['uri'], 'style_name' => 'posdcast_cover_image', 'attributes' => array('class' => array('media-object img-thumbnail')));
    echo theme('image_style', $style);
    ?>
<!-- <img class="media-object img-thumbnail" src="<?php 
    echo base_path() . drupal_get_path('theme', 'zdigital') . '/images/podcats_14.jpg';
    ?>
" /> --></div>
			<div class="media-body">
				<h3 class="media-heading"><a href="<?php 
    echo user_is_anonymous() ? url('user/login', array('query' => array('destination' => 'podcasts/' . $entity->nid))) : url('podcasts/' . $entity->nid);
    ?>
"><?php 
    echo $entity->title;
    ?>
</a></h3><?php 
    list($field) = field_get_items('node', $entity, 'body');
    echo text_summary($field['safe_value'], 1, 250);
    ?>
<div class="submitted">
					<span class="date"><span class="icon glyphicon glyphicon-calendar"></span><?php 
    list($field) = field_get_items('node', $entity, 'field_post_date');
    if (!empty($field['value'])) {
        $datetime = strtotime($field['value']);
        echo format_date($datetime, 'custom', 'F d, Y');
    }
Esempio n. 15
0
require_api('gpc_api.php');
require_api('helper_api.php');
require_api('print_api.php');
require_api('user_api.php');
form_security_validate('bug_monitor_delete');
$f_bug_id = gpc_get_int('bug_id');
$t_bug = bug_get($f_bug_id, true);
$f_user_id = gpc_get_int('user_id', NO_USER);
$t_logged_in_user_id = auth_get_current_user_id();
if ($f_user_id === NO_USER) {
    $t_user_id = $t_logged_in_user_id;
} else {
    user_ensure_exists($f_user_id);
    $t_user_id = $f_user_id;
}
if (user_is_anonymous($t_user_id)) {
    trigger_error(ERROR_PROTECTED_ACCOUNT, E_USER_ERROR);
}
bug_ensure_exists($f_bug_id);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
if ($t_logged_in_user_id == $t_user_id) {
    access_ensure_bug_level(config_get('monitor_bug_threshold'), $f_bug_id);
} else {
    access_ensure_bug_level(config_get('monitor_delete_others_bug_threshold'), $f_bug_id);
}
bug_unmonitor($f_bug_id, $t_user_id);
form_security_purge('bug_monitor_delete');
Esempio n. 16
0
/**
 * Check if a user has a protected user account.
 * Protected user accounts cannot be updated without manage_user_threshold
 * permission. If the user ID supplied is that of the anonymous user, this
 * function will always return true. The anonymous user account is always
 * considered to be protected.
 *
 * @param integer $p_user_id A valid user identifier.
 * @return boolean true: user is protected; false: user is not protected.
 * @access public
 */
function user_is_protected($p_user_id)
{
    if (user_is_anonymous($p_user_id) || ON == user_get_field($p_user_id, 'protected')) {
        return true;
    }
    return false;
}
Esempio n. 17
0
/**
 * Page preprocessing
 */
function ciclo20v2_preprocess_page(&$vars)
{
    if ($_GET['q'] != 'user' && strpos($_GET['q'], 'sites') !== 0 && strpos($_GET['q'], 'JQUERY') !== 0) {
        if (user_is_anonymous()) {
            unset($_REQUEST['destination']);
            drupal_goto('user');
        }
    }
    // Format the footer message
    // We do this here instead of in page.tpl.php because
    // we need a formatted message to pass along to the
    // same theme function as the $footer in order to have
    // them nested together
    if (isset($vars['footer_message']) && strlen($vars['footer_message'])) {
        $markup = '';
        $markup .= '<div id="footer-message" class="footer-message">';
        $markup .= '<div id="footer-message-inner" class="footer-message-inner inner">';
        $markup .= $vars['footer_message'];
        $markup .= '</div><!-- /footer-message-inner -->';
        $markup .= '</div><!-- /footer-message -->';
        $vars['footer_message'] = $markup;
    }
    if (isset($vars['node']) && $vars['node']->type === 'group') {
        $vars['tabs'] = '';
        if ($vars['body_id'] === 'pid-node-' . $vars['node']->nid . '-edit') {
            $vars['is_edit'] = TRUE;
        } else {
            $vars['is_edit'] = FALSE;
        }
    }
    if (isset($vars['node'])) {
        // If the node type is "blog" the template suggestion will be "page-blog.tpl.php".
        $vars['template_files'][] = 'page-' . str_replace('_', '-', $vars['node']->type);
    }
    if (isset($vars['template_files'])) {
        foreach ($vars['template_files'] as $tpl) {
            if (strpos($tpl, 'page-user-') !== FALSE) {
                $arr = explode('-', $tpl);
                if (count($arr) > 2 && is_numeric($arr[2])) {
                    $cuid = intval($arr[2]);
                    $cuser = user_load($cuid);
                    if (empty($cuser->profile_name) || empty($cuser->profile_last_name)) {
                        profile_load_profile($cuser);
                    }
                    if (!empty($cuser->profile_name) && !empty($cuser->profile_last_name)) {
                        $vars['title'] = $cuser->profile_name . ' ' . $cuser->profile_last_name;
                    }
                    break;
                }
            }
        }
    }
    // Include language switcher
    $block = module_invoke('locale', 'block', 'view', 0);
    $vars['language_switcher'] = $block['content'];
    // Add a class of "CONTENT-TYPE-node-form" to the <body> tag of each node form.
    // Identify the page as a node form.
    if (arg(0) == 'node' && arg(1) == 'add' || arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'edit') {
        // Retrieve the node type for...
        // The node creation form
        if (arg(0) == 'node' && arg(1) == 'add') {
            $node_type = arg(2);
            // The node edit form
        } else {
            $node_type = $vars['node']->type;
        }
        // Store the current body_classes in an array.
        $body_classes = explode(' ', $vars['body_classes']);
        // Add "content-type-node-form to the array.
        $body_classes[] = $node_type . '-node-form';
        $body_classes[] = 'node-edit';
        // Turn the array back into a string and place it back in the correct key of the $vars array.
        $vars['body_classes'] = implode(' ', $body_classes);
    }
}
Esempio n. 18
0
/**
 * Imlements hook_preprocess_hook().
 *
 * @param $variables
 */
function druio_theme_preprocess_flag(&$variables)
{
    global $user;
    $user_wrapper = entity_metadata_wrapper('user', $user);
    if ($variables['flag']->name == 'ready2work' && !user_is_anonymous()) {
        $field_user_contacts = $user_wrapper->field_user_contacts->value();
        if ($field_user_contacts) {
            $variables['has_contacts'] = TRUE;
        } else {
            $variables['has_contacts'] = FALSE;
        }
        $node = menu_get_object();
        $variables['is_active'] = FALSE;
        if (isset($node) && ($node->type = 'order')) {
            $node_wrapper = entity_metadata_wrapper('node', $node);
            $field_order_status_term = $node_wrapper->field_order_status_term->getIdentifier();
            if ($field_order_status_term == 3420) {
                $variables['is_active'] = TRUE;
            }
        }
        $variables['no_contacts_message'] = format_string('<div class="no-contacts-warning">@text !link</div>', array('@text' => 'Для того чтобы отозваться на заявку, вам необходимо указать личные контактные данные в своём профиле.', '!link' => l('Добавить контактную информацию.', '/user/' . $user->uid . '/edit', array('fragment' => 'edit-field-user-contacts', 'query' => array('destination' => current_path())))));
    }
}
Esempio n. 19
0
/**
 * Returns an array that can be passed to drupal_render() of the given user's sites/roles.
 * @param string $username
 */
function _unl_get_user_audit_content($username)
{
    if (user_is_anonymous()) {
        return array();
    }
    $audit_map = array();
    foreach (unl_get_site_user_map('username', $username) as $site_id => $site) {
        $audit_map[$site_id] = array('uri' => l($site['uri'], $site['uri']), 'roles' => '', 'last_update' => $site['last_update']);
        foreach ($site['roles'] as $role => $user) {
            $audit_map[$site_id]['roles'] .= "{$role} ";
            $audit_map[$site_id]['roles'] .= $GLOBALS['user']->name != $username ? "({$user})" : '';
            $audit_map[$site_id]['roles'] .= "<br />";
        }
    }
    if (count($audit_map) > 0) {
        $header = array('uri' => array('data' => t('Site'), 'field' => 'uri'), 'role' => array('data' => t('Role') . ($GLOBALS['user']->name != $username ? ' (' . t('User') . ')' : '')), 'last_update' => array('data' => t('Last Updated'), 'field' => 'last_update'));
        // Sort the table data accordingly with a custom sort function.
        $order = tablesort_get_order($header);
        $sort = tablesort_get_sort($header);
        $rows = unl_sites_sort($audit_map, $order, $sort);
        // Now that the access timestamp has been used to sort, convert it to something readable.
        foreach ($rows as $key => $row) {
            $rows[$key]['last_update'] = isset($rows[$key]['last_update']) ? format_date($rows[$key]['last_update'], 'short') : t('never');
        }
        $content = array('#theme' => 'table', '#header' => $header, '#rows' => $rows);
        if ($username == $GLOBALS['user']->name) {
            $content['#caption'] = t('You belong to the following sites as a member of the listed roles.');
        } else {
            $content['#caption'] = t('Users matching "@user" belong to the following sites as a member of the listed roles.', array('@user' => $username));
        }
    } else {
        $content = array('#type' => 'item');
        if ($username == $GLOBALS['user']->name) {
            $content['#title'] = t('You do not belong to any roles on any sites.');
        } else {
            $content['#title'] = t('User matching "@user" does not belong to any roles on any sites.', array('@user' => $username));
        }
    }
    return $content;
}
 /**
  * Displays the bean.
  */
 public function view($bean, $content, $view_mode = 'default', $langcode = NULL)
 {
     // Return the active entity information.
     $active_entity = bean_tax_active_entity_array($bean->settings['related']);
     // Create a unique id to be used by the cache.
     if (isset($active_entity['type']) && !empty($active_entity['ids'])) {
         // Determine user role and append to cache.
         if ($active_entity['type'] != 'user') {
             // Grab the highest rid attached to the user.
             global $user;
             $key = max(array_keys($user->roles));
             // Use active entity type, entity id and max role to determine cache id.
             $cid = $active_entity['type'] . ':' . $active_entity['ids'][0] . ':' . $key;
         } else {
             // Use active entity type and entity id to determine cache id.
             $cid = $active_entity['type'] . ':' . $active_entity['ids'][0];
         }
     } else {
         // Create a generic cache id for use otherwise.
         $cid = date('Y:m:d:i');
     }
     // Append language prefix to end of cache id.
     global $language;
     if ($language->prefix != '') {
         $cid = $cid . ':' . $language->prefix;
     }
     // Set the cache name.
     $cache_name = 'bean_tax:related:' . $bean->delta . ':' . $cid;
     // Check for cached content.
     if ($cache = cache_get($cache_name)) {
         $content = $cache->data;
     } else {
         // We need to make sure that the bean is configured correctly.
         if (!empty($active_entity) && !empty($bean->filters['vocabulary']) && !empty($bean->settings['bundle_types'])) {
             // Determine a list of possible terms based on the set vocabulary.
             $possible_tid = $this->getPossibleTerms($bean);
             // Return a list of valid term ids based on the terms attached to the
             // active entity object.
             $valid_tid = array();
             if (isset($active_entity['terms'])) {
                 $this->getValidTerms($active_entity['terms'], $possible_tid, $valid_tid);
             }
             // Use EFQ to return all possible related entites.
             $aggregate = $this->getAggregate($bean);
             // Score and sort any valid results.
             $result = $this->scoreResults($bean, $aggregate, $valid_tid);
             // Related entities initially set to none.
             if (empty($result)) {
                 // Hide block when result is empty and 'hide_empty' option is checked.
                 if (isset($bean->settings['hide_empty']) || !$active_entity['object']) {
                     return;
                 }
                 // There are no related nodes. Set Empty array for theme output.
                 $content['#markup'] = t('No Results');
             } elseif (isset($active_entity['type']) && $active_entity['type'] == 'bean' && $bean->bid === $active_entity['object']->bid) {
                 $content['#markup'] = '';
             } else {
                 // If all else fails, we really must have something to show people.
                 $content['#markup'] = $this->returnMarkup($bean, $result);
                 // Cache the bean where appropriate.
                 if (isset($bean->settings['cache_duration']) && isset($bean->settings['cache_auth_user']) && isset($bean->settings['cache_anon_user'])) {
                     $cache_bean = TRUE;
                     // Check if authenticated user caching is turned off.
                     if ($bean->settings['related'] == 'user' && !$bean->settings['cache_auth_user']) {
                         $cache_bean = FALSE;
                     }
                     // Anonymous user check.
                     $anon = user_is_anonymous();
                     // Check if anonymous user caching is turned off.
                     if ($bean->settings['related'] == 'user' && !$bean->settings['cache_anon_user'] && $anon == TRUE) {
                         $cache_bean = FALSE;
                     }
                     // Check if anonymous user caching is turned on.
                     if ($bean->settings['related'] == 'user' && $bean->settings['cache_anon_user'] && $anon == TRUE) {
                         $cache_bean = TRUE;
                     }
                     // Finally, set the cache after all checks pass.
                     if ($cache_bean) {
                         cache_set($cache_name, $content, 'cache', time() + 60 * $bean->settings['cache_duration']);
                     }
                 }
             }
         }
         // Render the optional "more link" if provided.
         if (!empty($bean->more_link['text']) && !empty($bean->more_link['path'])) {
             $content['#markup'] .= theme('bean_tax_more_link', array('text' => $bean->more_link['text'], 'path' => $bean->more_link['path']));
         }
     }
     return $content;
 }
Esempio n. 21
0
/**
 * Override or insert variables into the html template.
 */
function condenast_preprocess_html(&$vars)
{
    // Fix the viewport and zooming in mobile devices.
    $viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, maximum-scale=1, minimum-scale=1, user-scalable=no, initial-scale=1'));
    if (drupal_is_front_page()) {
        $vars['classes_array'] = array('cn-home');
        // integration with  NetAffiliation
        $code = cn_core_nettaffiliation_generate('main', null);
        if ($code && !empty($code)) {
            drupal_add_js($code);
        }
    }
    if (arg(0) == 'cart') {
        $vars['classes_array'] = array('checkout-page', 'cart-page');
        if (_cn_commerce_count_items_cart() == 0) {
            $vars['classes_array'] = array('checkout-page', 'cart-page', 'empty-cart');
        }
    }
    if (arg(2) == 'complete') {
        $vars['classes_array'] = array('checkout-page');
    }
    if (arg(2) == 'payment') {
        $vars['classes_array'] = array('checkout-page');
    }
    if (arg(3) == 'ogone') {
        $vars['classes_array'] = array('checkout-page');
        drupal_add_css(path_to_theme('condenast') . '/css/ogone.css');
        drupal_add_js(path_to_theme('condenast') . '/js/ogone.js', array('scope' => 'footer'));
    }
    if (arg(0) == 'user') {
        $vars['classes_array'] = array('profile-page');
    }
    if (arg(0) == 'account') {
        $vars['classes_array'] = array('profile-page');
    }
    drupal_add_html_head($viewport, 'viewport');
    // integration with  NetAffiliation on register/login page
    if (arg(0) == 'login') {
        if (!user_is_anonymous()) {
            drupal_goto('account');
            $code = cn_core_nettaffiliation_generate('login', null);
            if ($code && !empty($code)) {
                drupal_add_js($code);
            }
        }
    }
    // integration with  NetAffiliation
    if (arg(0) == 'account') {
        if (!user_is_anonymous()) {
            global $user;
            $uid = $user->uid;
            if (module_exists('user_stats')) {
                $login_count = user_stats_get_stats('login_count', $uid);
                if ($login_count == 1) {
                    $code = cn_core_nettaffiliation_generate('first_login', $uid);
                    if ($code && !empty($code)) {
                        drupal_add_js($code);
                    }
                }
            }
        }
    }
}
Esempio n. 22
0
/**
 * Control site status before menu dispatching.
 *
 * The hook is called after checking whether the site is offline but before
 * the current router item is retrieved and executed by
 * menu_execute_active_handler(). If the site is in offline mode,
 * $menu_site_status is set to MENU_SITE_OFFLINE.
 *
 * @param $menu_site_status
 *   Supported values are MENU_SITE_OFFLINE, MENU_ACCESS_DENIED,
 *   MENU_NOT_FOUND and MENU_SITE_ONLINE. Any other value than
 *   MENU_SITE_ONLINE will skip the default menu handling system and be passed
 *   for delivery to drupal_deliver_page() with a NULL
 *   $default_delivery_callback.
 * @param $path
 *   Contains the system path that is going to be loaded. This is read only,
 *   use hook_url_inbound_alter() to change the path.
 */
function hook_menu_site_status_alter(&$menu_site_status, $path)
{
    // Allow access to my_module/authentication even if site is in offline mode.
    if ($menu_site_status == MENU_SITE_OFFLINE && user_is_anonymous() && $path == 'my_module/authentication') {
        $menu_site_status = MENU_SITE_ONLINE;
    }
}
Esempio n. 23
0
				<li class="suscribe"><?php 
    echo l(t('<span></span>Suscribe'), 'user/register', array('html' => true));
    ?>
</li>
				<?php 
} else {
    ?>
				<li class="account"><?php 
    echo l(t('<span class="glyphicon glyphicon-cog"></span>ADMINISTRAR CUENTA'), 'user/change_password', array('html' => true, 'attributes' => array('data-toggle' => 'modal', 'data-target' => '#modal', 'data-remote' => "true")));
    ?>
</li>
				<?php 
}
?>
				<?php 
if (user_is_anonymous()) {
    ?>
				<li class="login"><?php 
    echo l(t('<span class="icon"></span>Login'), 'user/login', array('html' => true));
    ?>
</li>
				<?php 
} else {
    ?>
				<li class="logout"><?php 
    echo l(t('<span class="glyphicon glyphicon-log-out"></span>Logout'), 'user/logout', array('html' => true));
    ?>
</li>
				<?php 
}
?>
Esempio n. 24
0
/**
 * Override or insert variables into the page template.
 */
function cleancanvas_process_page(&$vars)
{
    $arg = arg();
    if (user_is_anonymous()) {
        $vars['tabs'] = NULL;
    }
    if (drupal_is_front_page()) {
        $vars['navbar_classes'] = "navbar navbar-inverse navbar-fixed-top";
    } else {
        $vars['navbar_classes'] = "navbar navbar-inverse navbar-static-top";
    }
    // hide page title from node page
    if (isset($vars['node'])) {
        if ($vars['node']->type == 'blog') {
            $vars['title'] = null;
        }
        if ($vars['node']->type == 'services') {
            //$vars['title'] = null;
        }
        if ($vars['node']->type == 'portfolio') {
            $vars['title'] = null;
        } else {
            if ($arg[0] == 'node' && $arg[1] == '18') {
                $vars['title'] = NULL;
            } else {
                if ($arg[0] == 'node' && $arg[1] == '20') {
                    $vars['title'] = NULL;
                } else {
                    if ($arg[0] == 'node' && $arg[1] == '25') {
                        $vars['title'] = NULL;
                    } else {
                        if ($arg[0] == 'node' && $arg[1] == '17') {
                            $vars['title'] = NULL;
                        } else {
                            if ($vars['node']->type == 'pricing') {
                                //$vars['title'] = NULL;
                            } else {
                                if ($arg[0] == 'node' && $arg[1] == '23') {
                                    $vars['title'] = NULL;
                                    $vars['tabs'] = NULL;
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        if ($arg[0] == 'user' && sizeof($arg) == 2 && user_is_anonymous()) {
            $vars['title'] = NULL;
        } else {
            if ($arg[0] == 'blog' && sizeof($arg) == 1) {
                $vars['title'] = NULL;
            } else {
                if ($arg[0] == 'user' && sizeof($arg) == 1 && user_is_anonymous()) {
                    $vars['title'] = NULL;
                }
            }
        }
    }
}
Esempio n. 25
0
/**
 * Implements hook_form_BASE_FORM_ID_alter().
 */
function devis_form_devenir_entityform_edit_form_alter(&$form, &$form_state, $form_id)
{
    global $user;
    if (in_array('provider', $user->roles)) {
        drupal_set_message(t('AVIS: Vous êtes déjà fournisseur.'), 'warning');
        $form['actions']['submit']['#access'] = FALSE;
    }
    $theme_path = drupal_get_path('theme', variable_get('theme_default', NULL));
    $form['#attached']['js'][] = $theme_path . '/js/easydropdown/jquery.easydropdown.min.js';
    $form['#attached']['css'][] = $theme_path . '/css/easydropdown.css';
    // Honorific, Name and Surname on the same line.
    $lang = $form['field_honorific']['#language'];
    $label = '<label for="edit-field-honorific-' . $lang . '">' . t('Last name') . ' <span class="form-required" title="' . t('Ce champ est requis.') . '">*</span></label>';
    $form['field_honorific']['#prefix'] = '<div class="container-wrapper">' . $label;
    $form['field_honorific'][$lang]['#options'] = array('_none' => t('Civilité')) + $form['field_honorific'][$lang]['#options'];
    $form['field_honorific'][$lang]['#title'] = t('Civilité');
    $form['field_honorific'][$lang]['#title_display'] = 'invisible';
    $form['field_honorific'][$lang]['#attributes']['class'][] = 'dropdown';
    $form['field_honorific']['#attributes']['class'][] = 'dropdown-honorific';
    $lang = $form['field_prenom']['#language'];
    $form['field_prenom'][$lang][0]['value']['#attributes']['placeholder'] = $form['field_prenom'][$lang][0]['value']['#title'] = t('First name');
    $form['field_prenom'][$lang][0]['value']['#title_display'] = 'invisible';
    $lang = $form['field_name']['#language'];
    $form['field_name'][$lang][0]['value']['#attributes']['placeholder'] = $form['field_name'][$lang][0]['value']['#title'] = t('Last name');
    $form['field_name'][$lang][0]['value']['#title_display'] = 'invisible';
    $form['field_name']['#suffix'] = '</div>';
    // Email and telephone in the same line.
    $lang = $form['field_email']['#language'];
    $label = '<label for="edit-field-email-' . $lang . '">' . t('Contact') . ' <span class="form-required" title="' . t('Ce champ est requis.') . '">*</span></label>';
    $form['field_email']['#prefix'] = '<div class="container-wrapper">' . $label;
    $form['field_email'][$lang][0]['email']['#title'] = 'E-mail';
    $form['field_email'][$lang][0]['email']['#title_display'] = 'invisible';
    $form['field_email'][$lang][0]['email']['#attributes']['placeholder'] = 'E-mail';
    $form['field_email'][$lang][0]['email']['#attributes']['class'][] = 'input-fixed-width';
    $lang = $form['field_phone_belgium']['#language'];
    $form['field_phone_belgium'][$lang][0]['value']['#title_display'] = 'invisible';
    //$form['field_phone_belgium'][$lang][0]['value']['#prefix'] = '<span class="prefix-phone">+32</span>';
    $form['field_phone_belgium'][$lang][0]['value']['#attributes']['placeholder'] = t('Telephone');
    $form['field_phone_belgium'][$lang][0]['value']['#attributes']['class'][] = 'input-fixed-width';
    $form['field_phone_belgium']['#suffix'] = '</div>';
    // Website.
    $form['#after_build'][] = 'devis_form_devenir_entityform_edit_form_after_build';
    // Address fields.
    $lang = $form['field_adresse']['#language'];
    $form['field_adresse'][$lang][0]['#prefix'] = '';
    $form['field_adresse'][$lang][0]['#suffix'] = '';
    $form['field_adresse'][$lang][0]['#title'] = '';
    $form['field_adresse'][$lang][0]['#attributes']['class'][] = 'fieldset-hide';
    $form['field_adresse'][$lang][0]['street_block']['thoroughfare']['#title'] = t('Address');
    $form['field_adresse'][$lang][0]['street_block']['premise']['#attributes']['style'] = 'display: none;';
    $form['field_adresse'][$lang][0]['street_block']['premise']['#title_display'] = 'invisible';
    // If the request is being checked by a manager, so it is not new.
    if (in_array('manager', array_values($user->roles)) && !isset($form_state['build_info']['args'][0]->is_new)) {
        $entity = $form_state['build_info']['args'][0];
        $mail = $entity->field_email[$form['field_email']['#language']][0]['email'];
        $lang = key($entity->field_approval);
        $approval = $entity->field_approval[$lang][0]['value'];
        // If the mail of the request is already registered.
        if ($approval == 'pending') {
            $account = user_load_by_mail($mail);
            if ($account) {
                drupal_set_message(t('Notice: The requester is already registered in the system: !user', array('!user' => theme('username', array('account' => $account)))), 'warning');
                $form['actions']['#access'] = FALSE;
            }
        } else {
            drupal_set_message(t('Notice: This request can no longer be modified.'), 'warning');
            $form['actions']['#access'] = FALSE;
        }
        $form_state['set_redirect'] = TRUE;
    } else {
        if (user_is_anonymous()) {
            $cid = variable_get('trois_devis_registration_promo_id', 0);
            $promo_code = promo_code_load($cid);
            if ($promo_code) {
                drupal_set_message(t('Register now and get a !promo_discount EUR discount!', array('!promo_discount' => $promo_code->discount / 100)), 'promo');
                $lang = $form['field_promotional_code']['#language'];
                $form['field_promotional_code'][$lang][0]['value']['#default_value'] = $promo_code->code;
            }
        }
    }
    // Extra validation rules.
    $form['#validate'][] = 'devis_devenir_entityform_edit_form_validate';
    $form['actions']['submit']['#validate'][] = 'devis_devenir_entityform_edit_form_validate';
    // Extra submission rules.
    $form['#submit'][] = 'devis_devenir_entityform_edit_form_submit';
    $form['actions']['save']['#submit'][] = 'devis_devenir_entityform_edit_form_submit';
}
<!--[a60_50_service_and_contact.tpl.php]<br>-->
<div id="service_contact_root">
<div class="service_contact_wrapper">

	<div class="affiliates_partners_inner content_inner row clear">

		<div class="table">
				<div class="tr">

					<?foreach ( $items['nodes'] as $node ){ ?>
						<? if($currentRow % 4 == 0) {?></div><div class="tr"> <? } ?>

					 

					    <div class="branch card yellow ae_wrapper">
<?      if ( ! user_is_anonymous() ){ ?>
					    	<a class="edit" href="/<?php 
echo $language->language;
?>
/node/<?php 
echo $node->nid;
?>
/edit"><span class="icon-edit"></span></a>
<?      } ?>
					        <a class="cs_anchor" href="<?php 
echo nsv($node, 'field_link');
?>
">     
				            <div class="card_head">
				            	
				            	<h4 class="bold text-white no-margin"><?php 
Esempio n. 27
0
/**
 * Returns true if the current user is the anonymous user.
 *
 * @return true: user is anonymous; false: otherwise.
 * @access public
 */
function current_user_is_anonymous()
{
    return user_is_anonymous(auth_get_current_user_id());
}
Esempio n. 28
0
/**
 * Attempt to login the user with the given password
 * If the user fails validation, false is returned
 * If the user passes validation, the cookies are set and
 * true is returned.  If $p_perm_login is true, the long-term
 * cookie is created.
 * @param string  $p_username   A prepared username.
 * @param string  $p_password   A prepared password.
 * @param boolean $p_perm_login Whether to create a long-term cookie.
 * @return boolean indicates if authentication was successful
 * @access public
 */
function auth_attempt_login($p_username, $p_password, $p_perm_login = false)
{
    $t_user_id = auth_get_user_id_from_login_name($p_username);
    if ($t_user_id === false) {
        $t_user_id = auth_auto_create_user($p_username, $p_password);
        if ($t_user_id === false) {
            return false;
        }
    }
    # check for disabled account
    if (!user_is_enabled($t_user_id)) {
        return false;
    }
    # max. failed login attempts achieved...
    if (!user_is_login_request_allowed($t_user_id)) {
        return false;
    }
    # check for anonymous login
    if (!user_is_anonymous($t_user_id)) {
        # anonymous login didn't work, so check the password
        if (!auth_does_password_match($t_user_id, $p_password)) {
            user_increment_failed_login_count($t_user_id);
            return false;
        }
    }
    # ok, we're good to login now
    # increment login count
    user_increment_login_count($t_user_id);
    user_reset_failed_login_count_to_zero($t_user_id);
    user_reset_lost_password_in_progress_count_to_zero($t_user_id);
    # set the cookies
    auth_set_cookies($t_user_id, $p_perm_login);
    auth_set_tokens($t_user_id);
    return true;
}
Esempio n. 29
0
/**
 * Decides which file type (bundle) should be assigned to a file entity.
 *
 * @param $file
 *   File object.
 *
 * @return
 *   Array of file type machine names that can be assigned to a given file type.
 *   If there are more proposed file types the one, that was returned the first,
 *   wil be chosen. This can be, however, changed in alter hook.
 *
 * @see hook_file_type_alter()
 */
function hook_file_type($file)
{
    // Assign all files uploaded by anonymous users to a special file type.
    if (user_is_anonymous()) {
        return array('untrusted_files');
    }
}
Esempio n. 30
0
</div>
                    <?php 
}
?>
                    <?php 
if ($action_links) {
    ?>
                    <ul class="action-links"><?php 
    print render($action_links);
    ?>
</ul>
                    <?php 
}
?>
		    <?php 
if ($columns != 1 && arg(2) != 'edit' && user_is_anonymous()) {
    ?>
                    <div class="row facebookbtn-page">
		    <div class="span5 right-separator">
                    <?php 
    print render($page['content']);
    ?>
			<span class="option-separator"><span class="option-text"><?php 
    print t('Or');
    ?>
</span></span>
		    </div>
		    <div class="span3 pl20">
			<div class="fb-block">
			<p class="fb-desc"><?php 
    print t('Not a mermix User? Connect using your facebook account');