-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
59 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
<?php | ||
include ('config.php'); | ||
if (isset($_REQUEST['method']) && isset($_REQUEST['url'])) { | ||
include (APP_BASE_PATH.'api.php'); | ||
} else { | ||
include (APP_BASE_PATH.'rest.php'); | ||
} | ||
include (APP_BASE_PATH.'rest.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
define('CLIENT_PATH',dirname(__FILE__)); | ||
include ("config.base.php"); | ||
include ("include.common.php"); | ||
include("server.includes.inc.php"); | ||
|
||
if(\Classes\SettingsManager::getInstance()->getSetting('Api: REST Api Enabled') == '1') { | ||
|
||
if (defined('SYM_CLIENT')) { | ||
define('REST_API_PATH', '/'.SYM_CLIENT.'/'); | ||
} else if (!defined('REST_API_PATH')){ | ||
define('REST_API_PATH', '/'); | ||
} | ||
|
||
|
||
\Utils\LogManager::getInstance()->info("Request: " . $_REQUEST); | ||
|
||
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { | ||
http_response_code(200); | ||
exit(); | ||
} | ||
|
||
$echoRoute = \Classes\Macaw::get(REST_API_PATH . 'echo', function () { | ||
echo "Echo " . rand(); | ||
}); | ||
|
||
\Utils\LogManager::getInstance()->debug('Api registered URI: '.$echoRoute); | ||
|
||
$moduleManagers = \Classes\BaseService::getInstance()->getModuleManagers(); | ||
|
||
foreach ($moduleManagers as $moduleManagerObj) { | ||
|
||
$moduleManagerObj->setupRestEndPoints(); | ||
} | ||
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); | ||
$method = $_SERVER['REQUEST_METHOD']; | ||
\Utils\LogManager::getInstance()->debug('Api dispatch URI: '.$uri); | ||
\Utils\LogManager::getInstance()->debug('Api dispatch method: '.$uri); | ||
if (!defined('SYM_CLIENT')) { | ||
//For hosted installations, dispatch will be done in app/index | ||
\Classes\Macaw::dispatch(); | ||
} | ||
|
||
|
||
}else{ | ||
echo "REST Api is not enabled. Please set 'Api: REST Api Enabled' setting to true"; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.