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 $includePaths = array();
protected $relativeIncludePaths = array();
//below here only approved methods
@@ -24,7 +25,8 @@ 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';
@@ -32,10 +34,28 @@ class Bootstrap
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;
}
}
//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
*/

View File

@@ -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;

View File

@@ -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));

View File

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

View File

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