本文整理汇总了PHP中ConfService类的典型用法代码示例。如果您正苦于以下问题:PHP ConfService类的具体用法?PHP ConfService怎么用?PHP ConfService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initPath
/**
* Initialize the stream from the given path.
* Concretely, transform ajxp.smb:// into smb://
*
* @param string $path
* @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
*/
protected static function initPath($path, $streamType, $storeOpenContext = false, $skipZip = false)
{
$url = parse_url($path);
$repoId = $url["host"];
$repoObject = ConfService::getRepositoryById($repoId);
if (!isset($repoObject)) {
throw new Exception("Cannot find repository with id " . $repoId);
}
$path = $url["path"];
// Fix if the host is defined as //MY_HOST/path/to/folder
$host = str_replace("//", "", $repoObject->getOption("HOST"));
$credentials = "";
$safeCreds = AJXP_Safe::tryLoadingCredentialsFromSources($url, $repoObject);
if ($safeCreds["user"] != "" && $safeCreds["password"] != "") {
$login = $safeCreds["user"];
$pass = $safeCreds["password"];
$_SESSION["AJXP_SESSION_REMOTE_PASS"] = $pass;
$credentials = "{$login}:{$pass}@";
$domain = $repoObject->getOption("DOMAIN");
if ($domain != "") {
$credentials = $domain . "/" . $credentials;
}
}
$basePath = $repoObject->getOption("PATH");
$fullPath = "smb://" . $credentials . $host . "/";
//.$basePath."/".$path;
if ($basePath != "") {
$fullPath .= trim($basePath, "/\\");
}
if ($path != "") {
$fullPath .= ($path[0] == "/" ? "" : "/") . $path;
}
return $fullPath;
}
示例2: toggleDisclaimer
public function toggleDisclaimer($actionName, $httpVars, $fileVars)
{
$u = AuthService::getLoggedUser();
$u->personalRole->setParameterValue("action.disclaimer", "DISCLAIMER_ACCEPTED", $httpVars["validate"] == "true" ? "yes" : "no", AJXP_REPO_SCOPE_ALL);
if ($httpVars["validate"] == "true") {
$u->removeLock();
$u->save("superuser");
AuthService::updateUser($u);
ConfService::switchUserToActiveRepository($u);
$force = $u->mergedRole->filterParameterValue("core.conf", "DEFAULT_START_REPOSITORY", AJXP_REPO_SCOPE_ALL, -1);
$passId = -1;
if ($force != "" && $u->canSwitchTo($force) && !isset($httpVars["tmp_repository_id"]) && !isset($_SESSION["PENDING_REPOSITORY_ID"])) {
$passId = $force;
}
$res = ConfService::switchUserToActiveRepository($u, $passId);
if (!$res) {
AuthService::disconnect();
AJXP_XMLWriter::header();
AJXP_XMLWriter::requireAuth(true);
AJXP_XMLWriter::close();
}
ConfService::getInstance()->invalidateLoadedRepositories();
} else {
$u->setLock("validate_disclaimer");
$u->save("superuser");
AuthService::disconnect();
AJXP_XMLWriter::header();
AJXP_XMLWriter::requireAuth(true);
AJXP_XMLWriter::close();
}
}
示例3: unifyChunks
public function unifyChunks($action, $httpVars, $fileVars)
{
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$dir = AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
$filename = AJXP_Utils::decodeSecureMagic($httpVars["file_name"]);
$chunks = array();
$index = 0;
while (isset($httpVars["chunk_" . $index])) {
$chunks[] = AJXP_Utils::decodeSecureMagic($httpVars["chunk_" . $index]);
$index++;
}
$newDest = fopen($destStreamURL . $filename, "w");
for ($i = 0; $i < count($chunks); $i++) {
$part = fopen($destStreamURL . $chunks[$i], "r");
while (!feof($part)) {
fwrite($newDest, fread($part, 4096));
}
fclose($part);
unlink($destStreamURL . $chunks[$i]);
}
fclose($newDest);
}
示例4: ajxp_gluecode_updateRole
function ajxp_gluecode_updateRole($loginData, &$userObject)
{
$authPlug = ConfService::getAuthDriverImpl();
if (property_exists($authPlug, "drivers") && is_array($authPlug->drivers) && $authPlug->drivers["remote"]) {
$authPlug = $authPlug->drivers["remote"];
}
$rolesMap = $authPlug->getOption("ROLES_MAP");
if (!isset($rolesMap) || strlen($rolesMap) == 0) {
return;
}
// String like {key:value,key2:value2,key3:value3}
$rolesMap = explode(",", $rolesMap);
$newMap = array();
foreach ($rolesMap as $value) {
$parts = explode(":", trim($value));
$roleId = trim($parts[1]);
$roleObject = AuthService::getRole($roleId);
if ($roleObject != null) {
$newMap[trim($parts[0])] = $roleObject;
$userObject->removeRole($roleId);
}
}
$rolesMap = $newMap;
if (isset($loginData["roles"]) && is_array($loginData["roles"])) {
foreach ($loginData["roles"] as $role) {
if (isset($rolesMap[$role])) {
$userObject->addRole($rolesMap[$role]);
}
}
}
}
示例5: buildPublicHtaccessContent
function buildPublicHtaccessContent()
{
$downloadFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
$dlURL = ConfService::getCoreConf("PUBLIC_DOWNLOAD_URL");
if ($dlURL != "") {
$url = rtrim($dlURL, "/");
} else {
$fullUrl = AJXP_Utils::detectServerURL(true);
$url = str_replace("\\", "/", rtrim($fullUrl, "/") . rtrim(str_replace(AJXP_INSTALL_PATH, "", $downloadFolder), "/"));
}
$htaccessContent = "Order Deny,Allow\nAllow from all\n";
$htaccessContent .= "\n<Files \".ajxp_*\">\ndeny from all\n</Files>\n";
$path = parse_url($url, PHP_URL_PATH);
$htaccessContent .= '
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase ' . $path . '
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)\\.php$ share.php?hash=$1 [QSA]
RewriteRule ^([a-zA-Z0-9_-]+)--([a-z]+)$ share.php?hash=$1&lang=$2 [QSA]
RewriteRule ^([a-zA-Z0-9_-]+)$ share.php?hash=$1 [QSA]
</IfModule>
';
return $htaccessContent;
}
示例6: switchActions
public function switchActions($actionName, $httpVars, $fileVars)
{
switch ($actionName) {
case "accept_invitation":
$remoteShareId = \AJXP_Utils::sanitize($httpVars["remote_share_id"], AJXP_SANITIZE_ALPHANUM);
$store = new SQLStore();
$remoteShare = $store->remoteShareById($remoteShareId);
if ($remoteShare !== null) {
$client = new OCSClient();
$client->acceptInvitation($remoteShare);
$remoteShare->setStatus(OCS_INVITATION_STATUS_ACCEPTED);
$store->storeRemoteShare($remoteShare);
}
break;
case "reject_invitation":
$remoteShareId = \AJXP_Utils::sanitize($httpVars["remote_share_id"], AJXP_SANITIZE_ALPHANUM);
$store = new SQLStore();
$remoteShare = $store->remoteShareById($remoteShareId);
if ($remoteShare !== null) {
$client = new OCSClient();
$client->declineInvitation($remoteShare);
$store->deleteRemoteShare($remoteShare);
\ConfService::getInstance()->invalidateLoadedRepositories();
}
break;
default:
break;
}
return null;
}
示例7: checkPassword
public function checkPassword($login, $pass, $seed)
{
require_once AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/access.smb/smb.php";
$_SESSION["AJXP_SESSION_REMOTE_PASS"] = $pass;
$repoId = $this->options["REPOSITORY_ID"];
$repoObject = ConfService::getRepositoryById($repoId);
if (!isset($repoObject)) {
throw new Exception("Cannot find repository with id " . $repoId);
}
$path = "";
$basePath = $repoObject->getOption("PATH", true);
$basePath = str_replace("AJXP_USER", $login, $basePath);
$host = $repoObject->getOption("HOST");
$url = "smb://{$login}:{$pass}@" . $host . "/" . $basePath . "/";
try {
if (!is_dir($url)) {
$this->logDebug("SMB Login failure");
$_SESSION["AJXP_SESSION_REMOTE_PASS"] = '';
unset($_SESSION["COUNT"]);
unset($_SESSION["disk"]);
return false;
}
AJXP_Safe::storeCredentials($login, $pass);
} catch (Exception $e) {
return false;
}
return true;
}
示例8: initRepository
public function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
if (!function_exists('ssh2_connect')) {
throw new Exception("You must have the php ssh2 extension active!");
}
ConfService::setConf("PROBE_REAL_SIZE", false);
$path = $this->repository->getOption("PATH");
$recycle = $this->repository->getOption("RECYCLE_BIN");
$this->detectStreamWrapper(true);
$this->urlBase = "pydio://" . $this->repository->getId();
restore_error_handler();
if (!file_exists($this->urlBase)) {
if ($this->repository->getOption("CREATE")) {
$test = @mkdir($this->urlBase);
if (!$test) {
throw new AJXP_Exception("Cannot create path ({$path}) for your repository! Please check the configuration.");
}
} else {
throw new AJXP_Exception("Cannot find base path ({$path}) for your repository! Please check the configuration!");
}
}
if ($recycle != "") {
RecycleBinManager::init($this->urlBase, "/" . $recycle);
}
}
示例9: __construct
public function __construct()
{
$storage = \ConfService::getConfStorageImpl();
if ($storage->getId() == "conf.sql") {
$this->storage = $storage;
}
}
示例10: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// CHANGE USER PASSWORD
//------------------------------------
case "pass_change":
$userObject = AuthService::getLoggedUser();
if ($userObject == null || $userObject->getId() == "guest") {
header("Content-Type:text/plain");
print "SUCCESS";
}
$oldPass = $httpVars["old_pass"];
$newPass = $httpVars["new_pass"];
$passSeed = $httpVars["pass_seed"];
if (AuthService::checkPassword($userObject->getId(), $oldPass, false, $passSeed)) {
AuthService::updatePassword($userObject->getId(), $newPass);
} else {
header("Content-Type:text/plain");
print "PASS_ERROR";
}
header("Content-Type:text/plain");
print "SUCCESS";
break;
default:
break;
}
return "";
}
示例11: postProcess
public function postProcess($action, $httpVars, $postProcessData)
{
if (self::$skipDecoding) {
}
if (!isset($httpVars["partitionRealName"])) {
return;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $httpVars["dir"] . "/";
$count = intval($httpVars["partitionCount"]);
$index = intval($httpVars["partitionIndex"]);
$fileId = $httpVars["fileId"];
$clientId = $httpVars["clientId"];
AJXP_Logger::debug("Should now rebuild file!", $httpVars);
$newDest = fopen($destStreamURL . $httpVars["partitionRealName"], "w");
for ($i = 0; $i < $count; $i++) {
$part = fopen($destStreamURL . "{$clientId}.{$fileId}.{$i}", "r");
while (!feof($part)) {
fwrite($newDest, fread($part, 4096));
}
fclose($part);
unlink($destStreamURL . "{$clientId}.{$fileId}.{$i}");
}
fclose($newDest);
}
示例12: initPath
/**
* Initialize the stream from the given path.
* Concretely, transform ajxp.webdav:// into webdav://
*
* @param string $path
* @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
*/
protected static function initPath($path, $streamType, $storeOpenContext = false, $skipZip = false)
{
$url = parse_url($path);
$repoId = $url["host"];
$repoObject = ConfService::getRepositoryById($repoId);
if (!isset($repoObject)) {
throw new Exception("Cannot find repository with id " . $repoId);
}
$path = $url["path"];
$host = $repoObject->getOption("HOST");
$host = str_replace(array("http", "https"), array("webdav", "webdavs"), $host);
// MAKE SURE THERE ARE NO // OR PROBLEMS LIKE THAT...
$basePath = $repoObject->getOption("PATH");
if ($basePath[strlen($basePath) - 1] == "/") {
$basePath = substr($basePath, 0, -1);
}
if ($basePath[0] != "/") {
$basePath = "/{$basePath}";
}
$path = AJXP_Utils::securePath($path);
if ($path[0] == "/") {
$path = substr($path, 1);
}
// SHOULD RETURN webdav://host_server/uri/to/webdav/folder
return $host . $basePath . "/" . $path;
}
示例13: doTest
public function doTest()
{
$this->testedParams["Users enabled"] = AuthService::usersEnabled();
$this->testedParams["Guest enabled"] = ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth");
$this->failedLevel = "info";
return FALSE;
}
示例14: getRepository
/**
* @return Repository
*/
public function getRepository()
{
if (!isset($this->repository)) {
$this->repository = ConfService::getRepositoryById($this->repositoryId);
}
return $this->repository;
}
示例15: doTest
public function doTest()
{
$tmpDir = ini_get("upload_tmp_dir");
if (!$tmpDir) {
$tmpDir = realpath(sys_get_temp_dir());
}
if (ConfService::getCoreConf("AJXP_TMP_DIR") != "") {
$tmpDir = ConfService::getCoreConf("AJXP_TMP_DIR");
}
if (defined("AJXP_TMP_DIR") && AJXP_TMP_DIR != "") {
$tmpDir = AJXP_TMP_DIR;
}
$this->testedParams["Upload Tmp Dir Writeable"] = @is_writable($tmpDir);
$this->testedParams["PHP Upload Max Size"] = $this->returnBytes(ini_get("upload_max_filesize"));
$this->testedParams["PHP Post Max Size"] = $this->returnBytes(ini_get("post_max_size"));
foreach ($this->testedParams as $paramName => $paramValue) {
$this->failedInfo .= "\n{$paramName}={$paramValue}";
}
if (!$this->testedParams["Upload Tmp Dir Writeable"]) {
$this->failedLevel = "error";
$this->failedInfo = "The temporary folder used by PHP to upload files is either incorrect or not writeable! Upload will not work. Please check : " . ini_get("upload_tmp_dir");
$this->failedInfo .= "<p class='suggestion'><b>Suggestion</b> : Set the AJXP_TMP_DIR parameter in the <i>conf/bootstrap_conf.php</i> file</p>";
return FALSE;
}
$this->failedLevel = "info";
return FALSE;
}