本文整理汇总了PHP中show_error函数的典型用法代码示例。如果您正苦于以下问题:PHP show_error函数的具体用法?PHP show_error怎么用?PHP show_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html_purify
function html_purify($dirty_html, $config = FALSE)
{
require_once APPPATH . 'third_party/htmlpurifier-4.6.0-standalone/HTMLPurifier.standalone.php';
if (is_array($dirty_html)) {
foreach ($dirty_html as $key => $val) {
$clean_html[$key] = html_purify($val, $config);
}
} else {
$ci =& get_instance();
switch ($config) {
//settings for rhe WYSIWYG
case 'comment':
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', $ci->config->item('charset'));
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
$config->set('HTML.Allowed', 'a[href|title],img[title|src|alt],em,strong,cite,blockquote,code,ul,ol,li,dl,dt,dd,p,br,h1,h2,h3,h4,h5,h6,span,*[style]');
$config->set('AutoFormat.AutoParagraph', TRUE);
$config->set('AutoFormat.Linkify', TRUE);
$config->set('AutoFormat.RemoveEmpty', TRUE);
break;
case FALSE:
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', $ci->config->item('charset'));
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
break;
default:
show_error('The HTMLPurifier configuration labeled "' . htmlentities($config, ENT_QUOTES, 'UTF-8') . '" could not be found.');
}
$purifier = new HTMLPurifier($config);
$clean_html = $purifier->purify($dirty_html);
}
return $clean_html;
}
示例2: view
/**
* Replace the default $this->load->view() method
* with our own, so we can use Smarty!
*
* This method works identically to CI's default method,
* in that you should pass parameters to it in the same way.
*
* @access public
* @param string The template path name.
* @param array An array of data to convert to variables.
* @param bool Set to TRUE to return the loaded template as a string.
* @return mixed If $return is TRUE, returns string. If not, returns void.
*/
public function view($template, $data = array(), $return = false)
{
// Get the CI super object, load related library.
$CI =& get_instance();
$CI->load->library('smartytpl');
// Add extension to the filename if it's not there.
$ext = '.' . $CI->config->item('smarty_template_ext');
if (substr($template, -strlen($ext)) !== $ext) {
$template .= $ext;
}
// Make sure the file exists first.
if (!$CI->smartytpl->templateExists($template)) {
show_error('Unable to load the template file: ' . $template);
}
// Assign any variables from the $data array.
$CI->smartytpl->assign_variables($data);
// Assign CI instance to be available in templates as $ci
$CI->smartytpl->assignByRef('ci', $CI);
/*
Smarty has two built-in functions to rendering templates: display()
and fetch(). We're going to use only fetch(), since we want to take
the template contents and either return them or add them to
CodeIgniter's output class. This lets us optionally take advantage
of some of CI's built-in output features.
*/
$output = $CI->smartytpl->fetch($template);
// Return the output if the return value is TRUE.
if ($return === true) {
return $output;
}
// Otherwise append to output just like a view.
$CI->output->append_output($output);
}
示例3: __construct
function __construct()
{
parent::__construct();
if (!$this->require_min_level(9)) {
show_error('You do not have access to view this resource', '403');
}
}
示例4: _render_query
protected function _render_query()
{
if (empty($this->_config)) {
show_error("No están definidas las configuraciones para el elemento select_fk: {$this->_name}");
}
// array(
// * "table_fk" => La tabla de donde tomar los datos
// * "value_field" => El campo que se usará para el option.value [default = 'id_{table}']
// * "text_field" => El campo que se usará para option.text [default = 'nombre']
// * "where" => Los filtros que se usarán en $this->db->where($where)
// * "query" => Un query SQL por si es una query más compleja
// * y no alcanzan con los parámetros anteriores para especificar
// * los resultados.
// * )
$array_to_render = "<?php " . PHP_EOL;
$array_to_render .= "\$config_{$this->_name} = array(" . PHP_EOL;
if (!empty($this->_config["query"])) {
$query = str_ireplace("'", '"', $this->_config["query"]);
$array_to_render .= "'query' => '{$query}'," . PHP_EOL;
} else {
$where = str_ireplace("'", '"', $this->_config["where"]);
$array_to_render .= "'table' => '{$this->_config["table_fk"]}'," . PHP_EOL;
$array_to_render .= "'value_field' => '{$this->_config["value_field"]}'," . PHP_EOL;
$array_to_render .= "'text_field' => '{$this->_config["text_field"]}'," . PHP_EOL;
$array_to_render .= "'where' => '{$where}'," . PHP_EOL;
}
$array_to_render .= ");" . PHP_EOL;
$array_to_render .= '$rows = options_select_fk($config_' . $this->_name . ');' . PHP_EOL;
$array_to_render .= "?>" . PHP_EOL;
return $array_to_render;
}
示例5: extension
/**
* Load Extension
*
* This function loads the specified extension.
*
* @access public
* @param array $extensions specified extension
* @return void
*/
public function extension($extensions = array())
{
if (!is_array($extensions)) {
$extensions = array($extensions);
}
foreach ($extensions as $extension) {
$plugin = strtolower(str_replace('.php', '', $extension));
// If the extension is already loaded, continue on.
if (isset($this->_ci_extensions[$extension])) {
continue;
}
// Attempt to load the extension.
if (file_exists($extension_path = sprintf(APPPATH . 'extend/%s/main.php', $extension))) {
include $extension_path;
} else {
if (file_exists($extension_path = sprintf(BASEPATH . 'extend/%s/main.php', $extension))) {
include $extension_path;
} else {
show_error(sprintf('Unable to load the requested file: extend/%s/main.php', $extension));
}
}
// Initialize the plugin and log it.
$this->_ci_extensions[$extension] = new $plugin();
log_message('debug', sprintf('Extension loaded: %s', $plugin));
}
}
示例6: index
function index()
{
$usersListQuery = $this->usersModel->getLastXUsers(6);
$footerWidebarData['usersListArr'] = $usersListQuery;
$contactStatus['contactStatus'] = false;
if ($this->input->post('submit')) {
$name = (string) $this->input->post('name', TRUE);
$email = (string) $this->input->post('email', TRUE);
$subject = (string) $this->input->post('subject', TRUE);
$message = (string) $this->input->post('message', TRUE);
if (empty($name) or empty($email) or empty($subject) or empty($message)) {
show_error("Toate campurile sunt obligatorii. Te rog sa completezi toate campurile si sa incerci din nou.");
}
if (!valid_email($email)) {
show_error("Adresa de mail nu este valida.");
}
$config['protocol'] = 'sendmail';
$this->email->initialize($config);
$this->email->from($email, $name);
$this->email->to('radu.micu@radumicu.info');
$this->email->subject('NoiseStats Contact - ' . $subject);
$this->email->message($message);
$this->email->send();
$contactStatus['contactStatus'] = true;
$this->load->view('header');
$this->load->view('contact', $contactStatus);
$this->load->view('footer_widebar', $footerWidebarData);
$this->load->view('footer');
} else {
$this->load->view('header');
$this->load->view('contact', $contactStatus);
$this->load->view('footer_widebar', $footerWidebarData);
$this->load->view('footer');
}
}
示例7: _initialize
/**
* Load the EE config file and set the initial values
*
* @access private
* @return void
*/
function _initialize()
{
// Fetch the config file
if ( ! @include($this->config_path))
{
show_error('Unable to locate your config file (expressionengine/config/config.php)');
}
// Prior to 2.0 the config array was named $conf. This has changed to $config for 2.0
if (isset($conf))
{
$config = $conf;
}
// Is the config file blank? If not, we bail out since EE hasn't been installed
if ( ! isset($config) OR count($config) == 0)
{
return FALSE;
}
// Add the EE config data to the master CI config array
foreach ($config as $key => $val)
{
$this->set_item($key, $val);
}
unset($config);
// Set any config overrides. These are the items that used to be in
// the path.php file, which are now located in the main index file
$this->_set_overrides($this->config);
// Set the default_ini data, used by the sites feature
$this->default_ini = $this->config;
}
示例8: get_pages
public static function get_pages($lang = FALSE)
{
if ($lang == FALSE) {
$lang = Settings::get_lang();
}
$pages = self::$ci->page_model->get_lang_list(false, $lang);
// Should never be displayed : no pages are set.
if (empty($pages)) {
show_error('Internal error : <b>No pages found.</b><br/>Solution: <b>Create at least one online page.</b>', 500);
exit;
}
/* Spread authorizations from parents pages to chidrens.
* This adds the group ID to the childrens pages of a protected page
* If you don't want this, just uncomment this line.
*/
if (Connect()->logged_in()) {
self::$user = Connect()->get_current_user();
}
self::$ci->page_model->spread_authorizations($pages);
// Filter pages regarding the authorizations
$pages = array_values(array_filter($pages, array(__CLASS__, '_filter_pages_authorization')));
// Set all abolute URLs one time, for perf.
self::init_absolute_urls($pages, $lang);
return $pages;
}
示例9: __construct
public function __construct()
{
parent::__construct();
if (!ee()->cp->allowed_group('can_access_comm')) {
show_error(lang('unauthorized_access'));
}
}
示例10: read_config
function read_config($file, $fail_gracefully=TRUE)
{
$file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
if ( ! file_exists(APPPATH.'config/'.$file.EXT))
{
if ($fail_gracefully === TRUE)
{
return FALSE;
}
show_error('The configuration file '.$file.EXT.' does not exist.');
}
include(APPPATH.'config/'.$file.EXT);
if ( ! isset($config) OR ! is_array($config))
{
if ($fail_gracefully === TRUE)
{
return FALSE;
}
show_error('Your '.$file.EXT.' file does not appear to contain a valid configuration array.');
}
return $config;
}
示例11: __construct
/**
* Constructor
*/
function __construct()
{
log_message('debug', 'Amazon SES Class Initialized');
$this->_ci =& get_instance();
// Load all config items
$this->_ci->load->config('amazon_ses');
$this->_access_key = $this->_ci->config->item('amazon_ses_access_key');
$this->_secret_key = $this->_ci->config->item('amazon_ses_secret_key');
$this->_cert_path = $this->_ci->config->item('amazon_ses_cert_path');
$this->from = $this->_ci->config->item('amazon_ses_from');
$this->from_name = $this->_ci->config->item('amazon_ses_from_name');
$this->charset = $this->_ci->config->item('amazon_ses_charset');
$this->_mime_boundary = $this->_ci->config->item('amazon_ses_mime_boundary');
$this->crlf = "\n";
// Check whether reply_to is not set
if ($this->_ci->config->item('amazon_ses_reply_to') === FALSE) {
$this->reply_to = $this->_ci->config->item('amazon_ses_from');
} else {
$this->reply_to = $this->_ci->config->item('amazon_ses_reply_to');
}
// Is our certificate path valid?
if (!file_exists($this->_cert_path)) {
show_error('CA root certificates not found. Please <a href="http://curl.haxx.se/ca/cacert.pem">download</a> a bundle of public root certificates and/or specify its location in config/amazon_ses.php');
}
// Load Phil's cURL library as a Spark or the normal way
if (method_exists($this->_ci->load, 'spark')) {
$this->_ci->load->spark('curl/1.0.0');
}
$this->_ci->load->library('curl');
}
示例12: checkAuth
private function checkAuth($method)
{
$auth = "";
if ($this->input->server('HTTP_X_AUTHORIZATION')) {
$auth = $this->input->server('HTTP_X_AUTHORIZATION');
}
$request_date = "";
if ($this->input->server('HTTP_DATE')) {
$request_date = $this->input->server('HTTP_DATE');
}
$query_string = "";
if ($this->input->server('QUERY_STRING')) {
$query_string = $this->input->server('QUERY_STRING');
}
if (empty($request_date) || !$this->checkDate($request_date)) {
$error_code = "403";
$error_message = $error_code . " Date is invalid";
show_error($error_message, $error_code);
exit;
}
if (empty($auth) || !isAuthorized($auth, $request_date, $method, $query_string)) {
$error_code = "401";
$error_message = $error_code . " Unauthorized";
show_error($error_message, $error_code);
exit;
}
}
示例13: submit
function submit()
{
$form_id = $this->input->post('form_id');
if (empty($form_id)) {
die(show_error('You did not specify a "form_id" in your form post.'));
}
$this->load->model('forms/form_model');
$form = $this->form_model->get_form($form_id);
if (empty($form)) {
die(show_error('This form is invalid.'));
}
// do they have permissions?
if (!$this->user_model->in_group($form['privileges'])) {
die(show_error('Invalid permissions'));
}
// form validation and processing
$this->load->library('custom_fields/form_builder');
$this->form_builder->build_form_from_group($form['custom_field_group_id']);
$recaptchaUserResponse = $this->CI->input->post('g-recaptcha-response');
$this->CI->load->model('recaptcha_model');
$recaptchaValidation = $this->recaptcha_model->recaptchaValidation($recaptchaUserResponse);
if ($this->form_builder->validate_post() === FALSE || $recaptchaValidation == false) {
$this->session->set_flashdata('validation_errors', $this->form_builder->validation_errors());
$values = query_value_encode(serialize($this->form_builder->post_to_array($form['custom_field_group_id'])));
return redirect($form['url_path'] . '?errors=true&values=' . $values);
}
// we validated! let's make the post
$custom_fields = $this->form_builder->post_to_array($form['custom_field_group_id']);
$this->form_model->new_response($form['id'], $this->user_model->logged_in() ? $this->user_model->get('id') : 0, $custom_fields);
redirect($form['redirect']);
}
示例14: __construct
public function __construct()
{
parent::__construct();
if (!$this->auth->is_allowed_to('manage_categories', 'all')) {
show_error('You do not have permission to view this part of the website.');
}
}
示例15: __construct
public function __construct()
{
parent::__construct();
if (!$this->ion_auth->logged_in()) {
redirect('auth/login', 'refresh');
} elseif (!$this->ion_auth->is_admin()) {
return show_error('You must be an administrator to view this page.');
} else {
/* Load */
$this->load->config('admin/dp_config');
$this->load->library('admin/page_title');
$this->load->library('admin/breadcrumbs');
$this->load->model('admin/core_model');
$this->load->helper('menu');
$this->lang->load(['admin/main_header', 'admin/main_sidebar', 'admin/footer', 'admin/actions']);
/* Load library function */
$this->breadcrumbs->unshift(0, $this->lang->line('menu_dashboard'), 'admin/dashboard');
/* Data */
$this->data['title'] = $this->config->item('title');
$this->data['title_lg'] = $this->config->item('title_lg');
$this->data['title_mini'] = $this->config->item('title_mini');
$this->data['admin_prefs'] = $this->prefs_model->admin_prefs();
$this->data['user_login'] = $this->prefs_model->user_info_login($this->ion_auth->user()->row()->id);
if ($this->router->fetch_class() == 'dashboard') {
$this->data['dashboard_alert_file_install'] = $this->core_model->get_file_install();
$this->data['header_alert_file_install'] = NULL;
} else {
$this->data['dashboard_alert_file_install'] = NULL;
$this->data['header_alert_file_install'] = NULL;
}
}
}