|
@@ -3,7 +3,7 @@
|
|
|
spl_autoload_register(function ($class_name) {
|
|
spl_autoload_register(function ($class_name) {
|
|
|
$path = explode('\\', $class_name);
|
|
$path = explode('\\', $class_name);
|
|
|
$fileName = $path[sizeof($path)-1];
|
|
$fileName = $path[sizeof($path)-1];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$path[sizeof($path)-1] = '';
|
|
$path[sizeof($path)-1] = '';
|
|
|
|
|
|
|
|
//$path = strtolower(DIR_ROOT. implode(DIRECTORY_SEPARATOR, $path));
|
|
//$path = strtolower(DIR_ROOT. implode(DIRECTORY_SEPARATOR, $path));
|
|
@@ -20,51 +20,6 @@ spl_autoload_register(function ($class_name) {
|
|
|
@include $path . $fileName . '.php';
|
|
@include $path . $fileName . '.php';
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-class Connection {
|
|
|
|
|
-
|
|
|
|
|
- private function __construct() {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public static function open($connection_info = null) {
|
|
|
|
|
-
|
|
|
|
|
- $user = isset($connection_info['user']) ? $connection_info['user'] : NULL;
|
|
|
|
|
- $pass = isset($connection_info['pass']) ? $connection_info['pass'] : NULL;
|
|
|
|
|
- $name = isset($connection_info['name']) ? $connection_info['name'] : NULL;
|
|
|
|
|
- $host = isset($connection_info['host']) ? $connection_info['host'] : NULL;
|
|
|
|
|
- $driver = isset($connection_info['driver']) ? $connection_info['driver'] : NULL;
|
|
|
|
|
- $port = isset($connection_info['port']) ? $connection_info['port'] : NULL;
|
|
|
|
|
- $prefix = isset($connection_info['prefix']) ? $connection_info['prefix'] : '';
|
|
|
|
|
-
|
|
|
|
|
- switch ($driver) {
|
|
|
|
|
- case 'pgsql':
|
|
|
|
|
- $port = $port ? $port : '5432';
|
|
|
|
|
- $conn = new PDO("pgsql:dbname={$name}; user={$user}; password={$pass};host=$host;port={$port}");
|
|
|
|
|
- break;
|
|
|
|
|
- case 'mysql':
|
|
|
|
|
- $port = $port ? $port : '3306';
|
|
|
|
|
- $conn = new PDO("mysql:host={$host};port={$port};dbname={$name}", $user, $pass);
|
|
|
|
|
- break;
|
|
|
|
|
- case 'sqlite':
|
|
|
|
|
- $conn = new PDO("sqlite:{$name}");
|
|
|
|
|
- break;
|
|
|
|
|
- case 'ibase':
|
|
|
|
|
- $conn = new PDO("firebird:dbname={$name}", $user, $pass);
|
|
|
|
|
- break;
|
|
|
|
|
- case 'oci8':
|
|
|
|
|
- $conn = new PDO("oci:dbname={$name}", $user, $pass);
|
|
|
|
|
- break;
|
|
|
|
|
- case 'mssql':
|
|
|
|
|
- $conn = new PDO("mssql:host={$host},1433;dbname={$name}", $user, $pass);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- $conn->prefix = $prefix;
|
|
|
|
|
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
|
- return $conn;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
function is_ajax_request() {
|
|
function is_ajax_request() {
|
|
|
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
|
|
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
|
|
|
return true;
|
|
return true;
|
|
@@ -73,11 +28,6 @@ function is_ajax_request() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function last_class() {
|
|
|
|
|
- $class = get_declared_classes()[sizeof(get_declared_classes()) - 1];
|
|
|
|
|
- return new $class;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
global $_LANG;
|
|
global $_LANG;
|
|
|
$_LANG = Array();
|
|
$_LANG = Array();
|
|
|
|
|
|
|
@@ -131,6 +81,3 @@ class Lang {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-abstract class Controller {
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|