moving business model sources

This commit is contained in:
Erik Amaru Ortiz
2013-11-04 13:11:58 -04:00
parent 9991a261bc
commit 8ce4be68e4
7 changed files with 42 additions and 9 deletions

View File

@@ -10,6 +10,7 @@ class Bootstrap
{ {
public static $includeClassPaths = array(); public static $includeClassPaths = array();
public static $includePaths = array();
protected $relativeIncludePaths = array(); protected $relativeIncludePaths = array();
//below here only approved methods //below here only approved methods
@@ -24,19 +25,38 @@ class Bootstrap
require_once BootStrap::$includeClassPaths[$className]; require_once BootStrap::$includeClassPaths[$className];
return true; 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)) { if (file_exists($classFile)) {
require_once $classFile; require_once $classFile;
return true; return true;
} else {
//error_log(' ==> CLass not found: ' . $class);
} }
} }
//error_log(' ==> CLass not found: ' . $class);
return false; return false;
} }
@@ -46,6 +66,11 @@ class Bootstrap
return; return;
} }
public function registerDir($name, $dir)
{
BootStrap::$includePaths[$name] = $dir;
}
/* /*
* these functions still under revision * these functions still under revision
*/ */

View File

@@ -4,7 +4,6 @@ switch ($_SERVER['REQUEST_METHOD']) {
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'oauth2/authorize' ); $G_PUBLISH->AddContent( 'view', 'oauth2/authorize' );
$erik = 'neyek';
G::RenderPage('publish', 'minimal'); G::RenderPage('publish', 'minimal');
break; break;
@@ -19,6 +18,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
\Api\OAuth2\Server::setPmClientId('x-pm-local-client'); \Api\OAuth2\Server::setPmClientId('x-pm-local-client');
$oauthServer = new \Api\OAuth2\Server(); $oauthServer = new \Api\OAuth2\Server();
$userid = $_SESSION['USER_LOGGED']; $userid = $_SESSION['USER_LOGGED'];
$authorize = isset($_POST['authorize']) ? (bool) $_POST['authorize'] : false; $authorize = isset($_POST['authorize']) ? (bool) $_POST['authorize'] : false;

View File

@@ -46,6 +46,8 @@ class Server implements iAuthenticate
// Pass a storage object or array of storage objects to the OAuth2 server class // Pass a storage object or array of storage objects to the OAuth2 server class
$this->server = new \OAuth2\Server($this->storage); $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) // Add the "Authorization Code" grant type (this is where the oauth magic happens)
$this->server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->storage)); $this->server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->storage));

View File

@@ -1,9 +1,13 @@
<?php <?php
require_once PATH_CORE . 'services/oauth2/PmPdo.php'; require_once PATH_CORE . 'services/oauth2/PmPdo.php';
$dsn = 'mysql:dbname=wf_workflow;host=localhost';
$username = 'root'; list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
$password = 'sample'; $port = empty($port) ? '' : ";port=$port";
$dsn = DB_ADAPTER.':host='.$host.';dbname='.DB_NAME.$port;
$username = DB_USER;
$password = DB_PASS;
$this->scope = array( $this->scope = array(
'view_processes' => 'View Processes', 'view_processes' => 'View Processes',

View File

@@ -510,6 +510,8 @@ try {
Bootstrap::registerSystemClasses(); Bootstrap::registerSystemClasses();
Bootstrap::registerDir('BusinessModel', PATH_HOME . 'engine/BusinessModel/');
require_once PATH_THIRDPARTY . '/pear/PEAR.php'; require_once PATH_THIRDPARTY . '/pear/PEAR.php';
//Bootstrap::LoadSystem( 'pmException' ); //Bootstrap::LoadSystem( 'pmException' );