本文整理汇总了PHP中AJXP_XMLWriter::reloadDataNode方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::reloadDataNode方法的具体用法?PHP AJXP_XMLWriter::reloadDataNode怎么用?PHP AJXP_XMLWriter::reloadDataNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_XMLWriter
的用法示例。
在下文中一共展示了AJXP_XMLWriter::reloadDataNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: editMeta
public function editMeta($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 (!$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();
$newValues = array();
$def = $this->getMetaDefinition();
foreach ($def as $key => $label) {
if (isset($httpVars[$key])) {
$newValues[$key] = AJXP_Utils::xmlEntities(AJXP_Utils::decodeSecureMagic($httpVars[$key]));
} else {
if (!isset($original)) {
$original = array();
$this->loadMetaFileData($urlBase . $currentFile);
$base = basename($currentFile);
if (is_array(self::$metaCache) && array_key_exists($base, self::$metaCache)) {
$original = self::$metaCache[$base];
}
}
if (isset($original) && isset($original[$key])) {
$newValues[$key] = $original[$key];
}
}
}
$this->addMeta($urlBase . $currentFile, $newValues);
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode("", SystemTextEncoding::toUTF8($currentFile), true);
AJXP_XMLWriter::close();
}
示例4: switchAction
//.........这里部分代码省略.........
print '<tree text="' . AJXP_Utils::xmlEntities($data["LABEL"]) . '" description="' . AJXP_Utils::xmlEntities($data["DESCRIPTION"]) . '" icon="' . $data["ICON"] . '" filename="' . $parentName . $key . '" ' . $bmString . '/>';
} else {
print '<tree text="' . AJXP_Utils::xmlEntities($data["LABEL"]) . '" description="' . AJXP_Utils::xmlEntities($data["DESCRIPTION"]) . '" icon="' . $data["ICON"] . '" filename="' . $parentName . $key . '" ' . $bmString . '>';
foreach ($data["CHILDREN"] as $cKey => $cData) {
$bmString = '';
if (in_array($parentName . $key . "/" . $cKey, $this->currentBookmarks)) {
$bmString = ' ajxp_bookmarked="true" overlay_icon="bookmark.png" ';
}
if ($cKey == "users") {
$bmString .= ' remote_indexation="admin_search"';
}
if (isset($cData["AJXP_MIME"])) {
$bmString .= ' ajxp_mime="' . $cData["AJXP_MIME"] . '"';
}
print '<tree text="' . AJXP_Utils::xmlEntities($cData["LABEL"]) . '" description="' . AJXP_Utils::xmlEntities($cData["DESCRIPTION"]) . '" icon="' . $cData["ICON"] . '" filename="' . $parentName . $key . '/' . $cKey . '" ' . $bmString . '/>';
}
print '</tree>';
}
}
AJXP_XMLWriter::close();
}
break;
case "stat":
header("Content-type:application/json");
print '{"mode":true}';
return;
break;
case "clear_plugins_cache":
AJXP_XMLWriter::header();
// Clear plugins cache if they exist
AJXP_PluginsService::clearPluginsCache();
ConfService::clearMessagesCache();
AJXP_XMLWriter::sendMessage($mess["ajxp_conf." . (AJXP_SKIP_CACHE ? "132" : "131")], null);
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
break;
case "create_group":
if (isset($httpVars["group_path"])) {
$basePath = AJXP_Utils::forwardSlashDirname($httpVars["group_path"]);
if (empty($basePath)) {
$basePath = "/";
}
$gName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic(basename($httpVars["group_path"])), AJXP_SANITIZE_ALPHANUM);
} else {
$basePath = substr($httpVars["dir"], strlen("/data/users"));
$gName = AJXP_Utils::sanitize(SystemTextEncoding::magicDequote($httpVars["group_name"]), AJXP_SANITIZE_ALPHANUM);
}
$gLabel = AJXP_Utils::decodeSecureMagic($httpVars["group_label"]);
AuthService::createGroup($basePath, $gName, $gLabel);
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage($mess["ajxp_conf.124"], null);
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
break;
case "create_role":
$roleId = AJXP_Utils::sanitize(SystemTextEncoding::magicDequote($httpVars["role_id"]), AJXP_SANITIZE_HTML_STRICT);
if (!strlen($roleId)) {
throw new Exception($mess[349]);
}
if (AuthService::getRole($roleId) !== false) {
throw new Exception($mess["ajxp_conf.65"]);
}
$r = new AJXP_Role($roleId);
if (AuthService::getLoggedUser() != null && AuthService::getLoggedUser()->getGroupPath() != null) {
$r->setGroupPath(AuthService::getLoggedUser()->getGroupPath());
}
示例5: editMeta
public function editMeta($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();
$newValues = array();
$def = $this->getMetaDefinition();
$ajxpNode = new AJXP_Node($urlBase . $currentFile);
AJXP_Controller::applyHook("node.before_change", array(&$ajxpNode));
foreach ($def as $key => $label) {
if (isset($httpVars[$key])) {
$newValues[$key] = AJXP_Utils::decodeSecureMagic($httpVars[$key]);
} else {
if (!isset($original)) {
$original = $this->metaStore->retrieveMetadata($ajxpNode, "users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
}
if (isset($original) && isset($original[$key])) {
$newValues[$key] = $original[$key];
}
}
}
$this->metaStore->setMetadata($ajxpNode, "users_meta", $newValues, false, AJXP_METADATA_SCOPE_GLOBAL);
AJXP_Controller::applyHook("node.change", array(null, &$ajxpNode));
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode("", SystemTextEncoding::toUTF8($currentFile), true);
AJXP_XMLWriter::close();
}
示例6: switchAction
public function switchAction($actionName, $httpVars, $fileVars)
{
//var_dump($httpVars);
$xmlTemplate = $this->getFilteredOption("ENCFS_XML_TEMPLATE");
switch ($actionName) {
case "encfs.cypher_folder":
if (empty($xmlTemplate) || !is_file($xmlTemplate)) {
throw new Exception("It seems that you have not set the plugin 'Enfcs XML File' configuration, or the system cannot find it!");
}
//$repo = ConfService::getRepository();
$workingP = rtrim($this->getWorkingPath(), "/");
$dir = $workingP . AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
if (dirname($dir) != $workingP) {
throw new Exception("Please cypher only folders at the root of your repository");
}
$pass = $httpVars["pass"];
$raw = dirname($dir) . DIRECTORY_SEPARATOR . "ENCFS_RAW_" . basename($dir);
if (!strstr($dir, "ENCFS_CLEAR_") && !is_dir($raw)) {
// NEW FOLDER SCENARIO
$clear = dirname($dir) . DIRECTORY_SEPARATOR . "ENCFS_CLEAR_" . basename($dir);
mkdir($raw);
$result = self::initEncFolder($raw, $xmlTemplate, $this->getFilteredOption("ENCFS_XML_PASSWORD"), $pass);
if ($result) {
// Mount folder
mkdir($clear);
$uid = $this->getFilteredOption("ENCFS_UID");
self::mountFolder($raw, $clear, $pass, $uid);
$content = scandir($dir);
foreach ($content as $fileOrFolder) {
if ($fileOrFolder == "." || $fileOrFolder == "..") {
continue;
}
$cmd = "mv " . escapeshellarg($dir . DIRECTORY_SEPARATOR . $fileOrFolder) . " " . escapeshellarg($clear . DIRECTORY_SEPARATOR);
$exec = shell_exec($cmd);
}
self::umountFolder($clear);
rmdir($dir);
}
} else {
if (substr(basename($dir), 0, strlen("ENCFS_CLEAR_")) == "ENCFS_CLEAR_") {
// SIMPLY UNMOUNT
self::umountFolder($dir);
}
}
break;
case "encfs.uncypher_folder":
$dir = $this->getWorkingPath() . AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
$raw = str_replace("ENCFS_CLEAR_", "ENCFS_RAW_", $dir);
$pass = $httpVars["pass"];
$uid = $this->getFilteredOption("ENCFS_UID");
if (is_dir($raw)) {
self::mountFolder($raw, $dir, $pass, $uid);
}
break;
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
}
示例7: 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;
}
}
示例8: switchAction
//.........这里部分代码省略.........
continue;
}
print AJXP_XMLWriter::replaceAjxpXmlKeywords($paramNode->ownerDocument->saveXML($paramNode));
}
// ADD LABEL
echo '<param name="DISPLAY" type="string" label="' . $mess[359] . '" description="' . $mess[429] . '" mandatory="true" default="' . $defaultLabel . '"/>';
print "</template>";
}
AJXP_XMLWriter::close("repository_templates");
break;
case "user_create_repository":
$tplId = $httpVars["template_id"];
$tplRepo = ConfService::getRepositoryById($tplId);
$options = array();
AJXP_Utils::parseStandardFormParameters($httpVars, $options);
$loggedUser = AuthService::getLoggedUser();
$newRep = $tplRepo->createTemplateChild(AJXP_Utils::sanitize($httpVars["DISPLAY"]), $options, null, $loggedUser->getId());
$gPath = $loggedUser->getGroupPath();
if (!empty($gPath)) {
$newRep->setGroupPath($gPath);
}
$res = ConfService::addRepository($newRep);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, $mess[426]);
} else {
// Make sure we do not overwrite otherwise loaded rights.
$loggedUser->load();
$loggedUser->personalRole->setAcl($newRep->getUniqueId(), "rw");
$loggedUser->save("superuser");
$loggedUser->recomputeMergedRole();
AuthService::updateUser($loggedUser);
AJXP_XMLWriter::sendMessage($mess[425], null);
AJXP_XMLWriter::reloadDataNode("", $newRep->getUniqueId());
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
break;
case "user_delete_repository":
$repoId = $httpVars["repository_id"];
$repository = ConfService::getRepositoryById($repoId);
if (!$repository->getUniqueUser() || $repository->getUniqueUser() != AuthService::getLoggedUser()->getId()) {
throw new Exception("You are not allowed to perform this operation!");
}
$res = ConfService::deleteRepository($repoId);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, $mess[427]);
} else {
$loggedUser = AuthService::getLoggedUser();
// Make sure we do not override remotely set rights
$loggedUser->load();
$loggedUser->personalRole->setAcl($repoId, "");
$loggedUser->save("superuser");
AuthService::updateUser($loggedUser);
AJXP_XMLWriter::sendMessage($mess[428], null);
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
break;
case "user_delete_user":
$userId = $httpVars["user_id"];
$userObject = ConfService::getConfStorageImpl()->createUserObject($userId);
if ($userObject == null || !$userObject->hasParent() || $userObject->getParent() != AuthService::getLoggedUser()->getId()) {
throw new Exception("You are not allowed to edit this user");
}
示例9: switchAction
//.........这里部分代码省略.........
if (RecycleBinManager::recycleEnabled() && $dir == "" && "/" . $nodeName == RecycleBinManager::getRecyclePath()) {
continue;
}
if ($limitPerPage > 0 && $cursor - $offset >= $limitPerPage) {
break;
}
$currentFile = $nonPatchedPath . "/" . $nodeName;
$meta = array();
if ($isLeaf != "") {
$meta = array("is_file" => $isLeaf ? "1" : "0");
}
$node = new AJXP_Node($currentFile, $meta);
$node->setLabel($nodeName);
$node->loadNodeInfo(false, false, $lsOptions["l"] ? "all" : "minimal");
if (!empty($node->metaData["nodeName"]) && $node->metaData["nodeName"] != $nodeName) {
$node->setUrl($nonPatchedPath . "/" . $node->metaData["nodeName"]);
}
if (!empty($node->metaData["hidden"]) && $node->metaData["hidden"] === true) {
continue;
}
if (!empty($node->metaData["mimestring_id"]) && array_key_exists($node->metaData["mimestring_id"], $mess)) {
$node->mergeMetadata(array("mimestring" => $mess[$node->metaData["mimestring_id"]]));
}
if (isset($originalLimitPerPage) && $cursor > $originalLimitPerPage) {
$node->mergeMetadata(array("page_position" => floor($cursor / $originalLimitPerPage) + 1));
}
$nodeType = "d";
if ($node->isLeaf()) {
if (AJXP_Utils::isBrowsableArchive($nodeName)) {
if ($lsOptions["f"] && $lsOptions["z"]) {
$nodeType = "f";
} else {
$nodeType = "z";
}
} else {
$nodeType = "f";
}
}
// There is a special sorting, cancel the reordering of files & folders.
if (isset($orderField) && $orderField != "ajxp_label") {
$nodeType = "f";
}
$fullList[$nodeType][$nodeName] = $node;
$cursor++;
if (isset($uniqueFile) && $nodeName != $uniqueFile) {
break;
}
}
if (isset($httpVars["recursive"]) && $httpVars["recursive"] == "true") {
$breakNow = false;
if (isset($max_depth) && $max_depth > 0 && $crt_depth >= $max_depth) {
$breakNow = true;
}
if (isset($max_nodes) && $max_nodes > 0 && $crt_nodes >= $max_nodes) {
$breakNow = true;
}
foreach ($fullList["d"] as &$nodeDir) {
if ($breakNow) {
$nodeDir->mergeMetadata(array("ajxp_has_children" => $this->countFiles($nodeDir->getUrl(), false, true) ? "true" : "false"));
AJXP_XMLWriter::renderAjxpNode($nodeDir, true);
continue;
}
$this->switchAction("ls", array("dir" => SystemTextEncoding::toUTF8($nodeDir->getPath()), "options" => $httpVars["options"], "recursive" => "true", "max_depth" => $max_depth, "max_nodes" => $max_nodes, "crt_depth" => $crt_depth, "crt_nodes" => $crt_nodes), array());
}
} else {
array_map(array("AJXP_XMLWriter", "renderAjxpNode"), $fullList["d"]);
}
array_map(array("AJXP_XMLWriter", "renderAjxpNode"), $fullList["z"]);
array_map(array("AJXP_XMLWriter", "renderAjxpNode"), $fullList["f"]);
// ADD RECYCLE BIN TO THE LIST
if ($dir == "" && !$uniqueFile && RecycleBinManager::recycleEnabled() && $this->getFilteredOption("HIDE_RECYCLE", $this->repository->getId()) !== true) {
$recycleBinOption = RecycleBinManager::getRelativeRecycle();
if (file_exists($this->urlBase . $recycleBinOption)) {
$recycleNode = new AJXP_Node($this->urlBase . $recycleBinOption);
$recycleNode->loadNodeInfo();
AJXP_XMLWriter::renderAjxpNode($recycleNode);
}
}
$this->logDebug("LS Time : " . intval((microtime() - $startTime) * 1000) . "ms");
AJXP_XMLWriter::close();
break;
}
$xmlBuffer = "";
if (isset($logMessage) || isset($errorMessage)) {
$xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
}
if ($reloadContextNode) {
if (!isset($pendingSelection)) {
$pendingSelection = "";
}
$xmlBuffer .= AJXP_XMLWriter::reloadDataNode("", $pendingSelection, false);
}
if (isset($reloadDataNode)) {
$xmlBuffer .= AJXP_XMLWriter::reloadDataNode($reloadDataNode, "", false);
}
if (isset($nodesDiffs)) {
$xmlBuffer .= AJXP_XMLWriter::writeNodesDiff($nodesDiffs, false);
}
return $xmlBuffer;
}
示例10: switchAction
//.........这里部分代码省略.........
}
$fp = fopen($fileName, "w");
fputs($fp, $code);
fclose($fp);
header("Content-Type:text/plain");
print $mess[115];
exit(0);
break;
//------------------------------------
// COPY / MOVE
//------------------------------------
//------------------------------------
// COPY / MOVE
//------------------------------------
case "copy":
case "move":
if ($selection->isEmpty()) {
throw new AJXP_Exception("", 113);
}
$success = $error = array();
$dest = AJXP_Utils::decodeSecureMagic($httpVars["dest"]);
if ($selection->inZip()) {
// Set action to copy anycase (cannot move from the zip).
$action = "copy";
}
$this->copyOrMove($dest, $selection->getFiles(), $error, $success, $action == "move" ? true : false);
if (count($error)) {
throw new AJXP_Exception(join("\n", $error));
} else {
$logMessage = join("\n", $success);
AJXP_Logger::logAction($action == "move" ? "Move" : "Copy", array("files" => $selection, "destination" => $dest));
}
$reloadContextNode = true;
$reloadDataNode = $dest;
break;
//------------------------------------
// SUPPRIMER / DELETE
//------------------------------------
//------------------------------------
// SUPPRIMER / DELETE
//------------------------------------
case "delete":
if ($selection->isEmpty()) {
throw new AJXP_Exception("", 113);
}
$logMessages = array();
$errorMessage = $this->delete($selection->getFiles(), $logMessages);
if (count($logMessages)) {
$logMessage = join("\n", $logMessages);
}
if ($errorMessage) {
throw new AJXP_Exception($errorMessage);
}
AJXP_Logger::logAction("Delete", array("files" => $selection));
$reloadContextNode = true;
break;
//------------------------------------
// RENOMMER / RENAME
//------------------------------------
//------------------------------------
// RENOMMER / RENAME
//------------------------------------
case "rename":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$filename_new = AJXP_Utils::decodeSecureMagic($httpVars["filename_new"]);
$this->rename($file, $filename_new);
示例11: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
parent::accessPreprocess($action, $httpVars, $fileVars);
$loggedUser = AuthService::getLoggedUser();
if (AuthService::usersEnabled() && !$loggedUser->isAdmin()) {
return;
}
if ($action == "edit") {
if (isset($httpVars["sub_action"])) {
$action = $httpVars["sub_action"];
}
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// BASIC LISTING
//------------------------------------
case "ls":
$rootNodes = array("data" => array("LABEL" => $mess["ajxp_conf.110"], "ICON" => "user.png", "CHILDREN" => array("repositories" => array("LABEL" => $mess["ajxp_conf.3"], "ICON" => "hdd_external_unmount.png", "LIST" => "listRepositories"), "users" => array("LABEL" => $mess["ajxp_conf.2"], "ICON" => "user.png", "LIST" => "listUsers"), "roles" => array("LABEL" => $mess["ajxp_conf.69"], "ICON" => "yast_kuser.png", "LIST" => "listRoles"))), "config" => array("LABEL" => $mess["ajxp_conf.109"], "ICON" => "preferences_desktop.png", "CHILDREN" => array("core" => array("LABEL" => $mess["ajxp_conf.98"], "ICON" => "preferences_desktop.png", "LIST" => "listPlugins"), "plugins" => array("LABEL" => $mess["ajxp_conf.99"], "ICON" => "folder_development.png", "LIST" => "listPlugins"))), "admin" => array("LABEL" => $mess["ajxp_conf.111"], "ICON" => "toggle_log.png", "CHILDREN" => array("logs" => array("LABEL" => $mess["ajxp_conf.4"], "ICON" => "toggle_log.png", "LIST" => "listLogFiles"), "files" => array("LABEL" => $mess["ajxp_shared.3"], "ICON" => "html.png", "LIST" => "listSharedFiles"), "diagnostic" => array("LABEL" => $mess["ajxp_conf.5"], "ICON" => "susehelpcenter.png", "LIST" => "printDiagnostic"))));
AJXP_Controller::applyHook("ajxp_conf.list_config_nodes", array(&$rootNodes));
$dir = trim(AJXP_Utils::decodeSecureMagic(isset($httpVars["dir"]) ? $httpVars["dir"] : ""), " /");
if ($dir != "") {
$splits = explode("/", $dir);
$root = array_shift($splits);
if (count($splits)) {
$child = $splits[0];
if (strstr(urldecode($child), "#") !== false) {
list($child, $hash) = explode("#", urldecode($child));
}
if (isset($rootNodes[$root]["CHILDREN"][$child])) {
$callback = $rootNodes[$root]["CHILDREN"][$child]["LIST"];
if (is_string($callback) && method_exists($this, $callback)) {
AJXP_XMLWriter::header();
call_user_func(array($this, $callback), implode("/", $splits), $root, $hash);
AJXP_XMLWriter::close();
} else {
if (is_array($callback)) {
call_user_func($callback, implode("/", $splits), $root, $hash);
}
}
return;
}
} else {
$parentName = "/" . $root . "/";
$nodes = $rootNodes[$root]["CHILDREN"];
}
} else {
$parentName = "/";
$nodes = $rootNodes;
}
if (isset($nodes)) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.1" attributeName="ajxp_label" sortType="String"/></columns>');
foreach ($nodes as $key => $data) {
print '<tree text="' . AJXP_Utils::xmlEntities($data["LABEL"]) . '" icon="' . $data["ICON"] . '" filename="' . $parentName . $key . '"/>';
}
AJXP_XMLWriter::close();
}
break;
case "stat":
header("Content-type:application/json");
print '{"mode":true}';
return;
break;
case "create_role":
$roleId = AJXP_Utils::sanitize(SystemTextEncoding::magicDequote($httpVars["role_id"]), AJXP_SANITIZE_HTML_STRICT);
if (!strlen($roleId)) {
throw new Exception($mess[349]);
}
if (AuthService::getRole($roleId) !== false) {
throw new Exception($mess["ajxp_conf.65"]);
}
AuthService::updateRole(new AjxpRole($roleId));
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage($mess["ajxp_conf.66"], null);
AJXP_XMLWriter::reloadDataNode("", $httpVars["role_id"]);
AJXP_XMLWriter::close();
break;
case "edit_role":
$roleId = SystemTextEncoding::magicDequote($httpVars["role_id"]);
$role = AuthService::getRole($roleId);
if ($role === false) {
throw new Exception("Cant find role! ");
}
AJXP_XMLWriter::header("admin_data");
print AJXP_XMLWriter::writeRoleRepositoriesData($role);
AJXP_XMLWriter::close("admin_data");
break;
case "update_role_right":
if (!isset($httpVars["role_id"]) || !isset($httpVars["repository_id"]) || !isset($httpVars["right"])) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.61"]);
print "<update_checkboxes user_id=\"" . $httpVars["role_id"] . "\" repository_id=\"" . $httpVars["repository_id"] . "\" read=\"old\" write=\"old\"/>";
AJXP_XMLWriter::close();
return;
}
$role = AuthService::getRole($httpVars["role_id"]);
//.........这里部分代码省略.........
示例12: switchAction
//.........这里部分代码省略.........
$currentPage = 1;
}
$query = "SELECT * FROM {$tableName}";
$searchQuery = false;
if ($tableName == "ajxpmysqldriver_searchresults") {
if (isset($_SESSION["LAST_SQL_QUERY"])) {
$query = $_SESSION["LAST_SQL_QUERY"];
$matches = array();
if (preg_match("/SELECT [\\S, ]* FROM (\\S*).*/i", $query, $matches) !== false) {
$tableName = $matches[1];
$searchQuery = true;
} else {
break;
}
} else {
break;
}
}
if (isset($order_column)) {
$query .= " ORDER BY {$order_column} " . strtoupper($order_direction);
if (!isset($_SESSION["AJXP_ORDER_DATA"])) {
$_SESSION["AJXP_ORDER_DATA"] = array();
}
$_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName] = array("column" => $order_column, "dir" => $order_direction);
} else {
if (isset($_SESSION["AJXP_ORDER_DATA"])) {
if (isset($_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName])) {
$order_column = $_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName]["column"];
$order_direction = $_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName]["dir"];
$query .= " ORDER BY {$order_column} " . strtoupper($order_direction);
}
}
}
try {
$result = $this->showRecords($query, $tableName, $currentPage);
} catch (AJXP_Exception $ex) {
unset($_SESSION["LAST_SQL_QUERY"]);
throw $ex;
}
AJXP_XMLWriter::header();
$blobCols = array();
$columnsString = '<columns switchDisplayMode="list" switchGridMode="grid">';
foreach ($result["COLUMNS"] as $col) {
$columnsString .= "<column messageString=\"" . $col["NAME"] . "\" attributeName=\"" . $col["NAME"] . "\" field_name=\"" . $col["NAME"] . "\" field_type=\"" . $col["TYPE"] . "\" field_size=\"" . $col["LENGTH"] . "\" field_flags=\"" . $this->cleanFlagString($col["FLAGS"]) . "\" field_pk=\"" . (preg_match("/primary/", $col["FLAGS"]) ? "1" : "0") . "\" field_null=\"" . (preg_match("/not_null/", $col["FLAGS"]) ? "NOT_NULL" : "NULL") . "\" sortType=\"" . $this->sqlTypeToSortType($col["TYPE"]) . "\" field_default=\"" . $col["DEFAULT"] . "\"/>";
if (stristr($col["TYPE"], "blob") !== false && ($col["FLAGS"] != "" && stristr($col["FLAGS"], "binary"))) {
$blobCols[] = $col["NAME"];
}
}
$columnsString .= '</columns>';
AJXP_XMLWriter::sendFilesListComponentConfig($columnsString);
//print '<pagination total="'.$result["TOTAL_PAGES"].'" current="'.$currentPage.'" remote_order="true" currentOrderCol="'.$order_column.'" currentOrderDir="'.$order_direction.'"/>';
if ($result["TOTAL_PAGES"] > 1) {
AJXP_XMLWriter::renderPaginationData($count, $currentPage, $result["TOTAL_PAGES"]);
}
foreach ($result["ROWS"] as $arbitIndex => $row) {
print '<tree ';
$pkString = "";
foreach ($row as $key => $value) {
if (in_array($key, $blobCols)) {
$sizeStr = " - NULL";
if (strlen($value)) {
$sizeStr = " - " . AJXP_Utils::roundSize(strlen($value));
}
print "{$key}=\"BLOB{$sizeStr}\" ";
} else {
$value = str_replace("\"", "", $value);
$value = AJXP_Utils::xmlEntities($value);
print $key . '="' . SystemTextEncoding::toUTF8($value) . '" ';
if ($result["HAS_PK"] > 0) {
if (in_array($key, $result["PK_FIELDS"])) {
$pkString .= $key . "__" . $value . ".";
}
}
}
}
if ($result["HAS_PK"] > 0) {
print 'filename="record.' . $pkString . 'pk" ';
print 'is_file="1" ajxp_mime="pk"/>';
} else {
print 'filename="record_' . $arbitIndex . '.no_pk" ';
print 'is_file="1" ajxp_mime="row"/>';
}
}
AJXP_XMLWriter::close();
}
$this->closeDbLink($link);
exit(1);
break;
}
if (isset($logMessage) || isset($errorMessage)) {
$xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
}
if (isset($requireAuth)) {
$xmlBuffer .= AJXP_XMLWriter::requireAuth(false);
}
if (isset($reload_current_node) && $reload_current_node == "true" || isset($reload_file_list)) {
$xmlBuffer .= AJXP_XMLWriter::reloadDataNode("", "", false);
}
return $xmlBuffer;
}
示例13: switchAction
//.........这里部分代码省略.........
readfile(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/core.conf/" . $logo);
}
break;
case "get_user_templates_definition":
AJXP_XMLWriter::header("repository_templates");
$repositories = ConfService::getRepositoriesList();
$pServ = AJXP_PluginsService::getInstance();
foreach ($repositories as $repo) {
if (!$repo->isTemplate) {
continue;
}
if (!$repo->getOption("TPL_USER_CAN_CREATE")) {
continue;
}
$repoId = $repo->getUniqueId();
$repoLabel = $repo->getDisplay();
$repoType = $repo->getAccessType();
print "<template repository_id=\"{$repoId}\" repository_label=\"{$repoLabel}\" repository_type=\"{$repoType}\">";
$driverPlug = $pServ->getPluginByTypeName("access", $repoType);
$params = $driverPlug->getManifestRawContent("//param", "node");
$tplDefined = $repo->getOptionsDefined();
$defaultLabel = '';
foreach ($params as $paramNode) {
$name = $paramNode->getAttribute("name");
if (strpos($name, "TPL_") === 0) {
if ($name == "TPL_DEFAULT_LABEL") {
$defaultLabel = str_replace("AJXP_USER", AuthService::getLoggedUser()->getId(), $repo->getOption($name));
}
continue;
}
if (in_array($paramNode->getAttribute("name"), $tplDefined)) {
continue;
}
if ($paramNode->getAttribute('no_templates') == 'true') {
continue;
}
print AJXP_XMLWriter::replaceAjxpXmlKeywords($paramNode->ownerDocument->saveXML($paramNode));
}
// ADD LABEL
echo '<param name="DISPLAY" type="string" label="' . $mess[359] . '" description="' . $mess[429] . '" mandatory="true" default="' . $defaultLabel . '"/>';
print "</template>";
}
AJXP_XMLWriter::close("repository_templates");
break;
case "user_create_repository":
$tplId = $httpVars["template_id"];
$tplRepo = ConfService::getRepositoryById($tplId);
$options = array();
self::parseParameters($httpVars, $options);
$newRep = $tplRepo->createTemplateChild(AJXP_Utils::sanitize($httpVars["DISPLAY"]), $options, null, AuthService::getLoggedUser()->getId());
$res = ConfService::addRepository($newRep);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, $mess[426]);
} else {
$loggedUser = AuthService::getLoggedUser();
// Make sure we do not overwrite otherwise loaded rights.
$loggedUser->load();
$loggedUser->setRight($newRep->getUniqueId(), "rw");
$loggedUser->save("superuser");
AuthService::updateUser($loggedUser);
AJXP_XMLWriter::sendMessage($mess[425], null);
AJXP_XMLWriter::reloadDataNode("", $newRep->getUniqueId());
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
break;
case "user_delete_repository":
$repoId = $httpVars["repository_id"];
$repository = ConfService::getRepositoryById($repoId);
if (!$repository->getUniqueUser() || $repository->getUniqueUser() != AuthService::getLoggedUser()->getId()) {
throw new Exception("You are not allowed to perform this operation!");
}
$res = ConfService::deleteRepository($repoId);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, $mess[427]);
} else {
$loggedUser = AuthService::getLoggedUser();
// Make sure we do not override remotely set rights
$loggedUser->load();
$loggedUser->removeRights($repoId);
$loggedUser->save("superuser");
AuthService::updateUser($loggedUser);
AJXP_XMLWriter::sendMessage($mess[428], null);
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
break;
default:
break;
}
if (isset($logMessage) || isset($errorMessage)) {
$xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
}
if (isset($requireAuth)) {
$xmlBuffer .= AJXP_XMLWriter::requireAuth(false);
}
return $xmlBuffer;
}
示例14: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
parent::accessPreprocess($action, $httpVars, $fileVars);
if (!AuthService::usersEnabled()) {
return;
}
if ($action == "edit") {
if (isset($httpVars["sub_action"])) {
$action = $httpVars["sub_action"];
}
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// BASIC LISTING
//------------------------------------
case "ls":
$rootNodes = array("users" => array("LABEL" => $mess["user_dash.1"], "ICON" => "user_shared.png", "ICON-CLASS" => "icon-book", "DESCRIPTION" => $mess["user_dash.30"]), "files" => array("LABEL" => $mess["user_dash.34"], "ICON" => "user_shared.png", "ICON-CLASS" => "mdi mdi-share-variant", "DESCRIPTION" => $mess["user_dash.35"]), "settings" => array("LABEL" => $mess["user_dash.36"], "ICON" => "user_shared.png", "ICON-CLASS" => "icon-cog", "DESCRIPTION" => $mess["user_dash.37"]), "repositories" => array("LABEL" => $mess["user_dash.36"], "ICON" => "user_shared.png", "ICON-CLASS" => "icon-cog", "DESCRIPTION" => $mess["user_dash.37"]), "teams" => array("LABEL" => "Teams", "ICON" => "user_shared.png", "ICON-CLASS" => "icon-group", "DESCRIPTION" => "My Teams"));
$dir = isset($httpVars["dir"]) ? $httpVars["dir"] : "";
$splits = explode("/", $dir);
if (count($splits)) {
if ($splits[0] == "") {
array_shift($splits);
}
if (count($splits)) {
$strippedDir = strtolower(urldecode($splits[0]));
} else {
$strippedDir = "";
}
}
if (array_key_exists($strippedDir, $rootNodes)) {
AJXP_XMLWriter::header();
if ($strippedDir == "users") {
$this->listUsers();
} else {
if ($strippedDir == "teams") {
$this->listTeams();
} else {
if ($strippedDir == "repositories") {
$this->listRepositories();
} else {
if ($strippedDir == "files") {
$this->listSharedFiles("files");
}
}
}
}
AJXP_XMLWriter::close();
} else {
AJXP_XMLWriter::header();
/*
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="user_dash.8" attributeName="ajxp_label" sortType="String"/><column messageId="user_dash.31" attributeName="description" sortType="String"/></columns>');
foreach ($rootNodes as $key => $data) {
$l = $data["LABEL"];
print '<tree text="'.$l.'" icon="'.$data["ICON"].'" filename="/'.$key.'" parentname="/" description="'.$data["DESCRIPTION"].'" />';
}
*/
AJXP_XMLWriter::close();
}
break;
case "stat":
header("Content-type:application/json");
print '{"mode":true}';
break;
case "delete":
$mime = $httpVars["ajxp_mime"];
$selection = new UserSelection();
$selection->initFromHttpVars($httpVars);
$files = $selection->getFiles();
AJXP_XMLWriter::header();
$minisites = $this->listSharedFiles("minisites");
/**
* @var ShareCenter $shareCenter
*/
$shareCenter = AJXP_PluginsService::findPluginById("action.share");
foreach ($files as $index => $element) {
$element = basename($element);
$ar = explode("shared_", $mime);
$mime = array_pop($ar);
if ($mime == "repository" && isset($minisites[$element])) {
$mime = "minisite";
$element = $minisites[$element];
}
$shareCenter->getShareStore()->deleteShare($mime, $element);
if ($mime == "repository" || $mime == "minisite") {
$out = $mess["ajxp_conf.59"];
} else {
if ($mime == "user") {
$out = $mess["ajxp_conf.60"];
} else {
if ($mime == "file") {
$out = $mess["user_dash.13"];
}
}
}
}
AJXP_XMLWriter::sendMessage($out, null);
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
break;
//.........这里部分代码省略.........
示例15: handleTasks
public function handleTasks($action, $httpVars, $fileVars)
{
$tasks = AJXP_Utils::loadSerialFile($this->getDbFile(), false, "json");
switch ($action) {
case "scheduler_addTask":
if (isset($httpVars["task_id"])) {
foreach ($tasks as $index => $task) {
if ($task["task_id"] == $httpVars["task_id"]) {
$data = $task;
$theIndex = $index;
}
}
}
if (!isset($theIndex)) {
$data = array();
$data["task_id"] = substr(md5(time()), 0, 16);
}
$data["label"] = $httpVars["label"];
$data["schedule"] = $httpVars["schedule"];
$data["action_name"] = $httpVars["action_name"];
$data["repository_id"] = $httpVars["repository_id"];
$i = 1;
while (array_key_exists("repository_id_" . $i, $httpVars)) {
$data["repository_id"] .= "," . $httpVars["repository_id_" . $i];
$i++;
}
$data["user_id"] = $httpVars["user_id"];
$data["PARAMS"] = array();
if (!empty($httpVars["param_name"]) && !empty($httpVars["param_value"])) {
$data["PARAMS"][$httpVars["param_name"]] = $httpVars["param_value"];
}
foreach ($httpVars as $key => $value) {
if (preg_match('/^param_name_/', $key)) {
$paramIndex = str_replace("param_name_", "", $key);
if (preg_match('/ajxptype/', $paramIndex)) {
continue;
}
if (preg_match('/replication/', $paramIndex)) {
continue;
}
if (isset($httpVars["param_value_" . $paramIndex])) {
$data["PARAMS"][$value] = $httpVars["param_value_" . $paramIndex];
}
}
}
if (isset($theIndex)) {
$tasks[$theIndex] = $data;
} else {
$tasks[] = $data;
}
AJXP_Utils::saveSerialFile($this->getDbFile(), $tasks, true, false, "json");
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage("Successfully added/edited task", null);
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
break;
case "scheduler_removeTask":
$this->removeTask($httpVars["task_id"]);
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage("Successfully removed task", null);
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
break;
case "scheduler_loadTask":
$found = false;
foreach ($tasks as $task) {
if ($task["task_id"] == $httpVars["task_id"]) {
$index = 0;
$found = true;
foreach ($task["PARAMS"] as $pName => $pValue) {
if ($index == 0) {
$task["param_name"] = $pName;
$task["param_value"] = $pValue;
} else {
$task["param_name_" . $index] = $pName;
$task["param_value_" . $index] = $pValue;
}
$index++;
}
unset($task["PARAMS"]);
if (strpos($task["repository_id"], ",") !== false) {
$ids = explode(",", $task["repository_id"]);
$task["repository_id"] = $ids[0];
for ($i = 1; $i < count($ids); $i++) {
$task["repository_id_" . $i] = $ids[$i];
}
}
break;
}
}
if ($found) {
HTMLWriter::charsetHeader("application/json");
echo json_encode($task);
}
break;
default:
break;
}
//var_dump($tasks);
}