-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
57 lines (50 loc) · 1.76 KB
/
index.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
<?php
/**
* @package Engine_Core
* @version $Id: index.php 9764 2012-08-17 00:04:31Z matthew $
* @copyright Copyright (c) 2008 Webligo Developments
* @license http://www.socialengine.com/license/
*/
// Check version
if (version_compare(phpversion(), '5.2.11', '<')) {
printf('PHP 5.2.11 is required, you have %s', phpversion());
exit(1);
}
// Constants
define('_ENGINE_R_BASE', dirname($_SERVER['SCRIPT_NAME']));
define('_ENGINE_R_FILE', $_SERVER['SCRIPT_NAME']);
define('_ENGINE_R_REL', 'application');
//define('_ENGINE_R_TARG', 'index.php');
////////////////////////////////////////////////////////
//customization for rest api - Musharraf Jamil - 2018-06-30
//original code starts here
//define('_ENGINE_R_TARG', 'index.php');
//original code ends here
//modified code begins here
$getRequestUriPG = htmlspecialchars($_SERVER['REQUEST_URI']);
if(isset($getRequestUriPG) && !empty($getRequestUriPG) && strstr($getRequestUriPG, "api/v")){
define('_ENGINE_R_TARG', 'pgapi.php');
}else {
// define('_ENGINE_R_TARG', 'index.php');
}
//modifified code ends here
//end of customization
////////////////////////////////////////////////////////
//customization for rest api - Greg Cook - 20170718
//original code starts here
//define('_ENGINE_R_TARG', 'index.php');
//original code ends here
//modified code begins here
$getRequestUri = htmlspecialchars($_SERVER['REQUEST_URI']);
if(isset($getRequestUri) && !empty($getRequestUri) && strstr($getRequestUri, "api/rest")){
define('_ENGINE_R_TARG', 'siteapi.php');
}else if(!defined("_ENGINE_R_TARG")) {
define('_ENGINE_R_TARG', 'index.php');
}
//modifified code ends here
//end of customization
// Main
include dirname(__FILE__)
. DIRECTORY_SEPARATOR
. _ENGINE_R_REL . DIRECTORY_SEPARATOR
. _ENGINE_R_TARG;