Ejemplo n.º 1
0
 function index()
 {
     $this->load->model('User_Model', '', TRUE);
     $this->load->model('Usermodel', '', TRUE);
     $this->load->model('Userprofile', '', TRUE);
     if (isValidUser()) {
         $user = $this->User_Model->get_user_by_id(getUserProperty('id'));
     } else {
         redirect("", "location");
         return;
     }
     // Process form
     if (!empty($_POST)) {
         $profile_data = array('notifications' => $this->input->post('notifications'));
         $user_data = array('user_name' => $this->input->post('phone'));
         if (!empty($_POST['password'])) {
             $user_data['password'] = $this->freakauth_light->_encode($this->input->post('password'));
         }
         $this->Userprofile->updateUserProfile(getUserProperty('id'), $profile_data);
         $this->User_Model->update_user_by_id(getUserProperty('id'), $user_data);
         $this->db_session->set_flashdata('success', 'You have updated your account information');
         redirect('/profile');
     }
     $this->load->view('templates/header', $user);
     $this->load->view('user/profile', $user);
     $this->load->view('templates/footer');
 }
Ejemplo n.º 2
0
 function Posts()
 {
     parent::Controller();
     $this->load->module_model('account', 'usermodel');
     $this->load->model('forum_model');
     $this->load->model('post_model');
     $this->lang->load('forum');
     $this->config->load('forums');
     // Add a link to the forum CSS into the head
     $this->template->extra_head(css_asset('forum.css', 'forum'));
     $this->userID = getUserProperty('id');
     $this->data = array('userID' => $this->userID, 'message' => '');
 }
Ejemplo n.º 3
0
 function Topics()
 {
     parent::Controller();
     $this->load->module_model('account', 'usermodel');
     $this->load->model('forum_model');
     $this->load->model('post_model');
     $this->lang->load('forum');
     $this->config->load('forums');
     // Add a link to the forum CSS into the head
     $this->template->extra_head(css_asset('forum.css', 'forum'));
     $this->userID = getUserProperty('id');
     $this->data = array('userID' => $this->userID, 'message' => '');
     if (isAdmin()) {
         $this->template->navigation(array('Manage Categories' => 'forums/admin/categories', 'Manage Forums' => 'forums/admin/forums'));
     }
 }
Ejemplo n.º 4
0
 function index()
 {
     $this->load->model('User_Model', '', TRUE);
     $this->load->model('Plan_Model', '', TRUE);
     $this->load->model('Gram_Model', '', TRUE);
     $this->load->model('Message_Model', '', TRUE);
     if (isValidUser()) {
         $user = $this->User_Model->get_user_by_id(getUserProperty('id'));
     } else {
         redirect("", "location");
         return;
     }
     $messages = $this->Message_Model->get_messages_by_user_id($user["user_id"]);
     $this->load->view('templates/header', array("user" => $user));
     $this->load->view('dashboard/stats', array("messages" => $messages));
     $this->load->view('templates/footer');
 }
Ejemplo n.º 5
0
 function index()
 {
     $this->load->model('User_Model', '', TRUE);
     $this->load->model('Plan_Model', '', TRUE);
     $this->load->model('Gram_Model', '', TRUE);
     if (!isValidUser()) {
         $data['fal'] = $this->fal_front->register();
         $this->load->view('templates/header');
         $this->load->view('templates/home', $data);
     } else {
         $first_use = false;
         $user = $this->User_Model->get_user_by_id(getUserProperty('id'));
         if ($user["welcome_message_seen"] == 0) {
             $first_use = true;
         }
         $this->load->view('templates/header', array("user" => $user));
         $plan = $this->Plan_Model->get_plan_by_user_id(getUserProperty('id'));
         //echo "<pre>Plan: ".print_r($plan, true)."</pre>\n";
         $grams = $this->Gram_Model->get_grams_by_plan_id($plan["plan_id"]);
         //echo "<pre>Grams: ".print_r($grams, true)."</pre>\n";
         $this->load->view('dashboard/main', array("grams" => $grams, "first_use" => $first_use));
     }
     $this->load->view('templates/footer');
 }
Ejemplo n.º 6
0
 public function save_text()
 {
     $this->load->model('langdb_model');
     if (isValidUser()) {
         $data = array('title' => $this->input->post('title'), 'author' => $this->input->post('author'), 'year' => $this->input->post('year'), 'content' => $this->input->post('content'), 'language_id' => $this->input->post('language_id'), 'genre_id' => $this->input->post('genre_id'), 'users_id' => getUserProperty('id'));
     } else {
         $this->unAuthorizeduser();
     }
     $this->langdb_model->insert_entry('ldb_text', $data);
 }
Ejemplo n.º 7
0
 /**
  * Displays the registration form.
  * 
  * @access public
  *
  */
 function del($id)
 {
     // security check:
     // admins or superadmins cannot be deleted in the users controller
     $edited_role = getUserPropertyFromId($id, 'role');
     $allowed = ($edited_role != 'admin' and $edited_role != 'superadmin');
     if (!$allowed) {
         $this->freakauth_light->denyAccess(getUserProperty('role'));
     }
     $this->usermodel->deleteUser($id);
     if ($this->config->item('FAL_create_user_profile') == TRUE) {
         $this->load->model('Userprofile');
         $this->Userprofile->deleteUserProfile($id);
     }
     //set a flash message
     $msg = $this->db->affected_rows() . $this->lang->line('FAL_user_deleted');
     flashMsg($msg);
     redirect('admin/users', 'location');
 }
Ejemplo n.º 8
0
 /**
  * Deletes an administrator, but not a superadmin
  *
  * @access public
  * @param integer $id the id of the admin
  */
 function del($id)
 {
     // we only allow edition of this admin if if he/she is
     // - not a superadmin
     $allowed = getUserPropertyFromId($id, 'role') != 'superadmin';
     if (!$allowed) {
         $this->freakauth_light->denyAccess(getUserProperty('role'));
     }
     $this->usermodel->deleteUser($id);
     //set a flash message
     $msg = $this->db->affected_rows() . $this->lang->line('FAL_user_deleted');
     if ($this->config->item('FAL_create_user_profile') == TRUE) {
         $this->load->model('Userprofile');
         $this->Userprofile->deleteUserProfile($id);
     }
     $this->usermodel->deleteUser($id);
     flashMsg($msg);
     redirect('admin/admins', 'location');
 }
Ejemplo n.º 9
0
You are <b><?php 
echo getUserName();
?>
</b> (role:<b><?php 
echo getUserProperty('role');
?>
</b>),
your id is <b><?php 
echo getUserProperty('id');
?>
</b>.<br />

Your first superadmin is <b><?php 
echo getUserPropertyFromId(1, 'user_name');
?>
</b>.
<br /><br />

<b>example code:</b>
<code>
You are &lt;b&gt;&lt;?=getUserName()?&gt;&lt;/b&gt; (role:&lt;b&gt;&lt;?=getUserProperty('role')?&gt;&lt;/b&gt;),
your id is &lt;b&gt;&lt;?=getUserProperty('id')?&gt;&lt;/b&gt;.&lt;br /&gt;<br />
<br />
Your first superadmin is &lt;b&gt;&lt;?=getUserPropertyFromId(1,'user_name')?&gt;&lt;/b&gt;.<br />
</code>
<br /><br /><?php 
echo anchor('example', 'back to the list');
Ejemplo n.º 10
0
<?
$base_url = base_url();
$user = array();
if (isValidUser())
{
  $user = $this->freakauth_light->_getUserProfile(getUserProperty("id"));
  $user["id"] = getUserProperty("id");
  $user["user_name"] = getUserProperty("user_name");
  $user = prep_user($user);
}

?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>Vivagrams :: Healthy Habits for Happiness</title>
		<link id="page_favicon" href="<?php 
echo $base_url;
?>
/public/images/favicon.ico" rel="icon" type="image/x-icon" />
		
		<script>
		var base_url = "<?php 
echo $base_url;
?>
";
		</script>
		
		<link type="text/css" href="<?php 
echo $base_url;
Ejemplo n.º 11
0
 function NewPostNotify($topicID, $userID)
 {
     $mail_array = array();
     $this->db->select('*');
     $this->db->where('topicID', $topicID);
     $this->db->where('userID !=', $userID);
     $query = $this->db->get($this->subscriptionsTable);
     $i = 0;
     foreach ($query->result_array() as $row) {
         $mail_array[$i]['user_id'] = $row['userID'];
         $mail_array[$i]['user_name'] = getUserFullNameFromId($row['userID']);
         $mail_array[$i]['user_email'] = getUserProperty('email', $row['userID']);
         $i++;
     }
     $this->load->library('email');
     foreach ($mail_array as $user_data) {
         $this->email->clear();
         $this->email->to($user_data['user_email']);
         $this->email->from($this->config->item('admin_email'));
         $this->email->subject('New Message in Topic');
         $this->email->message('Dear ' . $user_data['user_name'] . '. <br>A new message has been posted in topic: ' . site_url('forums/topics/view_topic/' . $topicID) . ' <br>To unsubscribe please visit: ' . site_url('forums/topics/unsubscribe/' . $topicID) . ' ');
         $this->email->send();
     }
 }
Ejemplo n.º 12
0
    ?>
auth/login">
                <input type="text" name="username" class="form-control" placeholder="Username" />
                <input type="password" name="password" class="form-control" placeholder="Password" />
            <input type="submit" class="btn btn-primary" value="Sign In" />
          </form>
            <?php 
}
?>
            <?php 
if (isValidUser()) {
    ?>
          <ul class="nav navbar-nav navbar-right">
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Welcome <?php 
    echo getUserProperty('username');
    ?>
 <i class="glyphicon glyphicon-user"></i> <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                  <!--
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
                <li class="divider"></li> -->
                <li><a href="<?php 
    echo base_url();
    ?>
auth/change_password">Change Password</a></li>
                <li><a href="<?php 
    echo base_url();
    ?>