mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
can setup web api url to use PATH_INFO
This commit is contained in:
parent
a41eae1ea7
commit
ced75b805a
4 changed files with 12 additions and 3 deletions
|
|
@ -17,3 +17,7 @@ else if (getenv('MTT_DB_TYPE') == 'sqlite') {
|
|||
}
|
||||
|
||||
define("MTT_SALT", "Put Random Text Here");
|
||||
//define("MTT_DISABLE_EXT", 1);
|
||||
if (getenv('MTT_API_USE_PATH_INFO')) {
|
||||
define("MTT_API_USE_PATH_INFO", 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ApiRequest
|
|||
public $jsonBody;
|
||||
|
||||
function __construct() {
|
||||
if (defined('MTT_API_USE_PATH_INFO') && MTT_API_USE_PATH_INFO) {
|
||||
if (defined('MTT_API_USE_PATH_INFO')) {
|
||||
$this->path = $_SERVER['PATH_INFO'];
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ function js_options()
|
|||
"lang" => Lang::instance()->jsStrings(),
|
||||
"mttUrl" => get_mttinfo('mtt_url'),
|
||||
"homeUrl" => get_mttinfo('url'),
|
||||
// "apiUrl" => get_mttinfo('api_url'),
|
||||
"apiUrl" => get_mttinfo('api_url'),
|
||||
"needAuth" => need_auth() ? true : false,
|
||||
"isLogged" => is_logged() ? true : false,
|
||||
"showdate" => Config::get('showdate') ? true : false,
|
||||
|
|
|
|||
|
|
@ -352,7 +352,12 @@ function get_unsafe_mttinfo($v)
|
|||
/* URL for API, like http://localhost/mytinytodo/api/. No need to set by default. */
|
||||
$_mttinfo['api_url'] = Config::getUrl('api_url'); // need to have a trailing slash
|
||||
if ($_mttinfo['api_url'] == '') {
|
||||
$_mttinfo['api_url'] = get_unsafe_mttinfo('mtt_url'). 'api.php?_path=/';
|
||||
if (defined('MTT_API_USE_PATH_INFO')) {
|
||||
$_mttinfo['api_url'] = get_unsafe_mttinfo('mtt_url'). 'api/';
|
||||
}
|
||||
else {
|
||||
$_mttinfo['api_url'] = get_unsafe_mttinfo('mtt_url'). 'api.php?_path=/';
|
||||
}
|
||||
}
|
||||
return $_mttinfo['api_url'];
|
||||
case 'title':
|
||||
|
|
|
|||
Loading…
Reference in a new issue