Esempio n. 1
0
 public function execute($task)
 {
     if ($task != 'step') {
         $task = 'browse';
     }
     parent::execute($task);
 }
 public function __construct($config = array())
 {
     parent::__construct($config);
     $base_path = JPATH_COMPONENT_ADMINISTRATOR . '/plugins';
     $model_path = $base_path . '/models';
     $view_path = $base_path . '/views';
     $this->addModelPath($model_path);
     $this->addViewPath($view_path);
 }
Esempio n. 3
0
 public function save()
 {
     $result = parent::save();
     $model = $this->getThisModel();
     if ($result) {
         $id = $model->getId();
         $url = TrackslibHelperRoute::getIndividualRoute($id);
         $this->setRedirect($url, JText::_('COM_TRACKS_INDIVIDUAL_SAVED'));
         return true;
     }
     return $result;
 }
Esempio n. 4
0
 public function onBeforeBrowse()
 {
     $result = parent::onBeforeBrowse();
     if ($result) {
         $params = JComponentHelper::getParams('com_akeeba');
         $model = $this->getThisModel();
         $view = $this->getThisView();
         /** @var AkeebaModelCpanels $model */
         $view->setModel($model);
         $aeconfig = AEFactory::getConfiguration();
         // Invalidate stale backups
         AECoreKettenrad::reset(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180)));
         // Just in case the reset() loaded a stale configuration...
         AEPlatform::getInstance()->load_configuration();
         // Let's make sure the temporary and output directories are set correctly and writable...
         $wizmodel = FOFModel::getAnInstance('Confwiz', 'AkeebaModel');
         $wizmodel->autofixDirectories();
         // Check if we need to toggle the settings encryption feature
         $model->checkSettingsEncryption();
         // Update the magic component parameters
         $model->updateMagicParameters();
         // Run the automatic database check
         $model->checkAndFixDatabase();
         // Run the automatic update site refresh
         $model->refreshUpdateSite();
         // Check the last installed version
         $versionLast = null;
         if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php')) {
             include_once JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php';
             if (defined('AKEEBA_LASTVERSIONCHECK')) {
                 $versionLast = AKEEBA_LASTVERSIONCHECK;
             }
         }
         if (is_null($versionLast)) {
             $component = JComponentHelper::getComponent('com_akeeba');
             if (is_object($component->params) && $component->params instanceof JRegistry) {
                 $params = $component->params;
             } else {
                 $params = new JParameter($component->params);
             }
             $versionLast = $params->get('lastversion', '');
         }
         if (version_compare(AKEEBA_VERSION, $versionLast, 'ne') || empty($versionLast)) {
             $this->setRedirect('index.php?option=com_akeeba&view=postsetup');
             return true;
         }
     }
     return $result;
 }
Esempio n. 5
0
 public function __construct($config = array())
 {
     parent::__construct($config);
 }
Esempio n. 6
0
 /**
  * The main code of the Dispatcher. It spawns the necessary controller and
  * runs it.
  *
  * @throws Exception
  *
  * @return  null
  */
 public function dispatch()
 {
     $platform = FOFPlatform::getInstance();
     if (!$platform->authorizeAdmin($this->input->getCmd('option', 'com_foobar'))) {
         return $platform->raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
     }
     $this->transparentAuthentication();
     // Merge English and local translations
     $platform->loadTranslations($this->component);
     $canDispatch = true;
     if ($platform->isCli()) {
         $canDispatch = $canDispatch && $this->onBeforeDispatchCLI();
     }
     $canDispatch = $canDispatch && $this->onBeforeDispatch();
     if (!$canDispatch) {
         $platform->setHeader('Status', '403 Forbidden', true);
         return $platform->raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
     }
     // Get and execute the controller
     $option = $this->input->getCmd('option', 'com_foobar');
     $view = $this->input->getCmd('view', $this->defaultView);
     $task = $this->input->getCmd('task', null);
     if (empty($task)) {
         $task = $this->getTask($view);
     }
     // Pluralise/sungularise the view name for typical tasks
     if (in_array($task, array('edit', 'add', 'read'))) {
         $view = FOFInflector::singularize($view);
     } elseif (in_array($task, array('browse'))) {
         $view = FOFInflector::pluralize($view);
     }
     $this->input->set('view', $view);
     $this->input->set('task', $task);
     $config = $this->config;
     $config['input'] = $this->input;
     $controller = FOFController::getTmpInstance($option, $view, $config);
     $status = $controller->execute($task);
     if (!$this->onAfterDispatch()) {
         $platform->setHeader('Status', '403 Forbidden', true);
         return $platform->raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
     }
     $format = $this->input->get('format', 'html', 'cmd');
     $format = empty($format) ? 'html' : $format;
     if ($format == 'html') {
         // In HTML views perform a redirection
         if ($controller->redirect()) {
             return;
         }
     } else {
         // In non-HTML views just exit the application with the proper HTTP headers
         if ($controller->hasRedirect()) {
             $headers = $platform->sendHeaders();
             jexit();
         }
     }
 }
Esempio n. 7
0
 protected function onBeforeBrowse()
 {
     $result = parent::onBeforeBrowse();
     if ($result) {
         require_once JPATH_ADMINISTRATOR . '/components/com_zlmanager/helpers/extensions.php';
         $exts = ZLManagerExtensionsHelper::getExtensionsAndVersions();
         $view = $this->getThisView();
         $view->assign('jextensions', $exts['extensions']);
         $view->assign('versions', $exts['versions']);
     }
     return $result;
 }
Esempio n. 8
0
 public function getModel($name = 'Poll', $prefix = 'SppollsModel', $config = array())
 {
     return parent::getModel($name, $prefix, $config);
 }
Esempio n. 9
0
 public function execute($task)
 {
     $task = 'json';
     parent::execute($task);
 }
Esempio n. 10
0
 /**
  * Informs the user that all is done
  */
 public function done()
 {
     if (!$this->_checkPermissions()) {
         parent::redirect();
         return true;
     }
     parent::display();
 }
Esempio n. 11
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->akeebaACLCheck();
 }
Esempio n. 12
0
	public function edit()
	{
		parent::edit();
		JRequest::setVar('hidemainmenu', false);
	}
Esempio n. 13
0
 public function execute($task)
 {
     // The only allowed task is the browse one
     $task = 'browse';
     parent::execute($task);
 }
 /**
  * The main code of the Dispatcher. It spawns the necessary controller and
  * runs it.
  *
  * @return  null|Exception
  */
 public function dispatch()
 {
     // Timezone fix; avoids errors printed out by PHP 5.3.3+
     list($isCli, $isAdmin) = self::isCliAdmin();
     if ($isAdmin) {
         // Master access check for the back-end, Joomla! 1.6 style.
         $user = JFactory::getUser();
         if (!$user->authorise('core.manage', $this->input->getCmd('option', 'com_foobar')) && !$user->authorise('core.admin', $this->input->getCmd('option', 'com_foobar'))) {
             if (version_compare(JVERSION, '3.0', 'ge')) {
                 throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
             } else {
                 return JError::raiseError('403', JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
             }
         }
     } elseif (!$isCli) {
         // Perform transparent authentication for front-end requests
         $this->transparentAuthentication();
     }
     // Merge English and local translations
     if ($isAdmin) {
         $paths = array(JPATH_ROOT, JPATH_ADMINISTRATOR);
     } else {
         $paths = array(JPATH_ADMINISTRATOR, JPATH_ROOT);
     }
     $jlang = JFactory::getLanguage();
     $jlang->load($this->component, $paths[0], 'en-GB', true);
     $jlang->load($this->component, $paths[0], null, true);
     $jlang->load($this->component, $paths[1], 'en-GB', true);
     $jlang->load($this->component, $paths[1], null, true);
     $canDispatch = true;
     if ($isCli) {
         $canDispatch = $canDispatch && $this->onBeforeDispatchCLI();
     }
     $canDispatch = $canDispatch && $this->onBeforeDispatch();
     if (!$canDispatch) {
         JResponse::setHeader('Status', '403 Forbidden', true);
         if (version_compare(JVERSION, '3.0', 'ge')) {
             throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
         } else {
             return JError::raiseError('403', JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
         }
     }
     // Get and execute the controller
     $option = $this->input->getCmd('option', 'com_foobar');
     $view = $this->input->getCmd('view', $this->defaultView);
     $task = $this->input->getCmd('task', '');
     if (empty($task)) {
         $task = $this->getTask($view);
     }
     // Pluralise/sungularise the view name for typical tasks
     if (in_array($task, array('edit', 'add', 'read'))) {
         $view = FOFInflector::singularize($view);
     } elseif (in_array($task, array('browse'))) {
         $view = FOFInflector::pluralize($view);
     }
     $this->input->set('view', $view);
     $this->input->set('task', $task);
     $config = $this->config;
     $config['input'] = $this->input;
     $controller = FOFController::getTmpInstance($option, $view, $config);
     $status = $controller->execute($task);
     if (!$this->onAfterDispatch()) {
         JResponse::setHeader('Status', '403 Forbidden', true);
         if (version_compare(JVERSION, '3.0', 'ge')) {
             throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
         } else {
             return JError::raiseError('403', JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
         }
     }
     $format = $this->input->get('format', 'html', 'cmd');
     $format = empty($format) ? 'html' : $format;
     if ($format == 'html') {
         // In HTML views perform a redirection
         if ($controller->redirect()) {
             return;
         }
     } else {
         // In non-HTML views just exit the application with the proper HTTP headers
         if ($controller->hasRedirect()) {
             $headers = JResponse::sendHeaders();
             jexit();
         }
     }
 }