当前位置: 首页>>代码示例>>PHP>>正文


PHP bool_config_item函数代码示例

本文整理汇总了PHP中bool_config_item函数的典型用法代码示例。如果您正苦于以下问题:PHP bool_config_item函数的具体用法?PHP bool_config_item怎么用?PHP bool_config_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bool_config_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: form_open

 function form_open($action = '', $attributes = array(), $hidden = array())
 {
     $CI =& get_instance();
     if (strpos($action, '://') === FALSE && strpos($action, BASE) !== 0) {
         $action = BASE . AMP . $action;
     }
     $action = ee()->uri->reformat($action);
     $form = '<form action="' . $action . '"';
     if (is_array($attributes)) {
         if (!isset($attributes['method'])) {
             $form .= ' method="post"';
         }
         foreach ($attributes as $key => $val) {
             $form .= ' ' . $key . '="' . $val . '"';
         }
     } else {
         $form .= ' method="post" ' . $attributes;
     }
     $form .= ">\n";
     if (!bool_config_item('disable_csrf_protection')) {
         if (!is_array($hidden)) {
             $hidden = array();
         }
         $hidden['csrf_token'] = CSRF_TOKEN;
     }
     if (is_array($hidden) and count($hidden > 0)) {
         $form .= form_hidden($hidden) . "\n";
     }
     return $form;
 }
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:30,代码来源:EE_form_helper.php

示例2: setGlobalJs

 protected function setGlobalJs($entry, $valid)
 {
     $entry_id = $entry->entry_id;
     $channel_id = $entry->channel_id;
     $autosave_interval_seconds = ee()->config->item('autosave_interval_seconds') === FALSE ? 60 : ee()->config->item('autosave_interval_seconds');
     //	Create Foreign Character Conversion JS
     include APPPATH . 'config/foreign_chars.php';
     /* -------------------------------------
     		/*  'foreign_character_conversion_array' hook.
     		/*  - Allows you to use your own foreign character conversion array
     		/*  - Added 1.6.0
     		* 	- Note: in 2.0, you can edit the foreign_chars.php config file as well
     		*/
     if (isset(ee()->extensions->extensions['foreign_character_conversion_array'])) {
         $foreign_characters = ee()->extensions->call('foreign_character_conversion_array');
     }
     /*
     		/* -------------------------------------*/
     $smileys_enabled = isset(ee()->cp->installed_modules['emoticon']) ? TRUE : FALSE;
     if ($smileys_enabled) {
         ee()->load->helper('smiley');
         ee()->cp->add_to_foot(smiley_js());
     }
     ee()->javascript->set_global(array('lang.add_new_html_button' => lang('add_new_html_button'), 'lang.close' => lang('close'), 'lang.confirm_exit' => lang('confirm_exit'), 'lang.loading' => lang('loading'), 'publish.autosave.interval' => (int) $autosave_interval_seconds, 'publish.autosave.URL' => ee('CP/URL')->make('publish/autosave/' . $channel_id . '/' . $entry_id)->compile(), 'publish.add_category.URL' => ee('CP/URL')->make('channels/cat/createCat/###')->compile(), 'publish.foreignChars' => $foreign_characters, 'publish.lang.no_member_groups' => lang('no_member_groups'), 'publish.lang.refresh_layout' => lang('refresh_layout'), 'publish.lang.tab_count_zero' => lang('tab_count_zero'), 'publish.lang.tab_has_req_field' => lang('tab_has_req_field'), 'publish.markitup.foo' => FALSE, 'publish.smileys' => $smileys_enabled, 'publish.field.URL' => ee('CP/URL', 'publish/field/' . $channel_id . '/' . $entry_id)->compile(), 'publish.which' => $entry_id ? 'edit' : 'new', 'publish.word_separator' => ee()->config->item('word_separator') != "dash" ? '_' : '-', 'user.can_edit_html_buttons' => ee()->cp->allowed_group('can_edit_html_buttons'), 'user.foo' => FALSE, 'user_id' => ee()->session->userdata('member_id')));
     // -------------------------------------------
     //	Publish Page Title Focus - makes the title field gain focus when the page is loaded
     //
     //	Hidden Configuration Variable - publish_page_title_focus => Set focus to the tile? (y/n)
     ee()->javascript->set_global('publish.title_focus', FALSE);
     if (!$entry_id && $valid && bool_config_item('publish_page_title_focus')) {
         ee()->javascript->set_global('publish.title_focus', TRUE);
     }
 }
开发者ID:vigm,项目名称:advancedMD,代码行数:33,代码来源:AbstractPublish.php

示例3: form_open

 function form_open($action = '', $attributes = '', $hidden = array())
 {
     $CI =& get_instance();
     if ($attributes == '') {
         $attributes = 'method="post"';
     }
     $action = strpos($action, '://') === FALSE ? $CI->config->site_url($action) : $action;
     $form = '<form action="' . $action . '"';
     $form .= _attributes_to_string($attributes, TRUE);
     $form .= '>';
     // CSRF
     if (!bool_config_item('disable_csrf_protection')) {
         $hidden['csrf_token'] = CSRF_TOKEN;
     }
     if (is_array($hidden) and count($hidden) > 0) {
         $form .= sprintf("<div style=\"display:none\">%s</div>", form_hidden($hidden));
     }
     return $form;
 }
开发者ID:realfluid,项目名称:umbaugh,代码行数:19,代码来源:form_helper.php

示例4: have_valid_xid

 /**
  * Check and Validate Form CSRF tokens
  *
  * Checks any POST and PUT data for a valid csrf tokens. The main
  * processing happens in the csrf library which differentiates between
  * logged in and logged out users.
  *
  * @access public
  * @return boolean FALSE if there is an invalid XID, TRUE if valid or no XID
  */
 public function have_valid_xid($flags = self::CSRF_STRICT)
 {
     $is_valid = FALSE;
     // Check the token if we must
     ee()->load->library('csrf');
     if ($flags & self::CSRF_EXEMPT || AJAX_REQUEST && REQ != 'CP' && !($flags & self::CSRF_STRICT) || bool_config_item('disable_csrf_protection')) {
         $is_valid = TRUE;
     } else {
         $is_valid = ee()->csrf->check();
     }
     // Retrieve the current token
     $csrf_token = ee()->csrf->get_user_token();
     // Set the constant and the legacy constants. Le sigh.
     define('CSRF_TOKEN', $csrf_token);
     define('REQUEST_XID', $csrf_token);
     define('XID_SECURE_HASH', $csrf_token);
     // Send the header and legacy header for ajax requests
     if (AJAX_REQUEST && ee()->input->server('REQUEST_METHOD') == 'POST') {
         header('X-CSRF-TOKEN: ' . CSRF_TOKEN);
         header('X-EEXID: ' . CSRF_TOKEN);
     }
     return $is_valid;
 }
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:33,代码来源:EE_Security.php

示例5: set_cookie

 /**
  * Set cookie
  *
  * Accepts six parameter, or you can submit an associative
  * array in the first parameter containing all the values.
  *
  * @access	public
  * @param	mixed
  * @param	string	the value of the cookie
  * @param	string	the number of seconds until expiration
  * @param	string	the cookie domain.  Usually:  .yourdomain.com
  * @param	string	the cookie path
  * @param	string	the cookie prefix
  * @return	void
  */
 function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '')
 {
     if (is_array($name)) {
         foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item) {
             if (isset($name[$item])) {
                 ${$item} = $name[$item];
             }
         }
     }
     if ($prefix == '' and config_item('cookie_prefix') != '') {
         $prefix = config_item('cookie_prefix');
     }
     if ($domain == '' and config_item('cookie_domain') != '') {
         $domain = config_item('cookie_domain');
     }
     if ($path == '/' and config_item('cookie_path') != '/') {
         $path = config_item('cookie_path');
     }
     if (!is_numeric($expire)) {
         $expire = time() - 86500;
     } else {
         if ($expire > 0) {
             $expire = time() + $expire;
         } else {
             $expire = 0;
         }
     }
     $secure_cookie = bool_config_item('cookie_secure') === TRUE ? 1 : 0;
     if ($secure_cookie) {
         $req = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : FALSE;
         if (!$req or $req == 'off') {
             return FALSE;
         }
     }
     setcookie($prefix . $name, $value, $expire, $path, $domain, $secure_cookie);
 }
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:51,代码来源:Input.php

示例6: member_logout

 /**
  * Member Logout
  */
 public function member_logout()
 {
     // Check CSRF Token
     $token = FALSE;
     if (!$token) {
         $token = ee()->input->get('csrf_token');
     }
     if (!$token) {
         $token = ee()->input->get('XID');
     }
     if (!bool_config_item('disable_csrf_protection') && $token != CSRF_TOKEN) {
         return ee()->output->show_user_error('general', array(lang('not_authorized')));
     }
     // Kill the session and cookies
     ee()->db->where('site_id', ee()->config->item('site_id'));
     ee()->db->where('ip_address', ee()->input->ip_address());
     ee()->db->where('member_id', ee()->session->userdata('member_id'));
     ee()->db->delete('online_users');
     ee()->session->destroy();
     ee()->input->delete_cookie('read_topics');
     $csrf_token = ee()->csrf->refresh_token();
     /* -------------------------------------------
     		/* 'member_member_logout' hook.
     		/*  - Perform additional actions after logout
     		/*  - Added EE 1.6.1
     		*/
     ee()->extensions->call('member_member_logout');
     if (ee()->extensions->end_script === TRUE) {
         return;
     }
     /*
     		/* -------------------------------------------*/
     // Is this a forum redirect?
     $name = '';
     unset($url);
     if (ee()->input->get_post('FROM') == 'forum') {
         if (ee()->input->get_post('board_id') !== FALSE && is_numeric(ee()->input->get_post('board_id'))) {
             $query = ee()->db->select("board_forum_url, board_label")->where('board_id', ee()->input->get_post('board_id'))->get('forum_boards');
         } else {
             $query = ee()->db->select('board_forum_url, board_label')->where('board_id', (int) 1)->get('forum_boards');
         }
         $url = $query->row('board_forum_url');
         $name = $query->row('board_label');
     }
     // Build success message
     $url = !isset($url) ? ee()->config->item('site_url') : $url;
     $name = !isset($url) ? stripslashes(ee()->config->item('site_name')) : $name;
     $data = array('title' => lang('mbr_login'), 'heading' => lang('thank_you'), 'content' => lang('mbr_you_are_logged_out'), 'redirect' => $url, 'link' => array($url, $name));
     ee()->output->show_message($data);
 }
开发者ID:kentonquatman,项目名称:canyonwoodridge,代码行数:53,代码来源:mod.member_auth.php

示例7: bootstrap

 /**
  * Sets constants, sets paths contants to appropriate directories, loads
  * the database and generally prepares the system to run.
  */
 public function bootstrap()
 {
     // Define the request type
     // Note: admin.php defines REQ=CP
     if (!defined('REQ')) {
         define('REQ', ee()->input->get_post('ACT') !== FALSE ? 'ACTION' : 'PAGE');
     }
     // Set a liberal script execution time limit, making it shorter for front-end requests than CI's default
     if (function_exists("set_time_limit") == TRUE and @ini_get("safe_mode") == 0) {
         @set_time_limit(REQ == 'CP' ? 300 : 90);
     }
     // some path constants to simplify things
     define('PATH_MOD', APPPATH . 'modules/');
     define('PATH_PI', APPPATH . 'plugins/');
     define('PATH_EXT', APPPATH . 'extensions/');
     define('PATH_ACC', APPPATH . 'accessories/');
     define('PATH_FT', APPPATH . 'fieldtypes/');
     define('PATH_RTE', APPPATH . 'rte_tools/');
     if (ee()->config->item('third_party_path')) {
         define('PATH_THIRD', rtrim(realpath(ee()->config->item('third_party_path')), '/') . '/');
     } else {
         define('PATH_THIRD', APPPATH . 'third_party/');
     }
     // application constants
     define('IS_CORE', FALSE);
     define('APP_NAME', 'ExpressionEngine' . (IS_CORE ? ' Core' : ''));
     define('APP_BUILD', '20140715');
     define('APP_VER', '2.9.0');
     define('SLASH', '&#47;');
     define('LD', '{');
     define('RD', '}');
     define('AMP', '&amp;');
     define('NBS', '&nbsp;');
     define('BR', '<br />');
     define('NL', "\n");
     define('PATH_DICT', APPPATH . 'config/');
     define('AJAX_REQUEST', ee()->input->is_ajax_request());
     // Load DB and set DB preferences
     ee()->load->database();
     ee()->db->swap_pre = 'exp_';
     ee()->db->db_debug = FALSE;
     // Note enable_db_caching is a per site setting specified in EE_Config.php
     // If debug is on we enable the profiler and DB debug
     if (DEBUG == 1 or ee()->config->item('debug') == 2) {
         $this->_enable_debugging();
     }
     // Assign Site prefs now that the DB is fully loaded
     if (ee()->config->item('site_name') != '') {
         ee()->config->set_item('site_name', preg_replace('/[^a-z0-9\\-\\_]/i', '', ee()->config->item('site_name')));
     }
     ee()->config->site_prefs(ee()->config->item('site_name'));
     // Load the default caching driver
     ee()->load->driver('cache');
     // this look backwards, but QUERY_MARKER is only used where we MUST
     // have a ?, and do not want to double up
     // question marks on sites who are forcing query strings
     define('QUERY_MARKER', ee()->config->item('force_query_string') == 'y' ? '' : '?');
     // Load the settings of the site you're logged into, however use the
     // cookie settings from the site that corresponds to the URL
     // e.g. site1.com/system/ viewing site2
     // $last_site_id = the site that you're viewing
     // config->item('site_id') = the site who's URL is being used
     $last_site_id = ee()->input->cookie('cp_last_site_id');
     if (REQ == 'CP' && ee()->config->item('multiple_sites_enabled') == 'y') {
         $cookie_prefix = ee()->config->item('cookie_prefix');
         $cookie_path = ee()->config->item('cookie_path');
         $cookie_domain = ee()->config->item('cookie_domain');
         $cookie_httponly = ee()->config->item('cookie_httponly');
         if ($cookie_prefix) {
             $cookie_prefix .= '_';
         }
         if (!empty($last_site_id) && is_numeric($last_site_id) && $last_site_id != ee()->config->item('site_id')) {
             ee()->config->site_prefs('', $last_site_id);
         }
         ee()->config->cp_cookie_prefix = $cookie_prefix;
         ee()->config->cp_cookie_path = $cookie_path;
         ee()->config->cp_cookie_domain = $cookie_domain;
         ee()->config->cp_cookie_httponly = $cookie_httponly;
     }
     // This allows CI compatibility
     if (ee()->config->item('base_url') == FALSE) {
         ee()->config->set_item('base_url', ee()->config->item('site_url'));
     }
     if (ee()->config->item('index_page') == FALSE) {
         ee()->config->set_item('index_page', ee()->config->item('site_index'));
     }
     if (IS_CORE) {
         ee()->config->set_item('enable_template_routes', 'n');
     }
     // Backwards compatibility for the removed secure forms setting.
     // Developers are still checking against this key, so we'll wait some
     // time before removing it.
     $secure_forms = bool_config_item('disable_csrf_protection') ? 'n' : 'y';
     ee()->config->set_item('secure_forms', $secure_forms);
     // Set the path to the "themes" folder
     if (ee()->config->item('theme_folder_path') !== FALSE && ee()->config->item('theme_folder_path') != '') {
//.........这里部分代码省略.........
开发者ID:kentonquatman,项目名称:canyonwoodridge,代码行数:101,代码来源:Core.php

示例8: _update_upload_directories

 /**
  * Adds member image directories (avatars, photos, etc...) as upload
  * directories
  *
  * @access private
  * @return void
  */
 private function _update_upload_directories()
 {
     $module = ee('Model')->get('Module')->filter('module_name', 'Member')->first();
     // Bail if the member module isn't installed
     if (empty($module)) {
         return TRUE;
     }
     // Install member upload directories
     $site_id = ee()->config->item('site_id');
     $member_directories = array();
     if (bool_config_item('enable_avatars')) {
         $avatar_uploads = ee('Model')->get('UploadDestination')->filter('name', 'Avatars')->first();
         if (empty($avatar_uploads)) {
             $member_directories['Avatars'] = array('server_path' => ee()->config->item('avatar_path'), 'url' => ee()->config->item('avatar_url'), 'allowed_types' => 'img', 'max_width' => ee()->config->item('avatar_max_width'), 'max_height' => ee()->config->item('avatar_max_height'), 'max_size' => ee()->config->item('avatar_max_kb'));
         }
     }
     if (bool_config_item('enable_photos')) {
         $member_photo_uploads = ee('Model')->get('UploadDestination')->filter('name', 'Member Photos')->first();
         if (empty($member_photo_uploads)) {
             $member_directories['Member Photos'] = array('server_path' => ee()->config->item('photo_path'), 'url' => ee()->config->item('photo_url'), 'allowed_types' => 'img', 'max_width' => ee()->config->item('photo_max_width'), 'max_height' => ee()->config->item('photo_max_height'), 'max_size' => ee()->config->item('photo_max_kb'));
         }
     }
     if (bool_config_item('allow_signatures')) {
         $signature_uploads = ee('Model')->get('UploadDestination')->filter('name', 'Signature Attachments')->first();
         if (empty($signature_uploads)) {
             $member_directories['Signature Attachments'] = array('server_path' => ee()->config->item('sig_img_path'), 'url' => ee()->config->item('sig_img_url'), 'allowed_types' => 'img', 'max_width' => ee()->config->item('sig_img_max_width'), 'max_height' => ee()->config->item('sig_img_max_height'), 'max_size' => ee()->config->item('sig_img_max_kb'));
         }
     }
     if (bool_config_item('prv_msg_enabled') && bool_config_item('prv_msg_allow_attachments')) {
         $pm_uploads = ee('Model')->get('UploadDestination')->filter('name', 'PM Attachments')->first();
         if (empty($pm_uploads)) {
             $member_directories['PM Attachments'] = array('server_path' => ee()->config->item('prv_msg_upload_path'), 'url' => str_replace('avatars', 'pm_attachments', ee()->config->item('avatar_url')), 'allowed_types' => 'img', 'max_size' => ee()->config->item('prv_msg_attach_maxsize'));
         }
     }
     foreach ($member_directories as $name => $dir) {
         $directory = ee('Model')->make('UploadDestination');
         $directory->site_id = $site_id;
         $directory->name = $name;
         $directory->removeNoAccess();
         $directory->setModule($module);
         foreach ($dir as $property => $value) {
             $directory->{$property} = $value;
         }
         $directory->save();
     }
     return TRUE;
 }
开发者ID:vigm,项目名称:advancedMD,代码行数:54,代码来源:ud_3_00_00.php

示例9: index

 /**
  * Date Settings
  */
 public function index()
 {
     $field['allowed_channels'] = array();
     $all_sites_have_channels = TRUE;
     // If MSM is enabled, let them choose a channel for each site, should they
     // want to redirect to the publish form on each site
     if (bool_config_item('multiple_sites_enabled')) {
         $sites = ee('Model')->get('Site')->all();
         $field['sites'] = $sites->getDictionary('site_id', 'site_label');
         $assigned_channels = $this->member->MemberGroup->AssignedChannels->pluck('channel_id');
         foreach ($sites as $site) {
             // Get only the channels they're allowed to post in
             $field['allowed_channels'][$site->getId()] = $site->Channels->filter(function ($channel) {
                 return ee()->session->userdata('group_id') == 1 or !empty($assigned_channels) && in_array($channel->getId(), $assigned_channels);
             })->getDictionary('channel_id', 'channel_title');
             // No channels? Let them know
             if (empty($field['allowed_channels'][$site->getId()])) {
                 $all_sites_have_channels = FALSE;
                 $field['allowed_channels'][$site->getId()][0] = lang('no_channels');
             }
         }
     } else {
         $allowed_channels = ee('Model')->get('Channel')->filter('site_id', ee()->config->item('site_id'));
         if (!empty(ee()->session->userdata['assigned_channels'])) {
             $allowed_channels->filter('channel_id', 'IN', array_keys(ee()->session->userdata['assigned_channels']));
         }
         $field['allowed_channels'] = $allowed_channels->all()->getDictionary('channel_id', 'channel_title');
         if (empty($field['allowed_channels'])) {
             $all_sites_have_channels = FALSE;
             $field['allowed_channels'][0] = lang('no_channels');
         }
         $site_id = ee()->config->item('site_id');
         $field['selected_channel'] = isset($this->member->cp_homepage_channel[$site_id]) ? $this->member->cp_homepage_channel[$site_id] : 0;
     }
     $field['member'] = $this->member;
     $field['all_sites_have_channels'] = $all_sites_have_channels;
     $vars['sections'] = array(array(array('title' => 'default_cp_homepage', 'desc' => 'default_cp_homepage_myaccount_desc', 'fields' => array('cp_homepage_custom' => array('type' => 'html', 'content' => ee('View')->make('account/cp_homepage_setting')->render($field))))));
     $base_url = ee('CP/URL')->make($this->base_url);
     if (!empty($_POST)) {
         $validator = ee('Validation')->make();
         $validator->defineRule('whenTypeIs', function ($key, $value, $parameters, $rule) {
             if ($_POST['cp_homepage'] != $parameters[0]) {
                 $rule->skip();
             }
             return TRUE;
         });
         $validator->defineRule('validateHomepageChannel', function () use($all_sites_have_channels) {
             if (!$all_sites_have_channels) {
                 return 'must_have_channels';
             }
             return TRUE;
         });
         $validator->setRules(array('cp_homepage' => 'whenTypeIs[publish_form]|validateHomepageChannel', 'cp_homepage_custom' => 'whenTypeIs[custom]|required'));
         $result = $validator->validate($_POST);
         if (AJAX_REQUEST) {
             $field = ee()->input->post('ee_fv_field');
             if ($result->hasErrors($field)) {
                 ee()->output->send_ajax_response(array('error' => $result->renderError($field)));
             } else {
                 ee()->output->send_ajax_response('success');
             }
         }
         if ($result->isValid()) {
             // Only set what we need to set to prevent POST fiddling
             $this->member->set(array('cp_homepage' => $_POST['cp_homepage'], 'cp_homepage_channel' => $_POST['cp_homepage_channel'], 'cp_homepage_custom' => $_POST['cp_homepage_custom']))->save();
             ee('CP/Alert')->makeInline('shared-form')->asSuccess()->withTitle(lang('member_updated'))->addToBody(lang('member_updated_desc'))->defer();
             ee()->functions->redirect($base_url);
         } else {
             $vars['errors'] = $result;
             ee('CP/Alert')->makeInline('shared-form')->asIssue()->withTitle(lang('settings_save_error'))->addToBody(lang('settings_save_error_desc'))->now();
         }
     }
     ee()->javascript->output("\n\t\t\t\$(document).ready(function () {\n\n\t\t\t\t\$('input[type=\"radio\"]').click(function(){\n\t\t\t\t\t\$('label.child').toggleClass('chosen', \$(this).val() == 'publish_form');\n\t\t\t\t});\n\t\t\t});\n\t\t");
     ee()->view->base_url = $base_url;
     ee()->view->ajax_validate = TRUE;
     ee()->view->cp_page_title = lang('cp_settings');
     ee()->view->save_btn_text = 'btn_save_settings';
     ee()->view->save_btn_text_working = 'btn_saving';
     ee()->cp->render('settings/form', $vars);
 }
开发者ID:vigm,项目名称:advancedMD,代码行数:83,代码来源:CpSettings.php

示例10: _authenticate

 /**
  * Authenticate
  *
  * @access	private
  */
 private function _authenticate(CI_DB_result $member, $password)
 {
     $always_disallowed = array(4);
     if (bool_config_item('allow_pending_login')) {
         $always_disallowed = array_diff($always_disallowed, array(4));
     }
     if ($member->num_rows() !== 1) {
         return FALSE;
     }
     if (in_array($member->row('group_id'), $always_disallowed)) {
         return ee()->output->show_user_error('general', lang('mbr_account_not_active'));
     }
     $m_salt = $member->row('salt');
     $m_pass = $member->row('password');
     // hash using the algo used for this password
     $h_byte_size = strlen($m_pass);
     $hashed_pair = $this->hash_password($password, $m_salt, $h_byte_size);
     if ($hashed_pair === FALSE or $m_pass !== $hashed_pair['password']) {
         return FALSE;
     }
     // Officially a valid user, but are they as secure as possible?
     // ----------------------------------------------------------------
     reset($this->hash_algos);
     // Not hashed or better algo available?
     if (!$m_salt or $h_byte_size != key($this->hash_algos)) {
         $m_id = $member->row('member_id');
         $this->update_password($m_id, $password);
     }
     $authed = new Auth_result($member->row());
     $member->free_result();
     return $authed;
 }
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:37,代码来源:Auth.php

示例11: renderRevisionsPartial

 /**
  * Renders the template revisions table for the Revisions tab
  *
  * @param TemplateModel $template A Template entity
  * @param int $version_id ID of template version to mark as selected
  * @return string Table HTML for insertion into Template edit form
  */
 protected function renderRevisionsPartial($template, $version_id = FALSE)
 {
     if (!bool_config_item('save_tmpl_revisions')) {
         return FALSE;
     }
     $table = ee('CP/Table');
     $table->setColumns(array('rev_id', 'rev_date', 'rev_author', 'manage' => array('encode' => FALSE)));
     $table->setNoResultsText(lang('no_revisions'));
     $data = array();
     $i = 1;
     foreach ($template->Versions as $version) {
         $attrs = array();
         // Last item should be marked as current
         if ($template->Versions->count() == $i) {
             $toolbar = '<span class="st-open">' . lang('current') . '</span>';
         } else {
             $toolbar = ee('View')->make('_shared/toolbar')->render(array('toolbar_items' => array('txt-only' => array('href' => ee('CP/URL', 'design/template/edit/' . $template->getId(), array('version' => $version->getId())), 'title' => lang('view'), 'content' => lang('view')))));
         }
         // Mark currently-loaded version as selected
         if (!$version_id && $template->Versions->count() == $i or $version_id == $version->getId()) {
             $attrs = array('class' => 'selected');
         }
         $data[] = array('attrs' => $attrs, 'columns' => array($i, ee()->localize->human_time($version->item_date), $version->Author->getMemberName(), $toolbar));
         $i++;
     }
     $table->setData($data);
     return ee('View')->make('_shared/table')->render($table->viewData(''));
 }
开发者ID:vigm,项目名称:advancedMD,代码行数:35,代码来源:Template.php

示例12: _set_cookie

 /**
  * Write the session cookie
  *
  * @access	public
  * @return	void
  */
 function _set_cookie($cookie_data = NULL)
 {
     if (is_null($cookie_data)) {
         $cookie_data = $this->userdata;
     }
     // Serialize the userdata for the cookie
     $cookie_data = $this->_serialize($cookie_data);
     if ($this->sess_encrypt_cookie == TRUE) {
         $cookie_data = $this->CI->encrypt->encode($cookie_data);
     } else {
         // if encryption is not used, we provide an md5 hash to prevent userside tampering
         $cookie_data = $cookie_data . md5($cookie_data . $this->encryption_key);
     }
     $expire = $this->sess_expire_on_close === TRUE ? 0 : $this->sess_expiration + time();
     $secure_cookie = bool_config_item('cookie_secure') === TRUE ? 1 : 0;
     if ($secure_cookie) {
         $req = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : FALSE;
         if (!$req or $req == 'off') {
             return FALSE;
         }
     }
     // Set the cookie
     setcookie($this->sess_cookie_name, $cookie_data, $expire, $this->cookie_path, $this->cookie_domain, $secure_cookie);
 }
开发者ID:realfluid,项目名称:umbaugh,代码行数:30,代码来源:Session.php

示例13: bootstrap

 /**
  * Sets constants, sets paths contants to appropriate directories, loads
  * the database and generally prepares the system to run.
  */
 public function bootstrap()
 {
     if ($this->bootstrapped) {
         return;
     }
     $this->bootstrapped = TRUE;
     // Define the request type
     // Note: admin.php defines REQ=CP
     if (!defined('REQ')) {
         define('REQ', ee()->input->get_post('ACT') !== FALSE ? 'ACTION' : 'PAGE');
     }
     // Set a liberal script execution time limit, making it shorter for front-end requests than CI's default
     if (function_exists("set_time_limit") == TRUE and @ini_get("safe_mode") == 0) {
         @set_time_limit(REQ == 'CP' ? 300 : 90);
     }
     // If someone's trying to access the CP but EE_APPPATH is defined, it likely
     // means the installer is still active; redirect to clean path
     if (defined('EE_APPPATH') && ee()->uri->segment(1) == 'cp') {
         header('Location: ' . SELF);
     }
     // some path constants to simplify things
     define('PATH_ADDONS', SYSPATH . 'ee/EllisLab/Addons/');
     define('PATH_MOD', SYSPATH . 'ee/EllisLab/Addons/');
     define('PATH_PI', SYSPATH . 'ee/EllisLab/Addons/');
     define('PATH_EXT', SYSPATH . 'ee/EllisLab/Addons/');
     define('PATH_FT', SYSPATH . 'ee/EllisLab/Addons/');
     define('PATH_RTE', APPPATH . 'rte_tools/');
     define('PATH_THIRD', SYSPATH . 'user/addons/');
     define('PATH_CACHE', SYSPATH . 'user/cache/');
     define('PATH_TMPL', SYSPATH . 'user/templates/');
     // application constants
     define('IS_CORE', TRUE);
     define('APP_NAME', 'ExpressionEngine' . (IS_CORE ? ' Core' : ''));
     define('APP_BUILD', '20151201');
     define('APP_VER', '3.0.5');
     define('SLASH', '&#47;');
     define('LD', '{');
     define('RD', '}');
     define('AMP', '&amp;');
     define('NBS', '&nbsp;');
     define('BR', '<br />');
     define('NL', "\n");
     define('PATH_DICT', APPPATH . 'config/');
     define('AJAX_REQUEST', ee()->input->is_ajax_request());
     define('PASSWORD_MAX_LENGTH', 72);
     ee()->load->helper('language');
     ee()->load->helper('string');
     // Load the default caching driver
     ee()->load->driver('cache');
     ee()->load->database();
     ee()->db->swap_pre = 'exp_';
     ee()->db->db_debug = FALSE;
     // boot the addons
     ee('App')->setupAddons(SYSPATH . 'ee/EllisLab/Addons/');
     ee('App')->setupAddons(PATH_THIRD);
     // Set ->api on the legacy facade to the model factory
     ee()->set('api', ee()->di->make('Model'));
     // If debug is on we enable the profiler and DB debug
     if (DEBUG == 1 or ee()->config->item('debug') == 2) {
         $this->_enable_debugging();
     }
     // Assign Site prefs now that the DB is fully loaded
     if (ee()->config->item('site_name') != '') {
         ee()->config->set_item('site_name', preg_replace('/[^a-z0-9\\-\\_]/i', '', ee()->config->item('site_name')));
     }
     ee()->config->site_prefs(ee()->config->item('site_name'));
     // earliest point we can apply this, makes sure that PHPSESSID cookies
     // don't leak to JS by setting the httpOnly flag
     $secure = bool_config_item('cookie_secure');
     $httpOnly = ee()->config->item('cookie_httponly') ? bool_config_item('cookie_httponly') : TRUE;
     session_set_cookie_params(0, ee()->config->item('cookie_path'), ee()->config->item('cookie_domain'), $secure, $httpOnly);
     // this look backwards, but QUERY_MARKER is only used where we MUST
     // have a ?, and do not want to double up
     // question marks on sites who are forcing query strings
     define('QUERY_MARKER', ee()->config->item('force_query_string') == 'y' ? '' : '?');
     // Load the settings of the site you're logged into, however use the
     // cookie settings from the site that corresponds to the URL
     // e.g. site1.com/system/ viewing site2
     // $last_site_id = the site that you're viewing
     // config->item('site_id') = the site who's URL is being used
     $last_site_id = ee()->input->cookie('cp_last_site_id');
     if (REQ == 'CP' && ee()->config->item('multiple_sites_enabled') == 'y') {
         $cookie_prefix = ee()->config->item('cookie_prefix');
         $cookie_path = ee()->config->item('cookie_path');
         $cookie_domain = ee()->config->item('cookie_domain');
         $cookie_httponly = ee()->config->item('cookie_httponly');
         if ($cookie_prefix) {
             $cookie_prefix .= '_';
         }
         if (!empty($last_site_id) && is_numeric($last_site_id) && $last_site_id != ee()->config->item('site_id')) {
             ee()->config->site_prefs('', $last_site_id);
         }
         ee()->config->cp_cookie_prefix = $cookie_prefix;
         ee()->config->cp_cookie_path = $cookie_path;
         ee()->config->cp_cookie_domain = $cookie_domain;
         ee()->config->cp_cookie_httponly = $cookie_httponly;
//.........这里部分代码省略.........
开发者ID:vigm,项目名称:advancedMD,代码行数:101,代码来源:Core.php

示例14: saveNewTemplateRevision

 /**
  * Saves a new template revision and rotates revisions based on 'max_tmpl_revisions' config item
  *
  * @param	Template	$template	Saved template model object
  */
 protected function saveNewTemplateRevision($template)
 {
     if (!bool_config_item('save_tmpl_revisions')) {
         return;
     }
     // Create the new version
     $version = ee('Model')->make('RevisionTracker');
     $version->Template = $template;
     $version->item_table = 'exp_templates';
     $version->item_field = 'template_data';
     $version->item_data = $template->template_data;
     $version->item_date = ee()->localize->now;
     $version->Author = $template->LastAuthor;
     $version->save();
     // Now, rotate template revisions based on 'max_tmpl_revisions' config item
     $versions = ee('Model')->get('RevisionTracker')->filter('item_id', $template->getId())->filter('item_field', 'template_data')->order('item_date', 'desc')->limit(ee()->config->item('max_tmpl_revisions'))->all();
     // Reassign versions and delete the leftovers
     $template->Versions = $versions;
     $template->save();
 }
开发者ID:vigm,项目名称:advancedMD,代码行数:25,代码来源:AbstractDesign.php

示例15: lang

		&mdash; <i><?php 
    echo lang('choose_channels_per_site');
    ?>
</i>
	<?php 
} else {
    ?>
		<?php 
    echo form_dropdown('cp_homepage_channel[' . ee()->config->item('site_id') . ']', $allowed_channels, $selected_channel);
    ?>
	<?php 
}
?>
</label>
<?php 
if (bool_config_item('multiple_sites_enabled')) {
    ?>
	<?php 
    foreach ($allowed_channels as $site_id => $channels) {
        ?>
		<label class="choice block child<?php 
        if ($member->cp_homepage == 'publish_form') {
            ?>
 chosen<?php 
        }
        ?>
">
			<?php 
        echo $sites[$site_id];
        ?>
 &mdash;
开发者ID:vigm,项目名称:advancedMD,代码行数:31,代码来源:cp_homepage_setting.php


注:本文中的bool_config_item函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。