本文整理汇总了PHP中ConfService::currentContextIsRestAPI方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::currentContextIsRestAPI方法的具体用法?PHP ConfService::currentContextIsRestAPI怎么用?PHP ConfService::currentContextIsRestAPI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::currentContextIsRestAPI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detectServerURL
/**
* Build the current server URL
* @param bool $withURI
* @static
* @return string
*/
public static function detectServerURL($withURI = false)
{
$setUrl = ConfService::getCoreConf("SERVER_URL");
if (!empty($setUrl)) {
return $setUrl;
}
if (php_sapi_name() == "cli") {
AJXP_Logger::debug("WARNING, THE SERVER_URL IS NOT SET, WE CANNOT BUILD THE MAIL ADRESS WHEN WORKING IN CLI");
}
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$port = $protocol === 'http' && $_SERVER['SERVER_PORT'] == 80 || $protocol === 'https' && $_SERVER['SERVER_PORT'] == 443 ? "" : ":" . $_SERVER['SERVER_PORT'];
$name = $_SERVER["SERVER_NAME"];
if (!$withURI) {
return "{$protocol}://{$name}{$port}";
} else {
$uri = dirname($_SERVER["REQUEST_URI"]);
$api = ConfService::currentContextIsRestAPI();
if (!empty($api)) {
// Keep only before api base
$explode = explode("/" . $api . "/", $uri);
$uri = array_shift($explode);
}
return "{$protocol}://{$name}{$port}" . $uri;
}
}
示例2: header
$confPlugin = ConfService::getInstance()->confPluginSoftLoad($pServ);
$pServ->loadPluginsRegistry(AJXP_INSTALL_PATH . "/plugins", $confPlugin);
ConfService::start();
$confStorageDriver = ConfService::getConfStorageImpl();
require_once $confStorageDriver->getUserClassFileName();
//session_name("AjaXplorer");
//session_start();
AJXP_PluginsService::getInstance()->initActivePlugins();
AuthService::preLogUser(array_merge($_GET, $_POST));
if (AuthService::getLoggedUser() == null) {
header('HTTP/1.0 401 Unauthorized');
echo 'You are not authorized to access this API.';
exit;
}
$authDriver = ConfService::getAuthDriverImpl();
ConfService::currentContextIsRestAPI("api");
$uri = $_SERVER["REQUEST_URI"];
$scriptUri = ltrim(AJXP_Utils::safeDirname($_SERVER["SCRIPT_NAME"]), '/') . "/api/";
$uri = substr($uri, strlen($scriptUri));
$uri = explode("/", trim($uri, "/"));
// GET REPO ID
$repoID = array_shift($uri);
// GET ACTION NAME
$action = array_shift($uri);
$path = "/" . implode("/", $uri);
if ($repoID == 'pydio') {
ConfService::switchRootDir();
$repo = ConfService::getRepository();
} else {
$repo = ConfService::findRepositoryByIdOrAlias($repoID);
if ($repo == null) {