-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasics.php
68 lines (52 loc) · 1.42 KB
/
basics.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
ini_set('error_reporting', E_ALL);
header('P3P: CP="CAO PSA OUR"');
if (RESPONSE_MODE == 'xml') {
header('Content-type: application/xml; charset=utf-8');
} elseif (RESPONSE_MODE == 'json') {
header('Content-type: application/json; charset=utf-8');
} else {
// For my Debug and future developments
header('Content-type: text/html; charset=utf-8');
}
define('PATH_SERVER','http://'.$_SERVER['SERVER_NAME']);
define('PATH_BASE','../');
define('PATH_CORE',PATH_BASE.'core/');
define('PATH_SERVICES',PATH_BASE.'services/');
define('PATH_LIBRARIES', dirname(__FILE__).'/../libraries/');
include 'router.class.php';
include 'service.class.php';
class CORE{
public static $SERVICE = 0;
public static function redirect($url)
{
header('Location: '.$url);
exit();
}
}
class IO{
public static function _var($key,$default='')
{
$stack = end(Controller::$variableStack);
return isset($stack[$key]) ? $stack[$key] : $default;
}
public static function post($key,$default='')
{
return isset($_POST[$key]) ? $_POST[$key] : $default;
}
public static function get($key,$default='')
{
return isset($_GET[$key]) ? $_GET[$key] : $default;
}
public static function error($text)
{
return '<error>'.$text.'</error>';
}
}
function __autoload($className)
{
if(class_exists($className))
return true;
if(file_exists(PATH_LIBRARIES.$className.'.class.php'))
include(PATH_LIBRARIES.$className.'.class.php');
}