本文整理汇总了PHP中AJXP_XMLWriter类的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter类的具体用法?PHP AJXP_XMLWriter怎么用?PHP AJXP_XMLWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AJXP_XMLWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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);
}
示例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();
}
示例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;
}
示例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));
}
示例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));
}
示例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();
}
示例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");
}
}
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
}
示例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;
}
示例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();
}