From 6a096dce21cc24efd9b30f3d325128a86562a100 Mon Sep 17 00:00:00 2001 From: matthieu_ Date: Mon, 3 Sep 2007 13:06:05 +0000 Subject: A lot of new stuff, AJAX administration, Login Controller, jquery integration, quickform, ... --- modules/FrontController.php | 107 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 modules/FrontController.php (limited to 'modules/FrontController.php') diff --git a/modules/FrontController.php b/modules/FrontController.php new file mode 100644 index 0000000000..6bacad7ac0 --- /dev/null +++ b/modules/FrontController.php @@ -0,0 +1,107 @@ +getDefaultAction(); + $action = Piwik_Common::getRequestVar('action', $defaultAction, 'string'); + + try{ + $controller->$action(); + } catch(Piwik_Access_NoAccessException $e) { + Piwik::log("NO ACCESS EXCEPTION =>"); + Piwik_PostEvent('FrontController.NoAccessException', $e); + } + } + else + { + throw new Exception("Module controller $moduleController not found!"); + } + } + else + { + throw new Exception("Invalid module name"); + } + + } + + function end() + { + + Piwik::printZendProfiler(); + Piwik::printMemoryUsage(); + Piwik::printQueryCount(); +// Piwik::uninstall(); + + Piwik::log($this->timer); + + } + + function init() + { + $this->timer = new Piwik_Timer; + + //move into a init() method + Piwik::createConfigObject(); + + // database object + Piwik::createDatabaseObject(); + + // Create the log objects + Piwik::createLogObject(); + + Piwik::printMemoryUsage('Start program'); + //TODO move all DB related methods in a DB static class + + //Piwik::createDatabase(); + //Piwik::createDatabaseObject(); + + $doNotDrop = array( + Piwik::prefixTable('log_visit'), + Piwik::prefixTable('access'), + Piwik::prefixTable('user'), + Piwik::prefixTable('site'), + Piwik::prefixTable('log_link_visit_action'), + Piwik::prefixTable('log_action'), + Piwik::prefixTable('log_profiling'), + Piwik::prefixTable('archive'), + ); + + Piwik::dropTables($doNotDrop); + Piwik::createTables(); + + // load plugins + Piwik_PluginsManager::getInstance()->setInstallPlugins(); + //TODO plugins install to handle in a better way + Piwik::loadPlugins(); + + // Create auth object + Zend_Registry::set('auth', $authAdapter = new Piwik_Auth()); + + // Setup the auth object + Piwik_PostEvent('FrontController.authSetCredentials'); + + // Perform the authentication query, saving the result + $access = new Piwik_Access($authAdapter); + Zend_Registry::set('access', $access); + Zend_Registry::get('access')->loadAccess(); + } +} + -- cgit v1.2.3