本文整理汇总了PHP中AJXP_XMLWriter::header方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::header方法的具体用法?PHP AJXP_XMLWriter::header怎么用?PHP AJXP_XMLWriter::header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_XMLWriter
的用法示例。
在下文中一共展示了AJXP_XMLWriter::header方法的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: 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) {
$dir = $node->getPath() == "/" || is_dir($node->getUrl());
// SIMPLE FILE
if (!$dir) {
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;
}
示例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: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
parent::accessPreprocess($action, $httpVars, $fileVars);
switch ($action) {
case "ls":
$doc = DOMDocument::load($this->repository->getOption("HOST") . "?request=GetCapabilities");
$xPath = new DOMXPath($doc);
$dir = $httpVars["dir"];
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="wms.1" attributeName="ajxp_label" sortType="String"/><column messageId="wms.6" attributeName="srs" sortType="String"/><column messageId="wms.4" attributeName="style" sortType="String"/><column messageId="wms.5" attributeName="keywords" sortType="String"/></columns>');
$layers = $xPath->query("Capability/Layer/Layer");
// Detect "levels"
$levels = array();
$leafs = array();
$styleLevels = $prefixLevels = false;
foreach ($layers as $layer) {
$name = $xPath->evaluate("Name", $layer)->item(0)->nodeValue;
$stylesList = $xPath->query("Style/Name", $layer);
if (strstr($name, ":") !== false) {
$exp = explode(":", $name);
if (!isset($levels[$exp[0]])) {
$levels[$exp[0]] = array();
}
$levels[$exp[0]][] = $layer;
$prefixLevels = true;
} else {
if ($stylesList->length > 1) {
if (!isset($levels[$name])) {
$levels[$name] = array();
}
foreach ($stylesList as $style) {
$levels[$name][$style->nodeValue] = $layer;
}
$styleLevels = true;
} else {
$leafs[] = $layer;
}
}
}
if ($dir == "/" || $dir == "") {
$this->listLevels($levels);
$this->listLayers($leafs, $xPath);
} else {
if (isset($levels[basename($dir)])) {
$this->listLayers($levels[basename($dir)], $xPath, $styleLevels ? array($this, "replaceStyle") : null);
}
}
AJXP_XMLWriter::close();
break;
default:
break;
}
}
示例5: 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();
}
示例6: loadInstallerForm
/**
* Transmit to the ajxp_conf load_plugin_manifest action
* @param $action
* @param $httpVars
* @param $fileVars
*/
public function loadInstallerForm($action, $httpVars, $fileVars)
{
if (isset($httpVars["lang"])) {
ConfService::setLanguage($httpVars["lang"]);
}
AJXP_XMLWriter::header("admin_data");
$fullManifest = $this->getManifestRawContent("", "xml");
$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();
} catch (Exception $e) {
$checkErrorMessage = " (Warning : " . $e->getMessage() . ")";
}
$tParams = AJXP_XMLWriter::replaceAjxpXmlKeywords($typePlug->getManifestRawContent("server_settings/param"));
$addParams .= '<global_param group_switch_name="' . $fieldName . '" name="instance_name" group_switch_label="' . $typePlug->getManifestLabel() . $checkErrorMessage . '" group_switch_value="' . $typePlug->getId() . '" default="' . $typePlug->getId() . '" type="hidden"/>';
$addParams .= str_replace("<param", "<global_param group_switch_name=\"{$fieldName}\" group_switch_label=\"" . $typePlug->getManifestLabel() . $checkErrorMessage . "\" group_switch_value=\"" . $typePlug->getId() . "\" ", $tParams);
$addParams .= AJXP_XMLWriter::replaceAjxpXmlKeywords($typePlug->getManifestRawContent("server_settings/global_param"));
}
}
$uri = $_SERVER["REQUEST_URI"];
if (strpos($uri, '.php') !== false) {
$uri = AJXP_Utils::safeDirname($uri);
}
if (empty($uri)) {
$uri = "/";
}
$loadedValues = array("ENCODING" => defined('AJXP_LOCALE') ? AJXP_LOCALE : SystemTextEncoding::getEncoding(), "SERVER_URI" => $uri);
foreach ($loadedValues as $pName => $pValue) {
$vNodes = $xPath->query("server_settings/global_param[@name='{$pName}']");
if (!$vNodes->length) {
continue;
}
$vNodes->item(0)->setAttribute("default", $pValue);
}
$allParams = AJXP_XMLWriter::replaceAjxpXmlKeywords($fullManifest->ownerDocument->saveXML($fullManifest));
$allParams = str_replace('type="plugin_instance:', 'type="group_switch:', $allParams);
$allParams = str_replace("</server_settings>", $addParams . "</server_settings>", $allParams);
echo $allParams;
AJXP_XMLWriter::close("admin_data");
}
示例7: catchError
function catchError($code, $message, $fichier, $ligne, $context)
{
if (error_reporting() == 0) {
return;
}
$message = "{$code} : {$message} in {$fichier} (l.{$ligne})";
AJXP_Logger::logAction("error", array("message" => $message));
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $message, true);
AJXP_XMLWriter::close();
exit(1);
}
示例8: 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();
}
示例9: 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);
}
示例10: 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();
}
示例11: 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);
}
}
示例12: 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();
}
示例13: loadInstallerForm
/**
* Transmit to the ajxp_conf load_plugin_manifest action
* @param $action
* @param $httpVars
* @param $fileVars
*/
public function loadInstallerForm($action, $httpVars, $fileVars)
{
if (isset($httpVars["lang"])) {
ConfService::setLanguage($httpVars["lang"]);
}
AJXP_XMLWriter::header("admin_data");
$fullManifest = $this->getManifestRawContent("", "xml");
$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();
} catch (Exception $e) {
$checkErrorMessage = " (Warning : " . $e->getMessage() . ")";
}
$tParams = AJXP_XMLWriter::replaceAjxpXmlKeywords($typePlug->getManifestRawContent("server_settings/param"));
$addParams .= '<global_param group_switch_name="' . $fieldName . '" name="instance_name" group_switch_label="' . $typePlug->getManifestLabel() . $checkErrorMessage . '" group_switch_value="' . $typePlug->getId() . '" default="' . $typePlug->getId() . '" type="hidden"/>';
$addParams .= str_replace("<param", "<global_param group_switch_name=\"{$fieldName}\" group_switch_label=\"" . $typePlug->getManifestLabel() . $checkErrorMessage . "\" group_switch_value=\"" . $typePlug->getId() . "\" ", $tParams);
$addParams .= AJXP_XMLWriter::replaceAjxpXmlKeywords($typePlug->getManifestRawContent("server_settings/global_param"));
}
}
$allParams = AJXP_XMLWriter::replaceAjxpXmlKeywords($fullManifest->ownerDocument->saveXML($fullManifest));
$allParams = str_replace('type="plugin_instance:', 'type="group_switch:', $allParams);
$allParams = str_replace("</server_settings>", $addParams . "</server_settings>", $allParams);
echo $allParams;
AJXP_XMLWriter::close("admin_data");
}
示例14: 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();
}
示例15: applyActions
public function applyActions($actionName, $httpVars, $fileVars)
{
$git = new VersionControl_Git($this->repoBase);
switch ($actionName) {
case "git_history":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$file = ltrim($file, "/");
$res = $this->gitHistory($git, $file);
AJXP_XMLWriter::header();
$ic = AJXP_Utils::mimetype($file, "image", false);
$index = count($res);
$mess = ConfService::getMessages();
foreach ($res as &$commit) {
unset($commit["DETAILS"]);
$commit["icon"] = $ic;
$commit["index"] = $index;
$commit["EVENT"] = $mess["meta.git." . $commit["EVENT"]];
$index--;
AJXP_XMLWriter::renderNode("/" . $commit["ID"], basename($commit["FILE"]), true, $commit);
}
AJXP_XMLWriter::close();
break;
break;
case "git_revertfile":
$originalFile = AJXP_Utils::decodeSecureMagic($httpVars["original_file"]);
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$commitId = $httpVars["commit_id"];
$command = $git->getCommand("cat-file");
$command->setOption("s", true);
$command->addArgument($commitId . ":" . $file);
$size = $command->execute();
$command = $git->getCommand("show");
$command->addArgument($commitId . ":" . $file);
$commandLine = $command->createCommandString();
$outputStream = fopen($this->repoBase . $originalFile, "w");
$this->executeCommandInStreams($git, $commandLine, $outputStream);
fclose($outputStream);
$this->commitChanges();
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
break;
case "git_getfile":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$commitId = $httpVars["commit_id"];
$attach = $httpVars["attach"];
$command = $git->getCommand("cat-file");
$command->setOption("s", true);
$command->addArgument($commitId . ":" . $file);
$size = $command->execute();
$command = $git->getCommand("show");
$command->addArgument($commitId . ":" . $file);
$commandLine = $command->createCommandString();
if ($attach == "inline") {
$fileExt = substr(strrchr(basename($file), '.'), 1);
if (empty($fileExt)) {
$fileMime = "application/octet-stream";
} else {
$regex = "/^([\\w\\+\\-\\.\\/]+)\\s+(\\w+\\s)*({$fileExt}\\s)/i";
$lines = file(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/editor.browser/resources/other/mime.types");
foreach ($lines as $line) {
if (substr($line, 0, 1) == '#') {
continue;
}
// skip comments
$line = rtrim($line) . " ";
if (!preg_match($regex, $line, $matches)) {
continue;
}
// no match to the extension
$fileMime = $matches[1];
}
}
if (empty($fileMime)) {
$fileMime = "application/octet-stream";
}
HTMLWriter::generateInlineHeaders(basename($file), $size, $fileMime);
} else {
HTMLWriter::generateAttachmentsHeader(basename($file), $size, false, false);
}
$outputStream = fopen("php://output", "a");
$this->executeCommandInStreams($git, $commandLine, $outputStream);
fclose($outputStream);
break;
break;
default:
break;
}
}