-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
108 lines (93 loc) · 4.48 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
// Path to root directory of app.
define("ROOTPATH", dirname(__FILE__));
// Path to app folder.
define("APPPATH", ROOTPATH."/php/");
// Check if SSL enabled
$protocol = isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] && $_SERVER["HTTPS"] != "off"
? "https://" : "http://";
// Define APPURL
$site_url = $protocol
. $_SERVER["SERVER_NAME"]
. (dirname($_SERVER["SCRIPT_NAME"]) == DIRECTORY_SEPARATOR ? "" : "/")
. trim(str_replace("\\", "/", dirname($_SERVER["SCRIPT_NAME"])), "/");
define("SITEURL", $site_url);
$config['app_url'] = SITEURL."/php/";
//$config['site_url'] = SITEURL."/";
include ROOTPATH . '/includes/classes/AltoRouter.php';
// Start routing.
$router = new AltoRouter();
$bp = trim(str_replace("\\", "/", dirname($_SERVER["SCRIPT_NAME"])), "/");
$router->setBasePath($bp ? "/".$bp : "");
/* Setup the URL routing. This is production ready. */
// Main routes that non-customers see
// /*
// $router->map('GET|POST','/', 'listing.php');
// $router->map('GET|POST','/home/[a:lang]?/?', 'listing.php');
// $router->map('GET|POST','/home/[a:lang]?/[a:country]?/?', 'hlisting.php');
// */
// maintenance
//$router->map('GET|POST','/', 'maintenance.php');
$router->map('GET|POST','/', 'home.php');
$router->map('GET|POST','/home/[a:lang]?/?', 'home.php');
$router->map('GET|POST','/home/[a:lang]?/[a:country]?/?', 'listing.php');
$router->map('GET|POST','/signup/?', 'signup.php');
$router->map('GET|POST','/index1/?', 'index1.php');
$router->map('GET|POST','/index2/?', 'index2.php');
$router->map('GET|POST','/login/?', 'login.php');
$router->map('GET|POST','/logout/?', 'logout.php');
$router->map('GET|POST','/message/?', 'message.php');
$router->map('GET|POST','/forgot/?', 'forgot.php');
$router->map('GET|POST','/dashboard/?', 'dashboard.php');
$router->map('GET|POST','/myads/?', 'ad-my.php');
$router->map('GET|POST','/pending/?', 'ad-pending.php');
$router->map('GET|POST','/favourite/?', 'ad-favourite.php');
$router->map('GET|POST','/hidden/?', 'ad-hidden.php');
$router->map('GET|POST','/resubmission/?', 'ad-resubmission.php');
$router->map('GET|POST','/transaction/?', 'transaction.php');
$router->map('GET|POST','/account-setting/?', 'account-setting.php');
$router->map('GET|POST','/report/?', 'report.php');
$router->map('GET|POST','/contact/?', 'contact.php');
$router->map('GET|POST','/sitemap/?', 'sitemap.php');
$router->map('GET|POST','/countries/?', 'countries.php');
$router->map('GET|POST','/faq/?', 'faq.php');
$router->map('GET|POST','/feedback/?', 'feedback.php');
$router->map('GET|POST','/membership/?', 'membership.php');
$router->map('GET|POST','/payment/?', 'payment.php');
$router->map('GET|POST','/ipn/?', 'ipn.php');
$router->map('GET|POST','/deals/?', 'deals.php');
// Special (GET processing, etc)
$router->map('GET|POST','/profile/[*:username]?/[*:page]?/?','profile.php');
$router->map('GET|POST','/ad/[i:id]?/[*:slug]?/?', 'ad-detail.php');
$router->map('GET|POST','/post-ad/[a:lang]?/[a:country]?/[a:action]?/?', 'ad-post-test.php');
$router->map('GET|POST','/post-ad-test/[a:lang]?/[a:country]?/[a:action]?/?', 'ad-post-test.php');
$router->map('GET|POST','/edit-ad/[i:id]?/[a:lang]?/[a:country]?/[a:action]?/?', 'ad-edit.php');
$router->map('GET|POST','/listing/?', 'listing.php');
$router->map('GET|POST','/category/[*:cat]?/[*:subcat]?/?', 'listing.php');
$router->map('GET|POST','/sub-category/[*:subcat]?/[*:slug]?/?', 'listing.php');
$router->map('GET|POST','/city/[i:city]?/[*:slug]?/?', 'listing.php');
$router->map('GET|POST','/keywords/[*:keywords]?/?', 'listing.php');
$router->map('GET|POST','/page/[*:id]?/?', 'html.php');
$router->map('GET|POST','/membership/[a:change_plan]?/?', 'membership.php');
$router->map('GET|POST','/ipn/[a:i]?/[*:id]?/?', 'ipn.php');
$router->map('GET|POST','/payment/[*:token]?/[a:status]?/[*:message]?/?', 'payment.php');
$router->map('GET|POST','/payment-option/[*:token]?/?', 'payment-option.php');
$router->map('GET','/sitemap.xml/?', 'xml.php');
//$router->map('GET|POST','/payment-option/?', 'payment-option.php');
$router->map('GET|POST','/payment-middleware/[*:order_id]?/?', 'payment-middleware.php');
$router->map('POST','/payment-notify/?', 'payment-notify.php');
$router->map('GET|POST','/payment-canceled/?', 'payment-canceled.php');
// API Routes
/* Match the current request */
$match=$router->match();
if($match) {
if ($_SERVER["REQUEST_METHOD"] == "GET") {
$_GET = array_merge($match['params'],$_GET);
}
require APPPATH.$match['target'];
}
else {
header("HTTP/1.0 404 Not Found");
require APPPATH.'404.php';
}
?>