本文整理汇总了PHP中AJXP_XMLWriter::sendMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::sendMessage方法的具体用法?PHP AJXP_XMLWriter::sendMessage怎么用?PHP AJXP_XMLWriter::sendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_XMLWriter
的用法示例。
在下文中一共展示了AJXP_XMLWriter::sendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
$errorMessage = "This is a demo, all 'write' actions are disabled!";
switch ($action) {
//------------------------------------
// WRITE ACTIONS
//------------------------------------
case "put_content":
case "copy":
case "move":
case "rename":
case "delete":
case "mkdir":
case "mkfile":
case "chmod":
case "compress":
return AJXP_XMLWriter::sendMessage(null, $errorMessage, false);
break;
//------------------------------------
// UPLOAD
//------------------------------------
//------------------------------------
// UPLOAD
//------------------------------------
case "upload":
return array("ERROR" => array("CODE" => "", "MESSAGE" => $errorMessage));
break;
default:
break;
}
return parent::switchAction($action, $httpVars, $fileVars);
}
示例2: catchError
function catchError($code, $message, $fichier, $ligne, $context)
{
if (error_reporting() == 0) {
return;
}
$message = "{$code} : {$message} in {$fichier} (l.{$ligne})";
AJXP_Logger::logAction("error", array("message" => $message));
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $message, true);
AJXP_XMLWriter::close();
exit(1);
}
示例3: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
$errorMessage = "This is a demo, all 'write' actions are disabled!";
switch ($action) {
//------------------------------------
// ONLINE EDIT
//------------------------------------
case "public_url":
if ($httpVars["sub_action"] == "delegate_repo") {
return AJXP_XMLWriter::sendMessage(null, $errorMessage, false);
} else {
print $errorMessage;
}
exit(0);
break;
//------------------------------------
// WRITE ACTIONS
//------------------------------------
//------------------------------------
// WRITE ACTIONS
//------------------------------------
case "put_content":
case "copy":
case "move":
case "rename":
case "delete":
case "mkdir":
case "mkfile":
case "chmod":
case "compress":
return AJXP_XMLWriter::sendMessage(null, $errorMessage, false);
break;
//------------------------------------
// UPLOAD
//------------------------------------
//------------------------------------
// UPLOAD
//------------------------------------
case "upload":
return array("ERROR" => array("CODE" => "", "MESSAGE" => $errorMessage));
break;
default:
break;
}
return parent::switchAction($action, $httpVars, $fileVars);
}
示例4: errorToXml
function errorToXml($mixed)
{
if (is_a($mixed, "AJXP_Exception")) {
$messages = ConfService::getMessages();
$error = "Unkown Error";
if (isset($mixed->messageId) && array_key_exists($mixed->messageId, $messages)) {
$error = $messages[$mixed->messageId];
} else {
$error = $mixed->messageId;
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $error);
AJXP_XMLWriter::close();
exit(1);
}
}
示例5: deleteSelection
public function deleteSelection($actionName, &$httpVars, $filesVars)
{
$init = $this->initDirAndSelection($httpVars, array(), true);
if (isset($init["RECYCLE"]) && isset($init["RECYCLE"]["action"]) && $init["RECYCLE"]["action"] != "delete") {
$httpVars["dest"] = SystemTextEncoding::fromUTF8($init["RECYCLE"]["dest"]);
$this->copyOrMoveSelection("move", $httpVars, $filesVars);
$userSelection = $init["ORIGINAL_SELECTION"];
$files = $userSelection->getFiles();
if ($actionName == "delete") {
foreach ($files as $file) {
RecycleBinManager::fileToRecycle($file);
}
} else {
if ($actionName == "restore") {
foreach ($files as $file) {
RecycleBinManager::deleteFromRecycle($file);
}
}
}
$this->commitChanges($actionName, array("dir" => RecycleBinManager::getRelativeRecycle()), $filesVars);
return;
}
foreach ($init["SELECTION"] as $selectedFile) {
$res = ExecSvnCmd('svn delete', $selectedFile, '--force');
}
$this->commitMessageParams = "[" . implode(",", $init["SELECTION"]) . "]";
$this->commitChanges($actionName, $httpVars, $filesVars);
$this->logInfo("Delete (svn delegate)", array("files" => $init["SELECTION"]));
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage("The selected files/folders have been deleted (by SVN)", null);
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
}
示例6: catchError
/**
* Error Catcher for PHP errors. Depending on the SERVER_DEBUG config
* shows the file/line info or not.
* @static
* @param $code
* @param $message
* @param $fichier
* @param $ligne
* @param $context
*/
public static function catchError($code, $message, $fichier, $ligne, $context)
{
if (error_reporting() == 0) {
return;
}
AJXP_Logger::error(basename($fichier), "error l.{$ligne}", array("message" => $message));
if (ConfService::getConf("SERVER_DEBUG")) {
$stack = debug_backtrace();
$stackLen = count($stack);
for ($i = 1; $i < $stackLen; $i++) {
$entry = $stack[$i];
$func = $entry['function'] . '(';
$argsLen = count($entry['args']);
for ($j = 0; $j < $argsLen; $j++) {
$s = $entry['args'][$j];
if (is_string($s)) {
$func .= $s;
} else {
if (is_object($s)) {
$func .= get_class($s);
}
}
if ($j < $argsLen - 1) {
$func .= ', ';
}
}
$func .= ')';
$message .= "\n" . str_replace(dirname(__FILE__), '', $entry['file']) . ':' . $entry['line'] . ' - ' . $func . PHP_EOL;
}
}
if (!headers_sent()) {
AJXP_XMLWriter::header();
}
if (!empty($context) && is_object($context) && is_a($context, "AJXP_PromptException")) {
AJXP_XMLWriter::write("<prompt type=\"" . $context->getPromptType() . "\"><message>" . $message . "</message><data><![CDATA[" . json_encode($context->getPromptData()) . "]]></data></prompt>", true);
} else {
AJXP_XMLWriter::sendMessage(null, SystemTextEncoding::toUTF8($message), true);
}
AJXP_XMLWriter::close();
exit(1);
}
示例7: switchAction
//.........这里部分代码省略.........
print '<pagination count="' . $countFiles . '" total="' . $totalPages . '" current="' . $crtPage . '"/>';
}
foreach ($reps as $repIndex => $repName) {
if (preg_match("/\\.zip\$/", $repName) && $skipZip) {
continue;
}
$attributes = "";
if ($searchMode) {
if (is_file($nom_rep . "/" . $repIndex)) {
$attributes = "is_file=\"true\" icon=\"{$repName}\"";
$repName = $repIndex;
}
} else {
if ($fileListMode) {
$currentFile = $nom_rep . "/" . $repIndex;
$atts = array();
$atts[] = "is_file=\"" . (is_file($currentFile) ? "1" : "0") . "\"";
$atts[] = "is_image=\"" . Utils::is_image($currentFile) . "\"";
$fGroup = @filegroup($currentFile) || "unknown";
$atts[] = "file_group=\"" . $fGroup . "\"";
$fOwner = @fileowner($currentFile) || "unknown";
$atts[] = "file_owner=\"" . $fOwner . "\"";
$fPerms = @fileperms($currentFile);
if ($fPerms !== false) {
$fPerms = substr(decoct($fPerms), is_file($currentFile) ? 2 : 1);
} else {
$fPerms = '0000';
}
$atts[] = "file_perms=\"" . $fPerms . "\"";
if (Utils::is_image($currentFile)) {
list($width, $height, $type, $attr) = @getimagesize($currentFile);
$atts[] = "image_type=\"" . image_type_to_mime_type($type) . "\"";
$atts[] = "image_width=\"{$width}\"";
$atts[] = "image_height=\"{$height}\"";
}
$atts[] = "mimestring=\"" . Utils::mimetype($currentFile, "type", is_dir($currentFile)) . "\"";
$datemodif = $this->date_modif($currentFile);
$atts[] = "ajxp_modiftime=\"" . ($datemodif ? $datemodif : "0") . "\"";
$bytesize = @filesize($currentFile) or 0;
if ($bytesize < 0) {
$bytesize = sprintf("%u", $bytesize);
}
$atts[] = "filesize=\"" . Utils::roundSize($bytesize) . "\"";
$atts[] = "bytesize=\"" . $bytesize . "\"";
$atts[] = "filename=\"" . Utils::xmlEntities(SystemTextEncoding::toUTF8($dir . "/" . $repIndex)) . "\"";
$atts[] = "icon=\"" . (is_file($currentFile) ? SystemTextEncoding::toUTF8($repName) : (is_dir($currentFile) ? "folder.png" : "mime-empty.png")) . "\"";
$attributes = join(" ", $atts);
$repName = $repIndex;
} else {
$folderBaseName = Utils::xmlEntities($repName);
$link = SystemTextEncoding::toUTF8(SERVER_ACCESS . "?dir=" . $dir . "/" . $folderBaseName);
$link = urlencode($link);
$folderFullName = Utils::xmlEntities($dir) . "/" . $folderBaseName;
$parentFolderName = $dir;
if (!$completeMode) {
$icon = CLIENT_RESOURCES_FOLDER . "/images/foldericon.png";
$openicon = CLIENT_RESOURCES_FOLDER . "/images/openfoldericon.png";
if (preg_match("/\\.zip\$/", $repName)) {
$icon = $openicon = CLIENT_RESOURCES_FOLDER . "/images/crystal/actions/16/accessories-archiver.png";
}
$attributes = "icon=\"{$icon}\" openicon=\"{$openicon}\" filename=\"" . SystemTextEncoding::toUTF8($folderFullName) . "\" src=\"{$link}\"";
}
}
}
print "<tree text=\"" . Utils::xmlEntities(SystemTextEncoding::toUTF8($repName)) . "\" {$attributes}>";
print "</tree>";
}
// ADD RECYCLE BIN TO THE LIST
if ($nom_rep == $this->repository->getOption("PATH") && RecycleBinManager::recycleEnabled() && !$completeMode && !$skipZip) {
$recycleBinOption = $this->repository->getOption("RECYCLE_BIN");
if (is_dir($this->repository->getOption("PATH") . "/" . $recycleBinOption)) {
$recycleIcon = $this->countFiles($this->repository->getOption("PATH") . "/" . $recycleBinOption, false, true) > 0 ? "trashcan_full.png" : "trashcan.png";
if ($fileListMode) {
print "<tree text=\"" . Utils::xmlEntities($mess[122]) . "\" filesize=\"-\" is_file=\"0\" is_recycle=\"1\" mimestring=\"Trashcan\" ajxp_modiftime=\"" . $this->date_modif($this->repository->getOption("PATH") . "/" . $recycleBinOption) . "\" filename=\"/" . $recycleBinOption . "\" icon=\"{$recycleIcon}\"></tree>";
} else {
print "<tree text=\"{$mess['122']}\" is_recycle=\"true\" icon=\"" . CLIENT_RESOURCES_FOLDER . "/images/crystal/mimes/16/{$recycleIcon}\" openIcon=\"" . CLIENT_RESOURCES_FOLDER . "/images/crystal/mimes/16/{$recycleIcon}\" filename=\"/" . $recycleBinOption . "\"/>";
}
}
}
AJXP_XMLWriter::close();
exit(1);
break;
}
if (isset($logMessage) || isset($errorMessage)) {
$xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
}
if (isset($requireAuth)) {
$xmlBuffer .= AJXP_XMLWriter::requireAuth(false);
}
if (isset($reload_current_node) && $reload_current_node == "true") {
$xmlBuffer .= AJXP_XMLWriter::reloadCurrentNode(false);
}
if (isset($reload_dest_node) && $reload_dest_node != "") {
$xmlBuffer .= AJXP_XMLWriter::reloadNode($reload_dest_node, false);
}
if (isset($reload_file_list)) {
$xmlBuffer .= AJXP_XMLWriter::reloadFileList($reload_file_list, false);
}
return $xmlBuffer;
}
示例8: switchAction
//.........这里部分代码省略.........
continue;
}
if ($data[$name] === "" || $userObject->parentRole == null || $userObject->parentRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "") != $data[$name] || $userObject->personalRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "") != $data[$name]) {
$userObject->personalRole->setParameterValue($pluginId, $name, $data[$name]);
$rChanges = true;
}
}
}
}
}
if ($rChanges) {
AuthService::updateRole($userObject->personalRole, $userObject);
$userObject->recomputeMergedRole();
if ($action == "custom_data_edit") {
AuthService::updateUser($userObject);
}
}
if ($action == "user_create_user") {
AJXP_Controller::applyHook($updating ? "user.after_update" : "user.after_create", array($userObject));
if (isset($data["send_email"]) && $data["send_email"] == true && !empty($data["email"])) {
$mailer = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("mailer");
if ($mailer !== false) {
$mess = ConfService::getMessages();
$link = AJXP_Utils::detectServerURL();
$apptitle = ConfService::getCoreConf("APPLICATION_TITLE");
$subject = str_replace("%s", $apptitle, $mess["507"]);
$body = str_replace(array("%s", "%link", "%user", "%pass"), array($apptitle, $link, $data["new_user_id"], $data["new_password"]), $mess["508"]);
$mailer->sendMail(array($data["email"]), $subject, $body);
}
}
echo "SUCCESS";
} else {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage($mess["241"], null);
AJXP_XMLWriter::close();
}
break;
case "user_update_user":
if (!isset($httpVars["user_id"])) {
throw new Exception("invalid arguments");
}
$userId = $httpVars["user_id"];
if (!AuthService::userExists($userId)) {
throw new Exception("Cannot find user");
}
$userObject = ConfService::getConfStorageImpl()->createUserObject($userId);
if ($userObject->getParent() != AuthService::getLoggedUser()->getId()) {
throw new Exception("Cannot find user");
}
$paramsString = ConfService::getCoreConf("NEWUSERS_EDIT_PARAMETERS", "conf");
$result = array();
$params = explode(",", $paramsString);
foreach ($params as $p) {
$result[$p] = $userObject->personalRole->filterParameterValue("core.conf", $p, AJXP_REPO_SCOPE_ALL, "");
}
HTMLWriter::charsetHeader("application/json");
echo json_encode($result);
break;
//------------------------------------
// WEBDAV PREFERENCES
//------------------------------------
//------------------------------------
// WEBDAV PREFERENCES
//------------------------------------
case "webdav_preferences":
$userObject = AuthService::getLoggedUser();
示例9: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
$mess = ConfService::getMessages();
$timestamp_url = $this->getFilteredOption("TIMESTAMP_URL");
$timestamp_login = $this->getFilteredOption("USER");
$timestamp_password = $this->getFilteredOption("PASS");
//Check if the configuration has been initiated
if (empty($timestamp_url) || empty($timestamp_login) || !empty($timestamp_password)) {
throw new AJXP_Exception($mess["timestamp.4"]);
$this->logError("Config", "TimeStamp : configuration is needed");
return false;
}
//Check if after being initiated, conf. fields have some values
if (strlen($timestamp_url) < 2 || strlen($timestamp_login) < 2 || strlen($timestamp_password) < 2) {
throw new AJXP_Exception($mess["timestamp.4"]);
$this->logError("Config", "TimeStamp : configuration is incorrect");
return false;
}
//Get active repository
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
return false;
}
$selection = new UserSelection($repository, $httpVars);
$destStreamURL = $selection->currentBaseUrl();
$fileName = $selection->getUniqueFile();
$fileUrl = $destStreamURL . $fileName;
$file = AJXP_MetaStreamWrapper::getRealFSReference($fileUrl, true);
//Hash the file, to send it to Universign
$hashedDataToTimestamp = hash_file('sha256', $file);
//Check that a tokken is not going to be timestamped !
if (substr("{$file}", -4) != '.ers') {
if (file_exists($file . '.ers')) {
throw new AJXP_Exception($mess["timestamp.1"]);
return false;
} else {
//Prepare the query that will be sent to Universign
$dataToSend = array('hashAlgo' => 'SHA256', 'withCert' => 'true', 'hashValue' => $hashedDataToTimestamp);
$dataQuery = http_build_query($dataToSend);
//Check if allow_url_fopen is allowed on the server. If not, it will use cUrl
if (ini_get('allow_url_fopen')) {
$context_options = array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($dataQuery) . "\r\n" . "Authorization: Basic " . base64_encode($timestamp_login . ':' . $timestamp_password) . "\r\n", 'content' => $dataQuery));
//Get the result from Universign
$context = stream_context_create($context_options);
$fp = fopen($timestamp_url, 'r', false, $context);
$tsp = stream_get_contents($fp);
} else {
$timestamp_header = array("Content-type: application/x-www-form-urlencoded", "Content-Length: " . strlen($dataQuery), "Authorization: Basic " . base64_encode($timestamp_login . ':' . $timestamp_password));
$timeout = 5;
$ch = curl_init($timestamp_url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataQuery);
curl_setopt($ch, CURLOPT_HTTPHEADER, $timestamp_header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Get the result from Universign
$tsp = curl_exec($ch);
curl_close($ch);
}
//Save the result to a file
file_put_contents($file . '.ers', $tsp);
//Send the succesful message
$this->logInfo("TimeStamp", array("files" => $file, "destination" => $file . '.ers'));
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::sendMessage($mess["timestamp.3"] . $fileName, null);
AJXP_XMLWriter::close();
}
} else {
throw new AJXP_Exception($mess["timestamp.2"]);
return false;
}
}
示例10: applyAction
function applyAction($actionName, $httpVars, $filesVar)
{
if ($actionName == "get_driver_actions") {
AJXP_XMLWriter::header();
$this->sendActionsToClient(false, null, null);
AJXP_XMLWriter::close();
exit(1);
}
if (isset($this->actions[$actionName])) {
// use callback;
$action = $this->actions[$actionName];
$callBack = $action["callback"];
try {
return call_user_func(array(&$this, $callBack), $actionName, $httpVars, $filesVar);
} catch (Exception $e) {
return AJXP_XMLWriter::sendMessage(null, SystemTextEncoding::toUTF8($e->getMessage()) . " (" . basename($e->getFile()) . " - L." . $e->getLine() . ")", false);
}
}
}
示例11: switchAction
//.........这里部分代码省略.........
if (isset($_GET["bm_action"]) && isset($_GET["bm_path"])) {
if ($_GET["bm_action"] == "add_bookmark") {
$title = "";
if (isset($_GET["title"])) {
$title = $_GET["title"];
}
if ($title == "" && $_GET["bm_path"] == "/") {
$title = ConfService::getCurrentRootDirDisplay();
}
$bmUser->addBookMark($_GET["bm_path"], $title);
} else {
if ($_GET["bm_action"] == "delete_bookmark") {
$bmUser->removeBookmark($_GET["bm_path"]);
} else {
if ($_GET["bm_action"] == "rename_bookmark" && isset($_GET["bm_title"])) {
$bmUser->renameBookmark($_GET["bm_path"], $_GET["bm_title"]);
}
}
}
}
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser->save();
AuthService::updateUser($bmUser);
} else {
if (!AuthService::usersEnabled()) {
$bmUser->save();
}
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::writeBookmarks($bmUser->getBookmarks());
AJXP_XMLWriter::close();
exit(1);
break;
//------------------------------------
// SAVE USER PREFERENCE
//------------------------------------
//------------------------------------
// SAVE USER PREFERENCE
//------------------------------------
case "save_user_pref":
$userObject = AuthService::getLoggedUser();
if ($userObject == null) {
exit(1);
}
$i = 0;
while (isset($_GET["pref_name_" . $i]) && isset($_GET["pref_value_" . $i])) {
$prefName = $_GET["pref_name_" . $i];
$prefValue = $_GET["pref_value_" . $i];
if ($prefName != "password") {
$userObject->setPref($prefName, $prefValue);
$userObject->save();
AuthService::updateUser($userObject);
setcookie("AJXP_{$prefName}", $prefValue);
} else {
if (isset($_GET["crt"]) && AuthService::checkPassword($userObject->getId(), $_GET["crt"], false, $_GET["pass_seed"])) {
AuthService::updatePassword($userObject->getId(), $prefValue);
} else {
//$errorMessage = "Wrong password!";
header("Content-Type:text/plain");
print "PASS_ERROR";
exit(1);
}
}
$i++;
}
header("Content-Type:text/plain");
print "SUCCESS";
exit(1);
break;
//------------------------------------
// DISPLAY DOC
//------------------------------------
//------------------------------------
// DISPLAY DOC
//------------------------------------
case "display_doc":
header("Content-type:text/html; charset:UTF-8");
echo HTMLWriter::getDocFile(htmlentities($_GET["doc_file"]));
exit(1);
break;
default:
break;
}
if (isset($logMessage) || isset($errorMessage)) {
$xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
}
if (isset($requireAuth)) {
$xmlBuffer .= AJXP_XMLWriter::requireAuth(false);
}
if (isset($reload_current_node) && $reload_current_node == "true") {
$xmlBuffer .= AJXP_XMLWriter::reloadCurrentNode(false);
}
if (isset($reload_dest_node) && $reload_dest_node != "") {
$xmlBuffer .= AJXP_XMLWriter::reloadNode($reload_dest_node, false);
}
if (isset($reload_file_list)) {
$xmlBuffer .= AJXP_XMLWriter::reloadFileList($reload_file_list, false);
}
return $xmlBuffer;
}
示例12: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->accessDriver)) {
throw new Exception("Cannot find access driver!");
}
if ($this->accessDriver->getId() == "access.demo") {
$errorMessage = "This is a demo, all 'write' actions are disabled!";
if ($httpVars["sub_action"] == "delegate_repo") {
return AJXP_XMLWriter::sendMessage(null, $errorMessage, false);
} else {
print $errorMessage;
}
return;
}
switch ($action) {
//------------------------------------
// SHARING FILE OR FOLDER
//------------------------------------
case "share":
$subAction = isset($httpVars["sub_action"]) ? $httpVars["sub_action"] : "";
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$ajxpNode = new AJXP_Node($this->urlBase . $file);
if (!file_exists($ajxpNode->getUrl())) {
throw new Exception("Cannot share a non-existing file: " . $ajxpNode->getUrl());
}
$metadata = null;
if ($subAction == "delegate_repo") {
header("Content-type:text/plain");
$result = $this->createSharedRepository($httpVars, $this->repository, $this->accessDriver);
if (is_a($result, "Repository")) {
$metadata = array("element" => $result->getUniqueId());
$numResult = 200;
} else {
$numResult = $result;
}
print $numResult;
} else {
if ($subAction == "create_minisite") {
header("Content-type:text/plain");
$res = $this->createSharedMinisite($httpVars, $this->repository, $this->accessDriver);
if (!is_array($res)) {
$url = $res;
} else {
list($hash, $url) = $res;
$metadata = array("element" => $hash, "minisite" => isset($httpVars["create_guest_user"]) ? "public" : "private");
}
print $url;
} else {
$maxdownload = abs(intval($this->getFilteredOption("FILE_MAX_DOWNLOAD", $this->repository->getId())));
$download = isset($httpVars["downloadlimit"]) ? abs(intval($httpVars["downloadlimit"])) : 0;
if ($maxdownload == 0) {
$httpVars["downloadlimit"] = $download;
} elseif ($maxdownload > 0 && $download == 0) {
$httpVars["downloadlimit"] = $maxdownload;
} else {
$httpVars["downloadlimit"] = min($download, $maxdownload);
}
$maxexpiration = abs(intval($this->getFilteredOption("FILE_MAX_EXPIRATION", $this->repository->getId())));
$expiration = isset($httpVars["expiration"]) ? abs(intval($httpVars["expiration"])) : 0;
if ($maxexpiration == 0) {
$httpVars["expiration"] = $expiration;
} elseif ($maxexpiration > 0 && $expiration == 0) {
$httpVars["expiration"] = $maxexpiration;
} else {
$httpVars["expiration"] = min($expiration, $maxexpiration);
}
$data = $this->accessDriver->makePublicletOptions($file, $httpVars["password"], $httpVars["expiration"], $httpVars["downloadlimit"], $this->repository);
$customData = array();
foreach ($httpVars as $key => $value) {
if (substr($key, 0, strlen("PLUGINS_DATA_")) == "PLUGINS_DATA_") {
$customData[substr($key, strlen("PLUGINS_DATA_"))] = $value;
}
}
if (count($customData)) {
$data["PLUGINS_DATA"] = $customData;
}
list($hash, $url) = $this->writePubliclet($data, $this->accessDriver, $this->repository);
$metaArray = array();
if ($ajxpNode->hasMetaStore()) {
$existingMeta = $ajxpNode->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
if (isset($existingMeta) && is_array($existingMeta) && array_key_exists("element", $existingMeta)) {
if (is_string($existingMeta["element"])) {
$metaArray[$existingMeta["element"]] = array();
} else {
$metaArray = $existingMeta["element"];
}
}
}
$metaArray[$hash] = array();
$metadata = array("element" => $metaArray);
if (isset($httpVars["format"]) && $httpVars["format"] == "json") {
header("Content-type:application/json");
echo json_encode(array("element_id" => $hash, "publiclet_link" => $url));
} else {
header("Content-type:text/plain");
echo $url;
}
flush();
}
}
//.........这里部分代码省略.........
示例13: crossRepositoryCopy
public function crossRepositoryCopy($httpVars)
{
ConfService::detectRepositoryStreams(true);
$mess = ConfService::getMessages();
$selection = new UserSelection();
$selection->initFromHttpVars($httpVars);
$files = $selection->getFiles();
$accessType = $this->repository->getAccessType();
$repositoryId = $this->repository->getId();
$plugin = AJXP_PluginsService::findPlugin("access", $accessType);
$origWrapperData = $plugin->detectStreamWrapper(true);
$origStreamURL = $origWrapperData["protocol"] . "://{$repositoryId}";
$destRepoId = $httpVars["dest_repository_id"];
$destRepoObject = ConfService::getRepositoryById($destRepoId);
$destRepoAccess = $destRepoObject->getAccessType();
$plugin = AJXP_PluginsService::findPlugin("access", $destRepoAccess);
$plugin->repository = $destRepoObject;
$destWrapperData = $plugin->detectStreamWrapper(true);
$destStreamURL = $destWrapperData["protocol"] . "://{$destRepoId}";
// Check rights
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if (!$loggedUser->canRead($repositoryId) || !$loggedUser->canWrite($destRepoId) || isset($httpVars["moving_files"]) && !$loggedUser->canWrite($repositoryId)) {
throw new Exception($mess[364]);
}
}
$srcRepoData = array('base_url' => $origStreamURL, 'wrapper_name' => $origWrapperData['classname'], 'recycle' => $this->repository->getOption("RECYCLE_BIN"));
$destRepoData = array('base_url' => $destStreamURL, 'wrapper_name' => $destWrapperData['classname'], 'chmod' => $this->repository->getOption('CHMOD'));
$messages = array();
$errorMessages = array();
foreach ($files as $file) {
$this->copyOrMoveFile(AJXP_Utils::decodeSecureMagic($httpVars["dest"]), $file, $errorMessages, $messages, isset($httpVars["moving_files"]) ? true : false, $srcRepoData, $destRepoData);
}
AJXP_XMLWriter::header();
if (count($errorMessages)) {
AJXP_XMLWriter::sendMessage(null, join("\n", $errorMessages), true);
}
AJXP_XMLWriter::sendMessage(join("\n", $messages), null, true);
AJXP_XMLWriter::close();
}
示例14: applyAction
public function applyAction($actionName, $httpVars, $fileVars)
{
$messages = ConfService::getMessages();
$repoId = $this->accessDriver->repository->getId();
if ($actionName == "search") {
// TMP
if (strpos($httpVars["query"], "keyword:") === 0) {
$parts = explode(":", $httpVars["query"]);
$this->applyAction("search_by_keyword", array("field" => $parts[1]), array());
return null;
}
require_once "Zend/Search/Lucene.php";
try {
$index = $this->loadIndex($repoId, false);
} catch (Exception $ex) {
AJXP_XMLWriter::header();
if ($this->seemsCurrentlyIndexing($repoId, 3)) {
AJXP_XMLWriter::sendMessage($messages["index.lucene.11"], null);
} else {
if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
AJXP_Controller::applyActionInBackground($repoId, "index", array());
sleep(2);
AJXP_XMLWriter::triggerBgAction("check_index_status", array("repository_id" => $repoId), sprintf($messages["index.lucene.8"], "/"), true, 5);
AJXP_XMLWriter::sendMessage($messages["index.lucene.7"], null);
} else {
AJXP_XMLWriter::sendMessage($messages["index.lucene.12"], null);
}
}
AJXP_XMLWriter::close();
return null;
}
$textQuery = $httpVars["query"];
if ($this->getFilteredOption("AUTO_WILDCARD") === true && strlen($textQuery) > 0 && ctype_alnum($textQuery)) {
if ($textQuery[0] == '"' && $textQuery[strlen($textQuery) - 1] == '"') {
$textQuery = substr($textQuery, 1, -1);
} else {
if ($textQuery[strlen($textQuery) - 1] != "*") {
$textQuery .= "*";
}
}
}
if (strpos($textQuery, ":") !== false) {
$textQuery = str_replace("ajxp_meta_ajxp_document_content:", "body:", $textQuery);
$textQuery = $this->filterSearchRangesKeywords($textQuery);
$query = "ajxp_scope:shared AND ({$textQuery})";
} else {
if ((isset($this->metaFields) || $this->indexContent) && isset($httpVars["fields"])) {
$sParts = array();
foreach (explode(",", $httpVars["fields"]) as $searchField) {
if ($searchField == "filename") {
$sParts[] = "basename:" . $textQuery;
} else {
if ($searchField == "ajxp_document_content") {
$sParts[] = $textQuery;
} else {
if (in_array($searchField, $this->metaFields)) {
$sParts[] = "ajxp_meta_" . $searchField . ":" . $textQuery;
} else {
if ($searchField == "ajxp_document_content") {
$sParts[] = "title:" . $textQuery;
$sParts[] = "body:" . $textQuery;
$sParts[] = "keywords:" . $textQuery;
}
}
}
}
}
$query = implode(" OR ", $sParts);
$query = "ajxp_scope:shared AND ({$query})";
$this->logDebug("Query : {$query}");
} else {
$index->setDefaultSearchField("basename");
$query = $this->filterSearchRangesKeywords($textQuery);
}
}
$this->setDefaultAnalyzer();
if ($query == "*") {
$index->setDefaultSearchField("ajxp_node");
$query = "yes";
$hits = $index->find($query, "node_url", SORT_STRING);
} else {
$hits = $index->find($query);
}
$commitIndex = false;
if (isset($httpVars['return_selection'])) {
$returnNodes = array();
} else {
AJXP_XMLWriter::header();
}
$cursor = 0;
if (isset($httpVars['limit'])) {
$limit = intval($httpVars['limit']);
}
foreach ($hits as $hit) {
// Backward compatibility
$hit->node_url = preg_replace("#ajxp\\.[a-z_]+://#", "pydio://", $hit->node_url);
if ($hit->serialized_metadata != null) {
$meta = unserialize(base64_decode($hit->serialized_metadata));
if (isset($meta["ajxp_modiftime"])) {
$meta["ajxp_relativetime"] = $meta["ajxp_description"] = $messages[4] . " " . AJXP_Utils::relativeDate($meta["ajxp_modiftime"], $messages);
//.........这里部分代码省略.........
示例15: 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;
}