diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 5c465822a..b3062eb7f 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -10,6 +10,7 @@ class Bootstrap { public static $includeClassPaths = array(); + public static $includePaths = array(); protected $relativeIncludePaths = array(); //below here only approved methods @@ -24,19 +25,38 @@ class Bootstrap require_once BootStrap::$includeClassPaths[$className]; return true; - } else { - // try resolve a Model class file - $classFile = PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . $class . '.php'; + } + + // try resolve a Model class file + $classFile = PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . $class . '.php'; + + if (file_exists($classFile)) { + require_once $classFile; + + return true; + } + + $classHasNamespaceSeparator = strpos($class, '\\') !== false ? true : false; + + foreach (BootStrap::$includePaths as $path) { + if ($classHasNamespaceSeparator) { + $class = str_replace('\\', DIRECTORY_SEPARATOR, $class); + } else { + $class = str_replace('_', DIRECTORY_SEPARATOR, $class); + } + + $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + $classFile = $path . $class; if (file_exists($classFile)) { require_once $classFile; return true; - } else { - //error_log(' ==> CLass not found: ' . $class); } } + //error_log(' ==> CLass not found: ' . $class); + return false; } @@ -46,6 +66,11 @@ class Bootstrap return; } + public function registerDir($name, $dir) + { + BootStrap::$includePaths[$name] = $dir; + } + /* * these functions still under revision */ diff --git a/workflow/engine/methods/oauth2/authorize.php b/workflow/engine/methods/oauth2/authorize.php index 3090ba1bc..9d501dcb7 100644 --- a/workflow/engine/methods/oauth2/authorize.php +++ b/workflow/engine/methods/oauth2/authorize.php @@ -4,7 +4,6 @@ switch ($_SERVER['REQUEST_METHOD']) { $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent( 'view', 'oauth2/authorize' ); - $erik = 'neyek'; G::RenderPage('publish', 'minimal'); break; @@ -19,6 +18,7 @@ switch ($_SERVER['REQUEST_METHOD']) { \Api\OAuth2\Server::setPmClientId('x-pm-local-client'); $oauthServer = new \Api\OAuth2\Server(); + $userid = $_SESSION['USER_LOGGED']; $authorize = isset($_POST['authorize']) ? (bool) $_POST['authorize'] : false; diff --git a/workflow/engine/services/oauth2/Server.php b/workflow/engine/services/oauth2/Server.php index 7a0a10d74..ccedcb960 100644 --- a/workflow/engine/services/oauth2/Server.php +++ b/workflow/engine/services/oauth2/Server.php @@ -46,6 +46,8 @@ class Server implements iAuthenticate // Pass a storage object or array of storage objects to the OAuth2 server class $this->server = new \OAuth2\Server($this->storage); + $this->server->setConfig('enforce_state', false); + // Add the "Authorization Code" grant type (this is where the oauth magic happens) $this->server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->storage)); diff --git a/workflow/engine/businessModel/Process.php b/workflow/engine/src/BusinessModel/Process.php similarity index 100% rename from workflow/engine/businessModel/Process.php rename to workflow/engine/src/BusinessModel/Process.php diff --git a/workflow/engine/businessModel/Task.php b/workflow/engine/src/BusinessModel/Task.php similarity index 100% rename from workflow/engine/businessModel/Task.php rename to workflow/engine/src/BusinessModel/Task.php diff --git a/workflow/engine/templates/oauth2/authorize.php b/workflow/engine/templates/oauth2/authorize.php index 677b6d4e1..716a44b00 100644 --- a/workflow/engine/templates/oauth2/authorize.php +++ b/workflow/engine/templates/oauth2/authorize.php @@ -1,9 +1,13 @@ scope = array( 'view_processes' => 'View Processes', diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index d3e89825c..ce0fdbaaa 100755 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -510,6 +510,8 @@ try { Bootstrap::registerSystemClasses(); + Bootstrap::registerDir('BusinessModel', PATH_HOME . 'engine/BusinessModel/'); + require_once PATH_THIRDPARTY . '/pear/PEAR.php'; //Bootstrap::LoadSystem( 'pmException' );