<?php /* * 2007-2011 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <*****@*****.**> * @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ require dirname(__FILE__) . '/config/config.inc.php'; controllerFactory::getController('IndexController')->run(); //echo "ddkjk,hjk,";
/** * Executes a controller action * @Exception thrown if the action does not exist */ public function route(Container $container) { // general configuration $generalConfig = isset($container['Config']['general']) ? $container['Config']['general'] : array(); // per mvc component configuration $controllerConfig = array_merge($generalConfig, isset($container['Config']['controller']) ? $container['Config']['controller'] : array()); $modelConfig = array_merge($generalConfig, isset($container['Config']['model']) ? $container['Config']['model'] : array()); $viewConfig = array_merge($generalConfig, isset($container['Config']['view']) ? $container['Config']['view'] : array()); // get the controller Object $controller = controllerFactory::getController($this->_controller, $controllerConfig); $controller->setControllerName($this->_controller); // inject any dependencies to the controller $container['Router'] = $this; $controller->setActionName($this->_action); $controller->setContainer($container); $viewName = substr($this->_controller, 0, -10); $view = viewFactory::getView($viewName, $viewConfig); $view->setController($this->_controller); $view->setViewName($this->_action); $view->setExtension('.php'); $view->setTemplate('default.php'); $controller->setView($view); $action = $this->_action . 'Action'; if (method_exists($controller, $action)) { // execute always action every time, $controller->alwaysAction(); // Execute beforeAction if exists $beforeAction = "before" . ucfirst($action); if (method_exists($controller, $beforeAction)) { $controller->{$beforeAction}(); } // Execute the current action $controller->{$action}(); // Execute after if exists $afterAction = "after" . ucfirst($action); if (method_exists($controller, $afterAction)) { $controller->{$afterAction}(); } // execute view always action $controller->view->alwaysAction(); // Execute the view action . _executeView will indicate which view to execute // if we indicate it via Controller::setView(view); $setViewName = $controller->view->getViewName() . 'Action'; if (method_exists($controller->view, $setViewName)) { $controller->view->{$setViewName}(); } else { if (method_exists($controller->view, $action)) { $controller->view->{$action}(); // render any scripts after the view if set $controller->view->renderScripts(true); } } // render the template if (true === $controller->view->renderTemplate) { $controller->view->renderTemplate(); } else { $controller->view->main(); } } else { throw new Exception('you have to specify a valid action for the controller ' . $this->_controller); } }