forked from hiraq/RedisSoundCloud-Ex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·80 lines (67 loc) · 1.94 KB
/
Copy pathindex.php
File metadata and controls
executable file
·80 lines (67 loc) · 1.94 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/*
* main
*/
define('ROOT',__DIR__);
define('DS',DIRECTORY_SEPARATOR);
define('LIB',ROOT.DS.'lib'.DS);
define('INC',ROOT.DS.'includes'.DS);
define('CONFIG',ROOT.DS.'configs'.DS);
/*
* paths
*/
define('PATH_SOUNDCLOUD',LIB.'SoundCloud'.DS.'Services'.DS);
define('PATH_CORE',LIB.'Core'.DS);
define('PATH_REDIS',LIB.'Redis'.DS);
//error level
define('DEBUG_LEVEL',1);
/*
* check php version
* only run at php version >= 5.3
*/
$phpVersion = floatval(PHP_VERSION);
if ($phpVersion < 5.3) {
echo 'This example application need php version at least 5.3';
} elseif (!class_exists('Redis')) {
echo 'Please install php extension for redis - https://github.com/nicolasff/phpredis';
} else {
/*
* load core apps
*/
require_once(PATH_CORE.'Debug.php');
require_once(PATH_CORE.'Import.php');
require_once(PATH_CORE.'Request.php');
require_once(PATH_CORE.'Response.php');
require_once(PATH_CORE.'Assets.php');
require_once(PATH_CORE.'Config.php');
require_once(PATH_CORE.'Exception/PageException.php');
require_once(PATH_CORE.'Exception/SystemException.php');
/*
* load redis
*/
require_once(PATH_REDIS.'Data.php');
/*
* load SoundCloud sdk
*/
require_once(PATH_SOUNDCLOUD.'Soundcloud.php');
$debug = new \Core\Debug();
$debug->init();
/*
* run apps
*/
$request = new \Core\Request();
$request->setupGlobalUri();
/*
* give response
*/
try {
$response = new \Core\Response($request);
$response->listen();
}catch(\Core\Exception\PageException $e) {//page not found
echo '<h1>'.$e->getMessage().'</h1>';
}catch(\Core\Exception\SystemException $e) {//system error
echo '<h1>System error: '.$e->getMessage().'</h1>';
}catch(Exception $e) {
echo '<h1>Exception: '.$e->getMessage().'</h1>';
}
}