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


PHP Notify::error方法代码示例

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


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

示例1: delete

 /**
  * Removes an item
  */
 function delete()
 {
     // Check for request forgeries
     Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
     // Initialise variables.
     $ids = Request::getVar('cid', array(), '', 'array');
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!User::authorise('core.delete', 'com_content.article.' . (int) $id)) {
             // Prune items that you can't delete.
             unset($ids[$i]);
             Notify::warning(Lang::txt('JERROR_CORE_DELETE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         Notify::error(Lang::txt('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Remove the items.
         if (!$model->featured($ids, 0)) {
             throw new Exception($model->getError(), 500);
         }
     }
     $this->setRedirect('index.php?option=com_content&view=featured');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:29,代码来源:featured.php

示例2: featured

 /**
  * Method to toggle the featured setting of a list of articles.
  *
  * @return	void
  * @since	1.6
  */
 function featured()
 {
     // Check for request forgeries
     Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
     // Initialise variables.
     $ids = Request::getVar('cid', array(), '', 'array');
     $values = array('featured' => 1, 'unfeatured' => 0);
     $task = $this->getTask();
     $value = \Hubzero\Utility\Arr::getValue($values, $task, 0, 'int');
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) {
             // Prune items that you can't change.
             unset($ids[$i]);
             Notify::warning(Lang::txt('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         Notify::error(Lang::txt('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Publish the items.
         if (!$model->featured($ids, $value)) {
             throw new Exception($model->getError(), 500);
         }
     }
     $this->setRedirect('index.php?option=com_content&view=articles');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:35,代码来源:articles.php

示例3: addTask

 /**
  * Create a new member
  *
  * @return     void
  */
 public function addTask()
 {
     Request::setVar('hidemainmenu', 1);
     // Set any errors
     foreach ($this->getErrors() as $error) {
         \Notify::error($error);
     }
     // Output the HTML
     $this->view->setLayout('add')->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:15,代码来源:members.php

示例4: duplicate

 /**
  * Method to clone an existing module.
  * @since	1.6
  */
 public function duplicate()
 {
     // Check for request forgeries
     Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
     // Initialise variables.
     $pks = Request::getVar('cid', array(), 'post', 'array');
     \Hubzero\Utility\Arr::toInteger($pks);
     try {
         if (empty($pks)) {
             throw new Exception(Lang::txt('COM_MODULES_ERROR_NO_MODULES_SELECTED'));
         }
         $model = $this->getModel();
         $model->duplicate($pks);
         $this->setMessage(Lang::txts('COM_MODULES_N_MODULES_DUPLICATED', count($pks)));
     } catch (Exception $e) {
         Notify::error($e->getMessage());
     }
     $this->setRedirect(Route::url('index.php?option=com_modules&view=modules', false));
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:23,代码来源:modules.php

示例5: delete

 /**
  * Removes an item
  */
 public function delete()
 {
     // Check for request forgeries
     Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = Request::getVar('cid', array(), '', 'array');
     if (!is_array($cid) || count($cid) < 1) {
         Notify::error(Lang::txt('COM_MENUS_NO_MENUS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         \Hubzero\Utility\Arr::toInteger($cid);
         // Remove the items.
         if (!$model->delete($cid)) {
             $this->setMessage($model->getError());
         } else {
             $this->setMessage(Lang::txts('COM_MENUS_N_MENUS_DELETED', count($cid)));
         }
     }
     $this->setRedirect('index.php?option=com_menus&view=menus');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:25,代码来源:menus.php

示例6: _handleSuperGroup

 /**
  * Generate default template files for special groups
  *
  * @param     object $group \Hubzero\User\Group
  * @return    void
  */
 private function _handleSuperGroup($group)
 {
     //get the upload path for groups
     $uploadPath = PATH_APP . DS . trim($this->config->get('uploadpath', '/site/groups'), DS) . DS . $group->get('gidNumber');
     // get the source path
     $srcTplPath = null;
     $db = \App::get('db');
     $query = $db->getQuery(true);
     $query->select('s.id, s.home, s.template, s.params, e.protected');
     $query->from('#__template_styles as s');
     $query->where('s.client_id = 0');
     $query->where('e.enabled = 1');
     $query->where('s.home = 1');
     $query->leftJoin('#__extensions as e ON e.element=s.template AND e.type=' . $db->quote('template') . ' AND e.client_id=s.client_id');
     $db->setQuery($query);
     $template = $db->loadObject();
     if ($template) {
         foreach (array(PATH_APP, PATH_CORE) as $path) {
             if (is_dir($path . DS . 'templates' . DS . $template->template . DS . 'super')) {
                 $srcTplPath = $path . DS . 'templates' . DS . $template->template . DS . 'super';
                 break;
             }
         }
     }
     $srcPath = dirname(dirname(__DIR__)) . DS . 'super' . DS . 'default' . DS . '.';
     // create group folder if one doesnt exist
     if (!is_dir($uploadPath)) {
         if (!Filesystem::makeDirectory($uploadPath)) {
             Notify::error(Lang::txt('COM_GROUPS_SUPER_UNABLE_TO_CREATE'));
         }
     }
     // make sure folder is writable
     if (!is_writable($uploadPath)) {
         Notify::error(Lang::txt('COM_GROUPS_SUPER_FOLDER_NOT_WRITABLE', $uploadpath));
         return;
     }
     // We need to handle templates a little differently
     if ($srcTplPath) {
         $uploadTplPath = $uploadPath . DS . 'template';
         shell_exec("cp -rf {$srcTplPath} {$uploadTplPath} 2>&1");
     }
     // copy over default template recursively
     // must have  /. at the end of source path to get all items in that directory
     // also doesnt overwrite already existing files/folders
     shell_exec("cp -rn {$srcPath} {$uploadPath} 2>&1");
     // make sure files are group read and writable
     // make sure files are all group owned properly
     shell_exec("chmod -R 2770 {$uploadPath} 2>&1");
     shell_exec("chgrp -R " . escapeshellcmd($this->config->get('super_group_file_owner', 'access-content')) . " " . $uploadPath . " 2>&1");
     // get all current users granted permissionss
     $this->database->setQuery("SHOW GRANTS FOR CURRENT_USER();");
     $grants = $this->database->loadColumn();
     // look at all current users granted permissions
     $canCreateSuperGroupDB = false;
     if (count($grants) > 0) {
         foreach ($grants as $grant) {
             if (preg_match('/sg\\\\_%/', $grant)) {
                 $canCreateSuperGroupDB = true;
             }
         }
         //end foreach
     }
     //end if
     // create super group DB if doesnt already exist
     if ($canCreateSuperGroupDB) {
         $this->database->setQuery("CREATE DATABASE IF NOT EXISTS `sg_{$group->get('cn')}`;");
         if (!$this->database->query()) {
             Notify::error(Lang::txt('COM_GROUPS_SUPER_UNABLE_TO_CREATE_DB'));
         }
     } else {
         Notify::error(Lang::txt('COM_GROUPS_SUPER_UNABLE_TO_CREATE_DB'));
     }
     // check to see if we have a super group db config
     $supergroupDbConfigFile = DS . 'etc' . DS . 'supergroup.conf';
     if (!file_exists($supergroupDbConfigFile)) {
         Notify::error(Lang::txt('COM_GROUPS_SUPER_UNABLE_TO_LOAD_CONFIG'));
     } else {
         // get hub super group database config file
         $supergroupDbConfig = (include $supergroupDbConfigFile);
         // define username, password, and database to be written in config
         $username = isset($supergroupDbConfig['username']) ? $supergroupDbConfig['username'] : '';
         $password = isset($supergroupDbConfig['password']) ? $supergroupDbConfig['password'] : '';
         $database = 'sg_' . $group->get('cn');
         //write db config in super group
         $dbConfigFile = $uploadPath . DS . 'config' . DS . 'db.php';
         $dbConfigContents = "<?php\n\treturn array(\n\t\t'host'     => 'localhost',\n\t\t'port'     => '',\n\t\t'user' => '{$username}',\n\t\t'password' => '{$password}',\n\t\t'database' => '{$database}',\n\t\t'prefix'   => ''\n\t);";
         // write db config file
         if (!file_exists($dbConfigFile)) {
             if (!file_put_contents($dbConfigFile, $dbConfigContents)) {
                 Notify::error(Lang::txt('COM_GROUPS_SUPER_UNABLE_TO_WRITE_CONFIG'));
             }
         }
     }
     // log super group change
//.........这里部分代码省略.........
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:101,代码来源:manage.php

示例7: editTask

 /**
  * Edit a category
  *
  * @return  void
  */
 public function editTask($row = null)
 {
     Request::setVar('hidemainmenu', 1);
     $this->view->wishlist = Request::getInt('wishlist', 0);
     if (!is_object($row)) {
         // Incoming
         $id = Request::getVar('id', array(0));
         if (is_array($id) && !empty($id)) {
             $id = $id[0];
         }
         // Load category
         $row = new Wish($this->database);
         $row->load($id);
     }
     $this->view->row = $row;
     if (!$this->view->row->id) {
         $this->view->row->wishlist = $this->view->wishlist;
     } else {
         if (!$this->view->wishlist) {
             $this->view->wishlist = $this->view->row->wishlist;
         }
     }
     /*
     $m = new Models\AdminWish();
     $this->view->form = $m->getForm();
     */
     $obj = new Wishlist($this->database);
     $filters = array();
     $filters['sort'] = 'title';
     $filters['sort_Dir'] = 'ASC';
     $this->view->lists = $obj->getRecords($filters);
     // who are list owners?
     $this->admingroup = $this->config->get('group', 'hubadmin');
     $objOwner = new Owner($this->database);
     $objG = new OwnerGroup($this->database);
     $this->view->ownerassignees = array();
     $this->view->ownerassignees[-1] = array();
     $none = new stdClass();
     $none->id = '-1';
     $none->name = Lang::txt('COM_WISHLIST_SELECT');
     $this->view->ownerassignees[-1][] = $none;
     $this->view->assignees = null;
     if ($this->view->lists) {
         foreach ($this->view->lists as $k => $list) {
             if ($list->category == 'resource') {
                 include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'tables' . DS . 'resource.php';
                 $list->resource = new \Components\Resources\Tables\Resource($this->database);
                 $list->resource->load($list->referenceid);
             }
             $this->view->ownerassignees[$list->id] = array();
             $none = new stdClass();
             $none->id = '0';
             $none->name = Lang::txt('COM_WISHLIST_NONE');
             $this->view->ownerassignees[$list->id][] = $none;
             $owners = $objOwner->get_owners($list->id, $this->admingroup, $list);
             if (count($owners['individuals']) > 0) {
                 $query = "SELECT a.id, a.name FROM `#__users` AS a WHERE a.block = '0' AND a.id IN (" . implode(',', $owners['individuals']) . ") ORDER BY a.name";
                 $this->database->setQuery($query);
                 $users = $this->database->loadObjectList();
                 foreach ($users as $row2) {
                     $this->view->ownerassignees[$list->id][] = $row2;
                 }
                 if ($list->id == $this->view->row->wishlist) {
                     $this->view->assignees = $this->view->ownerassignees[$list->id];
                 }
             }
         }
     }
     // Get the plan for this wish
     $objPlan = new Plan($this->database);
     $plan = $objPlan->getPlan($this->view->row->id);
     $this->view->plan = $plan ? $plan[0] : $objPlan;
     // Get tags on this wish
     include_once dirname(dirname(__DIR__)) . DS . 'models' . DS . 'tags.php';
     $tagging = new Tags($this->view->row->id);
     $this->view->tags = $tagging->render('string');
     // Set any errors
     foreach ($this->getErrors() as $error) {
         \Notify::error($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:88,代码来源:wishes.php

示例8: removeTask

 /**
  * Remove one or more entries
  *
  * @return  void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken();
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     // Make sure we have an ID
     if (empty($ids)) {
         Notify::warning(Lang::txt('COM_GROUPS_ERROR_NO_ITEMS_SELECTED'));
         return $this->cancelTask();
     }
     $i = 0;
     foreach ($ids as $id) {
         // Remove the entry
         $model = Role::oneOrFail(intval($id));
         if (!$model->destroy()) {
             Notify::error($model->getError());
             continue;
         }
         $i++;
     }
     if ($i) {
         Notify::success(Lang::txt('COM_GROUPS_ROLE_REMOVED'));
     }
     $this->cancelTask();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:31,代码来源:roles.php

示例9: editTask

 /**
  * Edit a course page
  *
  * @return void
  */
 public function editTask($model = null)
 {
     Request::setVar('hidemainmenu', 1);
     if (!is_object($model)) {
         // Incoming
         $id = Request::getVar('id', array(0));
         // Get the single ID we're working with
         if (is_array($id)) {
             $id = !empty($id) ? $id[0] : 0;
         }
         $model = new \Components\Courses\Models\Page($id);
     }
     $this->view->row = $model;
     if (!$this->view->row->get('course_id')) {
         $this->view->row->set('course_id', Request::getInt('course', 0));
     }
     if (!$this->view->row->get('offering_id')) {
         $this->view->row->set('offering_id', Request::getInt('offering', 0));
     }
     if (!$this->view->row->exists()) {
         $this->view->row->set('active', 1);
     }
     $this->view->course = \Components\Courses\Models\Course::getInstance($this->view->row->get('course_id'));
     $this->view->offering = \Components\Courses\Models\Offering::getInstance($this->view->row->get('offering_id'));
     // Set any errors
     foreach ($this->getErrors() as $error) {
         \Notify::error($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:36,代码来源:pages.php

示例10: deleteTask

 /**
  * Mark an entry as deleted
  *
  * @return  void
  */
 public function deleteTask()
 {
     if (User::isGuest()) {
         $rtrn = Request::getVar('REQUEST_URI', Route::url('index.php?option=' . $this->_option, false, true), 'server');
         App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode($rtrn)), Lang::txt('COM_BLOG_LOGIN_NOTICE'), 'warning');
         return;
     }
     if (!$this->config->get('access-delete-entry') && !$this->config->get('access-manage-entry')) {
         App::abort(403, Lang::txt('COM_BLOG_NOT_AUTH'));
     }
     // Incoming
     $id = Request::getInt('entry', 0);
     if (!$id) {
         return $this->displayTask();
     }
     $process = Request::getVar('process', '');
     $confirmdel = Request::getVar('confirmdel', '');
     // Initiate a blog entry object
     $entry = Entry::oneOrFail($id);
     // Did they confirm delete?
     if (!$process || !$confirmdel) {
         if ($process && !$confirmdel) {
             $this->setError(Lang::txt('COM_BLOG_ERROR_CONFIRM_DELETION'));
         }
         foreach ($this->getErrors() as $error) {
             $this->view->setError($error);
         }
         $this->view->set('archive', $this->model)->set('config', $this->config)->set('entry', $entry)->display();
         return;
     }
     // Check for request forgeries
     Request::checkToken();
     // Delete the entry itself
     $entry->set('state', 2);
     if (!$entry->save()) {
         Notify::error($entry->getError());
     }
     // Log the activity
     Event::trigger('system.logActivity', ['activity' => ['action' => 'deleted', 'scope' => 'blog.entry', 'scope_id' => $id, 'description' => Lang::txt('COM_BLOG_ACTIVITY_ENTRY_DELETED', '<a href="' . Route::url($entry->link()) . '">' . $entry->get('title') . '</a>'), 'details' => array('title' => $entry->get('title'), 'url' => Route::url($entry->link()))], 'recipients' => [$entry->get('created_by')]]);
     // Return the entries lsit
     App::redirect(Route::url('index.php?option=' . $this->_option));
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:47,代码来源:entries.php

示例11: slug

            Notify::error($errors);
            return Response::redirect('admin/categories/add');
        }
        if (empty($input['slug'])) {
            $input['slug'] = $input['title'];
        }
        $input['slug'] = slug($input['slug']);
        $category = Category::create($input);
        Extend::process('category', $category->id);
        Notify::success(__('categories.created'));
        return Response::redirect('admin/categories');
    });
    /*
        Delete Category
    */
    Route::get('admin/categories/delete/(:num)', function ($id) {
        $total = Category::count();
        if ($total == 1) {
            Notify::error(__('categories.delete_error'));
            return Response::redirect('admin/categories/edit/' . $id);
        }
        // move posts
        $category = Category::where('id', '<>', $id)->fetch();
        // delete selected
        Category::find($id)->delete();
        // update posts
        Post::where('category', '=', $id)->update(array('category' => $category->id));
        Notify::success(__('categories.deleted'));
        return Response::redirect('admin/categories');
    });
});
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:31,代码来源:categories.php

示例12: save

 /**
  * Method to save the configuration data.
  *
  * @param   array  An array containing all global config data.
  * @return  bool   True on success, false on failure.
  * @since   1.6
  */
 public function save($data)
 {
     // Save the rules
     if (isset($data['rules'])) {
         $rules = new JAccessRules($data['rules']);
         // Check that we aren't removing our Super User permission
         // Need to get groups from database, since they might have changed
         $myGroups = JAccess::getGroupsByUser(\User::get('id'));
         $myRules = $rules->getData();
         $hasSuperAdmin = $myRules['core.admin']->allow($myGroups);
         if (!$hasSuperAdmin) {
             $this->setError(Lang::txt('COM_CONFIG_ERROR_REMOVING_SUPER_ADMIN'));
             return false;
         }
         $asset = JTable::getInstance('asset');
         if ($asset->loadByName('root.1')) {
             $asset->rules = (string) $rules;
             if (!$asset->check() || !$asset->store()) {
                 Notify::error('SOME_ERROR_CODE', $asset->getError());
             }
         } else {
             $this->setError(Lang::txt('COM_CONFIG_ERROR_ROOT_ASSET_NOT_FOUND'));
             return false;
         }
         unset($data['rules']);
     }
     // Save the text filters
     if (isset($data['filters'])) {
         $registry = new Registry(array('filters' => $data['filters']));
         $extension = JTable::getInstance('extension');
         // Get extension_id
         $extension_id = $extension->find(array('name' => 'com_config'));
         if ($extension->load((int) $extension_id)) {
             $extension->params = (string) $registry;
             if (!$extension->check() || !$extension->store()) {
                 Notify::error('SOME_ERROR_CODE', $extension->getError());
             }
         } else {
             $this->setError(Lang::txt('COM_CONFIG_ERROR_CONFIG_EXTENSION_NOT_FOUND'));
             return false;
         }
         unset($data['filters']);
     }
     // Get the previous configuration.
     $config = new \Hubzero\Config\Repository('site');
     $prev = $config->toArray();
     /*$extras = array();
     		foreach ($prev as $key => $val)
     		{
     			$found = false;
     
     			foreach ($data as $group => $values)
     			{
     				if (in_array($key, $values))
     				{
     					$found = true;
     				}
     			}
     
     			if (!$found)
     			{
     				$extras[$key] = $val;
     			}
     		}
     
     		// Merge the new data in. We do this to preserve values that were not in the form.
     		$data['app'] = array_merge($data['app'], $extras);*/
     // Perform miscellaneous options based on configuration settings/changes.
     // Escape the offline message if present.
     if (isset($data['offline']['offline_message'])) {
         $data['offline']['offline_message'] = \Hubzero\Utility\String::ampReplace($data['offline']['offline_message']);
     }
     // Purge the database session table if we are changing to the database handler.
     if ($prev['session']['session_handler'] != 'database' && $data['session']['session_handler'] == 'database') {
         $table = JTable::getInstance('session');
         $table->purge(-1);
     }
     if (empty($data['cache']['cache_handler'])) {
         $data['cache']['caching'] = 0;
     }
     // Clean the cache if disabled but previously enabled.
     if (!$data['cache']['caching'] && $prev['cache']['caching']) {
         \Cache::clean();
     }
     foreach ($data as $group => $values) {
         foreach ($values as $key => $value) {
             if (!isset($prev[$group])) {
                 $prev[$group] = array();
             }
             $prev[$group][$key] = $value;
         }
     }
     // Create the new configuration object.
//.........这里部分代码省略.........
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:101,代码来源:application.php

示例13: stateTask

 /**
  * Set the state of an entry
  *
  * @param      integer $state State to set
  * @return     void
  */
 public function stateTask($state = 0)
 {
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     //print_r($ids); die;
     // Check for an ID
     if (count($ids) < 1) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), $state == 1 ? Lang::txt('COM_STOREFRONT_SELECT_PUBLISH') : Lang::txt('COM_STOREFRONT_SELECT_UNPUBLISH'), 'error');
         return;
     }
     // Update record(s)
     $obj = new Archive();
     foreach ($ids as $ogId) {
         // Save category
         try {
             $obj->updateOptionGroup($ogId, array('state' => $state));
         } catch (\Exception $e) {
             \Notify::error($e->getMessage());
             return;
         }
     }
     // Set message
     switch ($state) {
         case '-1':
             $message = Lang::txt('COM_STOREFRONT_ARCHIVED', count($ids));
             break;
         case '1':
             $message = Lang::txt('COM_STOREFRONT_PUBLISHED', count($ids));
             break;
         case '0':
             $message = Lang::txt('COM_STOREFRONT_UNPUBLISHED', count($ids));
             break;
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), $message);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:42,代码来源:optiongroups.php

示例14: deleteTask

 /**
  * Mark an entry as deleted
  *
  * @return  void
  */
 public function deleteTask()
 {
     if (User::isGuest()) {
         $rtrn = Request::getVar('REQUEST_URI', Route::url('index.php?option=' . $this->_option, false, true), 'server');
         App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode($rtrn)), Lang::txt('COM_BLOG_LOGIN_NOTICE'), 'warning');
         return;
     }
     if (!$this->config->get('access-delete-entry')) {
         App::redirect(Route::url('index.php?option=' . $this->_option), Lang::txt('COM_BLOG_NOT_AUTHORIZED'), 'error');
         return;
     }
     // Incoming
     $id = Request::getInt('entry', 0);
     if (!$id) {
         return $this->displayTask();
     }
     $process = Request::getVar('process', '');
     $confirmdel = Request::getVar('confirmdel', '');
     // Initiate a blog entry object
     $entry = Entry::oneOrFail($id);
     // Did they confirm delete?
     if (!$process || !$confirmdel) {
         if ($process && !$confirmdel) {
             $this->setError(Lang::txt('COM_BLOG_ERROR_CONFIRM_DELETION'));
         }
         foreach ($this->getErrors() as $error) {
             $this->view->setError($error);
         }
         $this->view->set('archive', $this->model)->set('config', $this->config)->set('entry', $entry)->display();
         return;
     }
     // Check for request forgeries
     Request::checkToken();
     // Delete the entry itself
     $entry->set('state', 2);
     if (!$entry->save()) {
         Notify::error($entry->getError());
     }
     // Return the topics list
     App::redirect(Route::url('index.php?option=' . $this->_option));
     return;
 }
开发者ID:zooley,项目名称:hubzero-cms,代码行数:47,代码来源:entries.php

示例15: update_permissions

 public function update_permissions()
 {
     //return Input::all();
     //
     // create the validation rules ------------------------
     $rules = array('group_name' => 'required', 'permissions' => 'required');
     $messages = array('required' => 'The :attribute required.', 'permissions.required' => 'permissions.required');
     // do the validation ----------------------------------
     // validate against the inputs from our form
     $validator = Validator::make(Input::all(), $rules, $messages);
     // check if the validator failed -----------------------
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return Redirect::to('settings/user-management/user-groups')->withErrors($validator)->withInput();
     } else {
         // validation successful ---------------------------
         $permissionArray = array();
         // Creating permission array
         foreach (Input::get('permissions') as $permission) {
             $permissionArray[$permission] = 1;
         }
         $is_group_exists = DB::table('groups')->where('name', '=', urldecode(Input::get('group_name')))->get();
         if ($is_group_exists) {
             $sucsess = DB::table('groups')->where('name', '=', urldecode(Input::get('group_name')))->update(array('permissions' => json_encode($permissionArray)));
             if ($sucsess == 1) {
                 Notify::success('Permissions Successfully Updated');
                 return Redirect::to('settings/user-management/user-groups');
             }
         } else {
             try {
                 // Create the group
                 $group = Sentry::createGroup(array('name' => Input::get('group_name'), 'permissions' => $permissionArray));
             } catch (Cartalyst\Sentry\Groups\NameRequiredException $e) {
                 echo 'Name field is required';
             } catch (Cartalyst\Sentry\Groups\GroupExistsException $e) {
                 //echo 'Group already exists';
                 Notify::error('Group already exists');
                 return Redirect::to('settings/user-management/user-groups')->withErrors('Group already exists');
             }
         }
         // redirect ----------------------------------------
         return Redirect::to('settings/user-management/user-groups');
     }
 }
开发者ID:nu1ww,项目名称:ls-rewamp,代码行数:46,代码来源:UsersController.php


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