Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed global variables from entry points

git-svn-id: http://joomlacode.org/svn/joomla/development/trunk@13049 6f6e1ebd-4c2b-0410-823f-f34bde69bce9
  • Loading branch information...
commit 7e5a2ebd8268e748028d534242eada33a2a5540d 1 parent 99923b4
@ercanozkaya ercanozkaya authored
View
6 administrator/includes/application.php
@@ -115,8 +115,12 @@ static public function &getRouter($name = null, array $options = array())
*
* @param string The component to dispatch.
*/
- public function dispatch($component)
+ public function dispatch($component = null)
{
+ if ($component === null) {
+ $component = JAdministratorHelper::findOption();
+ }
+
$document = &JFactory::getDocument();
$user = &JFactory::getUser();
View
38 administrator/index.php
@@ -8,26 +8,21 @@
// Set flag that this is a parent file
define('_JEXEC', 1);
-
define('JPATH_BASE', dirname(__FILE__));
-
define('DS', DIRECTORY_SEPARATOR);
-require_once(JPATH_BASE .DS.'includes'.DS.'defines.php');
-require_once(JPATH_BASE .DS.'includes'.DS.'framework.php');
-require_once(JPATH_BASE .DS.'includes'.DS.'helper.php');
-require_once(JPATH_BASE .DS.'includes'.DS.'toolbar.php');
+require_once JPATH_BASE.DS.'includes'.DS.'defines.php';
+require_once JPATH_BASE.DS.'includes'.DS.'framework.php';
+require_once JPATH_BASE.DS.'includes'.DS.'helper.php';
+require_once JPATH_BASE.DS.'includes'.DS.'toolbar.php';
+// Mark afterLoad in the profiler.
JDEBUG ? $_PROFILER->mark('afterLoad') : null;
-/*
- * Instantiate the application.
- */
+// Instantiate the application.
$app = &JFactory::getApplication('administrator');
-/*
- * Initialise the application.
- */
+// Initialise the application.
$app->initialise(array(
'language' => $app->getUserState('application.lang', 'lang')
));
@@ -35,32 +30,23 @@
// Mark afterIntialise in the profiler.
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
-/*
- * Route the application.
- */
+// Route the application.
$app->route();
// Mark afterRoute in the profiler.
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
-/*
- * Dispatch the application.
- */
-$option = JAdministratorHelper::findOption();
-$app->dispatch($option);
+// Dispatch the application.
+$app->dispatch();
// Mark afterDispatch in the profiler.
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
-/*
- * Render the application.
- */
+// Render the application.
$app->render();
// Mark afterRender in the profiler.
JDEBUG ? $_PROFILER->mark('afterRender') : null;
-/*
- * Return the response.
- */
+// Return the response.
echo JResponse::toString($app->getCfg('gzip'));
View
14 includes/application.php
@@ -81,6 +81,18 @@ public function initialise($options = array())
}
/**
+ * Route the application.
+ *
+ */
+ public function route()
+ {
+ parent::route();
+
+ $Itemid = JRequest::getInt('Itemid');
+ $this->authorize($Itemid);
+ }
+
+ /**
* Dispatch the application
*
* @param string
@@ -214,7 +226,7 @@ public function authorize($itemid)
$return = $uri->toString();
$url = 'index.php?option=com_users&view=login';
- $url .= '&return='.base64_encode($return);;
+ $url .= '&return='.base64_encode($return);
//$url = JRoute::_($url, false);
$this->redirect($url, JText::_('You must login first'));
View
28 index.php
@@ -17,48 +17,32 @@
// Mark afterLoad in the profiler.
JDEBUG ? $_PROFILER->mark('afterLoad') : null;
-/*
- * Instantiate the application.
- */
+// Instantiate the application.
$app = &JFactory::getApplication('site');
-/*
- * Initialise the application.
- */
+// Initialise the application.
$app->initialise();
// Mark afterIntialise in the profiler.
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
-/*
- * Route the application.
- */
+// Route the application.
$app->route();
-// authorization
-$Itemid = JRequest::getInt('Itemid');
-$app->authorize($Itemid);
-
// Mark afterRoute in the profiler.
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
-/*
- * Dispatch the application.
- */
+// Dispatch the application.
$app->dispatch();
// Mark afterDispatch in the profiler.
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
-/*
- * Render the application.
- */
+// Render the application.
$app->render();
// Mark afterRender in the profiler.
JDEBUG ? $_PROFILER->mark('afterRender') : null;
-/*
- * Return the response.
- */
+// Return the response.
echo JResponse::toString($app->getCfg('gzip'));
Please sign in to comment.
Something went wrong with that request. Please try again.