Esempio n. 1
0
 public function find_author_img($id = 0)
 {
     if ((int) $id == 0) {
         return false;
     }
     $name = parent::find($id);
     return gravatar_link($name->email);
 }
Esempio n. 2
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     Events::trigger('before_controller', get_class($this));
     parent::__construct();
     // Load Activity Model Since it's used everywhere.
     $this->load->model('activities/Activity_model', 'activity_model');
     // Auth setup
     $this->load->model('users/User_model', 'user_model');
     $this->load->library('users/auth');
     // Load our current logged in user so we can access it anywhere.
     if ($this->auth->is_logged_in()) {
         $this->current_user = $this->user_model->find($this->auth->user_id());
         $this->current_user->id = (int) $this->current_user->id;
         $this->current_user->user_img = gravatar_link($this->current_user->email, 22, $this->current_user->email, "{$this->current_user->email} Profile");
         // if the user has a language setting then use it
         if (isset($this->current_user->language)) {
             $this->config->set_item('language', $this->current_user->language);
         }
     }
     // Make the current user available in the views
     $this->load->vars(array('current_user' => $this->current_user));
     // load the application lang file here so that the users language is known
     $this->lang->load('application');
     /*
     	Performance optimizations for production environments.
     */
     if (ENVIRONMENT == 'production') {
         $this->db->save_queries = FALSE;
         $this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
     } else {
         if (ENVIRONMENT == 'testing') {
             $this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
         } else {
             if (ENVIRONMENT == 'development') {
                 if ($this->settings_lib->item('site.show_front_profiler') and has_permission('Bonfire.Profiler.View')) {
                     // Profiler bar?
                     if (!$this->input->is_cli_request() and !$this->input->is_ajax_request()) {
                         $this->load->library('Console');
                         $this->output->enable_profiler(TRUE);
                     }
                 }
                 $this->load->driver('cache', array('adapter' => 'dummy'));
             }
         }
     }
     // Auto-migrate our core and/or app to latest version.
     if ($this->config->item('migrate.auto_core') || $this->config->item('migrate.auto_app')) {
         $this->load->library('migrations/migrations');
         $this->migrations->auto_latest();
     }
     // Make sure no assets in up as a requested page or a 404 page.
     if (!preg_match('/\\.(gif|jpg|jpeg|png|css|js|ico|shtml)$/i', $this->uri->uri_string())) {
         $this->previous_page = $this->session->userdata('previous_page');
         $this->requested_page = $this->session->userdata('requested_page');
     }
     // Pre-Controller Event
     Events::trigger('after_controller_constructor', get_class($this));
 }
Esempio n. 3
0
 /**
  * If the Auth lib is loaded, it will set the current user, since users
  * will never be needed if the Auth library is not loaded. By not requiring
  * this to be executed and loaded for every command, we can speed up calls
  * that don't need users at all, or rely on a different type of auth, like
  * an API or cronjob.
  *
  * Copied from Base_Controller
  */
 protected function set_current_user()
 {
     if (class_exists('Auth')) {
         // Load our current logged in user for convenience
         if ($this->auth->is_logged_in()) {
             $this->current_user = clone $this->auth->user();
             $this->current_user->user_img = gravatar_link($this->current_user->email, 22, $this->current_user->email, "{$this->current_user->email} Profile");
             // if the user has a language setting then use it
             if (isset($this->current_user->language)) {
                 $this->config->set_item('language', $this->current_user->language);
             }
         } else {
             $this->current_user = null;
         }
         // Make the current user available in the views
         if (!class_exists('Template')) {
             $this->load->library('Template');
         }
         Template::set('current_user', $this->current_user);
     }
 }
Esempio n. 4
0
" id="tb_email" class="btn dark" title="<?php 
echo lang('bf_user_settings');
?>
">
									<?php 
echo isset($current_user->display_name) && !empty($current_user->display_name) ? $current_user->display_name : ($this->settings_lib->item('auth.use_usernames') ? $current_user->username : $current_user->email);
?>
								</a>
								<!-- Change **light** to **dark** to match colors -->
								<a class="btn dropdown-toggle light" data-toggle="dropdown" href="#"><span class="caret"></span></a>
								<ul class="dropdown-menu pull-right toolbar-profile">
									<li>
										<div class="inner">
											<div class="toolbar-profile-img">
												<?php 
echo gravatar_link($current_user->email, 96, null, $current_user->display_name);
?>
											</div>

											<div class="toolbar-profile-info">
												<p><b><?php 
echo $current_user->display_name;
?>
</b><br/>
													<?php 
e($current_user->email);
?>
													<br/>
												</p>
												<a href="<?php 
echo site_url(SITE_AREA . '/settings/users/edit');
Esempio n. 5
0
			<div class="list-view" id="user-list">
			<?php 
    foreach ($users as $user) {
        ?>
				<?php 
        if (isset($user) && has_permission('Permissions.' . $user->role_name . '.Manage')) {
            ?>
				<div class="list-item with-icon" data-id="<?php 
            echo $user->id;
            ?>
" data-role="<?php 
            echo $user->role_name;
            ?>
">
					<?php 
            echo gravatar_link($user->email, 32, '', $user->first_name . '&nbsp;' . $user->last_name);
            ?>
				
					<p>
						<?php 
            if (config_item('auth.use_own_names')) {
                $name = trim($this->auth->user_name());
                if (empty($name)) {
                    if (!empty($user->username)) {
                        $name = $user->username;
                    } else {
                        $name = $user->email;
                    }
                }
            } else {
                if (config_item('auth.use_usernames') && $user->username) {
Esempio n. 6
0
">
                                <?php 
$userDisplayName = isset($current_user->display_name) && !empty($current_user->display_name) ? $current_user->display_name : ($this->settings_lib->item('auth.use_usernames') ? $current_user->username : $current_user->email);
echo $userDisplayName;
?>
                            </a>
                            <?php 
/* Change **light** to **dark** to match colors */
?>
                            <a class="btn dropdown-toggle light" data-toggle="dropdown" href="#"><span class="caret"></span></a>
                            <ul class="dropdown-menu pull-right toolbar-profile">
                                <li>
                                    <div class="inner">
                                        <div class="toolbar-profile-img">
                                            <?php 
echo gravatar_link($current_user->email, 96, null, $userDisplayName);
?>
                                        </div>

                                        <div class="toolbar-profile-info">
                                            <p><strong><?php 
echo $userDisplayName;
?>
</strong><br />
                                                <?php 
e($current_user->email);
?>
                                                <br/>
                                            </p>
                                            <a href="<?php 
echo site_url(SITE_AREA . '/settings/users/edit');
Esempio n. 7
0
				<option value="0">Show role...</option>
			<?php foreach ($roles as $role) : ?>
				<option><?php echo $role->role_name ?></option>
			<?php endforeach; ?>
			</select>
			
			<?php render_search_box(); ?>
		</div>
	
		<?php if (isset($users) && is_array($users)) : ?>
		
		<div class="scrollable">
			<div class="list-view" id="user-list">
			<?php foreach ($users as $user) : ?>
				<div class="list-item with-icon" data-id="<?php echo $user->id ?>" data-role="<?php echo $user->role_name ?>">
					<?php echo gravatar_link($user->email, 32); ?>
				
					<p>
						<b><?php echo config_item('auth.login_type') == 'username' ? $user->username : $user->email; ?></b><br/>
						<span><?php echo $user->role_name ?></span>
					</p>
				</div>
			<?php endforeach; ?>
			</div>	<!-- /list -->
		</div>
		
		<?php else : ?>
		
			<div class="notification information">
				<p>No users found.</p>
			</div>