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


PHP JError类代码示例

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


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

示例1: featured

 /**
  * Method to toggle the featured setting of a list of articles.
  *
  * @return	void
  * @since	1.6
  */
 function featured()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     $values = array('featured' => 1, 'unfeatured' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::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]);
             JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Publish the items.
         if (!$model->featured($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         }
     }
     $this->setRedirect('index.php?option=com_content&view=articles');
 }
开发者ID:joomline,项目名称:Joomla2.5.999,代码行数:36,代码来源:articles.php

示例2: display

 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/users.php';
     // Load the submenu.
     UsersHelper::addSubmenu(JRequest::getCmd('view', 'users'));
     $view = JRequest::getCmd('view', 'users');
     $layout = JRequest::getCmd('layout', 'default');
     $id = JRequest::getInt('id');
     if (!$this->canView($view)) {
         JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         return;
     }
     // Check for edit form.
     if ($view == 'user' && $layout == 'edit' && !$this->checkEditId('com_users.edit.user', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_users&view=users', false));
         return false;
     } elseif ($view == 'group' && $layout == 'edit' && !$this->checkEditId('com_users.edit.group', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_users&view=groups', false));
         return false;
     } elseif ($view == 'level' && $layout == 'edit' && !$this->checkEditId('com_users.edit.level', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_users&view=levels', false));
         return false;
     }
     return parent::display();
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:43,代码来源:controller.php

示例3: display

 /**
  * Generates a list of JSON items.
  *
  * @return    void
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     $this->item = $this->get('Item');
     $this->component = $model->getState($model->getName() . '.component');
     $this->section = $model->getState($model->getName() . '.section');
     $this->asset_id = $model->getState($model->getName() . '.asset_id');
     $this->project_id = $model->getState($model->getName() . '.project_id');
     $this->inherit = $model->getState($model->getName() . '.inherit');
     if (!$this->asset_id && $this->inherit) {
         $this->asset_id = $this->getComponentProjectAssetId($this->component, $this->project_id);
     }
     $this->rules = $this->getAssetRules();
     $this->public_groups = array('1', JComponentHelper::getParams('com_users')->get('guest_usergroup', 1));
     $user = JFactory::getUser();
     if (!$user->authorise('core.admin', $this->component) && !$user->authorise('core.manage', $this->component)) {
         JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     parent::display($tpl);
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:31,代码来源:view.raw.php

示例4: save

 function save()
 {
     $data = JRequest::getVar('jform', array(), 'post', 'NONE', 4);
     $id = (int) $data['id'];
     if (empty($id)) {
         if (!igGeneralHelper::authorise('core.igalleryfront.create')) {
             return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         }
     } else {
         if (!igGeneralHelper::authorise('core.igalleryfront.edit', $id)) {
             return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         }
     }
     $model = $this->getModel();
     $msg = '';
     if (!$model->save($data)) {
         JError::raise(2, 500, $model->getError());
     } else {
         $msg = JText::_('SUCCESSFULLY_SAVED');
     }
     switch ($this->task) {
         case 'apply':
             $url = 'index.php?option=com_igallery&view=icategory&id=' . $id;
             break;
         case 'save':
             $url = 'index.php?option=com_igallery&view=categories';
     }
     $this->setRedirect(JRoute::_($url, false), $msg);
 }
开发者ID:iFactoryDigital,项目名称:gympieradiology,代码行数:29,代码来源:icategory.php

示例5: display

 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed   A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Preprocess the list of items to find ordering divisions.
     foreach ($this->items as &$item) {
         $this->ordering[$item->parent_id][] = $item->id;
     }
     // Levels filter.
     $options = array();
     $options[] = JHtml::_('select.option', '1', JText::_('J1'));
     $options[] = JHtml::_('select.option', '2', JText::_('J2'));
     $options[] = JHtml::_('select.option', '3', JText::_('J3'));
     $options[] = JHtml::_('select.option', '4', JText::_('J4'));
     $options[] = JHtml::_('select.option', '5', JText::_('J5'));
     $options[] = JHtml::_('select.option', '6', JText::_('J6'));
     $options[] = JHtml::_('select.option', '7', JText::_('J7'));
     $options[] = JHtml::_('select.option', '8', JText::_('J8'));
     $options[] = JHtml::_('select.option', '9', JText::_('J9'));
     $options[] = JHtml::_('select.option', '10', JText::_('J10'));
     $this->f_levels = $options;
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         $this->addToolbar();
     }
     parent::display($tpl);
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:42,代码来源:view.html.php

示例6: move

 /**
  * swap the ordering of a record in the Xref tables
  * @param  $direction , 1/-1 The increment to reorder by
  */
 function move($direction, $where = '', $orderingkey = 0)
 {
     if (empty($this->_skey)) {
         vmError('No secondary keys defined in VmTableXarray ' . $this->_tbl);
         return false;
     }
     $skeyId = vRequest::getInt($this->_skey, 0);
     // Initialize variables
     $db = JFactory::getDBO();
     $cid = vRequest::getInt($this->_pkey);
     $order = vRequest::getInt('order');
     //I found now two times "order" instead of ordering.
     //This sql is broken
     $query = 'SELECT `id` FROM `' . $this->_tbl . '` WHERE ' . $this->_pkey . ' = ' . (int) $cid[0] . ' AND `tsmart_category_id` = ' . (int) $skeyId;
     $db->setQuery($query);
     $id = $db->loadResult();
     $keys = array_keys($order);
     // TODO next 2 lines not used ????
     if ($direction > 0) {
         $idToSwap = $order[$keys[array_search($id, $keys)] + 1];
     } else {
         $idToSwap = $order[$keys[array_search($id, $keys)] - 1];
     }
     if (isset($cid[0])) {
         $query = 'UPDATE `' . $this->_tbl . '` ' . ' SET `' . $this->_orderingKey . '` = `' . $this->_orderingKey . '` + ' . $direction . ' WHERE `' . $this->_pkey . '` = ' . (int) $cid[0] . ' AND `' . $this->_skey . '`  = ' . (int) $skeyId;
         $db->setQuery($query);
         if (!$db->execute()) {
             $err = $db->getErrorMsg();
             JError::raiseError(500, get_class($this) . ':: move ' . $err);
         }
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:36,代码来源:tsmtablexarray.php

示例7: akeebaACLCheck

 /**
  * Do our custom ACL checks for the back-end views
  *
  * @return boolean
  */
 private function akeebaACLCheck()
 {
     // Get the view
     $view = $this->input->getCmd('view', '');
     // Fetch the privilege to check, or use the default (akeeba.configure)
     // privilege.
     if (array_key_exists($view, self::$viewACLMap)) {
         $privilege = self::$viewACLMap[$view];
     } else {
         $privilege = 'akeeba.configure';
     }
     // If an empty privileve is defined do not do any ACL check
     if (empty($privilege)) {
         return true;
     }
     // Throw an error if we are not allowed access to the view
     if (!JFactory::getUser()->authorise($privilege, 'com_akeeba')) {
         $this->setRedirect('index.php?option=com_akeeba&view=cpanel');
         JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
         $this->redirect();
         return false;
     } else {
         return true;
     }
 }
开发者ID:jvhost,项目名称:A-Website,代码行数:30,代码来源:default.php

示例8: save

 function save()
 {
     $productfieldgroup = JTable::getInstance('productFieldGroup', 'jshop');
     $post = JRequest::get("post");
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeSaveProductFieldGroup', array(&$post));
     if (!$productfieldgroup->bind($post)) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=productfieldgroups");
         return 0;
     }
     if (!$id) {
         $productfieldgroup->ordering = null;
         $productfieldgroup->ordering = $productfieldgroup->getNextOrder();
     }
     if (!$productfieldgroup->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=productfieldgroups");
         return 0;
     }
     $dispatcher->trigger('onAfterSaveProductFieldGroup', array(&$productfieldgroup));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=productfieldgroups&task=edit&id=" . $productfieldgroup->id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=productfieldgroups");
     }
 }
开发者ID:Tommar,项目名称:vino2,代码行数:28,代码来源:productfieldgroups.php

示例9: render

 public function render($layout, $args = array())
 {
     // prevent render to recurse indefinitely
     static $count = 0;
     $count++;
     if ($count < self::MAX_RENDER_RECURSIONS) {
         // init vars
         $parts = explode($this->_separator, $layout);
         $this->_layout = preg_replace('/[^A-Z0-9_\\.-]/i', '', array_pop($parts));
         // render layout
         if ($__layout = JPath::find($this->_getPath(implode(DIRECTORY_SEPARATOR, $parts)), $this->_layout . $this->_extension)) {
             // import vars and layout output
             extract($args);
             ob_start();
             include $__layout;
             $output = ob_get_contents();
             ob_end_clean();
             $count--;
             return $output;
         }
         $count--;
         // raise warning, if layout was not found
         JError::raiseWarning(0, 'Renderer Layout "' . $layout . '" not found. (' . YUtility::debugInfo(debug_backtrace()) . ')');
         return null;
     }
     // raise warning, if render recurses indefinitly
     JError::raiseWarning(0, 'Warning! Render recursed indefinitly. (' . YUtility::debugInfo(debug_backtrace()) . ')');
     return null;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:29,代码来源:renderer.php

示例10: display

 /**
  * Display the view
  *
  * @return	mixed	False on error, null otherwise.
  */
 function display($tpl = null)
 {
     // Initialise variables
     $state = $this->get('State');
     $items = $this->get('Items');
     $parent = $this->get('Parent');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     if ($items === false) {
         JError::raiseError(404, JText::_('COM_CONTENT_ERROR_CATEGORY_NOT_FOUND'));
         return false;
     }
     if ($parent == false) {
         JError::raiseError(404, JText::_('COM_CONTENT_ERROR_PARENT_CATEGORY_NOT_FOUND'));
         return false;
     }
     $params =& $state->params;
     $items = array($parent->id => $items);
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->maxLevelcat = $params->get('maxLevelcat', -1);
     $this->assignRef('params', $params);
     $this->assignRef('parent', $parent);
     $this->assignRef('items', $items);
     $this->_prepareDocument();
     parent::display($tpl);
 }
开发者ID:networksoft,项目名称:networksoft.com.co,代码行数:35,代码来源:view.html.php

示例11: display

 /**
  * Method to display the view.
  *
  * @param   string  The template file to include
  * @since   1.5
  */
 public function display($tpl = null)
 {
     // This name will be used to get the model
     $name = $this->getLayout();
     // Check that the name is valid - has an associated model.
     if (!in_array($name, array('confirm', 'complete'))) {
         $name = 'default';
     }
     if ('default' == $name) {
         $formname = 'Form';
     } else {
         $formname = ucfirst($this->_name) . ucfirst($name) . 'Form';
     }
     // Get the view data.
     $this->form = $this->get($formname);
     $this->state = $this->get('State');
     $this->params = $this->state->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->prepareDocument();
     parent::display($tpl);
 }
开发者ID:01J,项目名称:topm,代码行数:33,代码来源:view.html.php

示例12: load

 /**
  * Loads the entire menu table into memory.
  *
  * @return  boolean  True on success, false on failure
  *
  * @since   1.5
  */
 public function load()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('m.id, m.menutype, m.title, m.alias, m.note, m.path AS route, m.link, m.type, m.level, m.language')->select($db->quoteName('m.browserNav') . ', m.access, m.params, m.home, m.img, m.template_style_id, m.component_id, m.parent_id')->select('e.element as component')->from('#__menu AS m')->join('LEFT', '#__extensions AS e ON m.component_id = e.extension_id')->where('m.published = 1')->where('m.parent_id > 0')->where('m.client_id = 0')->order('m.lft');
     // Set the query
     $db->setQuery($query);
     try {
         $this->_items = $db->loadObjectList('id');
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, JText::sprintf('JERROR_LOADING_MENUS', $e->getMessage()));
         return false;
     }
     foreach ($this->_items as &$item) {
         // Get parent information.
         $parent_tree = array();
         if (isset($this->_items[$item->parent_id])) {
             $parent_tree = $this->_items[$item->parent_id]->tree;
         }
         // Create tree.
         $parent_tree[] = $item->id;
         $item->tree = $parent_tree;
         // Create the query array.
         $url = str_replace('index.php?', '', $item->link);
         $url = str_replace('&amp;', '&', $url);
         parse_str($url, $item->query);
     }
     return true;
 }
开发者ID:naumangla,项目名称:joomla-cms,代码行数:35,代码来源:site.php

示例13: store

 /**
  * Method to store a file to the FTP server
  *
  * @param   string  $local   Path to local file to store on the FTP server
  * @param   string  $remote  FTP path to file to create
  *
  * @throws Exception
  *
  * @return  boolean  True if successful
  */
 public function store($local, $remote = null)
 {
     //-- Avoid all this mess by throwing appropriate exceptions !!
     if (false === parent::store($local, $remote)) {
         throw new Exception(JError::getError());
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:17,代码来源:ftp.php

示例14: display

 /**
  * Method to display the view.
  *
  * @param   string  $tpl  A template file to load. [optional]
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  *
  * @since   2.5
  */
 public function display($tpl = null)
 {
     // Load plug-in language files.
     FinderHelperLanguage::loadPluginLanguage();
     $this->items = $this->get('Items');
     $this->total = $this->get('Total');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->pluginState = $this->get('pluginState');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     FinderHelper::addSubmenu('index');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     if (!$this->pluginState['plg_content_finder']->enabled) {
         JFactory::getApplication()->enqueueMessage(JText::_('COM_FINDER_INDEX_PLUGIN_CONTENT_NOT_ENABLED'), 'warning');
     } elseif ($this->get('TotalIndexed') === 0) {
         JFactory::getApplication()->enqueueMessage(JText::_('COM_FINDER_INDEX_NO_DATA') . '  ' . JText::_('COM_FINDER_INDEX_TIP'), 'notice');
     }
     JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
     // Configure the toolbar.
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:37,代码来源:view.html.php

示例15: display

 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     ContentHelper::addSubmenu('featured');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->authors = $this->get('Authors');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Levels filter.
     $options = array();
     $options[] = JHtml::_('select.option', '1', JText::_('J1'));
     $options[] = JHtml::_('select.option', '2', JText::_('J2'));
     $options[] = JHtml::_('select.option', '3', JText::_('J3'));
     $options[] = JHtml::_('select.option', '4', JText::_('J4'));
     $options[] = JHtml::_('select.option', '5', JText::_('J5'));
     $options[] = JHtml::_('select.option', '6', JText::_('J6'));
     $options[] = JHtml::_('select.option', '7', JText::_('J7'));
     $options[] = JHtml::_('select.option', '8', JText::_('J8'));
     $options[] = JHtml::_('select.option', '9', JText::_('J9'));
     $options[] = JHtml::_('select.option', '10', JText::_('J10'));
     $this->f_levels = $options;
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:38,代码来源:view.html.php


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