本文整理汇总了PHP中log_activity函数的典型用法代码示例。如果您正苦于以下问题:PHP log_activity函数的具体用法?PHP log_activity怎么用?PHP log_activity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_activity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _updateDetails
private function _updateDetails()
{
// method to validate update details form fields
if ($this->validateForm() === TRUE) {
$update = array();
// START: retrieve $_POST data if $_POST data is not same as existing customer library data
$update['first_name'] = $this->input->post('first_name');
$update['last_name'] = $this->input->post('last_name');
$update['telephone'] = $this->input->post('telephone');
$update['security_question_id'] = $this->input->post('security_question_id');
$update['security_answer'] = $this->input->post('security_answer');
$update['password'] = $this->input->post('new_password');
$update['newsletter'] = $this->input->post('newsletter');
$update['status'] = '1';
// END: retrieve $_POST data if $_POST data is not same as existing customer library data
if (!empty($update)) {
// if update array is not empty then update customer details and display success message
if ($this->Customers_model->saveCustomer($this->customer->getId(), $update)) {
log_activity($this->customer->getId(), 'updated', 'customers', get_activity_message('activity_updated_account', array('{customer}', '{link}'), array($this->customer->getName(), admin_url('customers/edit?id=' . $this->customer->getId()))));
if (!empty($update['password'])) {
log_activity($this->customer->getId(), 'updated', 'customers', get_activity_message('activity_changed_password', array('{customer}', '{link}'), array($this->customer->getName(), admin_url('customers/edit?id=' . $this->customer->getId()))));
}
$this->alert->set('alert', $this->lang->line('alert_updated_success'));
}
return TRUE;
}
}
}
示例2: index
public function index()
{
$this->lang->load('login');
if ($this->user->islogged()) {
redirect('dashboard');
}
$this->template->setTitle($this->lang->line('text_title'));
$data['site_name'] = $this->config->item('site_name');
$data['reset_url'] = site_url('login/reset');
if ($this->input->post() and $this->validateLoginForm() === TRUE) {
if (!$this->user->login($this->input->post('user'), $this->input->post('password'))) {
// checks if form validation routines ran successfully
$this->alert->set('danger', $this->lang->line('alert_username_not_found'));
redirect('login');
} else {
log_activity($this->user->getStaffId(), 'logged in', 'staffs', get_activity_message('activity_logged_in', array('{staff}', '{link}'), array($this->user->getStaffName(), admin_url('staffs/edit?id=' . $this->user->getStaffId()))));
if ($previous_url = $this->session->tempdata('previous_url')) {
$this->session->unset_tempdata('previous_url');
redirect($previous_url);
}
redirect(referrer_url());
}
}
$this->template->setPartials(array('header', 'footer'));
$this->template->render('login', $data);
}
示例3: auth
function auth()
{
$id = mysql_escape_string($_POST['login']);
$password = mysql_escape_string($_POST['password']);
$query = mysql_query("SELECT * FROM tbl_auth WHERE id = '{$id}' and password ='{$password}' limit 1");
if (mysql_num_rows($query) == 1) {
$_SESSION['auth'] = "1";
$_SESSION['id'] = $id;
$_SESSION['name'] = get_agency_name($id);
//this is the first time we use this function to pull the agency name.
$_SESSION['ses_start'] = date('Y-m-d-h-i-s');
$_SESSION['log_ip'] = $_SERVER['REMOTE_ADDR'];
log_activity('login');
load_index();
} else {
$error_message = 'Sorry, try again! (your ip address has been recorded)';
// This is an example of a generic log entry
$_SESSION['extra'] = $id;
//we set the extra var to the attemped user id
$_SESSION['log_ip'] = $_SERVER['REMOTE_ADDR'];
//we record the ip address
log_activity('failed login');
//we use a string to id the activity and write the log
// end of logging
show_login($error_message);
}
//echo $query;
}
示例4: _addCustomer
private function _addCustomer()
{
if ($this->validateForm() === TRUE) {
$this->load->model('Customers_model');
// load the customers model
$this->load->model('Customer_groups_model');
$add = array();
// if successful CREATE an array with the following $_POST data values
$add['first_name'] = $this->input->post('first_name');
$add['last_name'] = $this->input->post('last_name');
$add['email'] = $this->input->post('email');
$add['password'] = $this->input->post('password');
$add['telephone'] = $this->input->post('telephone');
$add['security_question_id'] = $this->input->post('security_question');
$add['security_answer'] = $this->input->post('security_answer');
$add['newsletter'] = $this->input->post('newsletter');
$add['terms_condition'] = $this->input->post('terms_condition');
$add['customer_group_id'] = $this->config->item('customer_group_id');
$add['date_added'] = mdate('%Y-%m-%d', time());
$result = $this->Customer_groups_model->getCustomerGroup($this->config->item('customer_group_id'));
if ($result['approval'] === '1') {
$add['status'] = '0';
} else {
$add['status'] = '1';
}
if (!empty($add) and $customer_id = $this->Customers_model->saveCustomer(NULL, $add)) {
// pass add array data to saveCustomer method in Customers model then return TRUE
log_activity($customer_id, 'registered', 'customers', get_activity_message('activity_registered_account', array('{customer}', '{link}'), array($this->input->post('first_name') . ' ' . $this->input->post('last_name'), admin_url('customers/edit?id=' . $customer_id))));
return TRUE;
}
}
}
示例5: create
/**
* Create a Groups object.
*
* @return void
*/
public function create()
{
$this->load->config('address');
$this->load->helper('address');
if (isset($_POST['save'])) {
if ($insert_id = $this->save_groups()) {
log_activity($this->auth->user_id(), lang('groups_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'groups');
Template::set_message(lang('groups_create_success'), 'success');
redirect('/');
}
// Not validation error
if (!empty($this->groups_model->error)) {
Template::set_message(lang('groups_create_failure') . $this->groups_model->error, 'error');
}
}
if ($this->siteSettings['auth.password_show_labels'] == 1) {
Assets::add_js($this->load->view('users_js', array('settings' => $this->siteSettings), true), 'inline');
}
// Generate password hint messages.
$this->user_model->password_hints();
$result = array();
$group_type_options = $this->group_types_model->get_group_types_list();
array_unshift($group_type_options, "Select");
Template::set('group_type_options', $group_type_options);
Template::set('toolbar_title', lang('groups_action_create'));
Template::set_view('content/create', $result);
Template::render();
}
示例6: index
public function index()
{
if ($this->customer->islogged()) {
// checks if customer is logged in then redirect to account page.
redirect('account/account');
}
$this->load->model('Pages_model');
$this->lang->load('account/login_register');
$this->template->setTitle($this->lang->line('text_heading'));
$data['reset_url'] = site_url('account/reset');
$data['register_url'] = site_url('account/register');
if ($this->input->post()) {
// checks if $_POST data is set
if ($this->validateForm() === TRUE) {
$email = $this->input->post('email');
// retrieves email value from $_POST data if set
$password = $this->input->post('password');
// retrieves password value from $_POST data if set
if ($this->customer->login($email, $password) === FALSE) {
// invoke login method in customer library with email and password $_POST data value then check if login was unsuccessful
$this->alert->set('alert', $this->lang->line('alert_invalid_login'));
// display error message and redirect to account login page
redirect(current_url());
} else {
// else if login was successful redirect to account page
log_activity($this->customer->getId(), 'logged in', 'customers', get_activity_message('activity_logged_in', array('{customer}', '{link}'), array($this->customer->getName(), admin_url('customers/edit?id=' . $this->customer->getId()))));
if ($redirect_url = $this->input->get('redirect')) {
redirect($redirect_url);
}
redirect('account/account');
}
}
}
$this->template->render('account/login', $data);
}
示例7: index
public function index()
{
$this->lang->load('login');
log_activity($this->user->getStaffId(), 'logged out', 'staffs', get_activity_message('activity_logged_out', array('{staff}', '{link}'), array($this->user->getStaffName(), admin_url('staffs/edit?id=' . $this->user->getStaffId()))));
$this->user->logout();
$this->alert->set('success', $this->lang->line('alert_success_logout'));
redirect('login');
}
示例8: index
public function index()
{
$this->load->model('Pages_model');
$this->lang->load('account/login_register');
$this->template->setBreadcrumb('<i class="fa fa-home"></i>', '/');
$this->template->setBreadcrumb($this->lang->line('text_heading'), 'account/logout');
$this->template->setTitle($this->lang->line('text_logout_heading'));
$this->alert->set('success', $this->lang->line('alert_logout_success'));
log_activity($this->customer->getId(), 'logged out', 'customers', get_activity_message('activity_logged_out', array('{customer}', '{link}'), array($this->customer->getName(), admin_url('customers/edit?id=' . $this->customer->getId()))));
$this->customer->logout();
if ($redirect_url = $this->input->get('redirect')) {
redirect($redirect_url);
}
redirect('account/login');
}
示例9: status
public function status()
{
if ($D = $this->menu_model->find($this->uri->segment(5))) {
$depart['status'] = $D->status == "1" ? '0' : '1';
$this->db->where('id', $D->id);
if ($this->db->update('bf_menu', $depart)) {
log_activity($this->current_user->id, lang('menu_act_edit_record') . ': ' . $D->ID . ' : ' . $this->input->ip_address(), 'menu');
Template::set_message(lang('menu_edit_success'), 'success');
redirect("admin/content/menu");
} else {
Template::set_message(lang('menu_edit_failure') . $this->menu_model->error, 'error');
}
}
}
示例10: _saveMenu
private function _saveMenu()
{
if ($this->validateForm() === TRUE) {
$save_type = !is_numeric($this->input->get('id')) ? $this->lang->line('text_added') : $this->lang->line('text_updated');
if ($menu_id = $this->Menus_model->saveMenu($this->input->get('id'), $this->input->post())) {
log_activity($this->user->getStaffId(), $save_type, 'menus', get_activity_message('activity_custom', array('{staff}', '{action}', '{context}', '{link}', '{item}'), array($this->user->getStaffName(), $save_type, 'menu item', site_url('menus/edit?id=' . $menu_id), $this->input->post('menu_name'))));
$this->alert->set('success', sprintf($this->lang->line('alert_success'), 'Menu ' . $save_type));
} else {
$this->alert->set('warning', sprintf($this->lang->line('alert_error_nothing'), $save_type));
}
return $menu_id;
}
}
示例11: reset_password
/**
* Allows the user to create a new password for their account. At the moment,
* the only way to get here is to go through the forgot_password() process,
* which creates a unique code that is only valid for 24 hours.
*
* Since 0.7 this method is also reached via the force_password_reset security
* features.
*
* @param string $email The email address to check against.
* @param string $code A randomly generated alphanumeric code. (Generated by
* forgot_password()).
*
* @return void
*/
public function reset_password($email = '', $code = '')
{
// If the user is logged in, go home.
if ($this->auth->is_logged_in() !== false) {
Template::redirect('/');
}
// Bonfire may have stored the email and code in the session.
if (empty($code) && $this->session->userdata('pass_check')) {
$code = $this->session->userdata('pass_check');
}
if (empty($email) && $this->session->userdata('email')) {
$email = $this->session->userdata('email');
}
// If there is no code/email, then it's not a valid request.
if (empty($code) || empty($email)) {
Template::set_message(lang('us_reset_invalid_email'), 'error');
Template::redirect(LOGIN_URL);
}
// Handle the form
if (isset($_POST['set_password'])) {
$this->form_validation->set_rules('password', 'lang:bf_password', 'required|max_length[120]|valid_password');
$this->form_validation->set_rules('pass_confirm', 'lang:bf_password_confirm', 'required|matches[password]');
if ($this->form_validation->run() !== false) {
// The user model will create the password hash.
$data = array('password' => $this->input->post('password'), 'reset_by' => 0, 'reset_hash' => '', 'force_password_reset' => 0);
if ($this->user_model->update($this->input->post('user_id'), $data)) {
log_activity($this->input->post('user_id'), lang('us_log_reset'), 'users');
Template::set_message(lang('us_reset_password_success'), 'success');
Template::redirect(LOGIN_URL);
}
if (!empty($this->user_model->error)) {
Template::set_message(sprintf(lang('us_reset_password_error'), $this->user_model->error), 'error');
}
}
}
// Check the code against the database
$email = str_replace(':', '@', $email);
$user = $this->user_model->find_by(array('email' => $email, 'reset_hash' => $code, 'reset_by >=' => time()));
// $user will be an Object if a single result was returned.
if (!is_object($user)) {
Template::set_message(lang('us_reset_invalid_email'), 'error');
Template::redirect(LOGIN_URL);
}
if ($this->siteSettings['auth.password_show_labels'] == 1) {
Assets::add_js($this->load->view('users_js', array('settings' => $this->siteSettings), true), 'inline');
}
// At this point, it is a valid request....
Template::set('user', $user);
Template::set_view('users/reset_password');
Template::render();
}
示例12: _uninstall
private function _uninstall()
{
if ($this->input->get('action') === 'uninstall') {
if ($this->Extensions_model->uninstall('payment', $this->input->get('name'), $this->input->get('id'))) {
log_activity($this->user->getStaffId(), 'uninstalled', 'extensions', get_activity_message('activity_custom_no_link', array('{staff}', '{action}', '{context}', '{item}'), array($this->user->getStaffName(), 'uninstalled', 'extension payment', $this->input->get('name'))));
$this->alert->set('success', sprintf($this->lang->line('alert_success'), 'Payment uninstalled '));
return TRUE;
}
$this->alert->danger_now($this->lang->line('alert_error_try_again'));
return TRUE;
}
}
示例13: save_settings
/**
* Perform form validation and save the settings to the database
*
* @param array $extended_settings An optional array of settings from the
* extended_settings config file
*
* @return bool
*/
private function save_settings($extended_settings = array())
{
$this->form_validation->set_rules('title', 'lang:bf_site_name', 'required|trim');
$this->form_validation->set_rules('system_email', 'lang:bf_site_email', 'required|trim|valid_email');
$this->form_validation->set_rules('list_limit', 'Items <em>p.p.</em>', 'required|trim|numeric');
$this->form_validation->set_rules('password_min_length', 'lang:bf_password_length', 'required|trim|numeric');
$this->form_validation->set_rules('password_force_numbers', 'lang:bf_password_force_numbers', 'trim|numeric');
$this->form_validation->set_rules('password_force_symbols', 'lang:bf_password_force_symbols', 'trim|numeric');
$this->form_validation->set_rules('password_force_mixed_case', 'lang:bf_password_force_mixed_case', 'trim|numeric');
$this->form_validation->set_rules('password_show_labels', 'lang:bf_password_show_labels', 'trim|numeric');
$this->form_validation->set_rules('languages[]', 'lang:bf_language', 'required|trim|is_array');
// Setup the validation rules for any extended settings
$extended_data = array();
foreach ($extended_settings as $field) {
if (empty($field['permission']) || has_permission($field['permission'])) {
$this->form_validation->set_rules($field['name'], $field['label'], $field['rules']);
$extended_data["ext.{$field['name']}"] = $this->input->post($field['name']);
}
}
if ($this->form_validation->run() === false) {
return false;
}
$data = array(array('name' => 'site.title', 'value' => $this->input->post('title')), array('name' => 'site.system_email', 'value' => $this->input->post('system_email')), array('name' => 'site.status', 'value' => $this->input->post('status')), array('name' => 'site.list_limit', 'value' => $this->input->post('list_limit')), array('name' => 'auth.allow_register', 'value' => isset($_POST['allow_register']) ? 1 : 0), array('name' => 'auth.user_activation_method', 'value' => isset($_POST['user_activation_method']) ? $_POST['user_activation_method'] : 0), array('name' => 'auth.login_type', 'value' => $this->input->post('login_type')), array('name' => 'auth.use_usernames', 'value' => isset($_POST['use_usernames']) ? $this->input->post('use_usernames') : 0), array('name' => 'auth.allow_remember', 'value' => isset($_POST['allow_remember']) ? 1 : 0), array('name' => 'auth.remember_length', 'value' => (int) $this->input->post('remember_length')), array('name' => 'auth.use_extended_profile', 'value' => isset($_POST['use_ext_profile']) ? 1 : 0), array('name' => 'auth.allow_name_change', 'value' => $this->input->post('allow_name_change') ? 1 : 0), array('name' => 'auth.name_change_frequency', 'value' => $this->input->post('name_change_frequency')), array('name' => 'auth.name_change_limit', 'value' => $this->input->post('name_change_limit')), array('name' => 'auth.password_min_length', 'value' => $this->input->post('password_min_length')), array('name' => 'auth.password_force_numbers', 'value' => $this->input->post('password_force_numbers')), array('name' => 'auth.password_force_symbols', 'value' => $this->input->post('password_force_symbols')), array('name' => 'auth.password_force_mixed_case', 'value' => $this->input->post('password_force_mixed_case')), array('name' => 'auth.password_show_labels', 'value' => $this->input->post('password_show_labels') ? 1 : 0), array('name' => 'site.show_profiler', 'value' => isset($_POST['show_profiler']) ? 1 : 0), array('name' => 'site.show_front_profiler', 'value' => isset($_POST['show_front_profiler']) ? 1 : 0), array('name' => 'site.languages', 'value' => $this->input->post('languages') != '' ? serialize($this->input->post('languages')) : ''), array('name' => 'password_iterations', 'value' => $this->input->post('password_iterations')));
log_activity($this->current_user->id, lang('bf_act_settings_saved') . ': ' . $this->input->ip_address(), 'core');
// Save the settings to the DB
$updated = $this->settings_model->update_batch($data, 'name');
// If the update was successful and there are extended settings to save,
if ($updated && !empty($extended_data)) {
// Save them
$updated = $this->save_extended_settings($extended_data);
}
return $updated;
}
示例14: user_status
/**
* Activates or deavtivates a user from the users dashboard.
* Redirects to /settings/users on completion.
*
* @access private
*
* @param int $user_id User ID int
* @param int $status 1 = Activate, -1 = Deactivate
* @param int $supress_email 1 = Supress, All others = send email
*
* @return void
*/
private function user_status($user_id = false, $status = 1, $supress_email = 0)
{
$supress_email = isset($supress_email) && $supress_email == 1 ? true : false;
if ($user_id !== false && $user_id != -1) {
$result = false;
$type = '';
if ($status == 1) {
$result = $this->user_model->admin_activation($user_id);
$type = lang('bf_action_activate');
} else {
$result = $this->user_model->admin_deactivation($user_id);
$type = lang('bf_action_deactivate');
}
$user = $this->user_model->find($user_id);
$log_name = $this->settings_lib->item('auth.use_own_names') ? $this->current_user->username : ($this->settings_lib->item('auth.use_usernames') ? $user->username : $user->email);
log_activity($this->current_user->id, lang('us_log_status_change') . ': ' . $log_name . ' : ' . $type . "ed", 'users');
if ($result) {
$message = lang('us_active_status_changed');
if ($status == 1 && !$supress_email) {
// Now send the email
$this->load->library('emailer/emailer');
$site_title = $this->settings_lib->item('site.title');
$data = array('to' => $this->user_model->find($user_id)->email, 'subject' => lang('us_account_active'), 'message' => $this->load->view('_emails/activated', array('link' => site_url(), 'title' => $site_title), true));
if ($this->emailer->send($data)) {
$message = lang('us_active_email_sent');
} else {
$message = lang('us_err_no_email') . $this->emailer->error;
}
}
Template::set_message($message, 'success');
} else {
Template::set_message(lang('us_err_status_error') . $this->user_model->error, 'error');
}
//end if
} else {
Template::set_message(lang('us_err_no_id'), 'error');
}
//end if
}
示例15: save_settings
/**
* Save multiple shortcut keys at the same time allowing the user to
* edit the settings
*
* @param array $settings Array of shortcuts
*
* @return bool
*/
private function save_settings($settings = array())
{
if (empty($settings)) {
// Read available shortcuts from the application config
$available_actions = config_item('ui.current_shortcuts');
// We can't use an array like the remove buttons do
// because the text inputs need set_value().
// set_value("shortcut[$action]") is not supported
foreach ($available_actions as $action => $shortcut) {
if (isset($_POST["shortcut_{$action}"])) {
$this->form_validation->set_rules("shortcut_{$action}", lang('ui_shortcuts'), 'required|callback__validate_shortcuts');
$settings[$action] = $this->input->post("shortcut_{$action}");
}
}
if ($this->form_validation->run() === FALSE) {
return FALSE;
}
}
//end if
if (is_array($settings)) {
foreach ($settings as $action => $shortcut) {
$updated = $this->settings_lib->set($action, $shortcut, 'core.ui');
}
}
// Log the activity
log_activity($this->current_user->id, lang('bf_act_settings_saved') . ': ' . $this->input->ip_address(), 'ui');
return $updated;
}