本文整理汇总了PHP中settings_item函数的典型用法代码示例。如果您正苦于以下问题:PHP settings_item函数的具体用法?PHP settings_item怎么用?PHP settings_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settings_item函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
//Assets::add_css( array('bootstrap.min.css', 'bootstrap-responsive.min.css'));
$inline = '$(".dropdown-toggle").dropdown();';
$inline .= '$(".tooltips").tooltip();';
Assets::add_js($inline, 'inline');
?>
<!doctype html>
<html class="full" lang="fr" ng-app="app" id="ng-app">
<head>
<meta charset="utf-8">
<title><?php
echo isset($page_title) ? $page_title . ' : ' : '';
?>
<?php
if (class_exists('Settings_lib')) {
e(settings_item('site.title'));
} else {
echo 'Bonfire';
}
?>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="fbmfbm">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">
<?php
echo Assets::css();
示例2: form_open
?>
<?php
echo form_open(current_url(), 'class="form-horizontal"');
?>
<fieldset>
<div class="control-group<?php
echo form_error('context_name') ? ' error' : '';
?>
">
<label for="context_name" class="control-label"><?php
echo lang('mb_context_name');
?>
</label>
<div class="controls">
<input type="text" name="context_name" id="context_name" class="input-large" value="<?php
echo settings_item('context_name');
?>
" />
<span class="help-inline"><?php
echo form_error('context_name') ? form_error('context_name') . '<br />' : '';
echo lang('mb_context_name_help');
?>
</span>
</div>
</div>
<?php
if (isset($roles) && is_array($roles) && count($roles)) {
?>
<div class="control-group">
<label class="control-label" id="roles_label"><?php
echo lang('mb_roles_label');
示例3: isset
<?php
Assets::add_css(array('bootstrap.css', 'font-awesome.css', 'style.css', 'dark.css', 'travel.css', 'datepicker.css', 'font-icons.css', 'animate.css', 'magnific-popup.css', 'responsive.css', 'colors.css'));
Assets::add_js(array('bootstrap.min.js', 'plugins.js', 'datepicker.js', 'functions.js'));
?>
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php
echo isset($page_title) ? "{$page_title} : " : '';
e(class_exists('Settings_lib') ? settings_item('site.title') : 'Bonfire');
?>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="<?php
e(isset($meta_description) ? $meta_description : '');
?>
">
<meta name="author" content="<?php
e(isset($meta_author) ? $meta_author : '');
?>
">
<?php
/* Modernizr is loaded before CSS so CSS can utilize its features */
//echo Assets::js('modernizr-2.5.3.js');
?>
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,400italic,600,700|Raleway:300,400,500,600,700|Crete+Round:400italic" rel="stylesheet" type="text/css" />
<?php
echo Assets::css();
示例4: login
/**
* Attempt to log the user in.
*
* @param string $login The user's login credentials (email/username).
* @param string $password The user's password.
* @param boolean $remember Whether the user should be remembered in the system.
*
* @return boolean True if the user has authenticated, else false.
*/
public function login($login, $password, $remember = false)
{
if (empty($login) || empty($password)) {
Template::set_message(sprintf(lang('us_fields_required'), $this->ci->settings->item('auth.login_type') == 'both' ? lang('us_login_type_both') : lang('us_' . $this->ci->settings->item('auth.login_type'))), 'error');
return false;
}
// Grab the user from the db.
$selects = array('id', 'email', 'username', 'users.role_id', 'users.deleted', 'users.active', 'banned', 'ban_message', 'password_hash', 'force_password_reset');
if ($this->ci->settings->item('auth.do_login_redirect')) {
$selects[] = 'login_destination';
}
$this->ci->user_model->select($selects);
if ($this->ci->settings->item('auth.login_type') == 'both') {
$user = $this->ci->user_model->find_by(array('username' => $login, 'email' => $login), null, 'or');
} else {
$user = $this->ci->user_model->find_by($this->ci->settings->item('auth.login_type'), $login);
}
// Check whether the username, email, or password doesn't exist.
if ($user == false) {
Template::set_message(lang('us_bad_email_pass'), 'error');
return false;
}
// Check whether the account has been activated.
if ($user->active == 0) {
$activation_type = $this->ci->settings->item('auth.user_activation_method');
if ($activation_type > 0) {
if ($activation_type == 1) {
Template::set_message(lang('us_account_not_active'), 'error');
} elseif ($activation_type == 2) {
Template::set_message(lang('us_admin_approval_pending'), 'error');
}
return false;
}
}
// Check whether the account has been soft deleted. The >= 1 check ensures
// this will still work if the deleted field is a UNIX timestamp.
if ($user->deleted >= 1) {
Template::set_message(sprintf(lang('us_account_deleted'), html_escape(settings_item("site.system_email"))), 'error');
return false;
}
// Try password
if (!$this->check_password($password, $user->password_hash)) {
// Bad password
Template::set_message(lang('us_bad_email_pass'), 'error');
$this->increase_login_attempts($login);
return false;
}
// Check whether the account has been banned.
if ($user->banned) {
$this->increase_login_attempts($login);
Template::set_message($user->ban_message ? $user->ban_message : lang('us_banned_msg'), 'error');
return false;
}
// Check whether the user needs to reset their password.
if ($user->force_password_reset == 1) {
Template::set_message(lang('us_forced_password_reset_note'), 'warning');
// Generate a reset hash to pass the reset_password checks...
$this->ci->load->helper('string');
$hash = sha1(random_string('alnum', 40) . $user->email);
// Save the hash to the db so it can be confirmed later.
$this->ci->user_model->update_where('id', $user->id, array('reset_hash' => $hash, 'reset_by' => strtotime("+24 hours")));
$this->ci->session->set_userdata('pass_check', $hash);
$this->ci->session->set_userdata('email', $user->email);
// Redirect the user to the reset password page.
redirect('/users/reset_password');
}
$this->clear_login_attempts($login);
// The login was successfully validated, so setup the session
$this->setupSession($user->id, $user->username, $user->password_hash, $user->email, $user->role_id, $remember, '', $user->username);
// Save the login info
$this->ci->user_model->update($user->id, array('last_login' => $this->getLoginTimestamp(), 'last_ip' => $this->ip_address));
// Clear the cached result of user() (and is_logged_in(), user_id(), etc.).
// Doesn't fix `$this->current_user` in controller (for this page load)...
unset($this->user);
// Can't pass the array directly to the trigger, must use a variable.
$trigger_data = array('user_id' => $user->id, 'role_id' => $user->role_id);
Events::trigger('after_login', $trigger_data);
// Save the redirect location
$this->login_destination = empty($user->login_destination) ? '' : $user->login_destination;
return true;
}
示例5: set_value
<div class="controls">
<input class="<?php
echo $controlClass;
?>
" type="text" id="display_name" name="display_name" value="<?php
echo set_value('display_name', isset($user) ? $user->display_name : '');
?>
" />
<span class="help-inline"><?php
echo form_error('display_name');
?>
</span>
</div>
</div>
<?php
if (settings_item('auth.login_type') !== 'email' || settings_item('auth.use_usernames')) {
?>
<div class="control-group<?php
echo form_error('username') ? $errorClass : '';
?>
">
<label class="control-label required" for="username"><?php
echo lang('bf_username');
?>
</label>
<div class="controls">
<input class="<?php
echo $controlClass;
?>
" type="text" id="username" name="username" value="<?php
echo set_value('username', isset($user) ? $user->username : '');
示例6: lang
echo lang('emailer_test_settings');
?>
</legend>
<div class='control-group'>
<p class="intro"><?php
echo lang('emailer_test_intro');
?>
</p>
</div>
<div class="control-group">
<label class="control-label" for="test-email"><?php
echo lang('bf_email');
?>
</label>
<div class="controls">
<input type="email" name="email" id="test-email" value="<?php
echo set_value('test_email', settings_item('site.system_email'));
?>
" />
<input type="submit" name="test" class="btn btn-primary" value="<?php
echo lang('emailer_test_button');
?>
" />
</div>
</div>
</fieldset>
<?php
echo form_close();
?>
<div id="test-ajax"></div>
</div>
示例7: process_queue
/**
* Process the email queue in chunks.
*
* Defaults to 33 which, if processed every 5 minutes, equals 400/hour and
* should keep you safe with most ISPs. Always check your ISP's terms of
* service to verify, though.
*
* @todo Modify the database update at the end of the method to use a batch
* update outside the loop. Additionally, it should probably be modified to
* use the emailer_model...
*
* @param int $limit An int specifying how many emails to process at once.
*
* @return bool true on success, else false
*/
public function process_queue($limit = 33)
{
$config_settings = $this->ci->settings_model->select(array('name', 'value'))->find_all_by('module', 'email');
// Grab records where success = 0
$query = $this->ci->db->limit($limit)->where('success', 0)->get($this->tableName);
// If the query returned no rows, the queue is empty, so it has been
// processed successfully.
if (!$query->num_rows()) {
return true;
}
$emails = $query->result();
$this->ci->load->library('email');
// MySQL datetime format
$dateTimeFormat = 'Y-m-d H:i:s';
$now = new DateTime();
$senderEmail = settings_item('sender_email');
$siteTitle = settings_item('site.title');
$success = true;
foreach ($emails as $email) {
$this->ci->email->initialize($config_settings);
$this->ci->email->clear(true);
$this->ci->email->set_newline("\r\n");
$this->ci->email->to($email->to_email);
$this->ci->email->from($senderEmail, $siteTitle);
$this->ci->email->subject($email->subject);
$this->ci->email->message($email->message);
if ($email->alt_message) {
$this->ci->email->set_alt_message($email->alt_message);
}
if ($email->csv_attachment) {
$attachments = str_getcsv($email->csv_attachment);
foreach ($attachments as $attachment) {
$this->ci->email->attach($attachment);
}
}
$data = array('attempts' => $email->attempts + 1);
if ($this->ci->email->send() === true) {
// Email was successfully sent
$data['success'] = 1;
} else {
// Error sending email
// While explicitly setting 'success' to 0 is not necessary, it
// makes it easier to check whether 'date_sent' should be set below.
$data['success'] = 0;
if ($this->debug) {
$this->debug_message = $this->ci->email->print_debugger();
}
// Note that $success is only set true before the loop, so, while
// the loop continues attempting to send queued emails after a
// failure, it still indicates a failure when a single email fails.
$success = false;
}
// Update the timestamp with the current time, this is done after
// calling email->send() because sending the email could take time.
$timeStamp = $now->setTimestamp(time())->format($dateTimeFormat);
$data['last_attempt'] = $timeStamp;
if ($data['success'] == 1) {
$data['date_sent'] = $timeStamp;
}
$this->ci->db->where('id', $email->id)->update($this->tableName, $data);
}
return $success;
}
示例8: isset
<head>
<meta charset="utf-8">
<title><?php
echo isset($page_title) ? "{$page_title} : " : '';
e(class_exists('Settings') ? settings_item('site.title') : 'Ignition Go');
?>
</title>
<link rel="shortcut icon" href="<?php
echo base_url();
?>
favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="<?php
e(isset($meta_description) ? $meta_description : '');
?>
">
<meta name="author" content="<?php
e(isset($meta_author) ? $meta_author : '');
?>
">
<link rel="stylesheet" href="<?php
echo base_url();
?>
components/bootstrap/css/bootstrap.css" media="screen">
<link rel="stylesheet" href="<?php
echo base_url();
?>
components/bootstrap-default/css/bootstrap.css" />
<link rel="stylesheet" href="<?php
echo base_url();
示例9: login
/**
* Attempt to log the user in.
*
* @access public
*
* @param string $login The user's login credentials (email/username)
* @param string $password The user's password
* @param bool $remember Whether the user should be remembered in the system.
*
* @return bool
*/
public function login($login, $password, $remember = FALSE, $hybridauth_login = FALSE)
{
$user = FALSE;
if (empty($login) || empty($password)) {
$user = $this->get_hauth_user();
if ($user === FALSE && $hybridauth_login == FALSE) {
$error = $this->ci->settings_lib->item('auth.login_type') == 'both' ? lang('bf_username') . '/' . lang('bf_email') : ucfirst($this->ci->settings_lib->item('auth.login_type'));
Template::set_message(sprintf(lang('us_fields_required'), $error), 'error');
return FALSE;
} else {
if ($user === FALSE && $hybridauth_login == TRUE) {
Template::set_message(lang('us_ha_login_fail'), 'error');
return FALSE;
}
}
//Hybrid_auth login. Condensed version of below for hauth
if ($user->deleted >= 1) {
Template::set_message(sprintf(lang('us_account_deleted'), html_escape(settings_item("site.system_email"))), 'error');
return FALSE;
}
if ($user->banned) {
Template::set_message($user->ban_message ? $user->ban_message : lang('us_banned_msg'), 'error');
return FALSE;
}
$this->setup_session($user->id, $user->username, $user->password_hash, $user->email, $user->role_id, $remember, '', $user->username);
$data = array('last_login' => date('Y-m-d H:i:s', time()), 'last_ip' => $this->ip_address);
$this->ci->user_model->update($user->id, $data);
// Clear the cached result of user() (and hence is_logged_in(), user_id() etc).
// Doesn't fix `$this->current_user` in controller (for this page load)...
unset($this->user);
$trigger_data = array('user_id' => $user->id, 'role_id' => $user->role_id);
Events::trigger('after_login', $trigger_data);
// Save our redirect location
$this->login_destination = isset($user->login_destination) && !empty($user->login_destination) ? $user->login_destination : '';
return TRUE;
}
$this->ci->load->model('users/User_model', 'user_model');
// Grab the user from the db
$selects = 'id, email, username, users.role_id, users.deleted, users.active, banned, ban_message, password_hash, force_password_reset';
if ($this->ci->settings_lib->item('auth.do_login_redirect')) {
$selects .= ', login_destination';
}
if ($this->ci->settings_lib->item('auth.login_type') == 'both') {
$user = $this->ci->user_model->select($selects)->find_by(array('username' => $login, 'email' => $login), null, 'or');
} else {
$user = $this->ci->user_model->select($selects)->find_by($this->ci->settings_lib->item('auth.login_type'), $login);
}
// check to see if a value of FALSE came back, meaning that the username or email or password doesn't exist.
if ($user == FALSE) {
Template::set_message(lang('us_bad_email_pass'), 'error');
return FALSE;
}
//Check to see if its a HybridAuth login account
if ($user->hauth_provider != NULL) {
Template::set_message(lang('us_bad_email_pass'), 'error');
return FALSE;
}
// check if the account has been activated.
$activation_type = $this->ci->settings_lib->item('auth.user_activation_method');
if ($user->active == 0 && $activation_type > 0) {
if ($activation_type == 1) {
Template::set_message(lang('us_account_not_active'), 'error');
} elseif ($activation_type == 2) {
Template::set_message(lang('us_admin_approval_pending'), 'error');
}
return FALSE;
}
// check if the account has been soft deleted.
if ($user->deleted >= 1) {
Template::set_message(sprintf(lang('us_account_deleted'), html_escape(settings_item("site.system_email"))), 'error');
return FALSE;
}
// Try password
if ($this->check_password($password, $user->password_hash)) {
// check if the account has been banned.
if ($user->banned) {
$this->increase_login_attempts($login);
Template::set_message($user->ban_message ? $user->ban_message : lang('us_banned_msg'), 'error');
return FALSE;
}
// Check if the user needs to reset their password
if ($user->force_password_reset == 1) {
Template::set_message(lang('us_forced_password_reset_note'), 'warning');
// Need to generate a reset hash to pass the reset_password checks...
$this->ci->load->helpers(array('string', 'security'));
$pass_code = random_string('alnum', 40);
$hash = do_hash($pass_code . $user->email);
// Save the hash to the db so we can confirm it later.
$this->ci->user_model->update_where('id', $user->id, array('reset_hash' => $hash, 'reset_by' => strtotime("+24 hours")));
//.........这里部分代码省略.........
示例10: login
/**
* Attempt to log the user in.
*
* @access public
*
* @param string $login The user's login credentials (email/username)
* @param string $password The user's password
* @param bool $remember Whether the user should be remembered in the system.
*
* @return bool
*/
public function login($login = NULL, $password = NULL, $remember = FALSE)
{
if (empty($login) || empty($password)) {
$error = $this->ci->settings_lib->item('auth.login_type') == lang('bf_both') ? lang('bf_username') . '/' . lang('bf_email') : ucfirst($this->ci->settings_lib->item('auth.login_type'));
Template::set_message(sprintf(lang('us_fields_required'), $error), 'error');
return FALSE;
}
if (!class_exists('User_model')) {
$this->ci->load->model('users/User_model', 'user_model', TRUE);
}
// Grab the user from the db
$selects = 'id, email, username, users.role_id, salt, password_hash, users.role_id, users.deleted, users.active';
if ($this->ci->settings_lib->item('auth.do_login_redirect')) {
$selects .= ', login_destination';
}
$user = $this->ci->user_model->select($selects)->find_by($this->ci->settings_lib->item('auth.login_type'), $login);
// check to see if a value of FALSE came back, meaning that the username or email or password doesn't exist.
if ($user == FALSE) {
Template::set_message(lang('us_bad_email_pass'), 'error');
return FALSE;
}
if (is_array($user)) {
$user = $user[0];
}
// check if the account has been activated.
$activation_type = $this->ci->settings_lib->item('auth.user_activation_method');
if ($user->active == 0 && $activation_type > 0) {
if ($activation_type == 1) {
Template::set_message(lang('us_account_not_active'), 'error');
} elseif ($activation_type == 2) {
Template::set_message(lang('us_admin_approval_pending'), 'error');
}
return FALSE;
}
// check if the account has been soft deleted.
if ($user->deleted >= 1) {
Template::set_message(sprintf(lang('us_account_deleted'), settings_item("site.system_email")), 'error');
return FALSE;
}
if ($user) {
// Validate the password
if (!function_exists('do_hash')) {
$this->ci->load->helper('security');
}
// Try password
if (do_hash($user->salt . $password) == $user->password_hash) {
// Do they even have permission to log in?
if (!$this->has_permission('Site.Signin.Allow', $user->role_id)) {
$this->increase_login_attempts($login);
Template::set_message(lang('us_banned_msg'), 'error');
return FALSE;
}
$this->clear_login_attempts($login);
// We've successfully validated the login, so setup the session
$this->setup_session($user->id, $user->username, $user->password_hash, $user->email, $user->role_id, $remember, '', $user->username);
// Save the login info
$data = array('last_login' => date('Y-m-d H:i:s', time()), 'last_ip' => $this->ip_address);
$this->ci->user_model->update($user->id, $data);
$trigger_data = array('user_id' => $user->id, 'role_id' => $user->role_id);
Events::trigger('after_login', $trigger_data);
// Save our redirect location
$this->login_destination = isset($user->login_destination) && !empty($user->login_destination) ? $user->login_destination : '';
return TRUE;
} else {
Template::set_message(lang('us_bad_email_pass'), 'error');
$this->increase_login_attempts($login);
}
} else {
Template::set_message(lang('us_bad_email_pass'), 'error');
}
//end if
return FALSE;
}
示例11: process_queue
/**
* Process the email queue in chunks.
*
* Defaults to 33 which, if processed every 5 minutes, equals 400/hour
* And should keep you safe with most ISP's. Always check your ISP's
* terms of service to verify, though.
*
* @access public
*
* @param int $limit An int specifying how many emails to process at once.
*
* @return bool TRUE/FALSE Whether the method was successful or not.
*/
public function process_queue($limit = 33)
{
//$limit = 33; // 33 emails every 5 minutes = 400 emails/hour.
$this->ci->load->library('email');
$config_settings = $this->ci->settings_model->select('name,value')->find_all_by('module', 'email');
// Grab records where success = 0
$this->ci->db->limit($limit);
$this->ci->db->where('success', 0);
$query = $this->ci->db->get('email_queue');
if ($query->num_rows() > 0) {
$emails = $query->result();
} else {
return TRUE;
}
foreach ($emails as $email) {
echo '.';
$this->ci->email->clear();
$this->ci->email->initialize($config_settings);
$this->ci->email->from(settings_item('sender_email'), settings_item('site.title'));
$this->ci->email->to($email->to_email);
$this->ci->email->subject($email->subject);
$this->ci->email->message($email->message);
$this->ci->email->set_newline("\r\n");
if ($email->alt_message) {
$this->ci->email->set_alt_message($email->alt_message);
}
$prefix = $this->ci->db->dbprefix;
if ($this->ci->email->send() === TRUE) {
// Email was successfully sent
$sql = "UPDATE {$prefix}email_queue SET success=1, attempts=attempts+1, last_attempt = NOW(), date_sent = NOW() WHERE id = " . $email->id;
$this->ci->db->query($sql);
} else {
// Error sending email
$sql = "UPDATE {$prefix}email_queue SET attempts = attempts+1, last_attempt=NOW() WHERE id=" . $email->id;
$this->ci->db->query($sql);
if (class_exists('CI_Session')) {
$result = $this->ci->email->print_debugger();
$this->ci->session->set_userdata('email_debug', $result);
}
}
}
//end foreach
return TRUE;
}
示例12: date
<?php
if (ENVIRONMENT == 'development') {
?>
<p class="pull-right text-muted">
CI Version: <strong><?php
echo CI_VERSION;
?>
</strong>,
Elapsed: <strong>{elapsed_time}</strong> sec,
Memory Usage: <strong>{memory_usage}</strong>
</p>
<?php
}
?>
<p class="text-muted">© <?php
echo date('Y') . (class_exists('Settings') && settings_item('site.company') ? settings_item('site.company') . '. ' : ' The Ignition Go Team. ');
?>
All rights reserved.</p>
</div>
</div>
</div>
<?php
/* echo theme_view('footer'); */
?>
<script src="<?php
echo base_url();
?>
/components/jquery/dist/jquery.min.js"></script>
<script src="<?php
echo base_url();
?>