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


PHP Messages::errors方法代码示例

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


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

示例1: on_page_load

 public function on_page_load()
 {
     $email_ctx_id = $this->get('email_id_ctx', 'email');
     $email = $this->_ctx->get($email_ctx_id);
     $referrer_page = Request::current()->referrer();
     $next_page = $this->get('next_url', Request::current()->referrer());
     if (!Valid::email($email)) {
         Messages::errors(__('Use a valid e-mail address.'));
         HTTP::redirect($referrer_page);
     }
     $user = ORM::factory('user', array('email' => $email));
     if (!$user->loaded()) {
         Messages::errors(__('No user found!'));
         HTTP::redirect($referrer_page);
     }
     $reflink = ORM::factory('user_reflink')->generate($user, 'forgot', array('next_url' => URL::site($this->next_url, TRUE)));
     if (!$reflink) {
         Messages::errors(__('Reflink generate error'));
         HTTP::redirect($referrer_page);
     }
     Observer::notify('admin_login_forgot_before', $user);
     try {
         Email_Type::get('user_request_password')->send(array('username' => $user->username, 'email' => $user->email, 'reflink' => Route::url('reflink', array('code' => $reflink)), 'code' => $reflink));
         Messages::success(__('Email with reflink send to address set in your profile'));
     } catch (Exception $e) {
         Messages::error(__('Something went wrong'));
     }
     HTTP::redirect($next_page);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:29,代码来源:forgot.php

示例2: action_post

 /**
  * 
  * @param Datasource_Section $ds
  * @param Datasource_Document $doc
  */
 public function action_post()
 {
     $id = (int) $this->request->post('id');
     $doc = $this->_get_document($id);
     Session::instance()->set('post_data', $this->request->post());
     try {
         $doc->read_values($this->request->post())->read_files($_FILES)->validate();
     } catch (Validation_Exception $e) {
         Messages::errors($e->errors('validation'));
         $this->go_back();
     } catch (DataSource_Exception_Document $e) {
         Messages::errors($e->getMessage());
         $this->go_back();
     }
     if ($doc->loaded()) {
         $this->section()->update_document($doc);
     } else {
         $doc = $this->section()->create_document($doc);
     }
     Messages::success(__('Document saved'));
     Session::instance()->delete('post_data');
     // save and quit or save and continue editing?
     if ($this->request->post('commit') !== NULL) {
         $this->go(Route::get('datasources')->uri(array('directory' => 'datasources', 'controller' => 'data')) . URL::query(array('ds_id' => $this->section()->id()), FALSE));
     } else {
         $this->go(Route::get('datasources')->uri(array('directory' => $this->section()->type(), 'controller' => 'document', 'action' => 'view')) . URL::query(array('ds_id' => $this->section()->id(), 'id' => $doc->id), FALSE));
     }
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:33,代码来源:document.php

示例3: action_index

 public function action_index()
 {
     $code = $this->request->param('code');
     if ($code === NULL) {
         Model_Page_Front::not_found();
     }
     $reflink_model = ORM::factory('user_reflink', $code);
     if (!$reflink_model->loaded()) {
         Messages::errors(__('Reflink not found'));
         $this->go_home();
     }
     $next_url = Arr::get($reflink_model->data, 'next_url');
     try {
         Database::instance()->begin();
         Reflink::factory($reflink_model)->confirm();
         $reflink_model->delete();
         Database::instance()->commit();
     } catch (Kohana_Exception $e) {
         Database::instance()->rollback();
         Messages::errors($e->getMessage());
     }
     if (Valid::url($next_url)) {
         $this->go($next_url);
     }
     $this->go_home();
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:26,代码来源:reflink.php

示例4: _login

 private function _login()
 {
     $array = $this->request->post('login');
     $array = Validation::factory($array)->label('username', 'Username')->label('password', 'Password')->label('email', 'Email')->rules('username', array(array('not_empty')))->rules('password', array(array('not_empty')));
     $fieldname = Valid::email(Arr::get($array, 'username')) ? Auth::EMAIL : Auth::USERNAME;
     // Get the remember login option
     $remember = isset($array['remember']);
     Observer::notify('admin_login_validation', $array);
     if ($array->check()) {
         Observer::notify('admin_login_before', $array);
         if (Auth::instance()->login($array['username'], $array['password'], $remember)) {
             Observer::notify('admin_login_success', $array['username']);
             Session::instance()->delete('install_data');
             Kohana::$log->add(Log::INFO, ':user login')->write();
             if ($next_url = Flash::get('redirect')) {
                 $this->go($next_url);
             }
             // $this->go to defaut controller and action
             $this->go_backend();
         } else {
             Observer::notify('admin_login_failed', $array);
             Messages::errors(__('Login failed. Please check your login data and try again.'));
             $array->error($fieldname, 'incorrect');
             Kohana::$log->add(Log::ALERT, 'Try to login with :field: :value. Incorrect data', array(':field' => $fieldname, ':value' => $array['username']))->write();
         }
     } else {
         Messages::errors($array->errors('validation'));
     }
     $this->go(Route::get('user')->uri(array('action' => 'login')));
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:30,代码来源:login.php

示例5: setErrors

 public static function setErrors($filename)
 {
     $array = array();
     foreach (file($filename) as $line) {
         list($key, $value) = explode(' ', $line, 2) + array(NULL, NULL);
         if ($value !== NULL) {
             $array[$key] = $value;
         }
     }
     self::$errors = $array;
 }
开发者ID:mikeschap,项目名称:WithTheClothesOnYourBack,代码行数:11,代码来源:Messages.class.php

示例6: _apply_patch

 private function _apply_patch()
 {
     $patch = $this->request->post('patch');
     try {
         Patch::apply($patch);
     } catch (Validation_Exception $ex) {
         Messages::errors($ex->errors());
     } catch (Kohana_Exception $ex) {
         Messages::errors($ex->getMessage());
     }
     $this->go_back();
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:12,代码来源:update.php

示例7: _login

 protected function _login(Validation $validation, $remember)
 {
     if ($validation->check()) {
         Observer::notify('login_before', $validation);
         if (Auth::instance()->login($validation[$this->get('login_field')], $validation[$this->get('password_field')], $remember)) {
             Observer::notify('login_success', $validation[$this->get('login_field')]);
             HTTP::redirect($this->get_next_url());
         } else {
             Observer::notify('login_failed', $validation);
             Messages::errors(__('Login failed. Please check your login data and try again.'));
         }
     }
     HTTP::redirect(Request::current()->referrer());
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:14,代码来源:login.php

示例8: action_go

 /**
  * 
  * @throws Installer_Exception
  */
 public function action_go()
 {
     $this->auto_render = FALSE;
     $post = $this->request->post('install');
     try {
         $this->_installer->install($post);
         Observer::notify('after_install', $post);
         Cache::clear_file();
     } catch (Validation_Exception $e) {
         Messages::errors($e->errors('validation'));
         $this->go_back();
     } catch (Exception $e) {
         Messages::errors($e->getMessage());
         $this->go_back();
     }
     $this->go($post['admin_dir_name'] . '/login');
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:21,代码来源:install.php

示例9: array

     $plugin = Plugins::get_registered($plugin_id);
     if ($this->request->method() == Request::POST) {
         return $this->_settings_save($plugin);
     }
     $this->template->content = View::factory('plugins/settings', array('content' => View::factory($plugin->id() . '/settings', array('plugin' => $plugin))));
     $this->set_title(__('Plugin :title settings', array(':title' => $plugin->title())));
 }
 protected function _settings_save($plugin)
 {
     $data = Arr::get($this->request->post(), 'setting', array());
     try {
         $plugin->set_settings($data)->validate()->save_settings();
         Kohana::$log->add(Log::INFO, ':user change settings for plugin :name ', array(':name' => $plugin->title()))->write();
         Messages::success(__('Plugin settings saved!'));
     } catch (Validation_Exception $e) {
         Messages::errors($e->errors('validation'));
         $this->go_back();
     }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:18,代码来源:plugins.php

示例10: section

 /**
  * 
  * @param integer $id
  * @return DataSource_Section
  * @throws HTTP_Exception_404
  */
 public function section($id = NULL)
 {
     if ($this->_section instanceof DataSource_Section) {
         return $this->_section;
     }
     if ($id === NULL) {
         Messages::errors(__('Datasource section not loaded'));
         $this->go_home();
     }
     $this->_section = Datasource_Data_Manager::load((int) $id);
     if ($this->request->action() == 'index' and !$this->_section->has_access_view()) {
         $this->_deny_access();
     }
     if (empty($this->_section)) {
         Messages::errors(__('Datasource section :id not found', array(':id' => $id)));
         $this->go_home();
     }
     return $this->_section;
 }
开发者ID:ortodesign,项目名称:cms,代码行数:25,代码来源:datasource.php

示例11: action_upload

 public function action_upload()
 {
     $this->auto_render = FALSE;
     $errors = array();
     # Проверяем файл
     if (!isset($_FILES['file'])) {
         $this->go_back();
     }
     $file = $_FILES['file'];
     if (!is_dir(BACKUP_PLUGIN_FOLDER)) {
         $errors[] = __('Folder (:folder) not exist!', array(':folder' => BACKUP_PLUGIN_FOLDER));
     }
     if (!is_writable(BACKUP_PLUGIN_FOLDER)) {
         $errors[] = __('Folder (:folder) must be writable!', array(':folder' => BACKUP_PLUGIN_FOLDER));
     }
     # Проверяем на пустоту
     if (!Upload::not_empty($file)) {
         $errors[] = __('File is not attached!');
     }
     # Проверяем на расширение
     if (!Upload::type($file, array('sql', 'zip'))) {
         $errors[] = __('Bad format of file!');
     }
     if (!empty($errors)) {
         Messages::errors($errors);
         $this->go_back();
     }
     $ext = pathinfo($file['name'], PATHINFO_EXTENSION);
     # Имя файла
     $filename = 'uploaded-' . date('YmdHis') . '-' . $file['name'];
     Upload::$default_directory = BACKUP_PLUGIN_FOLDER;
     # Cохраняем оригинал и продолжаем работать, если ок:
     if ($file = Upload::save($file, $filename, NULL, 0777)) {
         Messages::success(__('File :filename uploaded successfully', array(':filename' => $filename)));
         Kohana::$log->add(Log::ALERT, 'Backup file :filename uploaded by :user', array(':filename' => $filename))->write();
         $this->go_back();
     }
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:38,代码来源:backup.php

示例12: _edit

 private function _edit($field)
 {
     try {
         $field->set($this->request->post());
         DataSource_Hybrid_Field_Factory::update_field(clone $field, $field);
     } catch (Validation_Exception $e) {
         Session::instance()->set('post_data', $this->request->post());
         Messages::errors($e->errors('validation'));
         $this->go_back();
     } catch (Kohana_Exception $e) {
         Messages::errors($e->getMessage());
         $this->go_back();
     }
     Session::instance()->delete('post_data');
     // save and quit or save and continue editing?
     if ($this->request->post('commit') !== NULL) {
         $this->go(Route::get('datasources')->uri(array('directory' => 'datasources', 'controller' => 'section', 'action' => 'edit', 'id' => $field->ds_id)));
     } else {
         $this->go_back();
     }
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:21,代码来源:field.php

示例13: action_delete

 public function action_delete()
 {
     $this->auto_render = FALSE;
     $snippet_name = $this->request->param('id');
     $snippet = new Model_File_Snippet($snippet_name);
     // find the user to delete
     if ($snippet->is_exists()) {
         if ($snippet->delete()) {
             Kohana::$log->add(Log::INFO, 'Snippet :name has been deleted by :user', array(':name' => $snippet_name))->write();
             Messages::success(__('Snippet has been deleted!'));
             Observer::notify('snippet_after_delete', $snippet_name);
         } else {
             Messages::errors(__('Something went wrong!'));
         }
     } else {
         Messages::errors(__('Snippet not found!'));
     }
     $this->go();
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:19,代码来源:snippet.php

示例14: action_delete

 public function action_delete()
 {
     $this->auto_render = FALSE;
     $id = $this->request->param('id');
     // find the user to delete
     $user = ORM::factory('user', $id);
     if (!$user->loaded()) {
         Messages::errors(__('User not found!'));
         $this->go();
     }
     if ($user->delete()) {
         Messages::success(__('User has been deleted!'));
     } else {
         Messages::errors(__('Something went wrong!'));
     }
     $this->go();
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:17,代码来源:users.php

示例15: action_delete

 public function action_delete()
 {
     $this->auto_render = FALSE;
     $id = $this->request->param('id');
     if ($id < 2) {
         Messages::success(__('Action disabled!'));
         $this->go();
     }
     $role = ORM::factory('role', $id);
     if (!$role->loaded()) {
         Messages::errors(__('Role not found!'));
         $this->go();
     }
     try {
         $role->delete();
         Messages::success(__('Role has been deleted!'));
     } catch (Kohana_Exception $e) {
         Messages::errors(__('Something went wrong!'));
     }
     $this->go();
 }
开发者ID:ortodesign,项目名称:cms,代码行数:21,代码来源:roles.php


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