public function testSetRegister()
 {
     $register = new ControllerRegister();
     $register->registerNamespace('\\FlexibleORMTests\\Mock\\AlternateController');
     $this->factory->setRegister($register);
     $controller = $this->factory->get('owners');
     $this->assertInstanceOf('\\FlexibleORMTests\\Mock\\AlternateController\\Owners', $controller);
 }
Пример #2
0
 /** Lance le serveur */
 function run()
 {
     // racine du serveur a enregistrer qq part (pour l'instant ici)
     $root = '/blogmarks/servers/atom';
     // On construit le tableau d'arguments pour les filtres
     $args = array();
     // on extrait l'URI relative
     $uri = $_SERVER['REQUEST_URI'];
     //***** DEBUG echo $uri."<br/>".$root;
     $uri = ereg_replace($root, '', $uri);
     $args['uri'] = $uri;
     $args['method'] = $_SERVER['REQUEST_METHOD'];
     $args['content'] = $_GLOBALS['HTTP_RAW_POST_DATA'];
     // On filtre la requête
     $filter = new FilterChainRoot(array(new ContextBuilderFilter(), new AuthenticateFilter()));
     $ret = $filter->execute(&$args);
     if (BlogMarks::isError($ret)) {
         // erreur de filtre
         echo $ret->getMessage();
         return;
     }
     // **** DEBUG
     echo "objet : " . $args['object'] . "<br/>";
     echo "method : " . $args['method'] . "<br/>";
     echo "tag : " . $args['tag'] . "<br/>";
     echo "user : "******"<br/>";
     echo "id : " . $args['id'] . "<br/>";
     echo "auth_str :" . $args['auth_str'] . "<br/>";
     // **********
     // On construit le controlleur selon le type d'objet de la requête
     $ctrlerFactory = new ControllerFactory();
     $ctrler = $ctrlerFactory->createController($args['object']);
     if (BlogMarks::isError($ctrler)) {
         echo $ctrler->getMessage();
         exit(1);
     }
     // On lance le controlleur pour l'objet de la requête
     $response = $ctrler->execute($args);
     if (BlogMarks::isError($response)) {
         // erreur du controlleur de requête
         return;
     }
     // On applique le renderer atom a la reponse et on la renvoit
     $rendererFactory = new rendererFactory();
     $renderer = $rendererFactory->createRenderer($args['object']);
     // GERER LA REPONSE HTTP
     echo "HTTP/1.1 200 Ok\n";
     $response->accept($renderer);
     echo $renderer->render();
 }
Пример #3
0
 /**
  * Perform execution of the application. This method is called from index2.php
  */
 function execute()
 {
     global $sugar_config;
     if (!empty($sugar_config['default_module'])) {
         $this->default_module = $sugar_config['default_module'];
     }
     $module = $this->default_module;
     if (!empty($_REQUEST['module'])) {
         $module = $_REQUEST['module'];
     }
     insert_charset_header();
     $this->setupPrint();
     $this->controller = ControllerFactory::getController($module);
     // if the entry point is defined to not need auth, then don't authenicate
     if (empty($_REQUEST['entryPoint']) || $this->controller->checkEntryPointRequiresAuth($_REQUEST['entryPoint'])) {
         $this->loadUser();
         $this->ACLFilter();
         $this->preProcess();
         $this->controller->preProcess();
     }
     if (ini_get('session.auto_start') !== false) {
         $_SESSION['breadCrumbs'] = new BreadCrumbStack($GLOBALS['current_user']->id);
     }
     SugarThemeRegistry::buildRegistry();
     $this->loadLanguages();
     $this->checkDatabaseVersion();
     $this->loadDisplaySettings();
     $this->loadLicense();
     $this->loadGlobals();
     $this->setupResourceManagement($module);
     $this->controller->execute();
     sugar_cleanup();
 }
Пример #4
0
 /**
  * Perform execution of the application. This method is called from index2.php
  */
 function execute()
 {
     global $sugar_config;
     if (!empty($sugar_config['default_module'])) {
         $this->default_module = $sugar_config['default_module'];
     }
     $module = $this->default_module;
     if (!empty($_REQUEST['module'])) {
         $module = $_REQUEST['module'];
     }
     insert_charset_header();
     $this->setupPrint();
     $this->controller = ControllerFactory::getController($module);
     // If the entry point is defined to not need auth, then don't authenticate.
     if (empty($_REQUEST['entryPoint']) || $this->controller->checkEntryPointRequiresAuth($_REQUEST['entryPoint'])) {
         $this->loadUser();
         $this->ACLFilter();
         $this->preProcess();
         $this->controller->preProcess();
         $this->checkHTTPReferer();
     }
     SugarThemeRegistry::buildRegistry();
     $this->loadLanguages();
     $this->checkDatabaseVersion();
     $this->loadDisplaySettings();
     //$this->loadLicense();
     $this->loadGlobals();
     $this->setupResourceManagement($module);
     $this->controller->execute();
     sugar_cleanup();
 }
Пример #5
0
 public function dispatch()
 {
     $helper = HelperFactory::getHelper("Http");
     $conf = $helper->parseGet($_GET);
     try {
         $staticRoute = $this->getCotrollerByAlias(ucfirst($conf["controller"]));
         if ($staticRoute !== false) {
             $conf["controller"] = $staticRoute['controller'];
             if ($staticRoute['action'] != '') {
                 $conf["action"] = $staticRoute['action'];
             }
         }
         $controller = ControllerFactory::getController(ucfirst($conf["controller"]));
         $controller->applyFilters($conf);
         $action = $conf["action"] . "Action";
         $controller->startUp($conf);
         call_user_func_array(array($controller, $action), $conf["param"]);
         $controller->render($conf["action"]);
     } catch (Doctrine_Connection_Exception $e) {
         exit($e->getMessage());
         ErrorHandler::displayError("Found a Doctrine connection error.<br>\n\t\t\t\t\t\t\t\t\t \tMake suere that you have started the Doctrine\n\t\t\t\t\t\t\t\t\t \tsubsystem.<br>");
     } catch (MissingControllerException $e) {
         exit("<h1>ERROR</h1><br><h2>Missing Controller</h2>");
     } catch (MissingClassException $e) {
         exit("<h1>ERROR</h1><br><h2>Missing class</h2>");
     } catch (Exception $e) {
         exit($e->getMessage());
         $controller = ControllerFactory::getController("_404");
         $controller->startUp();
         $controller->render("index");
     }
 }
Пример #6
0
 private static function dispatch()
 {
     $control_name = CONTROLLER_NAME . 'Controller';
     $action_name = ACTION_NAME . 'Action';
     $factory = ControllerFactory::getInstance();
     $controller = $factory->getController($control_name);
     $controller->{$action_name}();
 }
Пример #7
0
 public function run()
 {
     try {
         $request = $this->requestFactory->createRequest();
         $controller = $this->controllerFactory->create($request);
         $response = $controller->run($request);
     } catch (AuthorizationException $e) {
         $response = new Response(['message' => $e->getMessage()], 401);
     } catch (ApiException $e) {
         $response = new Response(['message' => $e->getMessage()], $e->getCode() ?: 400);
     }
     http_response_code($response->getCode());
     header('Content-Type: application/json');
     $body = json_encode($response->getData());
     header('X-Api-Signature: ' . hash_hmac('sha256', $body, $this->configuration->getPrivateKey()));
     echo $body;
 }
Пример #8
0
 function testControllerNameFromClass()
 {
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("FPDFController"), "fpdf", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("FPDFController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("FPDFStaticController"), "fpdf_static", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("FPDFStaticController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("StaticRSSController"), "static_rss", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("StaticRSSController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("PippoPlutoController"), "pippo_pluto", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("PippoPlutoController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("Pippo_PlutoController"), "pippo_pluto", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("pippo_plutoController"));
     $this->assertEqual(ControllerFactory::get_controller_name_from_class("__Pippo__PlutoController"), "__pippo_pluto", "Il nome del controller non corrisponde! : " . ControllerFactory::get_controller_name_from_class("__pippo__plutoController"));
 }
Пример #9
0
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new ControllerFactory();
         return self::$instance;
     } else {
         return self::$instance;
     }
 }
Пример #10
0
 public function process()
 {
     try {
         $request = new Request();
         $action = ControllerFactory::runAction($request);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
Пример #11
0
	public function Begin() {
	
		$url = $_GET;

		/** 
		 * pseudocode: 
		 * $url = split($_GET, '/');
		 * $controllerName = $url[0];
		 * $actionName = $url[1];
		 * $queryParams = $url[2...];
		 **/
		
		$controllerFactory = new ControllerFactory();
		$controller = $controllerFactory->CreateController($controllerName, $actionName);
		
		$controller->OnActionExecuting();
		$controller->ExecuteAction($queryParams);
		$controller->OnActionExecuted();
	}
Пример #12
0
 public function run()
 {
     //Nécessaire pour l'affichage de la vue
     include_once 'Models/Template.php';
     include_once 'Models/Model.php';
     include_once 'functions.php';
     //Création de controlleur----------------------------
     include_once 'Controllers/ControllerFactory.php';
     $controller = ControllerFactory::createController();
     //On lance l'action
     $action = self::getInstance()->getActionName($controller);
     $controller->{$action}();
 }
Пример #13
0
 function __construct($controller_name, $action, $format, $params)
 {
     //vecchio setup, e' stata aggiunta la creazione del controller
     $this->controller = ControllerFactory::create($controller_name);
     //hack per supportare i vecchi mapping con "php".
     //$format = DataFormatManager::getFormatString($format);
     $this->__check_reserved_action($action);
     if ($format !== "raw") {
         $this->__check_protected_action($action, $format);
     }
     DataFormatManager::checkFormatSupported($format);
     $this->action = $action;
     $this->format = $format;
     $this->params = $params;
     $this->format_helper = DataFormatManager::getFormat($format);
     $this->execute_action = true;
     $this->action_result = null;
 }
Пример #14
0
 function testIsControllerClass2()
 {
     $this->assertTrue(ControllerFactory::is_controller_class("ErrorController"), "ErrorController non e' un controller!");
     $this->assertTrue(ControllerFactory::is_controller_class("ModuliController"), "ModuliController non e' un controller!");
     $this->assertFalse(ControllerFactory::is_controller_class("FolderPeer"), "FolderPeer e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("ImmaginiDO"), "ImmaginiDO e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("EventiPeer"), "EventiPeer e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("XMLBuilder"), "XMLBuilder e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("DataHolder"), "DataHolder e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("ArrayUtils"), "ArrayUtils e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("ProfileMap"), "ProfileMap e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("PageLoader"), "PageLoader e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("ModulePlug"), "ModulePlug e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("FileWriter"), "FileWriter e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("FormWriter"), "FormWriter e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("RouteMatch"), "RouteMatch e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("EpiTwitter"), "EpiTwitter e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("Securimage"), "Securimage e' un controller!!");
     $this->assertFalse(ControllerFactory::is_controller_class("AjaxHelper"), "AjaxHelper e' un controller!!");
 }
 function display()
 {
     global $mod_strings, $export_module, $current_language, $theme, $current_user;
     echo get_module_title("Activities", $mod_strings['LBL_MODULE_TITLE'], true);
     $mod_strings = return_module_language($current_language, 'Calls');
     // Overload the export module since the user got here by clicking the "Activities" tab
     $export_module = "Calls";
     $_REQUEST['module'] = 'Calls';
     $controller = ControllerFactory::getController('Calls');
     $controller->loadBean();
     $controller->preProcess();
     $controller->process();
     //Manipulate view directly to not display header, js and footer again
     $view = ViewFactory::loadView($controller->view, $controller->module, $controller->bean, $controller->view_object_map);
     $view->options['show_header'] = false;
     $view->options['show_title'] = false;
     $view->options['show_javascript'] = false;
     $view->process();
     die;
 }
Пример #16
0
 public function run()
 {
     require dirname(__FILE__) . '/init.php';
     try {
         ConfLoader::loadConfig();
         $context = ApplicationContext::getContext();
         $map = $context->getControllerMap();
         $url = new Url();
         $actionMap = $map->getAction($url->getPackage(), $url->getAction());
         $controller = ControllerFactory::Create($actionMap['class']);
         $actionAppointer = ActionAppointer::getInstance();
         $actionAppointer->setController($controller);
         $actionAppointer->appointer($actionMap);
     } catch (FileException $fe) {
         $fe->getTraceAsString();
     } catch (CheckedException $ce) {
         $ce->getTraceAsString();
     } catch (Exception $e) {
         $e->getTraceAsString();
     }
 }
Пример #17
0
 private static function validate($name)
 {
     try {
         $url = URL::getInstance();
         if ($name == null) {
             if (Session::getInstance()->isStarted()) {
                 $url->setController(DEFAULT_SESSION_CONTROLLER);
                 $url->setAction(DEFAULT_SESSION_ACTION);
                 return DEFAULT_SESSION_CONTROLLER;
             } else {
                 $url->setController(DEFAULT_REQUEST_CONTROLLER);
                 $url->setAction(DEFAULT_REQUEST_ACTION);
                 return DEFAULT_REQUEST_CONTROLLER;
             }
         }
         $controller = $name . CONTROLLER;
         $class = new ReflectionClass($controller);
         if ($class->isAbstract()) {
             throw new LogicException();
         }
         $classScope = $class->getConstant('SCOPE');
         if ($class->implementsInterface('Context')) {
             if (Scope::isAcceptable($classScope)) {
                 return $name;
             }
             if ($classScope == Scope::SESSION) {
                 $url->setController(DEFAULT_REQUEST_CONTROLLER);
                 $url->setAction(DEFAULT_REQUEST_ACTION);
                 return DEFAULT_REQUEST_CONTROLLER;
             }
             if ($classScope == Scope::REQUEST) {
                 ControllerFactory::create(DEFAULT_APPLICATION_CONTROLLER)->redirectToError();
             }
         }
         return DEFAULT_APPLICATION_CONTROLLER;
     } catch (LogicException $e) {
         $e->getTraceAsString();
         ControllerFactory::create(DEFAULT_APPLICATION_CONTROLLER)->redirectToError();
     }
 }
Пример #18
0
 /**
  * @group bug39787
  */
 public function testOpportunityNameValueFilled()
 {
     $lead = SugarTestLeadUtilities::createLead();
     $lead->opportunity_name = 'SBizzle Dollar Store';
     $lead->save();
     $_REQUEST['module'] = 'Leads';
     $_REQUEST['action'] = 'ConvertLead';
     $_REQUEST['record'] = $lead->id;
     // Check that the opportunity name doesn't get populated when it's not in the Leads editview layout
     require_once 'include/MVC/Controller/ControllerFactory.php';
     require_once 'include/MVC/View/ViewFactory.php';
     $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']);
     ob_start();
     $GLOBALS['app']->controller->execute();
     $output = ob_get_clean();
     $matches_one = array();
     $pattern = '/SBizzle Dollar Store/';
     preg_match($pattern, $output, $matches_one);
     $this->assertTrue(count($matches_one) == 0, "Opportunity name got carried over to the Convert Leads page when it shouldn't have.");
     // Add the opportunity_name to the Leads EditView
     SugarTestStudioUtilities::addFieldToLayout('Leads', 'editview', 'opportunity_name');
     // Check that the opportunity name now DOES get populated now that it's in the Leads editview layout
     ob_start();
     $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']);
     $GLOBALS['app']->controller->execute();
     $output = ob_get_clean();
     $matches_two = array();
     $pattern = '/SBizzle Dollar Store/';
     preg_match($pattern, $output, $matches_two);
     $this->assertTrue(count($matches_two) > 0, "Opportunity name did not carry over to the Convert Leads page when it should have.");
     SugarTestStudioUtilities::removeAllCreatedFields();
     unset($GLOBALS['app']->controller);
     unset($_REQUEST['module']);
     unset($_REQUEST['action']);
     unset($_REQUEST['record']);
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
Пример #19
0
<?php

/*
* 2012 TAS
*/
define('IN_TAS', true);
require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('RoomStockController')->run();
Пример #20
0
<?php

require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('DesignEnquiryController')->run();
Пример #21
0
<?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('OrderSlipController')->run();
<?php

/*
* 2007-2012 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-2012 PrestaShop SA
*  @version  Release: $Revision: 14007 $
*  @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('CompareController')->run();
Пример #23
0
<?php

/*
* 2012 TAS
*/
define('IN_TAS', true);
require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('AboutController')->run();
Пример #24
0
<?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('ContactController')->run();
 public static function getController($className, $auth = false, $ssl = false)
 {
     ControllerFactory::includeController($className);
     return new $className($auth, $ssl);
 }
Пример #26
0
<?php

/*
* 2007-2012 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-2012 PrestaShop SA
*  @version  Release: $Revision: 14007 $
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
require_once dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('BestSalesController')->run();
Пример #27
0
 private static function init()
 {
     self::$initialized = true;
     self::$instance = new ControllerFactory();
 }
Пример #28
0
<?php

/*
* 2012 TAS
*/
define('IN_TAS', true);
require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('RoomPlanSummaryController')->run();
Пример #29
0
<?php

define('IN_TAS', true);
require dirname(__FILE__) . '/config/config.inc.php';
ControllerFactory::getController('PromotionListController')->run();
Пример #30
0
<?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('ProductController')->run();