mirror of
https://github.com/sctn4elk/CustomerRewardsRESTAPI.git
synced 2025-01-09 05:14:29 -06:00
Update URI positions for testing and production
This commit is contained in:
parent
6212095c32
commit
db55067112
13
index.php
13
index.php
|
@ -11,6 +11,8 @@ header("Content-Type: application/json");
|
|||
require __DIR__ . "/include/bootstrap.php";
|
||||
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
$uri = explode( '/', $uri );
|
||||
//Set uri module location position to 1 for production, 2 for testing
|
||||
$uri_pos = 2;
|
||||
|
||||
/* When testing with UniServer the URI array placement position will be
|
||||
* incremented by 1 due to the folder addition
|
||||
|
@ -22,15 +24,12 @@ $uri = explode( '/', $uri );
|
|||
* uri[5] = parmeters
|
||||
*/
|
||||
|
||||
//Set uri module location position to 1 for production, 2 for testing
|
||||
$uri_pos = 2;
|
||||
|
||||
if (!isset($uri[$uri_pos+1]) || !isset($uri[$uri_pos+2]) || !isset($uri[$uri_pos+3])) {
|
||||
if (!isset($uri[$uri_pos]) || !isset($uri[$uri_pos+1]) || !isset($uri[$uri_pos+2])) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
exit();
|
||||
}
|
||||
|
||||
switch($uri[$uri_pos]) {
|
||||
switch($uri[$uri_pos + 1]) {
|
||||
case "purchase":
|
||||
header("HTTP/1.1 404 Module Not Defined");
|
||||
exit();
|
||||
|
@ -49,6 +48,6 @@ switch($uri[$uri_pos]) {
|
|||
break;
|
||||
}
|
||||
|
||||
$strMethodName = $uri[$uri_pos+1] . 'Action';
|
||||
$objFeedController->{$strMethodName}($uri[$uri_pos+2]);
|
||||
$strMethodName = $uri[$uri_pos + 2] . 'Action';
|
||||
$objFeedController->{$strMethodName}($uri[$uri_pos + 3]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user