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


PHP Session::error方法代码示例

本文整理汇总了PHP中Session::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::error方法的具体用法?PHP Session::error怎么用?PHP Session::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


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

示例1: action_plugin_activation

 /**
  * Don't bother loading if the gd library isn't active
  */
 public function action_plugin_activation($file)
 {
     if (!function_exists('imagecreatefromjpeg')) {
         Session::error(_t("Habari Silo activation failed. PHP has not loaded the gd imaging library."));
         Plugins::deactivate_plugin(__FILE__);
     }
 }
开发者ID:anupom,项目名称:my-blog,代码行数:10,代码来源:habarisilo.plugin.php

示例2: act_add_comment

 /**
  * function add_comment
  * adds a comment to a post, if the comment content is not NULL
  * @param array An associative array of content found in the $_POST array
  */
 public function act_add_comment()
 {
     Utils::check_request_method(array('POST'));
     // We need to get the post anyway to redirect back to the post page.
     $post = Post::get(array('id' => $this->handler_vars['id']));
     if (!$post) {
         // trying to comment on a non-existent post?  Weirdo.
         header('HTTP/1.1 403 Forbidden', true, 403);
         die;
     }
     // Allow theme action hooks to work
     Themes::create();
     $form = $post->comment_form();
     $form->get();
     // Disallow non-FormUI comments
     if (!$form->submitted) {
         // Trying to submit a non-FormUI comment
         header('HTTP/1.1 403 Forbidden', true, 403);
         die;
     } else {
         // To be eventually incorporated more fully into FormUI.
         Plugins::act('comment_form_submit', $form);
         if ($form->success) {
             $this->add_comment($post->id, $form->cf_commenter->value, $form->cf_email->value, $form->cf_url->value, $form->cf_content->value, $form->get_values());
         } else {
             Session::error(_t('There was a problem submitting your comment.'));
             $form->bounce();
             //Utils::redirect( $post->permalink . '#respond' );
         }
     }
 }
开发者ID:habari,项目名称:system,代码行数:36,代码来源:feedbackhandler.php

示例3: __static

 /**
  * Constructor for RenderCache
  *
  * Sets up paths and gets the list of groups from file
  */
 public static function __static()
 {
     //Define the cache path and url
     self::$cache_path = HABARI_PATH . '/' . self::$rel_cache_path;
     self::$cache_url = Site::get_url('habari') . '/' . self::$rel_cache_path;
     //If the cache directory doesn't exist, make it
     if (!is_dir(self::$cache_path)) {
         mkdir(self::$cache_path, 0755);
     }
     //Enable only if the cache directory now exists and is writable
     self::$enabled = is_dir(self::$cache_path) && is_writeable(self::$cache_path);
     //Give an error if the cache directory is not writable
     if (!self::$enabled) {
         Session::error(sprintf(_t("The cache directory '%s' is not writable - the cache is disabled. The user, or group, which your web server is running as, needs to have read, write, and execute permissions on this directory."), self::$cache_path), 'RenderCache');
         EventLog::log(sprintf(_t("The cache directory '%s' is not writable - the cache is disabled."), self::$cache_path), 'notice', 'RenderCache', 'habari');
         return;
     }
     //Get the list of group names
     $group_file = self::get_group_list_file();
     if (file_exists($group_file)) {
         self::$group_list = unserialize(file_get_contents($group_file));
     } else {
         self::$group_list = array();
     }
 }
开发者ID:justinjstark,项目名称:rendercache,代码行数:30,代码来源:rendercache.php

示例4: get_import

	/**
	 * Handles GET requests for the import page.
	 */
	public function get_import()
	{
		// First check for troublesome plugins
		$bad_features = array(
		    'ping',
		    'pingback',
		    'spamcheck',
		);
		$troublemakers = array();
		$plugins = Plugins::list_active();
		foreach( $plugins as $plugin ) {
			$info = Plugins::load_info( $plugin );
			$provides = array();
			if( isset($info->provides ) ) {
				foreach( $info->provides->feature as $feature ) {
					$provides[] = $feature;
				}
			}
			$has_bad = array_intersect( $bad_features, $provides );
			if( count( $has_bad ) ) {
				$troublemakers[] = $info->name;
			}
		}
		if( count( $troublemakers ) ) {
			$troublemakers = implode( ', ', $troublemakers );
			$msg = _t( 'Plugins that conflict with importing are active. To prevent undesirable consequences, please de-activate the following plugins until the import is finished: ' ) . '<br>';
			$msg .= $troublemakers;
			$this->theme->conflicting_plugins = $msg;
			Session::error( $msg );
		}

		// Now get on with creating the page
		$importer = isset( $_POST['importer'] ) ? $_POST['importer'] : '';
		$stage = isset( $_POST['stage'] ) ? $_POST['stage'] : '1';
		$step = isset( $_POST['step'] ) ? $_POST['step'] : '1';

		$this->theme->enctype = Plugins::filter( 'import_form_enctype', 'application/x-www-form-urlencoded', $importer, $stage, $step );
		
		// filter to get registered importers
		$importers = Plugins::filter( 'import_names', array() );
		
		// fitler to get the output of the current importer, if one is running
		if ( $importer != '' ) {
			$output = Plugins::filter( 'import_stage', '', $importer, $stage, $step );
		}
		else {
			$output = '';
		}

		$this->theme->importer = $importer;
		$this->theme->stage = $stage;
		$this->theme->step = $step;
		$this->theme->importers = $importers;
		$this->theme->output = $output;
		
		$this->display( 'import' );

	}
开发者ID:rynodivino,项目名称:system,代码行数:61,代码来源:adminimporthandler.php

示例5: __construct

 /**
  * Constructor for APCCache
  */
 public function __construct()
 {
     $this->prefix = Options::get('private-GUID');
     $this->enabled = extension_loaded('apc');
     if (!$this->enabled) {
         Session::error(_t("The APC Cache PHP module is not loaded - the cache is disabled.", "apccache"), 'filecache');
         EventLog::log(_t("The APC Cache PHP module is not loaded - the cache is disabled.", "apccache"), 'notice', 'cache', 'apccache');
     }
 }
开发者ID:habari,项目名称:system,代码行数:12,代码来源:apccache.php

示例6: login

 public function login($params = [])
 {
     if ($error = Session::authorize_admin($params['username'], $params['password'])) {
         Session::$error = $error;
         header('Location: ' . SUBDIR . '/md/admin');
     } else {
         header('Location: ' . SUBDIR . '/md/doc-editor');
     }
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:9,代码来源:admin_ctrl.php

示例7: filter_activate_plugin

 public function filter_activate_plugin($ok, $file)
 {
     // Don't bother loading if the gd library isn't active
     if (!function_exists('imagecreatefromjpeg')) {
         EventLog::log(_t("S3 Silo activation failed. PHP has not loaded the gd imaging library."), 'warning', 'plugin');
         Session::error(_t("S3 Silo activation failed. PHP has not loaded the gd imaging library."));
         $ok = false;
     }
     return $ok;
 }
开发者ID:ringmaster,项目名称:s3silo,代码行数:10,代码来源:s3silo.plugin.php

示例8: action_init

 /**
  * function action_init
  * A function which makes sure we are good to go for plugin activation.
  */
 public function action_init()
 {
     if (!class_exists('RenderCache')) {
         Session::error(_t("LaTeX activation failed. This plugin requires the RenderCache class which was not found."));
         Plugins::deactivate_plugin(__FILE__);
         //Deactivate plugin
         Utils::redirect();
         //Refresh page. Unfortunately, if not done so then results don't appear
     }
 }
开发者ID:justinjstark,项目名称:jLaTeX,代码行数:14,代码来源:jLaTeX.plugin.php

示例9: filter_do_replace

 /**
  * Handler FormUI success action and do the replacement
  **/
 public function filter_do_replace($show_form, $form)
 {
     if (DB::query('UPDATE {posts} SET content = REPLACE(content, ? , ?)', array($form->search->value, $form->replace->value))) {
         Session::notice(sprintf(_t('Successfully replaced \'%s\' with \'%s\' in all posts'), $form->search->value, $form->replace->value));
         Utils::redirect(URL::get('admin', array('page' => 'plugins', 'configure' => Plugins::id_from_file(__FILE__), 'configaction' => _t('Replace'))), false);
     } else {
         Session::error(_t('There was an error with replacement.'));
     }
     return false;
 }
开发者ID:habari-extras,项目名称:freeplace,代码行数:13,代码来源:freeplace.plugin.php

示例10: action_plugin_activation

 public function action_plugin_activation($file)
 {
     if (realpath($file) == __FILE__) {
         // Let's make sure we at least have the default paths set
         $this->default_paths();
         // Also, check if the upload directory exist and are writable
         if (!$this->check_upload_dir()) {
             Session::error(_t('Failed to create the upload directory for metaWeblog.'));
         }
     }
 }
开发者ID:habari-extras,项目名称:metaweblog,代码行数:11,代码来源:metaweblog.plugin.php

示例11: action_plugin_activation

 /**
  * Don't bother loading if the gd library isn't active
  */
 public function action_plugin_activation($file)
 {
     if (!function_exists('imagecreatefromjpeg')) {
         Session::error(_t("Habari Silo activation failed. PHP has not loaded the gd imaging library."));
         Plugins::deactivate_plugin(__FILE__);
     }
     // Create required tokens
     ACL::create_token('create_directories', _t('Create media silo directories'), 'Administration');
     ACL::create_token('delete_directories', _t('Delete media silo directories'), 'Administration');
     ACL::create_token('upload_media', _t('Upload files to media silos'), 'Administration');
     ACL::create_token('delete_media', _t('Delete files from media silos'), 'Administration');
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:15,代码来源:habarisilo.plugin.php

示例12: act_uninstall

 public function act_uninstall($handler, $theme)
 {
     try {
         $package = HabariPackages::remove($handler->handler_vars['guid']);
         Session::notice("{$package->name} {$package->version} was uninstalled.");
     } catch (Exception $e) {
         Session::error('Could not complete uninstall: ' . $e->getMessage());
         if (DEBUG) {
             Utils::debug($e);
         }
     }
 }
开发者ID:habari-extras,项目名称:hpm,代码行数:12,代码来源:hpm.plugin.php

示例13: call

 function call($method, $args = array())
 {
     $args = array_merge(array('method' => $method, 'api_key' => $this->key), $args);
     ksort($args);
     $args = array_merge($args, array('api_sig' => $this->sign($args)));
     ksort($args);
     if ($method == 'upload') {
         $req = curl_init();
         $args['api_key'] = $this->key;
         $photo = $args['photo'];
         $args['photo'] = '@' . $photo;
         curl_setopt($req, CURLOPT_URL, $this->uploadendpoint);
         curl_setopt($req, CURLOPT_TIMEOUT, 0);
         // curl_setopt($req, CURLOPT_INFILESIZE, filesize($photo));
         // Sign and build request parameters
         curl_setopt($req, CURLOPT_POSTFIELDS, $args);
         curl_setopt($req, CURLOPT_CONNECTTIMEOUT, $this->conntimeout);
         curl_setopt($req, CURLOPT_FOLLOWLOCATION, 1);
         curl_setopt($req, CURLOPT_HEADER, 0);
         curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
         $this->_http_body = curl_exec($req);
         if (curl_errno($req)) {
             throw new Exception(curl_error($req));
         }
         curl_close($req);
         $xml = simplexml_load_string($this->_http_body);
         $this->xml = $xml;
         return $xml;
     } else {
         $url = $this->endpoint . implode('&', $this->encode($args));
         $call = new RemoteRequest($url);
         $call->set_timeout(5);
         try {
             $result = $call->execute();
         } catch (RemoteRequest_Timeout $t) {
             Session::error('Currently unable to connect to Flickr.', 'flickr API');
             return false;
         } catch (Exception $e) {
             // at the moment we're using the same error message, though this is more catastrophic
             Session::error('Currently unable to connect to Flickr.', 'flickr API');
             return false;
         }
         $response = $call->get_response_body();
         try {
             $xml = new SimpleXMLElement($response);
             return $xml;
         } catch (Exception $e) {
             Session::error('Unable to process Flickr response.', 'flickr API');
             return false;
         }
     }
 }
开发者ID:ringmaster,项目名称:system,代码行数:52,代码来源:flickrsilo.plugin.php

示例14: ajax_tags

 /**
  * Handles AJAX from /admin/tags
  * Used to delete and rename tags
  */
 public function ajax_tags($handler_vars)
 {
     Utils::check_request_method(array('POST'));
     $wsse = Utils::WSSE($handler_vars['nonce'], $handler_vars['timestamp']);
     if ($handler_vars['digest'] != $wsse['digest']) {
         Session::error(_t('WSSE authentication failed.'));
         echo Session::messages_get(true, array('Format', 'json_messages'));
         return;
     }
     $tag_names = array();
     $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true));
     $this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir);
     $action = $this->handler_vars['action'];
     switch ($action) {
         case 'delete':
             foreach ($_POST as $id => $delete) {
                 // skip POST elements which are not tag ids
                 if (preg_match('/^tag_\\d+/', $id) && $delete) {
                     $id = substr($id, 4);
                     $tag = Tags::get_by_id($id);
                     $tag_names[] = $tag->term_display;
                     Tags::vocabulary()->delete_term($tag);
                 }
             }
             $msg_status = _n(_t('Tag %s has been deleted.', array(implode('', $tag_names))), _t('%d tags have been deleted.', array(count($tag_names))), count($tag_names));
             Session::notice($msg_status);
             break;
         case 'rename':
             if (!isset($this->handler_vars['master'])) {
                 Session::error(_t('Error: New name not specified.'));
                 echo Session::messages_get(true, array('Format', 'json_messages'));
                 return;
             }
             $master = $this->handler_vars['master'];
             $tag_names = array();
             foreach ($_POST as $id => $rename) {
                 // skip POST elements which are not tag ids
                 if (preg_match('/^tag_\\d+/', $id) && $rename) {
                     $id = substr($id, 4);
                     $tag = Tags::get_by_id($id);
                     $tag_names[] = $tag->term_display;
                 }
             }
             Tags::vocabulary()->merge($master, $tag_names);
             $msg_status = sprintf(_n('Tag %1$s has been renamed to %2$s.', 'Tags %1$s have been renamed to %2$s.', count($tag_names)), implode($tag_names, ', '), $master);
             Session::notice($msg_status);
             break;
     }
     $this->theme->tags = Tags::vocabulary()->get_tree();
     $this->theme->max = Tags::vocabulary()->max_count();
     echo json_encode(array('msg' => Session::messages_get(true, 'array'), 'tags' => $this->theme->fetch('tag_collection')));
 }
开发者ID:ringmaster,项目名称:system,代码行数:56,代码来源:admintagshandler.php

示例15: action_init

 /**
  * Initialize by added directory variables
  */
 public function action_init()
 {
     $this->logs = dirname(__FILE__) . '/logs';
     $this->cache = dirname(__FILE__) . '/cache';
     if (!$this->confirm_dirs($error)) {
         Session::error("Clickheat error: {$error}");
         Plugins::deactivate_plugin(__FILE__);
         // Deactivate plugin
         Utils::redirect();
         //Refresh page
         exit;
     }
 }
开发者ID:habari-extras,项目名称:clickheat,代码行数:16,代码来源:clickheat.plugin.php


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