本文整理汇总了PHP中AJXP_XMLWriter类的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter类的具体用法?PHP AJXP_XMLWriter怎么用?PHP AJXP_XMLWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AJXP_XMLWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
$errorMessage = "This is a demo, all 'write' actions are disabled!";
switch ($action) {
//------------------------------------
// WRITE ACTIONS
//------------------------------------
case "put_content":
case "copy":
case "move":
case "rename":
case "delete":
case "mkdir":
case "mkfile":
case "chmod":
case "compress":
return AJXP_XMLWriter::sendMessage(null, $errorMessage, false);
break;
//------------------------------------
// UPLOAD
//------------------------------------
//------------------------------------
// UPLOAD
//------------------------------------
case "upload":
return array("ERROR" => array("CODE" => "", "MESSAGE" => $errorMessage));
break;
default:
break;
}
return parent::switchAction($action, $httpVars, $fileVars);
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:32,代码来源:class.demoAccessDriver.php
示例3: applyChangeLock
/**
* @param string $action
* @param array $httpVars
* @param array $fileVars
*/
public function applyChangeLock($actionName, $httpVars, $fileVars)
{
if (!isset($this->actions[$actionName])) {
return;
}
if (is_a($this->accessDriver, "demoAccessDriver")) {
throw new Exception("Write actions are disabled in demo mode!");
}
$repo = $this->accessDriver->repository;
$user = AuthService::getLoggedUser();
if (!AuthService::usersEnabled() && $user != null && !$user->canWrite($repo->getId())) {
throw new Exception("You have no right on this action.");
}
$selection = new UserSelection();
$selection->initFromHttpVars();
$currentFile = $selection->getUniqueFile();
$wrapperData = $this->accessDriver->detectStreamWrapper(false);
$urlBase = $wrapperData["protocol"] . "://" . $this->accessDriver->repository->getId();
$unlock = isset($httpVars["unlock"]) ? true : false;
$ajxpNode = new AJXP_Node($urlBase . $currentFile);
if ($unlock) {
$this->metaStore->removeMetadata($ajxpNode, self::METADATA_LOCK_NAMESPACE, false, AJXP_METADATA_SCOPE_GLOBAL);
} else {
$this->metaStore->setMetadata($ajxpNode, SimpleLockManager::METADATA_LOCK_NAMESPACE, array("lock_user" => AuthService::getLoggedUser()->getId()), false, AJXP_METADATA_SCOPE_GLOBAL);
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:34,代码来源:class.SimpleLockManager.php
示例4: applyAction
public function applyAction($actionName, $httpVars, $fileVars)
{
$messages = ConfService::getMessages();
if ($actionName == "index") {
$repository = ConfService::getRepository();
$repositoryId = $repository->getId();
$userSelection = new UserSelection($repository, $httpVars);
if ($userSelection->isEmpty()) {
$userSelection->addFile("/");
}
$nodes = $userSelection->buildNodes($repository->driverInstance);
if (isset($httpVars["verbose"]) && $httpVars["verbose"] == "true") {
$this->verboseIndexation = true;
}
if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
AJXP_Controller::applyActionInBackground($repositoryId, "index", $httpVars);
AJXP_XMLWriter::header();
AJXP_XMLWriter::triggerBgAction("check_index_status", array("repository_id" => $repositoryId), sprintf($messages["core.index.8"], $nodes[0]->getPath()), true, 2);
if (!isset($httpVars["inner_apply"])) {
AJXP_XMLWriter::close();
}
return null;
}
// GIVE BACK THE HAND TO USER
session_write_close();
foreach ($nodes as $node) {
// SIMPLE FILE
if (!is_dir($node->getUrl())) {
try {
$this->logDebug("Indexing - node.index " . $node->getUrl());
AJXP_Controller::applyHook("node.index", array($node));
} catch (Exception $e) {
$this->logDebug("Error Indexing Node " . $node->getUrl() . " (" . $e->getMessage() . ")");
}
} else {
try {
$this->recursiveIndexation($node);
} catch (Exception $e) {
$this->logDebug("Indexation of " . $node->getUrl() . " interrupted by error: (" . $e->getMessage() . ")");
}
}
}
} else {
if ($actionName == "check_index_status") {
$repoId = $httpVars["repository_id"];
list($status, $message) = $this->getIndexStatus(ConfService::getRepositoryById($repoId), AuthService::getLoggedUser());
if (!empty($status)) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::triggerBgAction("check_index_status", array("repository_id" => $repoId), $message, true, 3);
AJXP_XMLWriter::close();
} else {
AJXP_XMLWriter::header();
AJXP_XMLWriter::triggerBgAction("info_message", array(), $messages["core.index.5"], true, 5);
AJXP_XMLWriter::close();
}
}
}
return null;
}
开发者ID:projectesIF,项目名称:Ateneu,代码行数:59,代码来源:class.CoreIndexer.php
示例5: repositoryDataAsJS
function repositoryDataAsJS()
{
if (AuthService::usersEnabled()) {
return "";
}
require_once INSTALL_PATH . "/server/classes/class.SystemTextEncoding.php";
require_once INSTALL_PATH . "/server/classes/class.AJXP_XMLWriter.php";
return str_replace("'", "\\'", AJXP_XMLWriter::writeRepositoriesData(null));
}
开发者ID:bloveing,项目名称:openulteo,代码行数:9,代码来源:class.HTMLWriter.php
示例6: repositoryDataAsJS
/**
* Write repository data directly as javascript string
* @static
* @return mixed|string
*/
public static function repositoryDataAsJS()
{
if (AuthService::usersEnabled()) {
return "";
}
require_once AJXP_BIN_FOLDER . "/class.SystemTextEncoding.php";
require_once AJXP_BIN_FOLDER . "/class.AJXP_XMLWriter.php";
return str_replace("'", "\\'", AJXP_XMLWriter::writeRepositoriesData(null));
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:14,代码来源:class.HTMLWriter.php
示例7: logoutCallback
public function logoutCallback($actionName, $httpVars, $fileVars)
{
AJXP_Safe::clearCredentials();
$adminUser = $this->options["AJXP_ADMIN_LOGIN"];
AuthService::disconnect();
session_write_close();
AJXP_XMLWriter::header();
AJXP_XMLWriter::loggingResult(2);
AJXP_XMLWriter::close();
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:10,代码来源:class.radiusAuthDriver.php
示例8: switchAction
public function switchAction($action, $httpVars, $postProcessData)
{
if (!isset($this->actions[$action])) {
return false;
}
$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() . "/";
if ($action == "audio_proxy") {
$file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
$localName = basename($file);
header("Content-Type: audio/mp3; name=\"" . $localName . "\"");
header("Content-Length: " . filesize($destStreamURL . $file));
$stream = fopen("php://output", "a");
call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
fflush($stream);
fclose($stream);
exit(1);
} else {
if ($action == "ls") {
if (!isset($httpVars["playlist"])) {
// This should not happen anyway, because of the applyCondition.
AJXP_Controller::passProcessDataThrough($postProcessData);
return;
}
// We transform the XML into XSPF
$xmlString = $postProcessData["ob_output"];
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($xmlString);
$xElement = $xmlDoc->documentElement;
header("Content-Type:application/xspf+xml;charset=UTF-8");
print '<?xml version="1.0" encoding="UTF-8"?>';
print '<playlist version="1" xmlns="http://xspf.org/ns/0/">';
print "<trackList>";
foreach ($xElement->childNodes as $child) {
$isFile = $child->getAttribute("is_file") == "true";
$label = $child->getAttribute("text");
$ar = explode(".", $label);
$ext = strtolower(end($ar));
if (!$isFile || $ext != "mp3") {
continue;
}
print "<track><location>" . AJXP_SERVER_ACCESS . "?secure_token=" . AuthService::getSecureToken() . "&get_action=audio_proxy&file=" . base64_encode($child->getAttribute("filename")) . "</location><title>" . $label . "</title></track>";
}
print "</trackList>";
AJXP_XMLWriter::close("playlist");
}
}
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:53,代码来源:class.AudioPreviewer.php
示例9: logoutCallback
public function logoutCallback($actionName, $httpVars, $fileVars)
{
AJXP_Safe::clearCredentials();
$adminUser = $this->options["ADMIN_USER"];
$subUsers = array();
unset($_SESSION["COUNT"]);
unset($_SESSION["disk"]);
AuthService::disconnect();
session_write_close();
AJXP_XMLWriter::header();
AJXP_XMLWriter::loggingResult(2);
AJXP_XMLWriter::close();
}
开发者ID:biggtfish,项目名称:cms,代码行数:13,代码来源:class.smbAuthDriver.php
示例10: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
$errorMessage = "This is a demo, all 'write' actions are disabled!";
switch ($action) {
//------------------------------------
// ONLINE EDIT
//------------------------------------
case "public_url":
if ($httpVars["sub_action"] == "delegate_repo") {
return AJXP_XMLWriter::sendMessage(null, $errorMessage, false);
} else {
print $errorMessage;
}
exit(0);
break;
//------------------------------------
// WRITE ACTIONS
//------------------------------------
//------------------------------------
// WRITE ACTIONS
//------------------------------------
case "put_content":
case "copy":
case "move":
case "rename":
case "delete":
case "mkdir":
case "mkfile":
case "chmod":
case "compress":
return AJXP_XMLWriter::sendMessage(null, $errorMessage, false);
break;
//------------------------------------
// UPLOAD
//------------------------------------
//------------------------------------
// UPLOAD
//------------------------------------
case "upload":
return array("ERROR" => array("CODE" => "", "MESSAGE" => $errorMessage));
break;
default:
break;
}
return parent::switchAction($action, $httpVars, $fileVars);
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:49,代码来源:class.demoAccessDriver.php
示例11: svnStubAction
function svnStubAction($actionName, $httpVars, $filesVars)
{
if ($actionName == "svnlog") {
AJXP_XMLWriter::header();
echo '<log><logentry revision="310"><author>cdujeu</author><date>2008-02-19</date><msg>Commit type errors</msg></logentry><logentry revision="308"><author>mbronni</author><date>2008-02-19</date><msg>New Function</msg></logentry><logentry revision="300"><author>cdujeu</author><date>2008-02-19</date><msg>New Factory Class</msg></logentry></log>
';
AJXP_XMLWriter::close();
} else {
if ($actionName == "svndownload") {
$file = $httpVars["file"];
$rev = $httpVars["revision"];
parent::switchAction("download", $httpVars);
}
}
exit(1);
}
开发者ID:umbecr,项目名称:camilaframework,代码行数:16,代码来源:class.remote_svnAccessDriver.php
示例12: logoutCallback
public function logoutCallback($actionName, $httpVars, $fileVars)
{
AJXP_Safe::clearCredentials();
$adminUser = $this->options["ADMIN_USER"];
$subUsers = array();
foreach ($_SESSION as $key => $val) {
if (substr($key, -4) === "disk" && substr($key, 0, 4) == "smb_") {
unset($_SESSION[$key]);
}
}
AuthService::disconnect();
session_write_close();
AJXP_XMLWriter::header();
AJXP_XMLWriter::loggingResult(2);
AJXP_XMLWriter::close();
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:16,代码来源:class.smbAuthDriver.php
示例13: errorToXml
function errorToXml($mixed)
{
if (is_a($mixed, "AJXP_Exception")) {
$messages = ConfService::getMessages();
$error = "Unkown Error";
if (isset($mixed->messageId) && array_key_exists($mixed->messageId, $messages)) {
$error = $messages[$mixed->messageId];
} else {
$error = $mixed->messageId;
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $error);
AJXP_XMLWriter::close();
exit(1);
}
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:16,代码来源:class.AJXP_Exception.php
示例14: getRegistryContributions
public function getRegistryContributions()
{
$logged = AuthService::getLoggedUser();
if (AuthService::usersEnabled()) {
if ($logged == null) {
return $this->registryContributions;
} else {
$xmlString = AJXP_XMLWriter::getUserXml($logged, false);
}
} else {
$xmlString = AJXP_XMLWriter::getUserXml(null, false);
}
$dom = new DOMDocument();
$dom->loadXML($xmlString);
$this->registryContributions[] = $dom->documentElement;
return $this->registryContributions;
}
开发者ID:umbecr,项目名称:camilaframework,代码行数:17,代码来源:class.AbstractAuthDriver.php
示例15: applyChangeLock
/**
* @param string $action
* @param array $httpVars
* @param array $fileVars
*/
public function applyChangeLock($actionName, $httpVars, $fileVars)
{
if (is_a($this->accessDriver, "demoAccessDriver")) {
throw new Exception("Write actions are disabled in demo mode!");
}
$repo = $this->accessDriver->repository;
$user = AuthService::getLoggedUser();
if (!AuthService::usersEnabled() && $user != null && !$user->canWrite($repo->getId())) {
throw new Exception("You have no right on this action.");
}
$selection = new UserSelection($repo, $httpVars);
$unlock = isset($httpVars["unlock"]) ? true : false;
if ($unlock) {
$this->metaStore->removeMetadata($selection->getUniqueNode(), self::METADATA_LOCK_NAMESPACE, false, AJXP_METADATA_SCOPE_GLOBAL);
} else {
$this->metaStore->setMetadata($selection->getUniqueNode(), SimpleLockManager::METADATA_LOCK_NAMESPACE, array("lock_user" => AuthService::getLoggedUser()->getId()), false, AJXP_METADATA_SCOPE_GLOBAL);
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:26,代码来源:class.SimpleLockManager.php
示例16: logoutCallback
public function logoutCallback($actionName, $httpVars, $fileVars)
{
$safeCredentials = AJXP_Safe::loadCredentials();
$crtUser = $safeCredentials["user"];
if (isset($_SESSION["AJXP_DYNAMIC_FTP_DATA"])) {
unset($_SESSION["AJXP_DYNAMIC_FTP_DATA"]);
}
AJXP_Safe::clearCredentials();
$adminUser = $this->options["AJXP_ADMIN_LOGIN"];
if (isset($this->options["ADMIN_USER"])) {
$adminUser = $this->options["AJXP_ADMIN_LOGIN"];
}
$subUsers = array();
if ($crtUser != $adminUser && $crtUser != "") {
ConfService::getConfStorageImpl()->deleteUser($crtUser, $subUsers);
}
AuthService::disconnect();
session_destroy();
session_write_close();
AJXP_XMLWriter::header();
AJXP_XMLWriter::loggingResult(2);
AJXP_XMLWriter::close();
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:23,代码来源:class.ftpAuthDriver.php
示例17: receiveAction
/**
* @param String $action
* @param Array $httpVars
* @param Array $fileVars
* @throws Exception
*/
public function receiveAction($action, $httpVars, $fileVars)
{
//VAR CREATION OUTSIDE OF ALL CONDITIONS, THEY ARE "MUST HAVE" VAR !!
$messages = ConfService::getMessages();
$repository = ConfService::getRepository();
$userSelection = new UserSelection($repository, $httpVars);
$nodes = $userSelection->buildNodes();
$currentDirPath = AJXP_Utils::safeDirname($userSelection->getUniqueNode()->getPath());
$currentDirPath = rtrim($currentDirPath, "/") . "/";
$currentDirUrl = $userSelection->currentBaseUrl() . $currentDirPath;
if (empty($httpVars["compression_id"])) {
$compressionId = sha1(rand());
$httpVars["compression_id"] = $compressionId;
} else {
$compressionId = $httpVars["compression_id"];
}
$progressCompressionFileName = $this->getPluginCacheDir(false, true) . DIRECTORY_SEPARATOR . "progressCompressionID-" . $compressionId . ".txt";
if (empty($httpVars["extraction_id"])) {
$extractId = sha1(rand());
$httpVars["extraction_id"] = $extractId;
} else {
$extractId = $httpVars["extraction_id"];
}
$progressExtractFileName = $this->getPluginCacheDir(false, true) . DIRECTORY_SEPARATOR . "progressExtractID-" . $extractId . ".txt";
if ($action == "compression") {
$archiveName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]), AJXP_SANITIZE_FILENAME);
$archiveFormat = $httpVars["type_archive"];
$tabTypeArchive = array(".tar", ".tar.gz", ".tar.bz2");
$acceptedExtension = false;
foreach ($tabTypeArchive as $extensionArchive) {
if ($extensionArchive == $archiveFormat) {
$acceptedExtension = true;
break;
}
}
if ($acceptedExtension == false) {
file_put_contents($progressCompressionFileName, "Error : " . $messages["compression.16"]);
throw new AJXP_Exception($messages["compression.16"]);
}
$typeArchive = $httpVars["type_archive"];
//if we can run in background we do it
if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
$archivePath = $currentDirPath . $archiveName;
file_put_contents($progressCompressionFileName, $messages["compression.5"]);
AJXP_Controller::applyActionInBackground($repository->getId(), "compression", $httpVars);
AJXP_XMLWriter::header();
AJXP_XMLWriter::triggerBgAction("check_compression_status", array("repository_id" => $repository->getId(), "compression_id" => $compressionId, "archive_path" => SystemTextEncoding::toUTF8($archivePath)), $messages["compression.5"], true, 2);
AJXP_XMLWriter::close();
return null;
} else {
$maxAuthorizedSize = 4294967296;
$currentDirUrlLength = strlen($currentDirUrl);
$tabFolders = array();
$tabAllRecursiveFiles = array();
$tabFilesNames = array();
foreach ($nodes as $node) {
$nodeUrl = $node->getUrl();
if (is_file($nodeUrl) && filesize($nodeUrl) < $maxAuthorizedSize) {
array_push($tabAllRecursiveFiles, $nodeUrl);
array_push($tabFilesNames, substr($nodeUrl, $currentDirUrlLength));
}
if (is_dir($nodeUrl)) {
array_push($tabFolders, $nodeUrl);
}
}
//DO A FOREACH OR IT'S GONNA HAVE SOME SAMES FILES NAMES
foreach ($tabFolders as $value) {
$dossiers = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($value));
foreach ($dossiers as $file) {
if ($file->isDir()) {
continue;
}
array_push($tabAllRecursiveFiles, $file->getPathname());
array_push($tabFilesNames, substr($file->getPathname(), $currentDirUrlLength));
}
}
//WE STOP IF IT'S JUST AN EMPTY FOLDER OR NO FILES
if (empty($tabFilesNames)) {
file_put_contents($progressCompressionFileName, "Error : " . $messages["compression.17"]);
throw new AJXP_Exception($messages["compression.17"]);
}
try {
$tmpArchiveName = tempnam(AJXP_Utils::getAjxpTmpDir(), "tar-compression") . ".tar";
$archive = new PharData($tmpArchiveName);
} catch (Exception $e) {
file_put_contents($progressCompressionFileName, "Error : " . $e->getMessage());
throw $e;
}
$counterCompression = 0;
//THE TWO ARRAY ARE MERGED FOR THE FOREACH LOOP
$tabAllFiles = array_combine($tabAllRecursiveFiles, $tabFilesNames);
foreach ($tabAllFiles as $fullPath => $fileName) {
try {
$archive->addFile(AJXP_MetaStreamWrapper::getRealFSReference($fullPath), $fileName);
//.........这里部分代码省略.........
开发者ID:Nanomani,项目名称:pydio-core,代码行数:101,代码来源:class.PluginCompression.php
示例18: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
$selection = new UserSelection();
$dir = $httpVars["dir"] or "";
$dir = AJXP_Utils::decodeSecureMagic($dir);
if ($dir == "/") {
$dir = "";
}
$selection->initFromHttpVars($httpVars);
if (!$selection->isEmpty()) {
//$this->filterUserSelectionToHidden($selection->getFiles());
}
$urlBase = "pydio://" . ConfService::getRepository()->getId();
$mess = ConfService::getMessages();
switch ($action) {
case "monitor_compression":
$percentFile = fsAccessWrapper::getRealFSReference($urlBase . $dir . "/.zip_operation_" . $httpVars["ope_id"]);
$percent = 0;
if (is_file($percentFile)) {
$percent = intval(file_get_contents($percentFile));
}
if ($percent < 100) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::triggerBgAction("monitor_compression", $httpVars, $mess["powerfs.1"] . " ({$percent}%)", true, 1);
AJXP_XMLWriter::close();
} else {
@unlink($percentFile);
AJXP_XMLWriter::header();
if ($httpVars["on_end"] == "reload") {
AJXP_XMLWriter::triggerBgAction("reload_node", array(), "powerfs.2", true, 2);
} else {
$archiveName = AJXP_Utils::sanitize($httpVars["archive_name"], AJXP_SANITIZE_FILENAME);
$archiveName = str_replace("'", "\\'", $archiveName);
$jsCode = "\n PydioApi.getClient().downloadSelection(null, \$('download_form'), 'postcompress_download', {ope_id:'" . $httpVars["ope_id"] . "',archive_name:'" . $archiveName . "'});\n ";
AJXP_XMLWriter::triggerBgJsAction($jsCode, $mess["powerfs.3"], true);
AJXP_XMLWriter::triggerBgAction("reload_node", array(), "powerfs.2", true, 2);
}
AJXP_XMLWriter::close();
}
break;
case "postcompress_download":
$archive = AJXP_Utils::getAjxpTmpDir() . DIRECTORY_SEPARATOR . $httpVars["ope_id"] . "_" . AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]), AJXP_SANITIZE_FILENAME);
$fsDriver = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("access");
if (is_file($archive)) {
if (!$fsDriver->getFilteredOption("USE_XSENDFILE", ConfService::getRepository()) && !$fsDriver->getFilteredOption("USE_XACCELREDIRECT", ConfService::getRepository())) {
register_shutdown_function("unlink", $archive);
}
$fsDriver->readFile($archive, "force-download", $httpVars["archive_name"], false, null, true);
} else {
echo "<script>alert('Cannot find archive! Is ZIP correctly installed?');</script>";
}
break;
case "compress":
case "precompress":
$archiveName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]), AJXP_SANITIZE_FILENAME);
if (!ConfService::currentContextIsCommandLine() && ConfService::backgroundActionsSupported()) {
$opeId = substr(md5(time()), 0, 10);
$httpVars["ope_id"] = $opeId;
AJXP_Controller::applyActionInBackground(ConfService::getRepository()->getId(), $action, $httpVars);
AJXP_XMLWriter::header();
$bgParameters = array("dir" => SystemTextEncoding::toUTF8($dir), "archive_name" => SystemTextEncoding::toUTF8($archiveName), "on_end" => isset($httpVars["on_end"]) ? $httpVars["on_end"] : "reload", "ope_id" => $opeId);
AJXP_XMLWriter::triggerBgAction("monitor_compression", $bgParameters, $mess["powerfs.1"] . " (0%)", true);
AJXP_XMLWriter::close();
session_write_close();
exit;
}
$rootDir = fsAccessWrapper::getRealFSReference($urlBase) . $dir;
$percentFile = $rootDir . "/.zip_operation_" . $httpVars["ope_id"];
$compressLocally = $action == "compress" ? true : false;
// List all files
$todo = array();
$args = array();
$replaceSearch = array($rootDir, "\\");
$replaceReplace = array("", "/");
foreach ($selection->getFiles() as $selectionFile) {
$baseFile = $selectionFile;
$args[] = escapeshellarg(substr($selectionFile, strlen($dir) + ($dir == "/" ? 0 : 1)));
$selectionFile = fsAccessWrapper::getRealFSReference($urlBase . $selectionFile);
$todo[] = ltrim(str_replace($replaceSearch, $replaceReplace, $selectionFile), "/");
if (is_dir($selectionFile)) {
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($selectionFile), RecursiveIteratorIterator::SELF_FIRST);
foreach ($objects as $name => $object) {
$todo[] = str_replace($replaceSearch, $replaceReplace, $name);
}
}
if (trim($baseFile, "/") == "") {
// ROOT IS SELECTED, FIX IT
$args = array(escapeshellarg(basename($rootDir)));
$rootDir = dirname($rootDir);
break;
}
}
$cmdSeparator = PHP_OS == "WIN32" || PHP_OS == "WINNT" || PHP_OS == "Windows" ? "&" : ";";
if (!$compressLocally) {
$archiveName = AJXP_Utils::getAjxpTmpDir() . DIRECTORY_SEPARATOR . $httpVars["ope_id"] . "_" . $archiveName;
}
chdir($rootDir);
$cmd = $this->getFilteredOption("ZIP_PATH") . " -r " . escapeshellarg($archiveName) . " " . implode(" ", $args);
$fsDriver = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("access");
$c = $fsDriver->getConfigs();
//.........这里部分代码省略.........
开发者ID:Nanomani,项目名称:pydio-core,代码行数:101,代码来源:class.PowerFSController.php
示例19: getUserXML
/**
* Extract all the user data and put it in XML
* @static
* @param null $userObject * @internal param bool $details
* @return string
*/
public static function getUserXML($userObject = null)
{
$buffer = "";
$loggedUser = AuthService::getLoggedUser();
$confDriver = ConfService::getConfStorageImpl();
if ($userObject != null) {
$loggedUser = $userObject;
}
if (!AuthService::usersEnabled()) {
$buffer .= "<user id=\"shared\">";
$buffer .= "<active_repo id=\"" . ConfService::getCurrentRepositoryId() . "\" write=\"1\" read=\"1\"/>";
$buffer .= AJXP_XMLWriter::writeRepositoriesData(null);
$buffer .= "</user>";
} else {
if ($loggedUser != null) {
$lock = $loggedUser->getLock();
$buffer .= "<user id=\"" . $loggedUser->id . "\">";
$buffer .= "<active_repo id=\"" . ConfService::getCurrentRepositoryId() . "\" write=\"" . ($loggedUser->canWrite(ConfService::getCurrentRepositoryId()) ? "1" : "0") . "\" read=\"" . ($loggedUser->canRead(ConfService::getCurrentRepositoryId()) ? "1" : "0") . "\"/>";
$buffer .= AJXP_XMLWriter::writeRepositoriesData($loggedUser);
$buffer .= "<preferences>";
$preferences = $confDriver->getExposedPreferences($loggedUser);
foreach ($preferences as $prefName => $prefData) {
$atts = "";
if (isset($prefData["exposed"]) && $prefData["exposed"] == true) {
foreach ($prefData as $k => $v) {
if ($k == "name") {
continue;
}
if ($k == "value") {
$k = "default";
}
$atts .= "{$k}='{$v}' ";
}
}
if (isset($prefData["pluginId"])) {
$atts .= "pluginId='" . $prefData["pluginId"] . "' ";
}
if ($prefData["type"] == "string") {
$buffer .= "<pref name=\"{$prefName}\" value=\"" . $prefData["value"] . "\" {$atts}/>";
} else {
if ($prefData["type"] == "json") {
$buffer .= "<pref name=\"{$prefName}\" {$atts}><![CDATA[" . $prefData["value"] . "]]></pref>";
}
}
}
$buffer .= "</preferences>";
$buffer .= "<special_rights is_admin=\"" . ($loggedUser->isAdmin() ? "1" : "0") . "\" " . ($lock !== false ? "lock=\"{$lock}\"" : "") . "/>";
/*
$bMarks = $loggedUser->getBookmarks();
if (count($bMarks)) {
$buffer.= "<bookmarks>".AJXP_XMLWriter::writeBookmarks($bMarks, false)."</bookmarks>";
}
*/
$buffer .= "</user>";
}
}
return $buffer;
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:64,代码来源:class.AJXP_XMLWriter.php
示例20: printFormFromServerSettings
public function printFormFromServerSettings($fullManifest)
{
AJXP_XMLWriter::header("admin_data");
$xPath = new DOMXPath($fullManifest->ownerDocument);
$addParams = "";
$pInstNodes = $xPath->query("server_settings/global_param[contains(@type, 'plugin_instance:')]");
foreach ($pInstNodes as $pInstNode) {
$type = $pInstNode->getAttribute("type");
$instType = str_replace("plugin_instance:", "", $type);
$fieldName = $pInstNode->getAttribute("name");
$pInstNode->setAttribute("type", "group_switch:" . $fieldName);
$typePlugs = AJXP_PluginsService::getInstance()->getPluginsByType($instType);
foreach ($typePlugs as $typePlug) {
if ($typePlug->getId() == "auth.multi") {
continue;
}
$checkErrorMessage = "";
try {
$typePlug->performChecks();
} ca
|
请发表评论