function superuser($id = "") { if (!$id and $id = user::id()) { $id = user::id(); } $userArray = user::get($id); if (group::superuser($userArray[group])) { return TRUE; } else { return FALSE; } }
function save_status($statusArray) { if (user::name() != "gast" and $userID = user::id()) { $tempArray = array(); while ($entry = each($statusArray)) { array_push($tempArray, $entry[key] . "=" . $entry[value]); } $statusString = implode($tempArray, ";"); if (database::query("UPDATE user SET status='{$statusString}' WHERE ID='{$userID}'")) { session::set("stored", time()); } } }
/** * Match User details and Logged in Application * * @return Redirect */ public function login() { if (user::id()) { AZ::redirect('admin/dashboard'); } $post = $this->input->post(); if ($this->_validate() == FALSE) { $this->index(); return false; } $user_id = $this->user->authenicate($post['username'], $post['password']); if ($user_id) { if (have_permission('dashboard/index')) { AZ::redirect('admin/dashboard'); } else { user::flush(); AZ::redirectError('administrator', __('Unauthorized Access', true)); } } else { AZ::redirectError('administrator', 'Invalid'); } }
/** * Removed Label and Redirect Back to Messages * * @param integer $id * @return redirect */ public function remove_label($id) { if ($this->db->delete('labels', array('id' => (int) $id, 'user_id' => user::id()))) { AZ::redirectSuccess('admin/dashboard/messages', lang('Removed')); } else { AZ::redirectError('admin/dashboard/messages', lang('Error occured')); } }
<?php $user_id = user::id(); ?> <?php if ($user_id) { ?> <ul class="nav navbar-nav navbar-right profile-menu"> <li class="dropdown text-right"> <a href="#" class="dropdown-toggle text-center" data-toggle="dropdown"> <i class="account-icon glyphicon glyphicon-off"></i> <b class="caret"></b> </a> <ul class="dropdown-menu dropdown-menu-right text-left"> <li> <a> <strong><?php __(ucfirst(user::username())); ?> </strong> <br /> <span class="muted"> <?php __(user::user_group()); ?> </span> </a>
public function track() { if (!$this->session->userdata('visited') && $_SERVER['REMOTE_ADDR'] != '::1') { AZ::helper('date'); $this->load->library('user_agent'); $visitData = array('ip' => $_SERVER['REMOTE_ADDR'], 'is_mobile' => $this->agent->is_mobile(), 'platform' => $this->agent->platform(), 'is_browser' => $this->agent->is_browser(), 'browser' => $this->agent->browser(), 'browser_version' => $this->agent->version(), 'device' => $this->agent->mobile(), 'refer' => $this->agent->referrer(), 'page' => $this->uri->uri_string(), 'logged' => user::id()); $this->session->set_userdata('visited', 1); return $this->db->insert('visitors', $visitData); } }
?> </strong> <p>From your Account Dashboard you have the ability to view a snapshot of your recent account activity and update your account information. Select your place below to view or edit information.</p> <div class="page-title"> <h3>Account Information</h3> </div> <hr /> <div class="row-fluid"> <div class="col-md-6"> <h6> <strong>Profile</strong> <small><?php _a('account/edit/' . user::id(), __('Edit', true), ' class="pull-right" '); ?> </small> </h6> <p> <?php echo user::username(); ?> <small class="muted"> ( <?php echo user::user_group(); ?> )</small><br /> </p> </div>
<?php if (user::id()) { ?> <ul class="list-group"> <li class="list-group-item"><strong><?php __('My Account'); ?> </strong></li> <li class="list-group-item"> <?php _a('account', __('Dashboard', true)); ?> </li> <li class="list-group-item"><?php _a('account/edit/' . user::id(), __('Account Profile', true)); ?> </li> <li class="list-group-item"><?php _a('account/change_password_box', __('Change Paassword', true), ' class="ajax-box" '); ?> </li> </ul> <?php } else { ?> <ul class="list-group"> <li class="list-group-item"><strong><?php __('My Account'); ?> </strong></li>
function have_permission($controllerMethod, $access_id = NULL) { if (!user::id()) { return false; } if (is_null($access_id) || empty($access_id)) { $access_id = user::access_id(); } $chunk = explode("/", $controllerMethod); $controller = $chunk[0]; $method = $chunk[1]; if (empty($controller) || empty($method)) { return FALSE; } $CI =& get_instance(); $check = $CI->db->get_where('access', array('access_id' => $access_id, 'controller' => $controller, 'method' => $method))->num_rows(); return $check; }
public function login() { user::login('evan', 'test'); echo user::id(); }
<div class="field-row"> <?php echo form_label(lang('Subject'), 'subject'); echo form_input(array('class' => 'form-control', 'name' => 'subject')); ?> </div> <div class="field-row"> <?php echo form_label(lang('Message'), 'body'); echo form_textarea(array('class' => 'form-control', 'name' => 'body')); ?> </div> <div class="panel-footer text-right"> <input type="hidden" name="author" value="<?php echo user::id(); ?> " /> <input type="hidden" name="message_id" value="<?php echo $message_id; ?> " /> <a class="btn btn-default" href="<?php _u('admin/dashboard/messages'); ?> "> <i class="fa fa-arrow-circle-left"></i> <?php __('Cancel'); ?> </a>
</head> <body> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> <?php foreach ($_GET as $key => $value) { ${$key} = $value; } foreach ($_POST as $key => $value) { ${$key} = $value; } //echoalert($_JS); // connect database $daba = new database(); $daba->connect("localhost", "iggmp", "1s87J37r0"); $daba->select("thesaurus"); $exportString = export::print_tree($id, $type); if ($type == "adlib") { $extension = ".xml"; } else { $extension = ".csv"; } $path = "import/export" . user::id() . $extension; $fHandle = fopen($path, "w"); fputs($fHandle, utf8_decode($exportString)); fclose($fHandle); echo "<a href='{$path}'>{$type} herunterladen</a>"; ?> </body>
function insert($name, $parent, $comment) { //debug //echo "$name - $parent - $comment<br>"; $owner = user::id(); // user id $status = 2; // descriptor $linktype = 1; // hyrarchic link $parentArray = search::get($parent, "exact"); $entryArray = search::get($name, "exact"); $parentId = $parentArray[0][ID]; $entryId = $entryArray[0][ID]; // entry already exists - create polyseme if ($entryId) { $name = "{$name} ({$parent})"; } // create new entry $entryString = "INSERT INTO entry SET\r\n name='{$name}',\r\n owner='{$owner}',\r\n status='{$status}',\r\n comment='{$comment}'"; mysql_query($entryString); // get new id $newId = mysql_insert_id(); //debug //echo "$parent ($parentId) > $name ($newId)<br>"; // create link to parent if ($newId) { $linkString = "INSERT INTO parent SET\r\n parent='{$parentId}',\r\n child='{$newId}',\r\n type='{$linktype}'"; mysql_query($linkString); } return $name; }
public function getMessagesData($mode = 'inbox', $message_id = 0, $offset = 0) { switch ($mode) { case 'inbox': $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 0, 'messages.receiver' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 0, 'messages.receiver' => user::id()), $offset, $limit); break; case 'stared': $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 0, 'messages.is_star' => 1, 'messages.receiver' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 0, 'messages.is_star' => 1, 'messages.receiver' => user::id()), $offset, $limit); break; case 'outbox': $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 0, 'messages.author' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 0, 'messages.author' => user::id()), $offset, $limit); break; case 'trash': $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 1, 'messages.receiver' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 1, 'messages.receiver' => user::id()), $offset, $limit); break; default: $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 0, 'messages.receiver' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 0, 'messages.receiver' => user::id()), $offset, $limit); break; } $messagesData = array('total_message' => $total_message, 'pagination' => $pagination, 'messages' => $messages); return $messagesData; }
<strong><?php __(ucfirst(user::username())); ?> </strong> <br /> <span class="muted"> <?php __(user::user_group()); ?> </span> </a> </li> <li class="divider"></li> <li> <a href="<?php _u('admin/users/edit/' . user::id()); ?> "> <i class="fa fa-briefcase"></i> <?php __('My Account'); ?> </a> </li> <li class="divider"></li> <li> <a href="<?php _u('administrator/logout'); ?> "> <i class="fa fa-sign-out"></i>
function count_user_messages() { AZ::model('message'); AZ::helper('date'); $CI =& get_instance(); $count = $CI->message->getMessages('*', array('messages.trash' => 0, 'messages.is_read' => 0, 'messages.receiver' => user::id()), 0, 0, true); return $count; }
?> </div> </div> <div class="col-xs-8"> <div class="input-group"> <?php echo form_input(array('class' => 'form-control', 'name' => 'label', 'placeholder' => 'Name', 'value' => isset($label->label) ? $label->label : '')); ?> <span class="input-group-btn"> <?php echo form_hidden('mode', $mode); ?> <?php echo form_hidden('user_id', user::id()); ?> <?php echo isset($label->id) ? form_hidden('id', $label->id) : ''; ?> <button type="submit" class="btn btn-primary"> <i class="fa fa-save"></i> <?php __('Save'); ?> </button> </span> </div> </div> </div>
/** * Match User details and Logged in Application if verify * * @return Redirect */ public function authenicate() { if (user::id()) { AZ::redirect('account'); } $post = $this->input->post(); if ($this->_validateLogin() == FALSE) { $this->index(); return false; } if ($this->user->authenicate($post['username'], $post['password'])) { AZ::redirect('account'); } else { AZ::redirectError('account', 'Invalid'); } }
function parent_insert($child, $parent, $type) { // check if dataset exists if (!database::parent_get($child, $parent)) { $user = user::id(); $queryString = "INSERT INTO parent SET child='{$child}',parent='{$parent}',type='{$type}',owner='{$user}'"; return database::query($queryString); } else { return FALSE; } // entry exists; nothing done }