本文整理汇总了PHP中ConfService类的典型用法代码示例。如果您正苦于以下问题:PHP ConfService类的具体用法?PHP ConfService怎么用?PHP ConfService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:biggtfish,项目名称:cms,代码行数:41,代码来源:class.smbAccessWrapper.php
示例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();
}
}
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:31,代码来源:class.DisclaimerProvider.php
示例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);
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:28,代码来源:class.SimpleUploadProcessor.php
示例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]);
}
}
}
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:31,代码来源:glueCode.php
示例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;
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:26,代码来源:5.3.4.php
示例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;
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:30,代码来源:ActionsController.php
示例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;
}
开发者ID:biggtfish,项目名称:cms,代码行数:28,代码来源:class.smbAuthDriver.php
示例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);
}
}
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:30,代码来源:class.sftpAccessDriver.php
示例9: __construct
public function __construct()
{
$storage = \ConfService::getConfStorageImpl();
if ($storage->getId() == "conf.sql") {
$this->storage = $storage;
}
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:7,代码来源:SQLStore.php
示例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 "";
}
开发者ID:pussbb,项目名称:CI_DEV_CMS,代码行数:33,代码来源:class.AbstractAuthDriver.php
示例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);
}
开发者ID:firstcoder55,项目名称:Webkey,代码行数:30,代码来源:class.JumploaderProcessor.php
示例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;
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:33,代码来源:class.webdavAccessWrapper.php
示例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;
}
开发者ID:biggtfish,项目名称:cms,代码行数:7,代码来源:test.UsersConfig.php
示例14: getRepository
/**
* @return Repository
*/
public function getRepository()
{
if (!isset($this->repository)) {
$this->repository = ConfService::getRepositoryById($this->repositoryId);
}
return $this->repository;
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:10,代码来源:class.CompositeShare.php
示例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;
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:27,代码来源:test.Upload.php
示例16: switchAction
public function switchAction($action, $httpVars, $filesVars)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
return false;
}
$streamData = $repository->streamData;
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
if ($action == "post_to_server") {
$file = base64_decode(AJXP_Utils::decodeSecureMagic($httpVars["file"]));
$target = base64_decode($httpVars["parent_url"]) . "/plugins/editor.pixlr";
$tmp = call_user_func(array($streamData["classname"], "getRealFSReference"), $destStreamURL . $file);
$fData = array("tmp_name" => $tmp, "name" => urlencode(basename($file)), "type" => "image/jpg");
$httpClient = new HttpClient("pixlr.com");
//$httpClient->setDebug(true);
$postData = array();
$httpClient->setHandleRedirects(false);
$params = array("referrer" => "AjaXplorer", "method" => "get", "loc" => ConfService::getLanguage(), "target" => $target . "/fake_save_pixlr.php", "exit" => $target . "/fake_close_pixlr.php", "title" => urlencode(basename($file)), "locktarget" => "false", "locktitle" => "true", "locktype" => "source");
$httpClient->postFile("/editor/", $params, "image", $fData);
$loc = $httpClient->getHeader("location");
header("Location:{$loc}");
} else {
if ($action == "retrieve_pixlr_image") {
$file = AJXP_Utils::decodeSecureMagic($httpVars["original_file"]);
$url = $httpVars["new_url"];
$urlParts = parse_url($url);
$query = $urlParts["query"];
$params = array();
$parameters = parse_str($query, $params);
$image = $params['image'];
/*
$type = $params['type'];
$state = $params['state'];
$filename = $params['title'];
*/
if (strpos($image, "pixlr.com") == 0) {
throw new AJXP_Exception("Invalid Referrer");
}
$headers = get_headers($image, 1);
$content_type = explode("/", $headers['Content-Type']);
if ($content_type[0] != "image") {
throw new AJXP_Exception("File Type");
}
$orig = fopen($image, "r");
$target = fopen($destStreamURL . $file, "w");
while (!feof($orig)) {
fwrite($target, fread($orig, 4096));
}
fclose($orig);
fclose($target);
header("Content-Type:text/plain");
print $mess[115];
}
}
return;
}
开发者ID:firstcoder55,项目名称:Webkey,代码行数:59,代码来源:class.PixlrEditor.php
示例17: switchAction
public function switchAction($action, $httpVars, $filesVars)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
return false;
}
if (!isset($this->pluginConf)) {
$this->pluginConf = array("GENERATE_THUMBNAIL" => false);
}
$streamData = $repository->streamData;
$this->streamData = $streamData;
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
if ($action == "preview_data_proxy") {
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
if (!file_exists($destStreamURL . $file)) {
header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($file)) . "; name=\"" . basename($file) . "\"");
header("Content-Length: 0");
return;
}
if (isset($httpVars["get_thumb"]) && $this->getFilteredOption("GENERATE_THUMBNAIL", $repository->getId())) {
$dimension = 200;
if (isset($httpVars["dimension"]) && is_numeric($httpVars["dimension"])) {
$dimension = $httpVars["dimension"];
}
$this->currentDimension = $dimension;
$cacheItem = AJXP_Cache::getItem("diaporama_" . $dimension, $destStreamURL . $file, array($this, "generateThumbnail"));
$data = $cacheItem->getData();
$cId = $cacheItem->getId();
header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($cId)) . "; name=\"" . basename($cId) . "\"");
header("Content-Length: " . strlen($data));
header('Cache-Control: public');
header("Pragma:");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time() - 10000) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 5 * 24 * 3600) . " GMT");
print $data;
} else {
//$filesize = filesize($destStreamURL.$file);
$node = new AJXP_Node($destStreamURL . $file);
$fp = fopen($destStreamURL . $file, "r");
$stat = fstat($fp);
$filesize = $stat["size"];
header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($file)) . "; name=\"" . basename($file) . "\"");
header("Content-Length: " . $filesize);
header('Cache-Control: public');
header("Pragma:");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time() - 10000) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 5 * 24 * 3600) . " GMT");
$class = $streamData["classname"];
$stream = fopen("php://output", "a");
call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
fflush($stream);
fclose($stream);
AJXP_Controller::applyHook("node.read", array($node));
}
}
}
开发者ID:biggtfish,项目名称:cms,代码行数:59,代码来源:class.ImagePreviewer.php
示例18: setUp
protected function setUp()
{
$pServ = AJXP_PluginsService::getInstance();
ConfService::init();
$confPlugin = ConfService::getInstance()->confPluginSoftLoad($pServ);
$pServ->loadPluginsRegistry(AJXP_INSTALL_PATH . "/plugins", $confPlugin);
ConfService::start();
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:8,代码来源:CoreStorages.php
示例19: tryToLogUser
function tryToLogUser(&$httpVars, $isLast = false)
{
if (!isset($httpVars["get_action"]) || $httpVars["get_action"] != "login") {
return false;
}
$rememberLogin = "";
$rememberPass = "";
$secureToken = "";
$loggedUser = null;
include_once AJXP_BIN_FOLDER . "/class.CaptchaProvider.php";
if (AuthService::suspectBruteForceLogin() && (!isset($httpVars["captcha_code"]) || !CaptchaProvider::checkCaptchaResult($httpVars["captcha_code"]))) {
$loggingResult = -4;
} else {
$userId = isset($httpVars["userid"]) ? AJXP_Utils::sanitize($httpVars["userid"], AJXP_SANITIZE_EMAILCHARS) : null;
$userPass = isset($httpVars["password"]) ? trim($httpVars["password"]) : null;
$rememberMe = isset($httpVars["remember_me"]) && $httpVars["remember_me"] == "true" ? true : false;
$cookieLogin = isset($httpVars["cookie_login"]) ? true : false;
$loggingResult = AuthService::logUser($userId, $userPass, false, $cookieLogin, $httpVars["login_seed"]);
if ($rememberMe && $loggingResult == 1) {
$rememberLogin = "notify";
$rememberPass = "notify";
}
if ($loggingResult == 1) {
session_regenerate_id(true);
$secureToken = AuthService::generateSecureToken();
}
if ($loggingResult < 1 && AuthService::suspectBruteForceLogin()) {
$loggingResult = -4;
// Force captcha reload
}
}
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$force = $loggedUser->mergedRole->filterParameterValue("core.conf", "DEFAULT_START_REPOSITORY", AJXP_REPO_SCOPE_ALL, -1);
$passId = -1;
if (isset($httpVars["tmp_repository_id"])) {
$passId = $httpVars["tmp_repository_id"];
} else {
if ($force != "" && $loggedUser->canSwitchTo($force) && !isset($httpVars["tmp_repository_id"]) && !isset($_SESSION["PENDING_REPOSITORY_ID"])) {
$passId = $force;
}
}
$res = ConfService::switchUserToActiveRepository($loggedUser, $passId);
if (!$res) {
AuthService::disconnect();
$loggingResult = -3;
}
}
if ($loggedUser != null && (AuthService::hasRememberCookie() || isset($rememberMe) && $rememberMe == true)) {
AuthService::refreshRememberCookie($loggedUser);
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::loggingResult($loggingResult, $rememberLogin, $rememberPass, $secureToken);
AJXP_XMLWriter::close();
if ($loggingResult > 0 || $isLast) {
exit;
}
}
开发者ID:ad-m,项目名称:pydio-core,代码行数:58,代码来源:class.SessionLoginFrontend.php
示例20: switchActions
public function switchActions($actionName, $httpVars, $fileVars)
{
//$urlBase = $this->accessDriver
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
return false;
}
if (!isset($this->pluginConf)) {
$this->pluginConf = array("GENERATE_THUMBNAIL" => false);
}
$streamData = $repository->streamData;
$this->streamData = $streamData;
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
switch ($actionName) {
case "filehasher_signature":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
if (!file_exists($destStreamURL . $file)) {
break;
}
$cacheItem = AJXP_Cache::getItem("signatures", $destStreamURL . $file, array($this, "generateSignature"));
$data = $cacheItem->getData();
header("Content-Type:application/octet-stream");
header("Content-Length", strlen($data));
echo $data;
break;
case "filehasher_delta":
case "filehasher_patch":
// HANDLE UPLOAD DATA
if (!isset($fileVars) && !is_array($fileVars["userfile_0"])) {
throw new Exception("These action should find uploaded data");
}
$uploadedData = tempnam(AJXP_Utils::getAjxpTmpDir(), $actionName . "-sig");
move_uploaded_file($fileVars["userfile_0"]["tmp_name"], $uploadedData);
$fileUrl = $destStreamURL . AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$file = call_user_func(array($this->streamData["classname"], "getRealFSReference"), $fileUrl, true);
if ($actionName == "filehasher_delta") {
$signatureFile = $uploadedData;
$deltaFile = tempnam(AJXP_Utils::getAjxpTmpDir(), $actionName . "-delta");
rsync_generate_delta($signatureFile, $file, $deltaFile);
header("Content-Type:application/octet-stream");
header("Content-Length:" . filesize($deltaFile));
readfile($deltaFile);
unlink($signatureFile);
unlink($deltaFile);
} else {
$patched = $file . ".rdiff_patched";
$deltaFile = $uploadedData;
rsync_patch_file($file, $deltaFile, $patched);
rename($patched, $file);
header("Content-Type:text/plain");
unlink($deltaFile);
echo md5_file($file);
}
break;
}
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:56,代码来源:class.FileHasher.php
注:本文中的ConfService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论