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


PHP SystemTextEncoding::toUTF8方法代码示例

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


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

示例1: switchAction

 function switchAction($action, $httpVars, $filesVars)
 {
     $sessionId = "";
     $crtRep = ConfService::getRepository();
     $httpClient = $this->getRemoteConnexion($sessionId);
     //$httpClient->setDebug(true);
     if ($crtRep->getOption("USE_AUTH")) {
         $httpVars["ajxp_sessid"] = $sessionId;
     }
     $method = "get";
     if ($action == "put_content") {
         $method = "post";
     }
     if ($method == "get") {
         if ($action == "download" || $action == "image_proxy" || $action == "mp3_proxy") {
             $httpClient->directForwarding = true;
         }
         $result = $httpClient->get($crtRep->getOption("URI"), $httpVars);
     } else {
         $result = $httpClient->post($crtRep->getOption("URI"), $httpVars);
     }
     // check if session is expired
     if (strpos($httpClient->getHeader("content-type"), "text/xml") !== false && strpos($httpClient->getContent(), "require_auth") != false) {
         $httpClient = $this->getRemoteConnexion($sessionId, true);
         $httpVars["ajxp_sessid"] = $sessionId;
         $method = "get";
         if ($method == "get") {
             if ($action == "download") {
                 $httpClient->directForwarding = true;
             }
             $result = $httpClient->get($crtRep->getOption("URI"), $httpVars);
         } else {
             $result = $httpClient->post($crtRep->getOption("URI"), $httpVars);
         }
     }
     if ($result === false && isset($httpClient->errormsg)) {
         throw new Exception(SystemTextEncoding::toUTF8($httpClient->errormsg));
     }
     switch ($action) {
         case "image_proxy":
         case "download":
         case "mp3_proxy":
             session_write_close();
             exit;
             break;
         case "get_content":
             header("Content-type:text/plain");
             break;
         default:
             header("Content-type: text/xml");
             break;
     }
     print $httpClient->getContent();
     session_write_close();
     exit;
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:56,代码来源:class.remote_fsAccessDriver.php

示例2: 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();
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:40,代码来源:class.UserMetaManager.php

示例3: listRepositories

    function listRepositories()
    {
        print '<columns switchGridMode="filelist"><column messageString="Repository Label" attributeName="ajxp_label" sortType="String"/><column messageString="Access Type" attributeName="accessType" sortType="String"/></columns>';
        $repos = ConfService::getRepositoriesList();
        $repoArray = array();
        foreach ($repos as $repoIndex => $repoObject) {
            if ($repoObject->getAccessType() == "ajxp_conf") {
                continue;
            }
            $name = Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay()));
            $repoArray[$name] = $repoIndex;
        }
        // Sort the list now by name
        ksort($repoArray);
        foreach ($repoArray as $name => $repoIndex) {
            $repoObject =& $repos[$repoIndex];
            print '<tree 				
				text="' . $name . '" 
				is_file="1" 
				repository_id="' . $repoIndex . '" 
				accessType="' . $repoObject->getAccessType() . '" 
				icon="folder_red.png" 
				openicon="folder_red.png" 
				filename="/users/' . $name . '" 
				parentname="/users" 
				src="content.php?dir=%2Fusers%2F' . $name . '" 
				ajxp_mime="repository' . ($repoObject->isWriteable() ? "_editable" : "") . '"
				/>';
        }
    }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:30,代码来源:class.ajxp_confAccessDriver.php

示例4: 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($oldNode->getRepository(), $oldNode->getUser());
             // DELETE
             $this->logDebug('DELETE', $oldNode->getUrl());
             dibi::query("DELETE FROM [ajxp_index] WHERE [node_path] LIKE %like~ AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
         } else {
             if ($oldNode == null || $copy) {
                 // CREATE
                 $stat = stat($newNode->getUrl());
                 $newNode->setLeaf(!($stat['mode'] & 040000));
                 $this->logDebug('INSERT', $newNode->getUrl());
                 dibi::query("INSERT INTO [ajxp_index]", array("node_path" => SystemTextEncoding::toUTF8($newNode->getPath()), "bytesize" => $stat["size"], "mtime" => $stat["mtime"], "md5" => $newNode->isLeaf() ? md5_file($newNode->getUrl()) : "directory", "repository_identifier" => $repoId = $this->computeIdentifier($newNode->getRepository(), $newNode->getUser())));
             } else {
                 $repoId = $this->computeIdentifier($oldNode->getRepository(), $oldNode->getUser());
                 if ($oldNode->getPath() == $newNode->getPath()) {
                     // CONTENT CHANGE
                     clearstatcache();
                     $stat = stat($newNode->getUrl());
                     $this->logDebug("Content changed", "current stat size is : " . $stat["size"]);
                     $this->logDebug('UPDATE CONTENT', $newNode->getUrl());
                     dibi::query("UPDATE [ajxp_index] SET ", array("bytesize" => $stat["size"], "mtime" => $stat["mtime"], "md5" => md5_file($newNode->getUrl())), "WHERE [node_path] = %s AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
                     try {
                         $rowCount = dibi::getAffectedRows();
                         if ($rowCount === 0) {
                             $this->logError(__FUNCTION__, "There was an update event on a non-indexed node (" . $newNode->getPath() . "), creating index entry!");
                             $this->updateNodesIndex(null, $newNode, false);
                         }
                     } catch (Exception $e) {
                     }
                 } else {
                     // PATH CHANGE ONLY
                     $newNode->loadNodeInfo();
                     if ($newNode->isLeaf()) {
                         $this->logDebug('UPDATE LEAF PATH', $newNode->getUrl());
                         dibi::query("UPDATE [ajxp_index] SET ", array("node_path" => SystemTextEncoding::toUTF8($newNode->getPath())), "WHERE [node_path] = %s AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
                         try {
                             $rowCount = dibi::getAffectedRows();
                             if ($rowCount === 0) {
                                 $this->logError(__FUNCTION__, "There was an update event on a non-indexed node (" . $newNode->getPath() . "), creating index entry!");
                                 $this->updateNodesIndex(null, $newNode, false);
                             }
                         } catch (Exception $e) {
                         }
                     } else {
                         $this->logDebug('UPDATE FOLDER PATH', $newNode->getUrl());
                         dibi::query("UPDATE [ajxp_index] SET [node_path]=REPLACE( REPLACE(CONCAT('\$\$\$',[node_path]), CONCAT('\$\$\$', %s), CONCAT('\$\$\$', %s)) , '\$\$\$', '') ", $oldNode->getPath(), $newNode->getPath(), "WHERE [node_path] LIKE %like~ AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
                         try {
                             $rowCount = dibi::getAffectedRows();
                             if ($rowCount === 0) {
                                 $this->logError(__FUNCTION__, "There was an update event on a non-indexed folder (" . $newNode->getPath() . "), relaunching a recursive indexation!");
                                 AJXP_Controller::findActionAndApply("index", array("file" => $newNode->getPath()), array());
                             }
                         } catch (Exception $e) {
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         AJXP_Logger::error("[meta.syncable]", "Exception", $e->getTraceAsString());
         AJXP_Logger::error("[meta.syncable]", "Indexation", $e->getMessage());
     }
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:85,代码来源:class.ChangesTracker.php

示例5: switchAction

 public function switchAction($action, $httpVars, $fileVars)
 {
     $selection = new UserSelection();
     $dir = $httpVars["dir"] or "";
     $dir = AJXP_Utils::decodeSecureMagic($dir);
     if ($dir == "/") {
         $dir = "";
     }
     $selection->initFromHttpVars($httpVars);
     if (!$selection->isEmpty()) {
         //$this->filterUserSelectionToHidden($selection->getFiles());
     }
     $urlBase = "pydio://" . ConfService::getRepository()->getId();
     $mess = ConfService::getMessages();
     switch ($action) {
         case "monitor_compression":
             $percentFile = fsAccessWrapper::getRealFSReference($urlBase . $dir . "/.zip_operation_" . $httpVars["ope_id"]);
             $percent = 0;
             if (is_file($percentFile)) {
                 $percent = intval(file_get_contents($percentFile));
             }
             if ($percent < 100) {
                 AJXP_XMLWriter::header();
                 AJXP_XMLWriter::triggerBgAction("monitor_compression", $httpVars, $mess["powerfs.1"] . " ({$percent}%)", true, 1);
                 AJXP_XMLWriter::close();
             } else {
                 @unlink($percentFile);
                 AJXP_XMLWriter::header();
                 if ($httpVars["on_end"] == "reload") {
                     AJXP_XMLWriter::triggerBgAction("reload_node", array(), "powerfs.2", true, 2);
                 } else {
                     $archiveName = AJXP_Utils::sanitize($httpVars["archive_name"], AJXP_SANITIZE_FILENAME);
                     $archiveName = str_replace("'", "\\'", $archiveName);
                     $jsCode = "\n                            PydioApi.getClient().downloadSelection(null, \$('download_form'), 'postcompress_download', {ope_id:'" . $httpVars["ope_id"] . "',archive_name:'" . $archiveName . "'});\n                        ";
                     AJXP_XMLWriter::triggerBgJsAction($jsCode, $mess["powerfs.3"], true);
                     AJXP_XMLWriter::triggerBgAction("reload_node", array(), "powerfs.2", true, 2);
                 }
                 AJXP_XMLWriter::close();
             }
             break;
         case "postcompress_download":
             $archive = AJXP_Utils::getAjxpTmpDir() . DIRECTORY_SEPARATOR . $httpVars["ope_id"] . "_" . AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]), AJXP_SANITIZE_FILENAME);
             $fsDriver = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("access");
             if (is_file($archive)) {
                 if (!$fsDriver->getFilteredOption("USE_XSENDFILE", ConfService::getRepository()) && !$fsDriver->getFilteredOption("USE_XACCELREDIRECT", ConfService::getRepository())) {
                     register_shutdown_function("unlink", $archive);
                 }
                 $fsDriver->readFile($archive, "force-download", $httpVars["archive_name"], false, null, true);
             } else {
                 echo "<script>alert('Cannot find archive! Is ZIP correctly installed?');</script>";
             }
             break;
         case "compress":
         case "precompress":
             $archiveName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]), AJXP_SANITIZE_FILENAME);
             if (!ConfService::currentContextIsCommandLine() && ConfService::backgroundActionsSupported()) {
                 $opeId = substr(md5(time()), 0, 10);
                 $httpVars["ope_id"] = $opeId;
                 AJXP_Controller::applyActionInBackground(ConfService::getRepository()->getId(), $action, $httpVars);
                 AJXP_XMLWriter::header();
                 $bgParameters = array("dir" => SystemTextEncoding::toUTF8($dir), "archive_name" => SystemTextEncoding::toUTF8($archiveName), "on_end" => isset($httpVars["on_end"]) ? $httpVars["on_end"] : "reload", "ope_id" => $opeId);
                 AJXP_XMLWriter::triggerBgAction("monitor_compression", $bgParameters, $mess["powerfs.1"] . " (0%)", true);
                 AJXP_XMLWriter::close();
                 session_write_close();
                 exit;
             }
             $rootDir = fsAccessWrapper::getRealFSReference($urlBase) . $dir;
             $percentFile = $rootDir . "/.zip_operation_" . $httpVars["ope_id"];
             $compressLocally = $action == "compress" ? true : false;
             // List all files
             $todo = array();
             $args = array();
             $replaceSearch = array($rootDir, "\\");
             $replaceReplace = array("", "/");
             foreach ($selection->getFiles() as $selectionFile) {
                 $baseFile = $selectionFile;
                 $args[] = escapeshellarg(substr($selectionFile, strlen($dir) + ($dir == "/" ? 0 : 1)));
                 $selectionFile = fsAccessWrapper::getRealFSReference($urlBase . $selectionFile);
                 $todo[] = ltrim(str_replace($replaceSearch, $replaceReplace, $selectionFile), "/");
                 if (is_dir($selectionFile)) {
                     $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($selectionFile), RecursiveIteratorIterator::SELF_FIRST);
                     foreach ($objects as $name => $object) {
                         $todo[] = str_replace($replaceSearch, $replaceReplace, $name);
                     }
                 }
                 if (trim($baseFile, "/") == "") {
                     // ROOT IS SELECTED, FIX IT
                     $args = array(escapeshellarg(basename($rootDir)));
                     $rootDir = dirname($rootDir);
                     break;
                 }
             }
             $cmdSeparator = PHP_OS == "WIN32" || PHP_OS == "WINNT" || PHP_OS == "Windows" ? "&" : ";";
             if (!$compressLocally) {
                 $archiveName = AJXP_Utils::getAjxpTmpDir() . DIRECTORY_SEPARATOR . $httpVars["ope_id"] . "_" . $archiveName;
             }
             chdir($rootDir);
             $cmd = $this->getFilteredOption("ZIP_PATH") . " -r " . escapeshellarg($archiveName) . " " . implode(" ", $args);
             $fsDriver = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("access");
             $c = $fsDriver->getConfigs();
//.........这里部分代码省略.........
开发者ID:Nanomani,项目名称:pydio-core,代码行数:101,代码来源:class.PowerFSController.php

示例6: uploadActions

 public function uploadActions($action, $httpVars, $filesVars)
 {
     switch ($action) {
         case "trigger_remote_copy":
             if (!$this->hasFilesToCopy()) {
                 break;
             }
             $toCopy = $this->getFileNameToCopy();
             $this->logDebug("trigger_remote", $toCopy);
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::triggerBgAction("next_to_remote", array(), "Copying file " . $toCopy . " to remote server");
             AJXP_XMLWriter::close();
             exit(1);
             break;
         case "next_to_remote":
             if (!$this->hasFilesToCopy()) {
                 break;
             }
             $fData = $this->getNextFileToCopy();
             $nextFile = '';
             if ($this->hasFilesToCopy()) {
                 $nextFile = $this->getFileNameToCopy();
             }
             $crtRep = ConfService::getRepository();
             session_write_close();
             $secureToken = "";
             $httpClient = $this->getRemoteConnexion($secureToken);
             //$httpClient->setDebug(true);
             $postData = array("get_action" => "upload", "dir" => base64_encode($fData["destination"]), "secure_token" => $secureToken);
             $httpClient->postFile($crtRep->getOption("URI") . "?", $postData, "Filedata", $fData);
             if (strpos($httpClient->getHeader("content-type"), "text/xml") !== false && strpos($httpClient->getContent(), "require_auth") != false) {
                 $httpClient = $this->getRemoteConnexion($secureToken, true);
                 $postData["secure_token"] = $secureToken;
                 $httpClient->postFile($crtRep->getOption("URI"), $postData, "Filedata", $fData);
             }
             unlink($fData["tmp_name"]);
             $response = $httpClient->getContent();
             AJXP_XMLWriter::header();
             $this->logDebug("next_to_remote", $nextFile);
             if (intval($response) >= 400) {
                 AJXP_XMLWriter::sendMessage(null, "Error : " . intval($response));
             } else {
                 if ($nextFile != '') {
                     AJXP_XMLWriter::triggerBgAction("next_to_remote", array(), "Copying file " . SystemTextEncoding::toUTF8($nextFile) . " to remote server");
                 } else {
                     AJXP_XMLWriter::triggerBgAction("reload_node", array(), "Upload done, reloading client.");
                 }
             }
             AJXP_XMLWriter::close();
             exit(1);
             break;
         case "upload":
             $rep_source = AJXP_Utils::securePath("/" . $httpVars['dir']);
             $this->logDebug("Upload : rep_source ", array($rep_source));
             $logMessage = "";
             foreach ($filesVars as $boxName => $boxData) {
                 if (substr($boxName, 0, 9) != "userfile_") {
                     continue;
                 }
                 $this->logDebug("Upload : rep_source ", array($rep_source));
                 $err = AJXP_Utils::parseFileDataErrors($boxData);
                 if ($err != null) {
                     $errorCode = $err[0];
                     $errorMessage = $err[1];
                     break;
                 }
                 $boxData["destination"] = $rep_source;
                 $destCopy = AJXP_XMLWriter::replaceAjxpXmlKeywords($this->repository->getOption("TMP_UPLOAD"));
                 $this->logDebug("Upload : tmp upload folder", array($destCopy));
                 if (!is_dir($destCopy)) {
                     if (!@mkdir($destCopy)) {
                         $this->logDebug("Upload error : cannot create temporary folder", array($destCopy));
                         $errorCode = 413;
                         $errorMessage = "Warning, cannot create folder for temporary copy.";
                         break;
                     }
                 }
                 if (!is_writeable($destCopy)) {
                     $this->logDebug("Upload error: cannot write into temporary folder");
                     $errorCode = 414;
                     $errorMessage = "Warning, cannot write into temporary folder.";
                     break;
                 }
                 $this->logDebug("Upload : tmp upload folder", array($destCopy));
                 if (isset($boxData["input_upload"])) {
                     try {
                         $destName = tempnam($destCopy, "");
                         $this->logDebug("Begining reading INPUT stream");
                         $input = fopen("php://input", "r");
                         $output = fopen($destName, "w");
                         $sizeRead = 0;
                         while ($sizeRead < intval($boxData["size"])) {
                             $chunk = fread($input, 4096);
                             $sizeRead += strlen($chunk);
                             fwrite($output, $chunk, strlen($chunk));
                         }
                         fclose($input);
                         fclose($output);
                         $boxData["tmp_name"] = $destName;
                         $this->storeFileToCopy($boxData);
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.remote_fsAccessDriver.php

示例7: copyOrMoveFile

 function copyOrMoveFile($destDir, $srcFile, &$error, &$success, $move = false)
 {
     $mess = ConfService::getMessages();
     $destFile = $this->repository->getOption("PATH") . $destDir . "/" . basename($srcFile);
     $realSrcFile = $this->repository->getOption("PATH") . "{$srcFile}";
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     if (!file_exists($realSrcFile)) {
         $error[] = $mess[100] . $srcFile;
         return;
     }
     if (dirname($realSrcFile) == dirname($destFile)) {
         if ($move) {
             $error[] = $mess[101];
             return;
         } else {
             $base = basename($srcFile);
             $i = 1;
             if (is_file($realSrcFile)) {
                 $dotPos = strrpos($base, ".");
                 if ($dotPos > -1) {
                     $radic = substr($base, 0, $dotPos);
                     $ext = substr($base, $dotPos);
                 }
             }
             // auto rename file
             $i = 1;
             $newName = $base;
             while (file_exists($this->repository->getOption("PATH") . $destDir . "/" . $newName)) {
                 $suffix = "-{$i}";
                 if (isset($radic)) {
                     $newName = $radic . $suffix . $ext;
                 } else {
                     $newName = $base . $suffix;
                 }
                 $i++;
             }
             $destFile = $this->repository->getOption("PATH") . $destDir . "/" . $newName;
         }
     }
     if (is_dir($realSrcFile)) {
         $errors = array();
         $succFiles = array();
         if ($move) {
             if (is_file($destFile)) {
                 unlink($destFile);
             }
             $res = rename($realSrcFile, $destFile);
         } else {
             $dirRes = $this->dircopy($realSrcFile, $destFile, $errors, $succFiles);
         }
         if (count($errors) || isset($res) && $res !== true) {
             $error[] = $mess[114];
             return;
         }
     } else {
         if ($move) {
             if (is_file($destFile)) {
                 unlink($destFile);
             }
             $res = rename($realSrcFile, $destFile);
         } else {
             $res = copy($realSrcFile, $destFile);
         }
         if ($res != 1) {
             $error[] = $mess[114];
             return;
         }
     }
     if ($move) {
         // Now delete original
         // $this->deldir($realSrcFile); // both file and dir
         $messagePart = $mess[74] . " " . SystemTextEncoding::toUTF8($destDir);
         if (RecycleBinManager::recycleEnabled() && $destDir == "/" . $recycle) {
             RecycleBinManager::fileToRecycle($srcFile);
             $messagePart = $mess[123] . " " . $mess[122];
         }
         if (isset($dirRes)) {
             $success[] = $mess[117] . " " . SystemTextEncoding::toUTF8(basename($srcFile)) . " " . $messagePart . " (" . SystemTextEncoding::toUTF8($dirRes) . " " . $mess[116] . ") ";
         } else {
             $success[] = $mess[34] . " " . SystemTextEncoding::toUTF8(basename($srcFile)) . " " . $messagePart;
         }
     } else {
         if (RecycleBinManager::recycleEnabled() && $destDir == "/" . $this->repository->getOption("RECYCLE_BIN")) {
             RecycleBinManager::fileToRecycle($srcFile);
         }
         if (isset($dirRes)) {
             $success[] = $mess[117] . " " . SystemTextEncoding::toUTF8(basename($srcFile)) . " " . $mess[73] . " " . SystemTextEncoding::toUTF8($destDir) . " (" . SystemTextEncoding::toUTF8($dirRes) . " " . $mess[116] . ")";
         } else {
             $success[] = $mess[34] . " " . SystemTextEncoding::toUTF8(basename($srcFile)) . " " . $mess[73] . " " . SystemTextEncoding::toUTF8($destDir);
         }
     }
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:92,代码来源:class.fsAccessDriver.php

示例8: render

 /**
  * @param array $data
  * @param array $options
  * @param ShareStore $shareStore
  */
 public static function render($data, $options, $shareStore)
 {
     if (isset($data["SECURITY_MODIFIED"]) && $data["SECURITY_MODIFIED"] === true) {
         self::renderError($data, "false");
         return;
     }
     // create driver from $data
     $className = $data["DRIVER"] . "AccessDriver";
     $u = parse_url($_SERVER["REQUEST_URI"]);
     $shortHash = pathinfo(basename($u["path"]), PATHINFO_FILENAME);
     // Load language messages
     $language = ConfService::getLanguage();
     if (isset($_GET["lang"])) {
         $language = basename($_GET["lang"]);
     }
     $messages = array();
     if (is_file(dirname(__FILE__) . "/res/i18n/" . $language . ".php")) {
         include dirname(__FILE__) . "/res/i18n/" . $language . ".php";
     } else {
         include dirname(__FILE__) . "/res/i18n/en.php";
     }
     if (isset($mess)) {
         $messages = $mess;
     }
     $AJXP_LINK_HAS_PASSWORD = false;
     $AJXP_LINK_BASENAME = SystemTextEncoding::toUTF8(basename($data["FILE_PATH"]));
     AJXP_PluginsService::getInstance()->initActivePlugins();
     ConfService::setLanguage($language);
     $mess = ConfService::getMessages();
     if ($shareStore->isShareExpired($shortHash, $data)) {
         self::renderError(array(), $shortHash, $mess["share_center.165"]);
         return;
     }
     $customs = array("title", "legend", "legend_pass", "background_attributes_1", "text_color", "background_color", "textshadow_color");
     $images = array("button", "background_1");
     $confs = $options;
     $confs["CUSTOM_SHAREPAGE_BACKGROUND_ATTRIBUTES_1"] = "background-repeat:repeat;background-position:50% 50%;";
     $confs["CUSTOM_SHAREPAGE_BACKGROUND_1"] = "plugins/action.share/res/hi-res/02.jpg";
     $confs["CUSTOM_SHAREPAGE_TEXT_COLOR"] = "#ffffff";
     $confs["CUSTOM_SHAREPAGE_TEXTSHADOW_COLOR"] = "rgba(0,0,0,5)";
     foreach ($customs as $custom) {
         $varName = "CUSTOM_SHAREPAGE_" . strtoupper($custom);
         ${$varName} = $confs[$varName];
     }
     $dlFolder = realpath(ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER"));
     foreach ($images as $custom) {
         $varName = "CUSTOM_SHAREPAGE_" . strtoupper($custom);
         if (!empty($confs[$varName])) {
             if (strpos($confs[$varName], "plugins/") === 0 && is_file(AJXP_INSTALL_PATH . "/" . $confs[$varName])) {
                 $realFile = AJXP_INSTALL_PATH . "/" . $confs[$varName];
                 copy($realFile, $dlFolder . "/binary-" . basename($realFile));
                 ${$varName} = "binary-" . basename($realFile);
             } else {
                 ${$varName} = "binary-" . $confs[$varName];
                 if (is_file($dlFolder . "/binary-" . $confs[$varName])) {
                     continue;
                 }
                 $copiedImageName = $dlFolder . "/binary-" . $confs[$varName];
                 $imgFile = fopen($copiedImageName, "wb");
                 ConfService::getConfStorageImpl()->loadBinary(array(), $confs[$varName], $imgFile);
                 fclose($imgFile);
             }
         }
     }
     HTMLWriter::charsetHeader();
     // Check password
     if (strlen($data["PASSWORD"])) {
         if (!isset($_POST['password']) || $_POST['password'] != $data["PASSWORD"]) {
             $AJXP_LINK_HAS_PASSWORD = true;
             $AJXP_LINK_WRONG_PASSWORD = isset($_POST['password']) && $_POST['password'] != $data["PASSWORD"];
             include AJXP_INSTALL_PATH . "/plugins/action.share/res/public_links.php";
             $res = '<div style="position: absolute;z-index: 10000; bottom: 0; right: 0; color: #666;font-family: HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size: 13px;text-align: right;padding: 6px; line-height: 20px;text-shadow: 0px 1px 0px white;" class="no_select_bg"><br>Build your own box with Pydio : <a style="color: #000000;" target="_blank" href="http://pyd.io/">http://pyd.io/</a><br/>Community - Free non supported version © C. du Jeu 2008-2014 </div>';
             AJXP_Controller::applyHook("tpl.filter_html", array(&$res));
             echo $res;
             return;
         }
     } else {
         if (!isset($_GET["dl"])) {
             include AJXP_INSTALL_PATH . "/plugins/action.share/res/public_links.php";
             $res = '<div style="position: absolute;z-index: 10000; bottom: 0; right: 0; color: #666;font-family: HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size: 13px;text-align: right;padding: 6px; line-height: 20px;text-shadow: 0px 1px 0px white;" class="no_select_bg"><br>Build your own box with Pydio : <a style="color: #000000;" target="_blank" href="http://pyd.io/">http://pyd.io/</a><br/>Community - Free non supported version © C. du Jeu 2008-2014 </div>';
             AJXP_Controller::applyHook("tpl.filter_html", array(&$res));
             echo $res;
             return;
         }
     }
     $filePath = AJXP_INSTALL_PATH . "/plugins/access." . $data["DRIVER"] . "/class." . $className . ".php";
     if (!is_file($filePath)) {
         die("Warning, cannot find driver for conf storage! ({$className}, {$filePath})");
     }
     require_once $filePath;
     $driver = new $className($data["PLUGIN_ID"], $data["BASE_DIR"]);
     $driver->loadManifest();
     //$hash = md5(serialize($data));
     $shareStore->incrementDownloadCounter($shortHash);
     //AuthService::logUser($data["OWNER_ID"], "", true);
//.........这里部分代码省略.........
开发者ID:Nanomani,项目名称:pydio-core,代码行数:101,代码来源:class.LegacyPubliclet.php

示例9: 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();
 }
开发者ID:kartx22,项目名称:Webkey,代码行数:42,代码来源:class.SerialMetaManager.php

示例10: 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

示例11: xmlLogs

 /**
  * Get a log in XML format.
  *
  * @param String $date Date in m-d-y format.
  * @param String $nodeName The name of the node to use for each log item.
  * @return null
  */
 public function xmlLogs($parentDir, $date, $nodeName = "log", $rootPath = "/logs")
 {
     $fName = $this->storageDir . "log_" . $date . ".txt";
     if (!is_file($fName) || !is_readable($fName)) {
         return;
     }
     $res = "";
     $lines = file($fName);
     foreach ($lines as $line) {
         $line = AJXP_Utils::xmlEntities($line);
         $matches = explode("\t", $line, 6);
         if (count($matches) == 6) {
             $fileName = $parentDir . "/" . $matches[0];
             foreach ($matches as $key => $match) {
                 $match = AJXP_Utils::xmlEntities($match);
                 $match = str_replace("\"", "'", $match);
                 $matches[$key] = $match;
             }
             if (count($matches) < 3) {
                 continue;
             }
             // rebuild timestamp
             $date = $matches[0];
             list($m, $d, $Y, $h, $i, $s) = sscanf($date, "%i-%i-%i %i:%i:%i");
             $tStamp = mktime($h, $i, $s, $m, $d, $Y);
             print SystemTextEncoding::toUTF8("<{$nodeName} is_file=\"1\" ajxp_modiftime=\"{$tStamp}\" filename=\"{$fileName}\" ajxp_mime=\"log\" date=\"{$matches['0']}\" ip=\"{$matches['1']}\" level=\"{$matches['2']}\" user=\"{$matches['3']}\" action=\"{$matches['4']}\" params=\"{$matches['5']}\" icon=\"toggle_log.png\" />", false);
         }
     }
     return;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:37,代码来源:class.textLogDriver.php

示例12: listRepositories

 public function listRepositories($root, $child, $hashValue = null, $returnNodes = false)
 {
     $REPOS_PER_PAGE = 50;
     $allNodes = array();
     if ($hashValue == null) {
         $hashValue = 1;
     }
     $offset = ($hashValue - 1) * $REPOS_PER_PAGE;
     $count = null;
     // Load all repositories = normal, templates, and templates children
     $currentUserIsGroupAdmin = AuthService::getLoggedUser() != null && AuthService::getLoggedUser()->getGroupPath() != "/";
     if ($currentUserIsGroupAdmin) {
         $repos = ConfService::listRepositoriesWithCriteria(array("owner_user_id" => AJXP_FILTER_EMPTY, "groupPath" => "regexp:/^" . str_replace("/", "\\/", AuthService::getLoggedUser()->getGroupPath()) . '/', "ORDERBY" => array("KEY" => "display", "DIR" => "ASC"), "CURSOR" => array("OFFSET" => $offset, "LIMIT" => $REPOS_PER_PAGE)), $count);
     } else {
         $repos = ConfService::listRepositoriesWithCriteria(array("parent_uuid" => AJXP_FILTER_EMPTY, "ORDERBY" => array("KEY" => "display", "DIR" => "ASC"), "CURSOR" => array("OFFSET" => $offset, "LIMIT" => $REPOS_PER_PAGE)), $count);
     }
     if (!$returnNodes) {
         var_dump($count);
         AJXP_XMLWriter::renderPaginationData($count, $hashValue, ceil($count / $REPOS_PER_PAGE));
         AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchDisplayMode="list" switchGridMode="filelist" template_name="ajxp_conf.repositories">
             <column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/>
             <column messageId="ajxp_conf.9" attributeName="accessType" sortType="String"/>
             <column messageId="ajxp_conf.125" attributeName="slug" sortType="String"/>
         </columns>');
     }
     foreach ($repos as $repoIndex => $repoObject) {
         if ($repoObject->getAccessType() == "ajxp_conf" || $repoObject->getAccessType() == "ajxp_shared") {
             continue;
         }
         if (!AuthService::canAdministrate($repoObject)) {
             continue;
         }
         if (is_numeric($repoIndex)) {
             $repoIndex = "" . $repoIndex;
         }
         $icon = "hdd_external_unmount.png";
         $editable = $repoObject->isWriteable();
         if ($repoObject->isTemplate) {
             $icon = "hdd_external_mount.png";
             if (AuthService::getLoggedUser() != null && AuthService::getLoggedUser()->getGroupPath() != "/") {
                 $editable = false;
             }
         }
         $meta = array("repository_id" => $repoIndex, "accessType" => ($repoObject->isTemplate ? "Template for " : "") . $repoObject->getAccessType(), "icon" => $icon, "owner" => $repoObject->hasOwner() ? $repoObject->getOwner() : "", "openicon" => $icon, "slug" => $repoObject->getSlug(), "parentname" => "/repositories", "ajxp_mime" => "repository" . ($editable ? "_editable" : ""));
         $nodeKey = "/data/repositories/{$repoIndex}";
         if (in_array($nodeKey, $this->currentBookmarks)) {
             $meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
         }
         $xml = AJXP_XMLWriter::renderNode($nodeKey, AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay())), true, $meta, true, false);
         if ($returnNodes) {
             $allNodes[$nodeKey] = $xml;
         } else {
             print $xml;
         }
         if ($repoObject->isTemplate) {
             // Now Load children for template repositories
             $children = ConfService::listRepositoriesWithCriteria(array("parent_uuid" => $repoIndex . ""), $count);
             foreach ($children as $childId => $childObject) {
                 if (!AuthService::canAdministrate($childObject)) {
                     continue;
                 }
                 if (is_numeric($childId)) {
                     $childId = "" . $childId;
                 }
                 $meta = array("repository_id" => $childId, "accessType" => $childObject->getAccessType(), "icon" => "repo_child.png", "owner" => $childObject->hasOwner() ? $childObject->getOwner() : "", "openicon" => "repo_child.png", "parentname" => "/repositories", "ajxp_mime" => "repository_editable");
                 $cNodeKey = "/data/repositories/{$childId}";
                 if (in_array($cNodeKey, $this->currentBookmarks)) {
                     $meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
                 }
                 $xml = AJXP_XMLWriter::renderNode($cNodeKey, AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($childObject->getDisplay())), true, $meta, true, false);
                 if ($returnNodes) {
                     $allNodes[$cNodeKey] = $xml;
                 } else {
                     print $xml;
                 }
             }
         }
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:79,代码来源:class.ajxp_confAccessDriver.php

示例13: array

/**
 * Executes an SVN command.
 * @param string $cmd Command to execute
 * @param string $switch Switches to be applied for the given command
 * @param string $arg Arguments of the command
 * @return array Result array containing commandline (idx = IDX_CMDLINE),
 * 	standard out array (idx = IDX_STDOUT),	error array (idx = IDX_ERROUT),
 *  and return code of the command (idx = IDX_CMD_RC).
 *
 * @since v1.0.0
 */
function &ExecSvnCmd($cmd, $arg = '', $switches = '')
{
    $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
    set_time_limit(100);
    $cwd = NULL;
    //'/tmp';
    $pipes = NULL;
    if (is_array($arg)) {
        $arg = implode(" ", array_map("escapeshellarg", $arg));
    } else {
        $arg = escapeshellarg(SystemTextEncoding::toUTF8($arg));
    }
    $cmdline = (SVNLIB_PATH != "" ? SVNLIB_PATH . "/" : "") . $cmd . " " . $switches . " " . $arg;
    /*
    $output = shell_exec($cmdline);
    $result = array();
    
    $result[IDX_CMDLINE] = $cmdline;
    if (strpos($switches, "xml")) {
        $result[IDX_STDOUT] = $output;
    } else {
        $result[IDX_STDOUT] = explode("\n", $output);
    }
    $result[IDX_ERROUT] = "";
    return $result;
    */
    $env = null;
    if (defined('AJXP_LOCALE')) {
        $env = array("LC_ALL" => AJXP_LOCALE);
    }
    $process = proc_open($cmdline, $descriptorspec, $pipes, NULL, $env, array("bypass_shell" => false));
    $result = array();
    $result[IDX_CMDLINE] = $cmdline;
    $result[IDX_STDOUT] = array();
    $result[IDX_ERROUT] = array();
    $result[IDX_CMD_RC] = -1;
    if (is_resource($process)) {
        // $pipes now looks like this:
        // 0 => writeable handle connected to child stdin
        // 1 => readable handle connected to child stdout
        // 2 => readable handle connected to child errout
        fclose($pipes[0]);
        $result = array();
        $result[IDX_CMDLINE] = $cmdline;
        if (strpos($switches, "xml")) {
            $result[IDX_STDOUT] = GetLineString($pipes[1]);
        } else {
            $result[IDX_STDOUT] = GetLineArray($pipes[1]);
        }
        fclose($pipes[1]);
        $result[IDX_ERROUT] = GetLineArray($pipes[2]);
        fclose($pipes[2]);
        // It is important that you close any pipes before calling
        // proc_close in order to avoid a deadlock
        $result[IDX_CMD_RC] = proc_close($process);
        //		echo "CMD: $cmdline<br/>";
        //		PrintDebugArray($result, "Result");
    }
    if (is_array($result[IDX_ERROUT]) && count($result[IDX_ERROUT])) {
        $join = trim(implode("", $result[IDX_ERROUT]));
        if ($join != "") {
            throw new Exception($join);
        }
    }
    return $result;
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:77,代码来源:svn_lib.inc.php

示例14: extractMeta

 public function extractMeta($currentFile, &$metadata, $wrapperClassName, &$realFile)
 {
     if (isset($_SESSION["SVN_COMMAND_RUNNING"]) && $_SESSION["SVN_COMMAND_RUNNING"] === true) {
         return;
     }
     $realDir = dirname(call_user_func(array($wrapperClassName, "getRealFSReference"), $currentFile));
     if (SvnManager::$svnListDir == $realDir) {
         $entries = SvnManager::$svnListCache;
     } else {
         SvnManager::$svnListDir = $realDir;
         $entries = $this->svnListNode($realDir);
         SvnManager::$svnListCache = $entries;
     }
     $fileId = SystemTextEncoding::toUTF8(basename($currentFile));
     if (isset($entries[$fileId])) {
         $metadata = array_merge($metadata, $entries[$fileId]);
     }
 }
开发者ID:pussbb,项目名称:CI_DEV_CMS,代码行数:18,代码来源:class.SvnManager.php

示例15: filterHttpVarsFromUniqueNode

 /**
  * @param array $httpVars
  * @param AJXP_Node $ajxpNode
  */
 public function filterHttpVarsFromUniqueNode(&$httpVars, $ajxpNode)
 {
     $httpVars["minisite"] = true;
     $httpVars["selection"] = true;
     if ($ajxpNode->isLeaf()) {
         $httpVars["filter_nodes"] = [$ajxpNode];
         $httpVars["file"] = "/";
         $httpVars["nodes"] = array("/");
     }
     if (!isset($httpVars["repo_label"])) {
         $httpVars["repo_label"] = SystemTextEncoding::toUTF8($ajxpNode->getLabel());
     }
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:17,代码来源:class.ShareCenter.php


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