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


PHP JApplicationCms::redirect方法代码示例

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


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

示例1: execute

 /**
  * Method to remove root in global configuration.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken('get')) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Initialise model.
     $model = new ConfigModelApplication();
     // Attempt to save the configuration and remove root.
     try {
         $model->removeroot();
     } catch (RuntimeException $e) {
         // Save failed, go back to the screen and display a notice.
         $this->app->enqueueMessage(JText::sprintf('JERROR_SAVE_FAILED', $e->getMessage()), 'error');
         $this->app->redirect(JRoute::_('index.php', false));
     }
     // Set the redirect based on the task.
     $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
     $this->app->redirect(JRoute::_('index.php', false));
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:33,代码来源:removeroot.php

示例2: execute

 /**
  * Execute the controller.
  *
  * @return  boolean  True if controller finished execution, false if the controller did not
  *                   finish execution. A controller might return false if some precondition for
  *                   the controller to run has not been satisfied.
  *
  * @since   12.1
  * @throws  LogicException
  * @throws  RuntimeException
  */
 public function execute()
 {
     $model = new MonitorModelIssue();
     $id = $this->input->getInt('id');
     $user = JFactory::getUser();
     // Get the params
     // TODO: may be removed when new MVC is implemented completely
     $this->app = JFactory::getApplication();
     if ($this->app instanceof JApplicationSite) {
         $params = $this->app->getParams();
     }
     if (!$model->canEdit($user, $id)) {
         if ($user->guest && isset($params) && $params->get('redirect_login', 1)) {
             $this->app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'error');
             $this->app->redirect(JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode(JUri::getInstance()->toString()), '403'));
         } else {
             throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
         }
     }
     if ($id) {
         $model->setIssueId($id);
     }
     $model->loadForm();
     $view = new MonitorViewIssueHtml($model);
     $view->setLayout('edit');
     $view->loadForm();
     echo $view->render();
     return true;
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:40,代码来源:edit.php

示例3: onUserLoginFailure

 public function onUserLoginFailure($response)
 {
     var_dump($response);
     if ($response['status'] === 4 && $response['error_message'] == "suspended") {
         $this->app->redirect(JRoute::_('account-suspended', false));
     }
     //die();
 }
开发者ID:camigreen,项目名称:ttop,代码行数:8,代码来源:zoostore.php

示例4: execute

 /**
  * Method to save global configuration.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken()) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Set FTP credentials, if given.
     JClientHelper::setCredentialsFromRequest('ftp');
     $model = new ConfigModelConfig();
     $form = $model->getForm();
     $data = $this->input->post->get('jform', array(), 'array');
     // Validate the posted data.
     $return = $model->validate($form, $data);
     // Check for validation errors.
     if ($return === false) {
         /*
          * The validate method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Redirect back to the edit screen.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     }
     // Attempt to save the configuration.
     $data = $return;
     // Access back-end com_config
     JLoader::registerPrefix('Config', JPATH_ADMINISTRATOR . '/components/com_config');
     $saveClass = new ConfigControllerApplicationSave();
     // Get a document object
     $document = JFactory::getDocument();
     // Set back-end required params
     $document->setType('json');
     // Execute back-end controller
     $return = $saveClass->execute();
     // Reset params back after requesting from service
     $document->setType('html');
     // Check the return value.
     if ($return === false) {
         /*
          * The save method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Save failed, go back to the screen and display a notice.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     }
     // Redirect back to com_config display
     $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
     $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     return true;
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:64,代码来源:save.php

示例5: execute

 /**
  * Execute the controller.
  *
  * @return  boolean  True if controller finished execution, false if the controller did not
  *                   finish execution. A controller might return false if some precondition for
  *                   the controller to run has not been satisfied.
  *
  * @since   12.1
  * @throws  LogicException
  * @throws  RuntimeException
  */
 public function execute()
 {
     $id = $this->input->getInt('id');
     $user = JFactory::getUser();
     if ($user->guest) {
         $this->app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'error');
     } else {
         $model = new MonitorModelSubscription();
         if ($model->isSubscriberIssue($id, $user->id)) {
             $model->unsubscribeIssue($id, $user->id);
             $this->app->enqueueMessage(JText::_('COM_MONITOR_SUBSCRIPTION_ISSUE_UNSUBSCRIBED'), 'message');
         }
     }
     $this->app->redirect(JRoute::_('index.php?option=com_monitor&view=issue&id=' . $id, false));
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:26,代码来源:unsubscribe.php

示例6: onAfterRouteAdmin

 /**
  * Re-route Gantry templates to Gantry Administration component.
  */
 private function onAfterRouteAdmin()
 {
     $input = $this->app->input;
     $option = $input->getCmd('option');
     $task = $input->getCmd('task');
     if (in_array($option, ['com_templates', 'com_advancedtemplates']) && $task && strpos($task, 'style') === 0) {
         // Get all ids.
         $cid = $input->post->get('cid', (array) $input->getInt('id'), 'array');
         if ($cid) {
             $styles = $this->getStyles();
             $selected = array_intersect(array_keys($styles), $cid);
             // If no Gantry templates were selected, just let com_templates deal with the request.
             if (!$selected) {
                 return;
             }
             // Special handling for tasks coming from com_template.
             if ($task == 'style.edit') {
                 $id = (int) array_shift($cid);
                 if (isset($styles[$id])) {
                     $token = JSession::getFormToken();
                     $this->app->redirect("index.php?option=com_gantry5&view=configurations/{$id}/styles&style={$id}&{$token}=1");
                 }
             }
         }
     }
 }
开发者ID:Ettore495,项目名称:Ettore-Work,代码行数:29,代码来源:gantry5.php

示例7: execute

 /**
  * Method to refresh help in global configuration.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function execute()
 {
     jimport('joomla.filesystem.file');
     // Set FTP credentials, if given
     JClientHelper::setCredentialsFromRequest('ftp');
     if (($data = file_get_contents('http://help.joomla.org/helpsites.xml')) === false) {
         $this->app->enqueueMessage(JText::_('COM_CONFIG_ERROR_HELPREFRESH_FETCH'), 'error');
         $this->app->redirect(JRoute::_('index.php?option=com_config', false));
     } elseif (!JFile::write(JPATH_BASE . '/help/helpsites.xml', $data)) {
         $this->app->enqueueMessage(JText::_('COM_CONFIG_ERROR_HELPREFRESH_ERROR_STORE'), 'error');
         $this->app->redirect(JRoute::_('index.php?option=com_config', false));
     } else {
         $this->app->enqueueMessage(JText::_('COM_CONFIG_HELPREFRESH_SUCCESS'), 'error');
         $this->app->redirect(JRoute::_('index.php?option=com_config', false));
     }
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:23,代码来源:refreshhelp.php

示例8: onAfterRoute

 /**
  * Converting the site URL to fit to the HTTP request
  */
 public function onAfterRoute()
 {
     $params = JComponentHelper::getParams('com_userxtd');
     if ($params->get('CoreRegistration_Redirect', 0)) {
         $option = $this->input->get('option');
         $view = $this->input->get('view');
         $layout = $this->input->get('layout', 'default');
         $id = $this->input->get('id', JFactory::getUser()->id);
         if ($option == 'com_users') {
             $this->initComponent();
             if ($view == 'registration' && $layout == 'default') {
                 $this->app->redirect(Route::_('register'));
             }
             if ($view == 'profile' && $layout == 'default') {
                 if ($id) {
                     $this->app->redirect(Route::_('user_id', array('id' => $id)));
                 } else {
                     $this->app->redirect(Route::_('user'));
                 }
             }
             if ($view == 'profile' && $layout == 'edit') {
                 $this->app->redirect(Route::_('user_layout', array('task' => 'user.edit.edit', 'layout' => 'edit', 'id' => $id)));
             }
         }
     }
 }
开发者ID:ForAEdesWeb,项目名称:AEW13,代码行数:29,代码来源:userxtd.php

示例9: parseCheckSSL

 /**
  * Force to SSL
  * 
  * @param   JRouterSite  &$router  Router object
  * @param   JUri         &$uri     URI object to process
  *
  * @return  void
  * 
  * @since   4.0
  */
 public function parseCheckSSL(&$router, &$uri)
 {
     if (strtolower($uri->getScheme()) != 'https') {
         // Forward to https
         $uri->setScheme('https');
         $this->app->redirect((string) $uri, 301);
     }
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:18,代码来源:site.php

示例10: parse

 /**
  * Function to convert a route to an internal URI
  *
  * @param   JUri  &$uri  The uri.
  *
  * @return  array
  *
  * @since   1.5
  */
 public function parse(&$uri)
 {
     $vars = array();
     if ($this->app->get('force_ssl') == 2 && strtolower($uri->getScheme()) != 'https') {
         // Forward to https
         $uri->setScheme('https');
         $this->app->redirect((string) $uri, 301);
     }
     // Get the path
     // Decode URL to convert percent-encoding to unicode so that strings match when routing.
     $path = urldecode($uri->getPath());
     // Remove the base URI path.
     $path = substr_replace($path, '', 0, strlen(JUri::base(true)));
     // Check to see if a request to a specific entry point has been made.
     if (preg_match("#.*?\\.php#u", $path, $matches)) {
         // Get the current entry point path relative to the site path.
         $scriptPath = realpath($_SERVER['SCRIPT_FILENAME'] ? $_SERVER['SCRIPT_FILENAME'] : str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']));
         $relativeScriptPath = str_replace('\\', '/', str_replace(JPATH_SITE, '', $scriptPath));
         // If a php file has been found in the request path, check to see if it is a valid file.
         // Also verify that it represents the same file from the server variable for entry script.
         if (file_exists(JPATH_SITE . $matches[0]) && $matches[0] == $relativeScriptPath) {
             // Remove the entry point segments from the request path for proper routing.
             $path = str_replace($matches[0], '', $path);
         }
     }
     // Identify format
     if ($this->_mode == JROUTER_MODE_SEF) {
         if ($this->app->get('sef_suffix') && !(substr($path, -9) == 'index.php' || substr($path, -1) == '/')) {
             if ($suffix = pathinfo($path, PATHINFO_EXTENSION)) {
                 $vars['format'] = $suffix;
             }
         }
     }
     // Set the route
     $uri->setPath(trim($path, '/'));
     // Set the parsepreprocess components methods
     $components = JComponentHelper::getComponents();
     foreach ($components as $component) {
         $componentRouter = $this->getComponentRouter($component->option);
         if (method_exists($componentRouter, 'parsepreprocess')) {
             $this->attachParseRule(array($componentRouter, 'parsepreprocess'), static::PROCESS_BEFORE);
         }
     }
     $vars += parent::parse($uri);
     return $vars;
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:55,代码来源:site.php

示例11: execute

 /**
  * Execute the controller.
  *
  * @return  boolean  True if controller finished execution, false if the controller did not
  *                   finish execution. A controller might return false if some precondition for
  *                   the controller to run has not been satisfied.
  *
  * @since   12.1
  * @throws  LogicException
  * @throws  RuntimeException
  */
 public function execute()
 {
     $id = $this->input->getInt('id');
     $user = JFactory::getUser();
     if ($user->guest) {
         $this->app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'error');
     } else {
         $model = new MonitorModelSubscription();
         if (!$model->isSubscriberProject($id, $user->id)) {
             $model->subscribeProject($id, $user->id);
             $this->app->enqueueMessage(JText::_('COM_MONITOR_SUBSCRIPTION_PROJECT'), 'message');
         }
     }
     $return = base64_decode($this->app->input->get('return', '', 'BASE64'));
     if (!JUri::isInternal($return)) {
         $return = 'index.php?option=com_monitor&view=project&id=' . $id;
     }
     $this->app->redirect(JRoute::_($return, false));
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:30,代码来源:subscribe.php

示例12: execute

 /**
  * Execute the controller.
  *
  * @return  boolean  True if controller finished execution, false if the controller did not
  *                   finish execution. A controller might return false if some precondition for
  *                   the controller to run has not been satisfied.
  *
  * @since   12.1
  * @throws  LogicException
  * @throws  RuntimeException
  */
 public function execute()
 {
     if (!JFactory::getUser()->authorise('attachment.delete', 'com_monitor')) {
         throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
     }
     $app = JFactory::getApplication();
     $model = new MonitorModelAttachments($app);
     $id = $app->input->getInt('id');
     if (!$id) {
         throw new Exception(JText::_('JERROR_NO_ITEMS_SELECTED'), 404);
     }
     $model->delete(array($id));
     $app->enqueueMessage(JText::_('COM_MONITOR_ATTACHMENT_DELETED'));
     $return = base64_decode($this->app->input->get('return', '', 'BASE64'));
     if (!JUri::isInternal($return)) {
         $return = 'index.php?option=com_monitor&view=projects';
     }
     $this->app->redirect(JRoute::_($return, false));
     return true;
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:31,代码来源:delete.php

示例13: execute

 /**
  * Method to save global configuration.
  *
  * @return  mixed  Calls $app->redirect()
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken()) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Set FTP credentials, if given.
     JClientHelper::setCredentialsFromRequest('ftp');
     $model = new ConfigModelComponent();
     $form = $model->getForm();
     $data = $this->input->get('jform', array(), 'array');
     $id = $this->input->getInt('id');
     $option = $this->input->get('component');
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin', $option)) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     $returnUri = $this->input->post->get('return', null, 'base64');
     $redirect = '';
     if (!empty($returnUri)) {
         $redirect = '&return=' . urlencode($returnUri);
     }
     // Validate the posted data.
     $return = $model->validate($form, $data);
     // Check for validation errors.
     if ($return === false) {
         /*
          * The validate method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Redirect back to the edit screen.
         $this->app->redirect(JRoute::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false));
     }
     // Attempt to save the configuration.
     $data = array('params' => $return, 'id' => $id, 'option' => $option);
     try {
         $model->save($data);
     } catch (RuntimeException $e) {
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Save failed, go back to the screen and display a notice.
         $this->app->enqueueMessage(JText::sprintf('JERROR_SAVE_FAILED', $e->getMessage()), 'error');
         $this->app->redirect(JRoute::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false));
     }
     // Set the redirect based on the task.
     switch ($this->options[3]) {
         case 'apply':
             $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
             $this->app->redirect(JRoute::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false));
             break;
         case 'save':
         default:
             $redirect = 'index.php?option=' . $option;
             if (!empty($returnUri)) {
                 $redirect = base64_decode($returnUri);
             }
             $this->app->redirect(JRoute::_($redirect, false));
             break;
     }
     return true;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:71,代码来源:save.php

示例14: execute

 /**
  * Method to handle cancel
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Redirect back to home(base) page
     $this->app->redirect(JUri::base());
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:12,代码来源:cancel.php

示例15: execute

 /**
  * Method to save global configuration.
  *
  * @return  mixed  Calls $app->redirect() for all cases except JSON
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken()) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Set FTP credentials, if given.
     JClientHelper::setCredentialsFromRequest('ftp');
     $model = new ConfigModelApplication();
     $data = $this->input->post->get('jform', array(), 'array');
     // Complete data array if needed
     $oldData = $model->getData();
     $data = array_replace($oldData, $data);
     // Get request type
     $saveFormat = JFactory::getDocument()->getType();
     // Handle service requests
     if ($saveFormat == 'json') {
         return $model->save($data);
     }
     // Must load after serving service-requests
     $form = $model->getForm();
     // Validate the posted data.
     $return = $model->validate($form, $data);
     // Check for validation errors.
     if ($return === false) {
         /*
          * The validate method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Redirect back to the edit screen.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.application', false));
     }
     // Attempt to save the configuration.
     $data = $return;
     $return = $model->save($data);
     // Check the return value.
     if ($return === false) {
         /*
          * The save method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Save failed, go back to the screen and display a notice.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.application', false));
     }
     // Set the success message.
     $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
     // Set the redirect based on the task.
     switch ($this->options[3]) {
         case 'apply':
             $this->app->redirect(JRoute::_('index.php?option=com_config', false));
             break;
         case 'save':
         default:
             $this->app->redirect(JRoute::_('index.php', false));
             break;
     }
 }
开发者ID:JonatanLiecheski,项目名称:MeditecJoomla,代码行数:72,代码来源:save.php


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