diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 1f560c03f..06e4bd7f1 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -414,6 +414,8 @@ class WebApplication public function loadEnvironment($workspace = "") { + $this->defineConstantsForPlugin(); + define("PATH_SEP", DIRECTORY_SEPARATOR); define("PATH_TRUNK", $this->rootDir . PATH_SEP); @@ -453,8 +455,6 @@ class WebApplication define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP); define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . PATH_SEP); - self::defineConstantsForPlugin(); - G::defineConstants(); $arraySystemConfiguration = System::getSystemConfiguration(); @@ -621,7 +621,7 @@ class WebApplication * file is not done by 'require' in this version of ProcessMaker. Therefore, * these definitions have been moved to this class. */ - public static function defineConstantsForPlugin() + public function defineConstantsForPlugin() { define('G_PLUGIN_CLASS', 1); define('PM_CREATE_CASE', 1001); @@ -646,4 +646,3 @@ class WebApplication define('PM_SCHEDULER_CREATE_CASE_AFTER', 1020); } } - diff --git a/workflow/public_html/app.php b/workflow/public_html/app.php index cb97f2ea2..c466fc603 100644 --- a/workflow/public_html/app.php +++ b/workflow/public_html/app.php @@ -1,5 +1,10 @@ setRootDir($rootDir); $app->setRequestUri($_SERVER['REQUEST_URI']); $stat = $app->route(); - switch ($stat) - { - case Maveriks\WebApplication::RUNNING_WORKFLOW: + switch ($stat) { + case WebApplication::RUNNING_WORKFLOW: + //TODO: This should be replaced by the 'WebApplication::loadEnvironment()' function, + //the sysGeneric file should no longer define constants. + $app->defineConstantsForPlugin(); include "sysGeneric.php"; break; - case Maveriks\WebApplication::RUNNING_API: - $app->run(Maveriks\WebApplication::SERVICE_API); + case WebApplication::RUNNING_API: + $app->run(WebApplication::SERVICE_API); break; - case Maveriks\WebApplication::RUNNING_OAUTH2: - $app->run(Maveriks\WebApplication::SERVICE_OAUTH2); + case WebApplication::RUNNING_OAUTH2: + $app->run(WebApplication::SERVICE_OAUTH2); break; - case Maveriks\WebApplication::RUNNING_INDEX: - $response = new Maveriks\Http\Response(file_get_contents("index.html"), 302); + case WebApplication::RUNNING_INDEX: + $response = new Response(file_get_contents("index.html"), 302); $response->send(); break; - case Maveriks\WebApplication::RUNNING_DEFAULT: - $response = new Maveriks\Http\Response("", 302); + case WebApplication::RUNNING_DEFAULT: + $response = new Response("", 302); //TODO compose this def url with configuration data from env.ini $response->setHeader("location", "/sys/en/neoclassic/login/login"); $response->send(); break; } - -} catch (ProcessMaker\Exception\RBACException $e) { +} catch (RBACException $e) { G::header('location: ' . $e->getPath()); } catch (Exception $e) { - $view = new Maveriks\Pattern\Mvc\PhtmlView($rootDir . "framework/src/templates/Exception.phtml"); + $view = new PhtmlView($rootDir . "framework/src/templates/Exception.phtml"); $view->set("message", $e->getMessage()); $view->set("exception", $e); - $response = new Maveriks\Http\Response($view->getOutput(), 503); + $response = new Response($view->getOutput(), 503); $response->send(); }