当前位置: 首页>>代码示例>>PHP>>正文


PHP AJXP_XMLWriter::writeNodesDiff方法代码示例

本文整理汇总了PHP中AJXP_XMLWriter::writeNodesDiff方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::writeNodesDiff方法的具体用法?PHP AJXP_XMLWriter::writeNodesDiff怎么用?PHP AJXP_XMLWriter::writeNodesDiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AJXP_XMLWriter的用法示例。


在下文中一共展示了AJXP_XMLWriter::writeNodesDiff方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: receiveAction


//.........这里部分代码省略.........
                 file_put_contents($progressCompressionFileName, sprintf($messages["compression.7"], strtoupper($archiveTypeCompress)));
                 if ($archiveTypeCompress == "gz") {
                     $archive->compress(Phar::GZ);
                 } elseif ($archiveTypeCompress == "bz2") {
                     $archive->compress(Phar::BZ2);
                 }
                 $finalArchive = $tmpArchiveName . "." . $archiveTypeCompress;
             }
             $destArchive = AJXP_MetaStreamWrapper::getRealFSReference($currentDirUrl . $archiveName);
             rename($finalArchive, $destArchive);
             AJXP_Controller::applyHook("node.before_create", array($destArchive, filesize($destArchive)));
             if (file_exists($tmpArchiveName)) {
                 unlink($tmpArchiveName);
                 unlink(substr($tmpArchiveName, 0, -4));
             }
             $newNode = new AJXP_Node($currentDirUrl . $archiveName);
             AJXP_Controller::applyHook("node.change", array(null, $newNode, false));
             file_put_contents($progressCompressionFileName, "SUCCESS");
         }
     } elseif ($action == "check_compression_status") {
         $archivePath = AJXP_Utils::decodeSecureMagic($httpVars["archive_path"]);
         $progressCompression = file_get_contents($progressCompressionFileName);
         $substrProgressCompression = substr($progressCompression, 0, 5);
         if ($progressCompression != "SUCCESS" && $substrProgressCompression != "Error") {
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::triggerBgAction("check_compression_status", array("repository_id" => $repository->getId(), "compression_id" => $compressionId, "archive_path" => SystemTextEncoding::toUTF8($archivePath)), $progressCompression, true, 5);
             AJXP_XMLWriter::close();
         } elseif ($progressCompression == "SUCCESS") {
             $newNode = new AJXP_Node($userSelection->currentBaseUrl() . $archivePath);
             $nodesDiffs = array("ADD" => array($newNode), "REMOVE" => array(), "UPDATE" => array());
             AJXP_Controller::applyHook("node.change", array(null, $newNode, false));
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::sendMessage($messages["compression.8"], null);
             AJXP_XMLWriter::writeNodesDiff($nodesDiffs, true);
             AJXP_XMLWriter::close();
             if (file_exists($progressCompressionFileName)) {
                 unlink($progressCompressionFileName);
             }
         } elseif ($substrProgressCompression == "Error") {
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::sendMessage(null, $progressCompression);
             AJXP_XMLWriter::close();
             if (file_exists($progressCompressionFileName)) {
                 unlink($progressCompressionFileName);
             }
         }
     } elseif ($action == "extraction") {
         $fileArchive = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["file"]), AJXP_SANITIZE_DIRNAME);
         $fileArchive = substr(strrchr($fileArchive, DIRECTORY_SEPARATOR), 1);
         $authorizedExtension = array("tar" => 4, "gz" => 7, "bz2" => 8);
         $acceptedArchive = false;
         $extensionLength = 0;
         $counterExtract = 0;
         $currentAllPydioPath = $currentDirUrl . $fileArchive;
         $pharCurrentAllPydioPath = "phar://" . AJXP_MetaStreamWrapper::getRealFSReference($currentAllPydioPath);
         $pathInfoCurrentAllPydioPath = pathinfo($currentAllPydioPath, PATHINFO_EXTENSION);
         //WE TAKE ONLY TAR, TAR.GZ AND TAR.BZ2 ARCHIVES
         foreach ($authorizedExtension as $extension => $strlenExtension) {
             if ($pathInfoCurrentAllPydioPath == $extension) {
                 $acceptedArchive = true;
                 $extensionLength = $strlenExtension;
                 break;
             }
         }
         if ($acceptedArchive == false) {
             file_put_contents($progressExtractFileName, "Error : " . $messages["compression.15"]);
开发者ID:Nanomani,项目名称:pydio-core,代码行数:67,代码来源:class.PluginCompression.php

示例2: postProcess

 public function postProcess($action, $httpVars, $postProcessData)
 {
     if (!isset($httpVars["simple_uploader"]) && !isset($httpVars["xhr_uploader"]) && !isset($httpVars["force_post"])) {
         return false;
     }
     $this->logDebug("SimpleUploadProc is active");
     $result = $postProcessData["processor_result"];
     if (isset($httpVars["simple_uploader"])) {
         print "<html><script language=\"javascript\">\n";
         if (isset($result["ERROR"])) {
             $message = $result["ERROR"]["MESSAGE"] . " (" . $result["ERROR"]["CODE"] . ")";
             print "\n if(parent.ajaxplorer.actionBar.multi_selector) parent.ajaxplorer.actionBar.multi_selector.submitNext('" . str_replace("'", "\\'", $message) . "');";
         } else {
             print "\n if(parent.ajaxplorer.actionBar.multi_selector) parent.ajaxplorer.actionBar.multi_selector.submitNext();";
             if (isset($result["CREATED_NODE"]) || isset($result["UPDATED_NODE"])) {
                 $s = '<tree>';
                 $s .= AJXP_XMLWriter::writeNodesDiff(array(isset($result["UPDATED_NODE"]) ? "UPDATE" : "ADD" => array($result[(isset($result["UPDATED_NODE"]) ? "UPDATED" : "CREATED") . "_NODE"])), false);
                 $s .= '</tree>';
                 print "\n var resultString = '" . $s . "'; var resultXML = parent.parseXml(resultString);";
                 print "\n parent.ajaxplorer.actionBar.parseXmlMessage(resultXML);";
             }
         }
         print "</script></html>";
     } else {
         if (isset($result["ERROR"])) {
             $message = $result["ERROR"]["MESSAGE"] . " (" . $result["ERROR"]["CODE"] . ")";
             exit($message);
         } else {
             AJXP_XMLWriter::header();
             if (isset($result["CREATED_NODE"]) || isset($result["UPDATED_NODE"])) {
                 AJXP_XMLWriter::writeNodesDiff(array(isset($result["UPDATED_NODE"]) ? "UPDATE" : "ADD" => array($result[(isset($result["UPDATED_NODE"]) ? "UPDATED" : "CREATED") . "_NODE"])), true);
             }
             AJXP_XMLWriter::close();
             /* for further implementation */
             if (!isset($result["PREVENT_NOTIF"])) {
                 if (isset($result["CREATED_NODE"])) {
                     AJXP_Controller::applyHook("node.change", array(null, $result["CREATED_NODE"], false));
                 } else {
                     if (isset($result["UPDATED_NODE"])) {
                         AJXP_Controller::applyHook("node.change", array($result["UPDATED_NODE"], $result["UPDATED_NODE"], false));
                     }
                 }
             }
             //exit("OK");
         }
     }
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:47,代码来源:class.SimpleUploadProcessor.php

示例3: switchActions

 public function switchActions($actionName, $httpVars, $fileVars)
 {
     switch ($actionName) {
         case "toggle_watch":
             $us = new UserSelection();
             $us->initFromHttpVars($httpVars);
             $node = $us->getUniqueNode($this->accessDriver);
             $node->loadNodeInfo();
             $cmd = $httpVars["watch_action"];
             $meta = $this->metaStore->retrieveMetadata($node, self::$META_WATCH_NAMESPACE, false, AJXP_METADATA_SCOPE_REPOSITORY);
             $userId = AuthService::getLoggedUser() != null ? AuthService::getLoggedUser()->getId() : "shared";
             if ($cmd == "watch_stop" && isset($meta) && isset($meta[$userId])) {
                 unset($meta[$userId]);
                 $this->metaStore->removeMetadata($node, self::$META_WATCH_NAMESPACE, false, AJXP_METADATA_SCOPE_REPOSITORY);
             } else {
                 switch ($cmd) {
                     case "watch_change":
                         $type = self::$META_WATCH_CHANGE;
                         break;
                     case "watch_read":
                         $type = self::$META_WATCH_READ;
                         break;
                     case "watch_both":
                         $type = self::$META_WATCH_BOTH;
                         break;
                     default:
                         break;
                 }
                 $meta[$userId] = $type;
                 $this->metaStore->setMetadata($node, self::$META_WATCH_NAMESPACE, $meta, false, AJXP_METADATA_SCOPE_REPOSITORY);
             }
             AJXP_XMLWriter::header();
             $node->metadata = array();
             $node->loadNodeInfo(true, false, "all");
             $this->enrichNode($node);
             AJXP_XMLWriter::writeNodesDiff(array("UPDATE" => array($node->getPath() => $node)), true);
             AJXP_XMLWriter::close();
             break;
         default:
             break;
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:42,代码来源:class.MetaWatchRegister.php

示例4: editMeta

 public function editMeta($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);
     $nodes = $selection->buildNodes();
     $nodesDiffs = array();
     $def = $this->getMetaDefinition();
     foreach ($nodes as $ajxpNode) {
         $newValues = array();
         //$ajxpNode->setDriver($this->accessDriver);
         AJXP_Controller::applyHook("node.before_change", array(&$ajxpNode));
         foreach ($def as $key => $data) {
             if (isset($httpVars[$key])) {
                 $newValues[$key] = AJXP_Utils::decodeSecureMagic($httpVars[$key]);
                 if ($data["type"] == "tags") {
                     $this->updateTags(AJXP_Utils::decodeSecureMagic($httpVars[$key]));
                 }
             } else {
                 if (!isset($original)) {
                     $original = $ajxpNode->retrieveMetadata("users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
                 }
                 if (isset($original) && isset($original[$key])) {
                     $newValues[$key] = $original[$key];
                 }
             }
         }
         $ajxpNode->setMetadata("users_meta", $newValues, false, AJXP_METADATA_SCOPE_GLOBAL);
         AJXP_Controller::applyHook("node.meta_change", array($ajxpNode));
         $nodesDiffs[$ajxpNode->getPath()] = $ajxpNode;
     }
     AJXP_XMLWriter::header();
     AJXP_XMLWriter::writeNodesDiff(array("UPDATE" => $nodesDiffs), true);
     AJXP_XMLWriter::close();
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:41,代码来源:class.UserMetaManager.php

示例5: switchAction


//.........这里部分代码省略.........
                         $httpVars["return_json"] = true;
                         if (isset($httpVars["hash"]) && !empty($httpVars["hash"])) {
                             $httpHash = $httpVars["hash"];
                         }
                         $ajxpNode->loadNodeInfo();
                         $results = $this->shareNode($ajxpNode, $httpVars, $isUpdate);
                         if (is_array($results) && $ajxpNode->hasMetaStore() && !$ajxpNode->isRoot()) {
                             foreach ($results as $shareObject) {
                                 if ($shareObject instanceof \Pydio\OCS\Model\TargettedLink) {
                                     $hash = $shareObject->getHash();
                                     $this->getShareStore()->getMetaManager()->addShareInMeta($ajxpNode, "ocs_remote", $hash, $shareScope == "public", $hash);
                                 } else {
                                     if (is_a($shareObject, "ShareLink")) {
                                         $hash = $shareObject->getHash();
                                         $this->getShareStore()->getMetaManager()->addShareInMeta($ajxpNode, "minisite", $hash, $shareScope == "public", $httpHash != null && $hash != $httpHash ? $httpHash : null);
                                     } else {
                                         if (is_a($shareObject, "Repository")) {
                                             $this->getShareStore()->getMetaManager()->addShareInMeta($ajxpNode, "repository", $shareObject->getUniqueId(), $shareScope == "public", null);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             AJXP_Controller::applyHook("msg.instant", array("<reload_shared_elements/>", ConfService::getRepository()->getId()));
             /*
              * Send IM to inform that node has been shared or unshared.
              * Should be done only if share scope is public.
              */
             if ($shareScope == "public") {
                 $ajxpNode->loadNodeInfo();
                 $content = AJXP_XMLWriter::writeNodesDiff(["UPDATE" => array($ajxpNode->getPath() => $ajxpNode)]);
                 AJXP_Controller::applyHook("msg.instant", array($content, $ajxpNode->getRepositoryId(), null, null, [$ajxpNode->getPath()]));
             }
             if (!isset($httpVars["return_json"])) {
                 header("Content-Type: text/plain");
                 print $plainResult;
             } else {
                 $compositeShare = $this->getShareStore()->getMetaManager()->getCompositeShareForNode($ajxpNode);
                 header("Content-type:application/json");
                 if (!empty($compositeShare)) {
                     echo json_encode($this->compositeShareToJson($compositeShare));
                 } else {
                     echo json_encode(array());
                 }
             }
             // as the result can be quite small (e.g error code), make sure it's output in case of OB active.
             flush();
             break;
         case "toggle_link_watch":
             $userSelection = new UserSelection($this->repository, $httpVars);
             $shareNode = $selectedNode = $userSelection->getUniqueNode();
             $watchValue = $httpVars["set_watch"] == "true" ? true : false;
             $folder = false;
             if (isset($httpVars["element_type"]) && $httpVars["element_type"] == "folder") {
                 $folder = true;
                 $selectedNode = new AJXP_Node("pydio://" . AJXP_Utils::sanitize($httpVars["repository_id"], AJXP_SANITIZE_ALPHANUM) . "/");
             }
             $shares = array();
             $this->getShareStore()->getMetaManager()->getSharesFromMeta($shareNode, $shares, false);
             if (!count($shares)) {
                 break;
             }
             if (isset($httpVars["element_id"]) && isset($shares[$httpVars["element_id"]])) {
开发者ID:Nanomani,项目名称:pydio-core,代码行数:67,代码来源:class.ShareCenter.php

示例6: publishNodeChange

 /**
  * @param AJXP_Node $origNode
  * @param AJXP_Node $newNode
  * @param bool $copy
  */
 public function publishNodeChange($origNode = null, $newNode = null, $copy = false)
 {
     $content = "";
     $repo = "";
     $targetUserId = null;
     $nodePathes = array();
     $update = false;
     if ($newNode != null) {
         $repo = $newNode->getRepositoryId();
         $targetUserId = $newNode->getUser();
         $nodePathes[] = $newNode->getPath();
         $update = false;
         $data = array();
         if ($origNode != null && !$copy) {
             $update = true;
             $data[$origNode->getPath()] = $newNode;
         } else {
             $data[] = $newNode;
         }
         $content = AJXP_XMLWriter::writeNodesDiff(array($update ? "UPDATE" : "ADD" => $data));
     }
     if ($origNode != null && !$update && !$copy) {
         $repo = $origNode->getRepositoryId();
         $targetUserId = $origNode->getUser();
         $nodePathes[] = $origNode->getPath();
         $content = AJXP_XMLWriter::writeNodesDiff(array("REMOVE" => array($origNode->getPath())));
     }
     if (!empty($content) && $repo != "") {
         $this->sendInstantMessage($content, $repo, $targetUserId, null, $nodePathes);
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:36,代码来源:class.MqManager.php

示例7: 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;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:101,代码来源:class.fsAccessDriver.php

示例8: 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($httpVars);
     $currentFile = $selection->getUniqueFile();
     $urlBase = $this->accessDriver->getResourceUrl($currentFile);
     $ajxpNode = new AJXP_Node($urlBase);
     $newValues = array();
     $def = $this->getMetaDefinition();
     $ajxpNode->setDriver($this->accessDriver);
     AJXP_Controller::applyHook("node.before_change", array(&$ajxpNode));
     foreach ($def as $key => $data) {
         if (isset($httpVars[$key])) {
             $newValues[$key] = AJXP_Utils::decodeSecureMagic($httpVars[$key]);
         } else {
             if (!isset($original)) {
                 $original = $ajxpNode->retrieveMetadata("users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
             }
             if (isset($original) && isset($original[$key])) {
                 $newValues[$key] = $original[$key];
             }
         }
     }
     $ajxpNode->setMetadata("users_meta", $newValues, false, AJXP_METADATA_SCOPE_GLOBAL);
     AJXP_Controller::applyHook("node.meta_change", array($ajxpNode));
     AJXP_XMLWriter::header();
     AJXP_XMLWriter::writeNodesDiff(array("UPDATE" => array($ajxpNode->getPath() => $ajxpNode)), true);
     AJXP_XMLWriter::close();
 }
开发者ID:biggtfish,项目名称:cms,代码行数:40,代码来源:class.UserMetaManager.php


注:本文中的AJXP_XMLWriter::writeNodesDiff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。