PageRenderTime 21ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/administrator/components/com_jce/jce.php

https://bitbucket.org/pastor399/newcastleunifc
PHP | 79 lines | 44 code | 14 blank | 21 comment | 8 complexity | 71811f258562c181c8c99d3fd608e4db MD5 | raw file
  1. <?php
  2. /**
  3. * @package JCE
  4. * @copyright Copyright (c) 2009-2013 Ryan Demmer. All rights reserved.
  5. * @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  6. * JCE is free software. This version may have been modified pursuant
  7. * to the GNU General Public License, and as distributed it includes or
  8. * is derivative of works licensed under the GNU General Public License or
  9. * other free or open source software licenses.
  10. */
  11. defined('_JEXEC') or die('RESTRICTED');
  12. // load base classes
  13. require_once(dirname(__FILE__) . '/includes/base.php');
  14. // get the view
  15. $view = JRequest::getCmd('view');
  16. // get task
  17. $task = JRequest::getCmd('task');
  18. // legacy conversion
  19. if ($task == 'popup') {
  20. $view = 'popup';
  21. JRequest::setVar('task', null);
  22. }
  23. // import library dependencies
  24. jimport('joomla.application.component.helper');
  25. jimport('joomla.application.component.controller');
  26. // Require the base controller
  27. require_once (WF_ADMINISTRATOR . '/controller.php');
  28. // Load controller
  29. $controllerPath = WF_ADMINISTRATOR . '/controller/' . $view . '.php';
  30. if (file_exists($controllerPath)) {
  31. require_once ($controllerPath);
  32. $controllerClass = 'WFController' . ucfirst($view);
  33. $controller = new $controllerClass(array(
  34. 'base_path' => WF_ADMINISTRATOR
  35. ));
  36. // load default controller
  37. } else {
  38. $controller = new WFController(array(
  39. 'base_path' => WF_ADMINISTRATOR
  40. ));
  41. }
  42. // check Authorisations
  43. switch ($view) {
  44. case 'editor':
  45. case 'help':
  46. case 'popup':
  47. break;
  48. default:
  49. $app = JFactory::getApplication();
  50. if ($app->isAdmin() === false) {
  51. $app->redirect('index.php', WFText::_('ALERTNOTAUTH'), 'error');
  52. }
  53. if ($view == 'cpanel') {
  54. $view = 'manage';
  55. }
  56. // Authorise
  57. $controller->authorize($view);
  58. // check state of extension
  59. $controller->check();
  60. break;
  61. }
  62. // Perform the Request task
  63. $controller->execute($task);
  64. $controller->redirect();
  65. ?>