• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AJXP_Node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: moveMeta

 /**
  *
  * @param AJXP_Node $oldFile
  * @param AJXP_Node $newFile
  * @param Boolean $copy
  */
 public function moveMeta($oldFile, $newFile = null, $copy = false)
 {
     if ($oldFile == null) {
         return;
     }
     $feedStore = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("feed");
     if ($feedStore !== false) {
         $feedStore->updateMetaObject($oldFile->getRepositoryId(), $oldFile->getPath(), $newFile != null ? $newFile->getPath() : null, $copy);
         return;
     }
     if (!$copy && $this->metaStore->inherentMetaMove()) {
         return;
     }
     $oldMeta = $this->metaStore->retrieveMetadata($oldFile, AJXP_META_SPACE_COMMENTS);
     if (!count($oldMeta)) {
         return;
     }
     // If it's a move or a delete, delete old data
     if (!$copy) {
         $this->metaStore->removeMetadata($oldFile, AJXP_META_SPACE_COMMENTS);
     }
     // If copy or move, copy data.
     if ($newFile != null) {
         $this->metaStore->setMetadata($newFile, AJXP_META_SPACE_COMMENTS, $oldMeta);
     }
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:32,代码来源:class.CommentsMetaManager.php


示例2: extractIndexableContent

 /**
  * @param AJXP_Node $ajxpNode
  * @return null|string
  */
 protected function extractIndexableContent($ajxpNode)
 {
     $ext = strtolower(pathinfo($ajxpNode->getLabel(), PATHINFO_EXTENSION));
     if (in_array($ext, explode(",", $this->getFilteredOption("PARSE_CONTENT_TXT")))) {
         return file_get_contents($ajxpNode->getUrl());
     }
     $unoconv = $this->getFilteredOption("UNOCONV");
     $pipe = false;
     if (!empty($unoconv) && in_array($ext, array("doc", "odt", "xls", "ods"))) {
         $targetExt = "txt";
         if (in_array($ext, array("xls", "ods"))) {
             $targetExt = "csv";
         } else {
             if (in_array($ext, array("odp", "ppt"))) {
                 $targetExt = "pdf";
                 $pipe = true;
             }
         }
         $realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
         $unoconv = "HOME=" . AJXP_Utils::getAjxpTmpDir() . " " . $unoconv . " --stdout -f {$targetExt} " . escapeshellarg($realFile);
         if ($pipe) {
             $newTarget = str_replace(".{$ext}", ".pdf", $realFile);
             $unoconv .= " > {$newTarget}";
             register_shutdown_function("unlink", $newTarget);
         }
         $output = array();
         exec($unoconv, $output, $return);
         if (!$pipe) {
             $out = implode("\n", $output);
             $enc = 'ISO-8859-1';
             $asciiString = iconv($enc, 'ASCII//TRANSLIT//IGNORE', $out);
             return $asciiString;
         } else {
             $ext = "pdf";
         }
     }
     $pdftotext = $this->getFilteredOption("PDFTOTEXT");
     if (!empty($pdftotext) && in_array($ext, array("pdf"))) {
         $realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
         if ($pipe && isset($newTarget) && is_file($newTarget)) {
             $realFile = $newTarget;
         }
         $cmd = $pdftotext . " " . escapeshellarg($realFile) . " -";
         $output = array();
         exec($cmd, $output, $return);
         $out = implode("\n", $output);
         $enc = 'UTF8';
         $asciiString = iconv($enc, 'ASCII//TRANSLIT//IGNORE', $out);
         return $asciiString;
     }
     return null;
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:56,代码来源:class.AbstractSearchEngineIndexer.php


示例3: computeIdForNode

 /**
  * @param AJXP_Node $node
  * @param string $cacheType
  * @param string $details
  * @return string
  */
 public static function computeIdForNode($node, $cacheType, $details = '')
 {
     $repo = $node->getRepository();
     if ($repo == null) {
         return "failed-id";
     }
     $scope = $repo->securityScope();
     $additional = "";
     if ($scope === "USER") {
         $additional = AuthService::getLoggedUser()->getId() . "@";
     } else {
         if ($scope == "GROUP") {
             $additional = ltrim(str_replace("/", "__", AuthService::getLoggedUser()->getGroupPath()), "__") . "@";
         }
     }
     $scheme = parse_url($node->getUrl(), PHP_URL_SCHEME);
     return str_replace($scheme . "://", $cacheType . "://" . $additional, $node->getUrl()) . ($details ? "##" . $details : "");
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:24,代码来源:class.AbstractCacheDriver.php


示例4: updateMetaShort

 protected function updateMetaShort($file, $elementId, $shortUrl)
 {
     $driver = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("access");
     $streamData = $driver->detectStreamWrapper(false);
     $baseUrl = $streamData["protocol"] . "://" . ConfService::getRepository()->getId();
     $node = new AJXP_Node($baseUrl . $file);
     if ($node->hasMetaStore()) {
         $metadata = $node->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY);
         if ($elementId != -1) {
             if (!is_array($metadata["element"][$elementId])) {
                 $metadata["element"][$elementId] = array();
             }
             $metadata["element"][$elementId]["short_form_url"] = $shortUrl;
         } else {
             $metadata['short_form_url'] = $shortUrl;
         }
         $node->setMetadata("ajxp_shared", $metadata, true, AJXP_METADATA_SCOPE_REPOSITORY);
     }
 }
开发者ID:biggtfish,项目名称:cms,代码行数:19,代码来源:class.BitlyShortener.php


示例5: updateMetaShort

 protected function updateMetaShort($file, $elementId, $shortUrl)
 {
     $context = new UserSelection(ConfService::getRepository());
     $baseUrl = $context->currentBaseUrl();
     $node = new AJXP_Node($baseUrl . $file);
     if ($node->hasMetaStore()) {
         $metadata = $node->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY);
         if ($elementId != -1) {
             if (!is_array($metadata["element"][$elementId])) {
                 $metadata["element"][$elementId] = array();
             }
             $metadata["element"][$elementId]["short_form_url"] = $shortUrl;
         } else {
             if (isset($metadata["shares"])) {
                 $key = array_pop(array_keys($metadata["shares"]));
                 $metadata["shares"][$key]["short_form_url"] = $shortUrl;
             } else {
                 $metadata['short_form_url'] = $shortUrl;
             }
         }
         $node->setMetadata("ajxp_shared", $metadata, true, AJXP_METADATA_SCOPE_REPOSITORY);
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:23,代码来源:class.BitlyShortener.php


示例6: 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") {
         $selection = new UserSelection($repository, $httpVars);
         // Backward compat
         $file = $selection->getUniqueFile();
         if (!file_exists($destStreamURL . $file) && strpos($httpVars["file"], "base64encoded:") === false) {
             // May be a backward compatibility problem, try to base64decode the filepath
             $file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
             if (!file_exists($destStreamURL . $file)) {
                 throw new Exception("Cannot find file!");
             }
         }
         $cType = "audio/" . array_pop(explode(".", $file));
         $localName = basename($file);
         $node = new AJXP_Node($destStreamURL . $file);
         if (method_exists($node->getDriver(), "filesystemFileSize")) {
             $size = $node->getDriver()->filesystemFileSize($node->getUrl());
         } else {
             $size = filesize($node->getUrl());
         }
         header("Content-Type: " . $cType . "; name=\"" . $localName . "\"");
         header("Content-Length: " . $size);
         $stream = fopen("php://output", "a");
         call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
         fflush($stream);
         fclose($stream);
         AJXP_Controller::applyHook("node.read", array($node));
         $this->logInfo('Preview', 'Read content of ' . $node->getUrl());
         //exit(1);
     } else {
         if ($action == "ls") {
             if (!isset($httpVars["playlist"])) {
                 // This should not happen anyway, because of the applyCondition.
                 AJXP_Controller::passProcessDataThrough($postProcessData);
                 return;
             }
             // We transform the XML into XSPF
             $xmlString = $postProcessData["ob_output"];
             $xmlDoc = new DOMDocument();
             $xmlDoc->loadXML($xmlString);
             $xElement = $xmlDoc->documentElement;
             header("Content-Type:application/xspf+xml;charset=UTF-8");
             print '<?xml version="1.0" encoding="UTF-8"?>';
             print '<playlist version="1" xmlns="http://xspf.org/ns/0/">';
             print "<trackList>";
             foreach ($xElement->childNodes as $child) {
                 $isFile = $child->getAttribute("is_file") == "true";
                 $label = $child->getAttribute("text");
                 $ar = explode(".", $label);
                 $ext = strtolower(end($ar));
                 if (!$isFile || $ext != "mp3") {
                     continue;
                 }
                 print "<track><location>" . AJXP_SERVER_ACCESS . "?secure_token=" . AuthService::getSecureToken() . "&get_action=audio_proxy&file=" . base64_encode($child->getAttribute("filename")) . "</location><title>" . $label . "</title></track>";
             }
             print "</trackList>";
             AJXP_XMLWriter::close("playlist");
         }
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:71,代码来源:class.AudioPreviewer.php


示例7: extractMeta

 /**
  * @param AJXP_Node $ajxpNode
  */
 public function extractMeta(&$ajxpNode)
 {
     $currentFile = $ajxpNode->getUrl();
     if (!$ajxpNode->isLeaf() || preg_match("/\\.zip\\//", $currentFile)) {
         return;
     }
     if (!preg_match("/\\.jpg\$|\\.jpeg\$|\\.tif\$|\\.tiff\$/i", $currentFile)) {
         return;
     }
     $definitions = $this->getMetaDefinition();
     if (!count($definitions)) {
         return;
     }
     if (!function_exists("exif_read_data")) {
         return;
     }
     //if(!exif_imagetype($currentFile)) return ;
     $realFile = $ajxpNode->getRealFile();
     $exif = @exif_read_data($realFile, 0, TRUE);
     $iptc = $this->extractIPTC($realFile);
     if ($exif === false) {
         return;
     }
     $additionalMeta = array();
     foreach ($definitions as $def => $label) {
         list($exifSection, $exifName) = explode("-", $def);
         if ($exifSection == "COMPUTED_GPS" && !isset($exif["COMPUTED_GPS"])) {
             $exif['COMPUTED_GPS'] = $this->convertGPSData($exif);
         }
         if (isset($exif[$exifSection]) && isset($exif[$exifSection][$exifName])) {
             $additionalMeta[$def] = $exif[$exifSection][$exifName];
         }
         if ($exifSection == "IPTC" && isset($iptc[$exifName])) {
             $additionalMeta[$def] = $iptc[$exifName];
         }
     }
     $ajxpNode->mergeMetadata($additionalMeta);
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:41,代码来源:class.ExifMetaManager.php


示例8: extractMimeHeaders

 /**
  * @param AJXP_Node $ajxpNode
  * @param Boolean $isParent
  */
 public function extractMimeHeaders(&$ajxpNode, $isParent = false)
 {
     if ($isParent) {
         return;
     }
     $currentNode = $ajxpNode->getUrl();
     $metadata = $ajxpNode->metadata;
     $wrapperClassName = $ajxpNode->wrapperClassName;
     $noMail = true;
     if ($metadata["is_file"] && ($wrapperClassName == "imapAccessWrapper" || preg_match("/\\.eml\$/i", $currentNode))) {
         $noMail = false;
     }
     if ($wrapperClassName == "imapAccessWrapper" && !$metadata["is_file"]) {
         $metadata["mimestring"] = "Mailbox";
     }
     $parsed = parse_url($currentNode);
     if ($noMail || isset($parsed["fragment"]) && strpos($parsed["fragment"], "attachments") === 0) {
         EmlParser::$currentListingOnlyEmails = FALSE;
         return;
     }
     if (EmlParser::$currentListingOnlyEmails === NULL) {
         EmlParser::$currentListingOnlyEmails = true;
     }
     if ($wrapperClassName == "imapAccessWrapper") {
         $cachedFile = AJXP_Cache::getItem("eml_remote", $currentNode, null, array("EmlParser", "computeCacheId"));
         $realFile = $cachedFile->getId();
         if (!is_file($realFile)) {
             $cachedFile->getData();
             // trigger loading!
         }
     } else {
         $realFile = $ajxpNode->getRealFile();
     }
     $cacheItem = AJXP_Cache::getItem("eml_mimes", $realFile, array($this, "mimeExtractorCallback"));
     $data = unserialize($cacheItem->getData());
     $data["ajxp_mime"] = "eml";
     $data["mimestring"] = "Email";
     $metadata = array_merge($metadata, $data);
     if ($wrapperClassName == "imapAccessWrapper" && $metadata["eml_attachments"] != "0" && strpos($_SERVER["HTTP_USER_AGENT"], "ajaxplorer-ios") !== false) {
         $metadata["is_file"] = false;
         $metadata["nodeName"] = basename($currentNode) . "#attachments";
     }
     $ajxpNode->metadata = $metadata;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:48,代码来源:class.EmlParser.php


示例9: moveSharesFromMeta

 /**
  * @param array $shares
  * @param String $operation
  * @param AJXP_Node $oldNode
  * @param AJXP_Node $newNode
  * @param array $collectRepositories
  * @param string|null $parentRepositoryPath
  * @return array
  * @throws Exception
  */
 public function moveSharesFromMeta($shares, $operation = "move", $oldNode, $newNode = null, &$collectRepositories = array(), $parentRepositoryPath = null)
 {
     $privateShares = array();
     $publicShares = array();
     foreach ($shares as $id => $data) {
         $type = $data["type"];
         if ($operation == "delete") {
             $this->deleteShare($type, $id, false, true);
             continue;
         }
         if ($type == "minisite") {
             $share = $this->loadShare($id);
             $repo = ConfService::getRepositoryById($share["REPOSITORY"]);
         } else {
             if ($type == "repository") {
                 $repo = ConfService::getRepositoryById($id);
             } else {
                 if ($type == "file") {
                     $publicLink = $this->loadShare($id);
                 }
             }
         }
         if (isset($repo)) {
             $oldNodeLabel = SystemTextEncoding::toUTF8($oldNode->getLabel());
             $newNodeLabel = SystemTextEncoding::toUTF8($newNode->getLabel());
             if ($newNode != null && $newNodeLabel != $oldNodeLabel && $repo->getDisplay() == $oldNodeLabel) {
                 $repo->setDisplay($newNodeLabel);
             }
             $cFilter = $repo->getContentFilter();
             $path = $repo->getOption("PATH", true);
             $save = false;
             if (isset($cFilter)) {
                 if ($parentRepositoryPath !== null) {
                     $repo->addOption("PATH", $parentRepositoryPath);
                 } else {
                     $cFilter->movePath($oldNode->getPath(), $newNode->getPath());
                     $repo->setContentFilter($cFilter);
                 }
                 $save = true;
             } else {
                 if (!empty($path)) {
                     $oldNodePath = SystemTextEncoding::toUTF8($oldNode->getPath());
                     $newNodePath = SystemTextEncoding::toUTF8($newNode->getPath());
                     $path = preg_replace("#" . preg_quote($oldNodePath, "#") . "\$#", $newNodePath, $path);
                     $repo->addOption("PATH", $path);
                     $save = true;
                     $collectRepositories[$repo->getId()] = $path;
                 }
             }
             if ($save) {
                 //ConfService::getConfStorageImpl()->saveRepository($repo, true);
                 ConfService::replaceRepository($repo->getId(), $repo);
             }
             $access = $repo->getOption("SHARE_ACCESS");
             if (!empty($access) && $access == "PUBLIC") {
                 $publicShares[$id] = $data;
             } else {
                 $privateShares[$id] = $data;
             }
         } else {
             if (isset($publicLink) && is_array($publicLink) && isset($publicLink["FILE_PATH"])) {
                 $oldNodePath = SystemTextEncoding::toUTF8($oldNode->getPath());
                 $newNodePath = SystemTextEncoding::toUTF8($newNode->getPath());
                 $publicLink["FILE_PATH"] = str_replace($oldNodePath, $newNodePath, $publicLink["FILE_PATH"]);
                 $this->deleteShare("file", $id);
                 $this->storeShare($newNode->getRepositoryId(), $publicLink, "file", $id);
                 $privateShares[$id] = $data;
             }
         }
     }
     return array($privateShares, $publicShares);
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:82,代码来源:class.ShareStore.php


示例10: switchAction

 public function switchAction($action, $httpVars, $filesVars)
 {
     if (!isset($this->actions[$action])) {
         return false;
     }
     $repository = ConfService::getRepositoryById($httpVars["repository_id"]);
     if (!$repository->detectStreamWrapper(true)) {
         return false;
     }
     if (AuthService::usersEnabled()) {
         $loggedUser = AuthService::getLoggedUser();
         if ($loggedUser === null && ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth")) {
             AuthService::logUser("guest", null);
             $loggedUser = AuthService::getLoggedUser();
         }
         if (!$loggedUser->canSwitchTo($repository->getId())) {
             echo "You do not have permissions to access this resource";
             return false;
         }
     }
     $streamData = $repository->streamData;
     $destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
     $selection = new UserSelection($repository, $httpVars);
     if ($action == "open_file") {
         $file = $selection->getUniqueFile();
         if (!file_exists($destStreamURL . $file)) {
             echo "File does not exist";
             return false;
         }
         $node = new AJXP_Node($destStreamURL . $file);
         if (method_exists($node->getDriver(), "filesystemFileSize")) {
             $filesize = $node->getDriver()->filesystemFileSize($node->getUrl());
         } else {
             $filesize = filesize($node->getUrl());
         }
         $fp = fopen($destStreamURL . $file, "rb");
         $fileMime = "application/octet-stream";
         //Get mimetype with fileinfo PECL extension
         if (class_exists("finfo")) {
             $finfo = new finfo(FILEINFO_MIME);
             $fileMime = $finfo->buffer(fread($fp, 100));
         }
         //Get mimetype with (deprecated) mime_content_type
         if (strpos($fileMime, "application/octet-stream") === 0 && function_exists("mime_content_type")) {
             $fileMime = @mime_content_type($fp);
         }
         //Guess mimetype based on file extension
         if (strpos($fileMime, "application/octet-stream") === 0) {
             $fileExt = substr(strrchr(basename($file), '.'), 1);
             if (empty($fileExt)) {
                 $fileMime = "application/octet-stream";
             } else {
                 $regex = "/^([\\w\\+\\-\\.\\/]+)\\s+(\\w+\\s)*({$fileExt}\\s)/i";
                 $lines = file($this->getBaseDir() . "/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];
                 }
             }
         }
         fclose($fp);
         // If still no mimetype, give up and serve application/octet-stream
         if (empty($fileMime)) {
             $fileMime = "application/octet-stream";
         }
         //Send headers
         HTMLWriter::generateInlineHeaders(basename($file), $filesize, $fileMime);
         $class = $streamData["classname"];
         $stream = fopen("php://output", "a");
         call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
         fflush($stream);
         fclose($stream);
         $node = new AJXP_Node($destStreamURL . $file);
         AJXP_Controller::applyHook("node.read", array($node));
         $this->logInfo('Download', 'Read content of ' . $node->getUrl());
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:85,代码来源:class.FileMimeSender.php


示例11: recursiveIndexation

 /**
  *
  * @param AJXP_Node $node
  * @param int $depth
  * @throws Exception
  */
 public function recursiveIndexation($node, $depth = 0)
 {
     $repository = $node->getRepository();
     $user = $node->getUser();
     $messages = ConfService::getMessages();
     if ($user == null && AuthService::usersEnabled()) {
         $user = AuthService::getLoggedUser();
     }
     if ($depth == 0) {
         $this->logDebug("Starting indexation - node.index.recursive.start  - " . memory_get_usage(true) . "  - " . $node->getUrl());
         $this->setIndexStatus("RUNNING", str_replace("%s", $node->getPath(), $messages["core.index.8"]), $repository, $user);
         AJXP_Controller::applyHook("node.index.recursive.start", array($node));
     } else {
         if ($this->isInterruptRequired($repository, $user)) {
             $this->logDebug("Interrupting indexation! - node.index.recursive.end - " . $node->getUrl());
             AJXP_Controller::applyHook("node.index.recursive.end", array($node));
             $this->releaseStatus($repository, $user);
             throw new Exception("User interrupted");
         }
     }
     if (!ConfService::currentContextIsCommandLine()) {
         @set_time_limit(120);
     }
     $url = $node->getUrl();
     $this->logDebug("Indexing Node parent node " . $url);
     $this->setIndexStatus("RUNNING", str_replace("%s", $node->getPath(), $messages["core.index.8"]), $repository, $user);
     try {
         AJXP_Controller::applyHook("node.index", array($node));
     } catch (Exception $e) {
         $this->logDebug("Error Indexing Node " . $url . " (" . $e->getMessage() . ")");
     }
     $handle = opendir($url);
     if ($handle !== false) {
         while (($child = readdir($handle)) != false) {
             if ($child[0] == ".") {
                 continue;
             }
             $childNode = new AJXP_Node(rtrim($url, "/") . "/" . $child);
             $childUrl = $childNode->getUrl();
             if (is_dir($childUrl)) {
                 $this->logDebug("Entering recursive indexation for " . $childUrl);
                 $this->recursiveIndexation($childNode, $depth + 1);
             } else {
                 try {
                     $this->logDebug("Indexing Node " . $childUrl);
                     AJXP_Controller::applyHook("node.index", array($childNode));
                 } catch (Exception $e) {
                     $this->logDebug("Error Indexing Node " . $childUrl . " (" . $e->getMessage() . ")");
                 }
             }
         }
         closedir($handle);
     } else {
         $this->logDebug("Cannot open {$url}!!");
     }
     if ($depth == 0) {
         $this->logDebug("End indexation - node.index.recursive.end - " . memory_get_usage(true) . "  -  " . $node->getUrl());
         $this->setIndexStatus("RUNNING", "Indexation finished, cleaning...", $repository, $user);
         AJXP_Controller::applyHook("node.index.recursive.end", array($node));
         $this->releaseStatus($repository, $user);
         $this->logDebug("End indexation - After node.index.recursive.end - " . memory_get_usage(true) . "  -  " . $node->getUrl());
     }
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:69,代码来源:class.CoreIndexer.php


示例12: moveShareIfPossible

 /**
  * @param String $type
  * @param String $element
  * @param AJXP_Node $oldNode
  * @param AJXP_Node $newNode
  * @return bool
  */
 public function moveShareIfPossible($type, $element, $oldNode, $newNode)
 {
     if (!$this->sqlSupported) {
         return false;
     }
     $this->confStorage->simpleStoreGet("share", $element, "serial", $data);
     if ($oldNode->isLeaf() && $type == "minisite" && is_array($data)) {
         $repo = ConfService::getRepositoryById($data["REPOSITORY"]);
         $cFilter = $repo->getContentFilter();
         if (isset($cFilter)) {
             $cFilter->movePath($oldNode->getPath(), $newNode->getPath());
         }
     }
 }
开发者ID:ad-m,项目名称:pydio-core,代码行数:21,代码来源:class.ShareStore.php


示例13: extractMeta

 /**
  *
  * @param AJXP_Node $ajxpNode
  * @param bool $contextNode
  * @param bool $details
  * @return void
  */
 public function extractMeta(&$ajxpNode, $contextNode = false, $details = false)
 {
     $metadata = $ajxpNode->retrieveMetadata("users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
     if (empty($metadata)) {
         $metadata = array();
     }
     $ajxpNode->mergeMetadata($metadata);
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:15,代码来源:class.UserMetaManager.php


示例14: enrichMetadata

 /**
  *
  * @param AJXP_Node $ajxpNode
  */
 public function enrichMetadata(&$ajxpNode)
 {
     $currentNode = $ajxpNode->getUrl();
     $metadata = $ajxpNode->metadata;
     $parsed = parse_url($currentNode);
     if (isset($parsed["fragment"]) && strpos($parsed["fragment"], "attachments") === 0) {
         list(, $attachmentId) = explode("/", $parsed["fragment"]);
         $meta = imapAccessWrapper::getCurrentAttachmentsMetadata();
         if ($meta != null) {
             foreach ($meta as $attach) {
                 if ($attach["x-attachment-id"] == $attachmentId) {
                     $metadata["text"] = $attach["filename"];
                     $metadata["icon"] = AJXP_Utils::mimetype($attach["filename"], "image", false);
                     $metadata["mimestring"] = AJXP_Utils::mimetype($attach["filename"], "text", false);
                 }
             }
         }
     }
     if (!$metadata["is_file"] && $currentNode != "") {
         $metadata["icon"] = "imap_images/ICON_SIZE/mail_folder_sent.png";
     }
     if (basename($currentNode) == "INBOX") {
         $metadata["text"] = "Incoming Mails";
     }
     if (strstr($currentNode, "__delim__") !== false) {
         $parts = explode("/", $currentNode);
         $metadata["text"] = str_replace("__delim__", "/", array_pop($parts));
     }
     $ajxpNode->metadata = $metadata;
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:34,代码来源:class.imapAccessDriver.php


示例15: getPartialHash

 /**
  * @param AJXP_Node $node
  * @param float $offset
  * @param float $length
  * @return String md5
  */
 public function getPartialHash($node, $offset, $length)
 {
     $this->logDebug('Getting partial hash from ' . $offset . ' to ' . $length);
     $fp = fopen($node->getUrl(), "r");
     $ctx = hash_init('md5');
     if ($offset > 0) {
         fseek($fp, $offset);
     }
     hash_update_stream($ctx, $fp, $length);
     $hash = hash_final($ctx);
     $this->logDebug('Partial hash is ' . $hash);
     fclose($fp);
     return $hash;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:20,代码来源:class.FileHasher.php


示例16: extractMeta

 /**
  *
  * @param AJXP_Node $ajxpNode
  */
 public function extractMeta(&$ajxpNode)
 {
     //if(isSet($_SESSION["SVN_COMMAND_RUNNING"]) && $_SESSION["SVN_COMMAND_RUNNING"] === true) return ;
     $realDir = dirname($ajxpNode->getRealFile());
     if (SvnManager::$svnListDir == $realDir) {
         $entries = SvnManager::$svnListCache;
     } else {
         try {
             SvnManager::$svnListDir = $realDir;
             $entries = $this->svnListNode($realDir);
             SvnManager::$svnListCache = $entries;
         } catch (Exception $e) {
             $this->logError("ExtractMeta", $e->getMessage());
         }
     }
     $fileId = SystemTextEncoding::toUTF8(basename($ajxpNode->getUrl()));
     if (isset($entries[$fileId])) {
         $ajxpNode->mergeMetadata($entries[$fileId]);
     }
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:24,代码来源:class.SvnManager.php


示例17: switchAction

 public function switchAction($action, $httpVars, $filesVars)
 {
     $repository = ConfService::getRepository();
     if (!$repository->detectStreamWrapper(true)) {
         return false;
     }
     $selection = new UserSelection($repository, $httpVars);
     $selectedNode = $selection->getUniqueNode();
     $selectedNodeUrl = $selectedNode->getUrl();
     if ($action == "post_to_server") {
         // Backward compat
         if (strpos($httpVars["file"], "base64encoded:") !== 0) {
             $legacyFilePath = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
             $selectedNode = new AJXP_Node($selection->currentBaseUrl() . $legacyFilePath);
             $selectedNodeUrl = $selectedNode->getUrl();
         }
         $target = rtrim(base64_decode($httpVars["parent_url"]), '/') . "/plugins/editor.pixlr";
         $tmp = AJXP_MetaStreamWrapper::getRealFSReference($selectedNodeUrl);
         $tmp = SystemTextEncoding::fromUTF8($tmp);
         $this->logInfo('Preview', 'Sending content of ' . $selectedNodeUrl . ' to Pixlr server.', array("files" => $selectedNodeUrl));
         AJXP_Controller::applyHook("node.read", array($selectedNode));
         $saveTarget = $target . "/fake_save_pixlr.php";
         if ($this->getFilteredOption("CHECK_SECURITY_TOKEN", $repository->getId())) {
             $saveTarget = $target . "/fake_save_pixlr_" . md5($httpVars["secure_token"]) . ".php";
         }
         $params = array("referrer" => "Pydio", "method" => "get", "loc" => ConfService::getLanguage(), "target" => $saveTarget, "exit" => $target . "/fake_close_pixlr.php", "title" => urlencode(basename($selectedNodeUrl)), "locktarget" => "false", "locktitle" => "true", "locktype" => "source");
         require_once AJXP_BIN_FOLDER . "/http_class/http_class.php";
         $arguments = array();
         $httpClient = new http_class();
         $httpClient->request_method = "POST";
         $httpClient->GetRequestArguments("https://pixlr.com/editor/", $arguments);
         $arguments["PostValues"] = $params;
         $arguments["PostFiles"] = array("image" => array("FileName" => $tmp, "Content-Type" => "automatic/name"));
         $err = $httpClient->Open($arguments);
         if (empty($err)) {
             $err = $httpClient->SendRequest($arguments);
             if (empty($err)) {
                 $response = "";
                 while (true) {
                     $header = array();
                     $error = $httpClient->ReadReplyHeaders($header, 1000);
                     if ($error != "" || $header != null) {
                         break;
                     }
                     $response .= $header;
                 }
             }
         }
         header("Location: {$header['location']}");
         //$response");
     } else {
         if ($action == "retrieve_pixlr_image") {
             $file = AJXP_Utils::decodeSecureMagic($httpVars["original_file"]);
             $selectedNode = new AJXP_Node($selection->currentBaseUrl() . $file);
             $selectedNode->loadNodeInfo();
             $this->logInfo('Edit', 'Retrieving content of ' . $file . ' from Pixlr server.', array("files" => $file));
             AJXP_Controller::applyHook("node.before_change", array(&$selectedNode));
             $url = $httpVars["new_url"];
             $urlParts = parse_url($url);
             $query = $urlParts["query"];
             if ($this->getFilteredOption("CHECK_SECURITY_TOKEN", $repository->getId())) {
                 $scriptName = basename($urlParts["path"]);
                 $token = str_replace(array("fake_save_pixlr_", ".php"), "", $scriptName);
                 if ($token != md5($httpVars["secure_token"])) {
                     throw new AJXP_Exception("Invalid Token, this could mean some security problem!");
                 }
             }
             $params = array();
             parse_str($query, $params);
             $image = $params['image'];
             $headers = get_headers($image, 1);
             $content_type = explode("/", $headers['Content-Type']);
             if ($content_type[0] != "image") {
                 throw new AJXP_Exception("Invalid File Type");
             }
             $content_length = intval($headers["Content-Length"]);
             if ($content_length != 0) {
                 AJXP_Controller::applyHook("node.before_change", array(&$selectedNode, $content_length));
             }
             $orig = fopen($image, "r");
             $target = fopen($selectedNode->getUrl(), "w");
             if (is_resource($orig) && is_resource($target)) {
                 while (!feof($orig)) {
                     fwrite($target, fread($orig, 4096));
                 }
                 fclose($orig);
                 fclose($target);
             }
             clearstatcache(true, $selectedNode->getUrl());
             $selectedNode->loadNodeInfo(true);
             AJXP_Controller::applyHook("node.change", array(&$selectedNode, &$selectedNode));
         }
     }
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:94,代码来源:class.PixlrEditor.php


示例18: handleNodeChange

 /**
  * @param AJXP_Node $fromNode
  * @param AJXP_Node $toNode
  * @param bool $copy
  */
 public function handleNodeChange($fromNode = null, $toNode = null, $copy = false)
 {
     if ($fromNode == null) {
         return;
     }
     if ($toNode == null) {
         $fromNode->removeMetadata("etherpad", AJXP_METADATA_ALLUSERS, AJXP_METADATA_SCOPE_GLOBAL, false);
     } else {
         if (!$copy) {
             $toNode->copyOrMoveMetadataFromNode($fromNode, "etherpad", "move", AJXP_METADATA_ALLUSERS, AJXP_METADATA_SCOPE_GLOBAL, false);
         }
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:18,代码来源:class.EtherpadClient.php


示例19: updateNodesIndex

 /**
  * @param AJXP_Node $oldNode
  * @param AJXP_Node $newNode
  * @param bool $copy
  */
 public function updateNodesIndex($oldNode = null, $newNode = null, $copy = false)
 {
     if (!dibi::isConnected()) {
         dibi::connect($this->sqlDriver);
     }
     //$this->logInfo("Syncable index", array($oldNode == null?'null':$oldNode->getUrl(), $newNode == null?'null':$newNode->getUrl()));
     try {
         if ($newNode != null && $this->excludeNode($newNode)) {
             // CREATE
             if ($oldNode == null) {
                 AJXP_Logger::debug("Ignoring " . $newNode->getUrl() . " for indexation");
                 return;
             } else {
                 AJXP_Logger::debug("Target node is excluded, see it as a deletion: " . $newNode->getUrl());
                 $newNode = null;
             }
         }
         if ($newNode == null) {
             $repoId = $this->computeIdentifier($old 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AJXP_Plugin类代码示例发布时间:2022-05-23
下一篇:
PHP AJXP_Logger类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap