本文整理汇总了PHP中ConfService::getMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getMessages方法的具体用法?PHP ConfService::getMessages怎么用?PHP ConfService::getMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getMessages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFolder
/**
* Initialize download folder if not already done
*/
public function initFolder()
{
$downloadFolder = $this->getPublicDownloadFolder();
$downloadUrl = $this->getPublicDownloadUrl();
if (is_file($downloadFolder . "/grid_t.png")) {
return;
}
$pDir = dirname(__FILE__);
$messages = ConfService::getMessages();
$sTitle = sprintf($messages["action.share.1"], ConfService::getCoreConf("APPLICATION_TITLE"));
$sLegend = $messages["action.share.20"];
@copy($pDir . "/res/dl.png", $downloadFolder . "/dl.png");
@copy($pDir . "/res/favi.png", $downloadFolder . "/favi.png");
@copy($pDir . "/res/grid_t.png", $downloadFolder . "/grid_t.png");
@copy($pDir . "/res/button_cancel.png", $downloadFolder . "/button_cancel.png");
@copy(AJXP_INSTALL_PATH . "/server/index.html", $downloadFolder . "/index.html");
$htaccessContent = "Order Deny,Allow\nAllow from all\n";
$htaccessContent .= "\n<Files \".ajxp_*\">\ndeny from all\n</Files>\n";
$path = parse_url($downloadUrl, PHP_URL_PATH);
$htaccessContent .= '
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase ' . $path . '
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([.a-zA-Z0-9_-]+)\\.php$ share.php?hash=$1 [QSA]
RewriteRule ^([.a-zA-Z0-9_-]+)--([a-z-]+)$ share.php?hash=$1&lang=$2 [QSA]
RewriteRule ^([.a-zA-Z0-9_-]+)$ share.php?hash=$1 [QSA]
</IfModule>
';
file_put_contents($downloadFolder . "/.htaccess", $htaccessContent);
$content404 = file_get_contents($pDir . "/res/404.html");
$content404 = str_replace(array("AJXP_MESSAGE_TITLE", "AJXP_MESSAGE_LEGEND"), array($sTitle, $sLegend), $content404);
file_put_contents($downloadFolder . "/404.html", $content404);
}
示例2: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// CHANGE USER PASSWORD
//------------------------------------
case "pass_change":
$userObject = AuthService::getLoggedUser();
if ($userObject == null || $userObject->getId() == "guest") {
header("Content-Type:text/plain");
print "SUCCESS";
}
$oldPass = $httpVars["old_pass"];
$newPass = $httpVars["new_pass"];
$passSeed = $httpVars["pass_seed"];
if (AuthService::checkPassword($userObject->getId(), $oldPass, false, $passSeed)) {
AuthService::updatePassword($userObject->getId(), $newPass);
} else {
header("Content-Type:text/plain");
print "PASS_ERROR";
}
header("Content-Type:text/plain");
print "SUCCESS";
break;
default:
break;
}
return "";
}
示例3: initMeta
public function initMeta($accessDriver)
{
$this->accessDriver = $accessDriver;
if (!function_exists("exif_read_data")) {
return;
}
$messages = ConfService::getMessages();
$def = $this->getMetaDefinition();
if (!count($def)) {
return;
}
$cdataHead = '<div>
<div class="panelHeader infoPanelGroup" colspan="2">' . $messages["meta.exif.1"] . '</div>
<table class="infoPanelTable" cellspacing="0" border="0" cellpadding="0">';
$cdataFoot = '</table></div>';
$cdataParts = "";
foreach ($def as $key => $label) {
$trClass = $even ? " class=\"even\"" : "";
$even = !$even;
$cdataParts .= '<tr' . $trClass . '><td class="infoPanelLabel">' . $label . '</td><td class="infoPanelValue" id="ip_' . $key . '">#{' . $key . '}</td></tr>';
}
$selection = $this->xPath->query('registry_contributions/client_configs/component_config[@className="InfoPanel"]/infoPanelExtension');
$contrib = $selection->item(0);
$contrib->setAttribute("attributes", implode(",", array_keys($def)));
$contrib->setAttribute("modifier", "ExifCellRenderer.prototype.infoPanelModifier");
$htmlSel = $this->xPath->query('html', $contrib);
$html = $htmlSel->item(0);
$cdata = $this->manifestDoc->createCDATASection($cdataHead . $cdataParts . $cdataFoot);
$html->appendChild($cdata);
parent::init($this->options);
}
示例4: bookmarkBar
function bookmarkBar($allBookmarks)
{
//echo '<div id="bmbar_title">MyBookmarks </div>';
$mess = ConfService::getMessages();
foreach (array_reverse($allBookmarks) as $path) {
if (is_array($path)) {
$path = $path["PATH"];
}
echo '<div class="bm" onmouseover="this.className=\'bm_hover\';" onmouseout="this.className=\'bm\';"><img width="16" height="16" src="' . CLIENT_RESOURCES_FOLDER . '/images/crystal/mimes/16/folder.png" border="0" align="ABSMIDDLE" style="float:left;"><a href="#" class="disabled" title="' . $mess[146] . '" onclick="ajaxplorer.actionBar.removeBookmark(\'' . $path . '\'); return false;" onmouseover="$(this).addClassName(\'enabled\');" onmouseout="$(this).removeClassName(\'enabled\');"><img width="16" height="16" src="' . CLIENT_RESOURCES_FOLDER . '/images/crystal/actions/16/delete_bookmark.png" border="0" align="ABSMIDDLE" alt="' . $mess[146] . '"></a> <a href="#" onclick="ajaxplorer.goTo(\'' . $path . '\'); return false;" class="bookmark_button">' . $path . '</a></div>';
}
}
示例5: AJXP_Exception
public function AJXP_Exception($messageString, $messageId = false)
{
if ($messageId !== false && class_exists("ConfService")) {
$messages = ConfService::getMessages();
if (array_key_exists($messageId, $messages)) {
$messageString = $messages[$messageId];
} else {
$messageString = $messageId;
}
}
parent::__construct($messageString);
}
示例6: processUserAccessPoint
public function processUserAccessPoint($action, $httpVars, $fileVars)
{
switch ($action) {
case "user_access_point":
$uri = explode("/", trim($_SERVER["REQUEST_URI"], "/"));
array_shift($uri);
$action = array_shift($uri);
$this->processSubAction($action, $uri);
$_SESSION['OVERRIDE_GUI_START_PARAMETERS'] = array("REBASE" => "../../", "USER_GUI_ACTION" => $action);
AJXP_Controller::findActionAndApply("get_boot_gui", array(), array());
unset($_SESSION['OVERRIDE_GUI_START_PARAMETERS']);
break;
case "reset-password-ask":
// This is a reset password request, generate a token and store it.
// Find user by id
if (AuthService::userExists($httpVars["email"])) {
// Send email
$userObject = ConfService::getConfStorageImpl()->createUserObject($httpVars["email"]);
$email = $userObject->personalRole->filterParameterValue("core.conf", "email", AJXP_REPO_SCOPE_ALL, "");
if (!empty($email)) {
$uuid = AJXP_Utils::generateRandomString(48);
ConfService::getConfStorageImpl()->saveTemporaryKey("password-reset", $uuid, AJXP_Utils::decodeSecureMagic($httpVars["email"]), array());
$mailer = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("mailer");
if ($mailer !== false) {
$mess = ConfService::getMessages();
$link = AJXP_Utils::detectServerURL() . "/user/reset-password/" . $uuid;
$mailer->sendMail(array($email), $mess["gui.user.1"], $mess["gui.user.7"] . "<a href=\"{$link}\">{$link}</a>");
} else {
echo 'ERROR: There is no mailer configured, please contact your administrator';
}
}
}
// Prune existing expired tokens
ConfService::getConfStorageImpl()->pruneTemporaryKeys("password-reset", 20);
echo "SUCCESS";
break;
case "reset-password":
ConfService::getConfStorageImpl()->pruneTemporaryKeys("password-reset", 20);
// This is a reset password
if (isset($httpVars["key"]) && isset($httpVars["user_id"])) {
$key = ConfService::getConfStorageImpl()->loadTemporaryKey("password-reset", $httpVars["key"]);
if ($key != null && $key["user_id"] == $httpVars["user_id"] && AuthService::userExists($key["user_id"])) {
AuthService::updatePassword($key["user_id"], $httpVars["new_pass"]);
}
ConfService::getConfStorageImpl()->deleteTemporaryKey("password-reset", $httpVars["key"]);
}
AuthService::disconnect();
echo 'SUCCESS';
break;
default:
break;
}
}
示例7: initMeta
public function initMeta($accessDriver)
{
$this->accessDriver = $accessDriver;
$messages = ConfService::getMessages();
$def = $this->getMetaDefinition();
$cdataHead = '<div>
<div class="panelHeader infoPanelGroup" colspan="2">' . $messages["meta.serial.1"] . '</div>
<table class="infoPanelTable" cellspacing="0" border="0" cellpadding="0">';
$cdataFoot = '</table></div>';
$cdataParts = "";
$selection = $this->xPath->query('registry_contributions/client_configs/component_config[@className="FilesList"]/columns');
$contrib = $selection->item(0);
$even = false;
$searchables = array();
foreach ($def as $key => $label) {
$col = $this->manifestDoc->createElement("additional_column");
$col->setAttribute("messageString", $label);
$col->setAttribute("attributeName", $key);
$col->setAttribute("sortType", "String");
if ($key == "stars_rate") {
$col->setAttribute("modifier", "MetaCellRenderer.prototype.starsRateFilter");
$col->setAttribute("sortType", "CellSorterValue");
} else {
if ($key == "css_label") {
$col->setAttribute("modifier", "MetaCellRenderer.prototype.cssLabelsFilter");
$col->setAttribute("sortType", "CellSorterValue");
} else {
$searchables[$key] = $label;
}
}
$contrib->appendChild($col);
$trClass = $even ? " class=\"even\"" : "";
$even = !$even;
$cdataParts .= '<tr' . $trClass . '><td class="infoPanelLabel">' . $label . '</td><td class="infoPanelValue" id="ip_' . $key . '">#{' . $key . '}</td></tr>';
}
$selection = $this->xPath->query('registry_contributions/client_configs/component_config[@className="InfoPanel"]/infoPanelExtension');
$contrib = $selection->item(0);
$contrib->setAttribute("attributes", implode(",", array_keys($def)));
if (isset($def["stars_rate"]) || isset($def["css_label"])) {
$contrib->setAttribute("modifier", "MetaCellRenderer.prototype.infoPanelModifier");
}
$htmlSel = $this->xPath->query('html', $contrib);
$html = $htmlSel->item(0);
$cdata = $this->manifestDoc->createCDATASection($cdataHead . $cdataParts . $cdataFoot);
$html->appendChild($cdata);
$selection = $this->xPath->query('registry_contributions/client_configs/template_part[@ajxpClass="SearchEngine"]');
$tag = $selection->item(0);
$tag->setAttribute("ajxpOptions", json_encode(count($searchables) ? array("metaColumns" => $searchables) : array()));
parent::init($this->options);
}
示例8: 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);
}
}
示例9: precheckQuotaUsage
/**
* @param AJXP_Node $node
* @param int $newSize
* @return mixed
* @throws Exception
*/
public function precheckQuotaUsage($node, $newSize = 0)
{
// POSITIVE DELTA ?
if ($newSize == 0) {
return null;
}
$delta = $newSize;
$quota = $this->getAuthorized();
$path = $this->getWorkingPath();
$q = $this->getUsage($path);
AJXP_Logger::debug("QUOTA : Previous usage was {$q}");
if ($q === false) {
$q = $this->computeDirSpace($path);
}
if ($q + $delta >= $quota) {
$mess = ConfService::getMessages();
throw new Exception($mess["meta.quota.3"] . " (" . AJXP_Utils::roundSize($quota) . ")!");
}
}
示例10: receiveAction
/**
* @param String $action
* @param Array $httpVars
* @param Array $fileVars
* @throws Exception
*/
public function receiveAction($action, $httpVars, $fileVars)
{
//VAR CREATION OUTSIDE OF ALL CONDITIONS, THEY ARE "MUST HAVE" VAR !!
$messages = ConfService::getMessages();
$repository = ConfService::getRepository();
$userSelection = new UserSelection($repository, $httpVars);
$nodes = $userSelection->buildNodes();
$currentDirPath = AJXP_Utils::safeDirname($userSelection->getUniqueNode()->getPath());
$currentDirPath = rtrim($currentDirPath, "/") . "/";
$currentDirUrl = $userSelection->currentBaseUrl() . $currentDirPath;
if (empty($httpVars["compression_id"])) {
$compressionId = sha1(rand());
$httpVars["compression_id"] = $compressionId;
} else {
$compressionId = $httpVars["compression_id"];
}
$progressCompressionFileName = $this->getPluginCacheDir(false, true) . DIRECTORY_SEPARATOR . "progressCompressionID-" . $compressionId . ".txt";
if (empty($httpVars["extraction_id"])) {
$extractId = sha1(rand());
$httpVars["extraction_id"] = $extractId;
} else {
$extractId = $httpVars["extraction_id"];
}
$progressExtractFileName = $this->getPluginCacheDir(false, true) . DIRECTORY_SEPARATOR . "progressExtractID-" . $extractId . ".txt";
if ($action == "compression") {
$archiveName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]), AJXP_SANITIZE_FILENAME);
$archiveFormat = $httpVars["type_archive"];
$tabTypeArchive = array(".tar", ".tar.gz", ".tar.bz2");
$acceptedExtension = false;
foreach ($tabTypeArchive as $extensionArchive) {
if ($extensionArchive == $archiveFormat) {
$acceptedExtension = true;
break;
}
}
if ($acceptedExtension == false) {
file_put_contents($progressCompressionFileName, "Error : " . $messages["compression.16"]);
throw new AJXP_Exception($messages["compression.16"]);
}
$typeArchive = $httpVars["type_archive"];
//if we can run in background we do it
if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
$archivePath = $currentDirPath . $archiveName;
file_put_contents($progressCompressionFileName, $messages["compression.5"]);
AJXP_Controller::applyActionInBackground($repository->getId(), "compression", $httpVars);
AJXP_XMLWriter::header();
AJXP_XMLWriter::triggerBgAction("check_compression_status", array("repository_id" => $repository->getId(), "compression_id" => $compressionId, "archive_path" => SystemTextEncoding::toUTF8($archivePath)), $messages["compression.5"], true, 2);
AJXP_XMLWriter::close();
return null;
} else {
$maxAuthorizedSize = 4294967296;
$currentDirUrlLength = strlen($currentDirUrl);
$tabFolders = array();
$tabAllRecursiveFiles = array();
$tabFilesNames = array();
foreach ($nodes as $node) {
$nodeUrl = $node->getUrl();
if (is_file($nodeUrl) && filesize($nodeUrl) < $maxAuthorizedSize) {
array_push($tabAllRecursiveFiles, $nodeUrl);
array_push($tabFilesNames, substr($nodeUrl, $currentDirUrlLength));
}
if (is_dir($nodeUrl)) {
array_push($tabFolders, $nodeUrl);
}
}
//DO A FOREACH OR IT'S GONNA HAVE SOME SAMES FILES NAMES
foreach ($tabFolders as $value) {
$dossiers = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($value));
foreach ($dossiers as $file) {
if ($file->isDir()) {
continue;
}
array_push($tabAllRecursiveFiles, $file->getPathname());
array_push($tabFilesNames, substr($file->getPathname(), $currentDirUrlLength));
}
}
//WE STOP IF IT'S JUST AN EMPTY FOLDER OR NO FILES
if (empty($tabFilesNames)) {
file_put_contents($progressCompressionFileName, "Error : " . $messages["compression.17"]);
throw new AJXP_Exception($messages["compression.17"]);
}
try {
$tmpArchiveName = tempnam(AJXP_Utils::getAjxpTmpDir(), "tar-compression") . ".tar";
$archive = new PharData($tmpArchiveName);
} catch (Exception $e) {
file_put_contents($progressCompressionFileName, "Error : " . $e->getMessage());
throw $e;
}
$counterCompression = 0;
//THE TWO ARRAY ARE MERGED FOR THE FOREACH LOOP
$tabAllFiles = array_combine($tabAllRecursiveFiles, $tabFilesNames);
foreach ($tabAllFiles as $fullPath => $fileName) {
try {
$archive->addFile(AJXP_MetaStreamWrapper::getRealFSReference($fullPath), $fileName);
//.........这里部分代码省略.........
示例11: writeNodesDiff
/**
* Send a <reload> XML instruction for refreshing the list
* @static
* @param $diffNodes
* @param bool $print
* @return string
*/
public static function writeNodesDiff($diffNodes, $print = false)
{
/**
* @var $ajxpNode AJXP_Node
*/
$mess = ConfService::getMessages();
$buffer = "<nodes_diff>";
if (isset($diffNodes["REMOVE"]) && count($diffNodes["REMOVE"])) {
$buffer .= "<remove>";
foreach ($diffNodes["REMOVE"] as $nodePath) {
$nodePath = AJXP_Utils::xmlEntities($nodePath, true);
$buffer .= "<tree filename=\"{$nodePath}\" ajxp_im_time=\"" . time() . "\"/>";
}
$buffer .= "</remove>";
}
if (isset($diffNodes["ADD"]) && count($diffNodes["ADD"])) {
$buffer .= "<add>";
foreach ($diffNodes["ADD"] as $ajxpNode) {
$ajxpNode->loadNodeInfo(false, false, "all");
if (!empty($ajxpNode->metaData["mimestring_id"]) && array_key_exists($ajxpNode->metaData["mimestring_id"], $mess)) {
$ajxpNode->mergeMetadata(array("mimestring" => $mess[$ajxpNode->metaData["mimestring_id"]]));
}
$buffer .= self::renderAjxpNode($ajxpNode, true, false);
}
$buffer .= "</add>";
}
if (isset($diffNodes["UPDATE"]) && count($diffNodes["UPDATE"])) {
$buffer .= "<update>";
foreach ($diffNodes["UPDATE"] as $originalPath => $ajxpNode) {
$ajxpNode->loadNodeInfo(false, false, "all");
if (!empty($ajxpNode->metaData["mimestring_id"]) && array_key_exists($ajxpNode->metaData["mimestring_id"], $mess)) {
$ajxpNode->mergeMetadata(array("mimestring" => $mess[$ajxpNode->metaData["mimestring_id"]]));
}
$ajxpNode->original_path = $originalPath;
$buffer .= self::renderAjxpNode($ajxpNode, true, false);
}
$buffer .= "</update>";
}
$buffer .= "</nodes_diff>";
return AJXP_XMLWriter::write($buffer, $print);
/*
$nodePath = AJXP_Utils::xmlEntities($nodePath, true);
$pendingSelection = AJXP_Utils::xmlEntities($pendingSelection, true);
return AJXP_XMLWriter::write("<reload_instruction object=\"data\" node=\"$nodePath\" file=\"$pendingSelection\"/>", $print);
*/
}
示例12: applyActions
public function applyActions($actionName, $httpVars, $fileVars)
{
$git = new VersionControl_Git($this->repoBase);
switch ($actionName) {
case "git_history":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$file = ltrim($file, "/");
$res = $this->gitHistory($git, $file);
AJXP_XMLWriter::header();
$ic = AJXP_Utils::mimetype($file, "image", false);
$index = count($res);
$mess = ConfService::getMessages();
foreach ($res as &$commit) {
unset($commit["DETAILS"]);
$commit["icon"] = $ic;
$commit["index"] = $index;
$commit["EVENT"] = $mess["meta.git." . $commit["EVENT"]];
$index--;
AJXP_XMLWriter::renderNode("/" . $commit["ID"], basename($commit["FILE"]), true, $commit);
}
AJXP_XMLWriter::close();
break;
break;
case "git_revertfile":
$originalFile = AJXP_Utils::decodeSecureMagic($httpVars["original_file"]);
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$commitId = $httpVars["commit_id"];
$command = $git->getCommand("cat-file");
$command->setOption("s", true);
$command->addArgument($commitId . ":" . $file);
$size = $command->execute();
$command = $git->getCommand("show");
$command->addArgument($commitId . ":" . $file);
$commandLine = $command->createCommandString();
$outputStream = fopen($this->repoBase . $originalFile, "w");
$this->executeCommandInStreams($git, $commandLine, $outputStream);
fclose($outputStream);
$this->commitChanges();
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
break;
case "git_getfile":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$commitId = $httpVars["commit_id"];
$attach = $httpVars["attach"];
$command = $git->getCommand("cat-file");
$command->setOption("s", true);
$command->addArgument($commitId . ":" . $file);
$size = $command->execute();
$command = $git->getCommand("show");
$command->addArgument($commitId . ":" . $file);
$commandLine = $command->createCommandString();
if ($attach == "inline") {
$fileExt = substr(strrchr(basename($file), '.'), 1);
if (empty($fileExt)) {
$fileMime = "application/octet-stream";
} else {
$regex = "/^([\\w\\+\\-\\.\\/]+)\\s+(\\w+\\s)*({$fileExt}\\s)/i";
$lines = file(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/editor.browser/resources/other/mime.types");
foreach ($lines as $line) {
if (substr($line, 0, 1) == '#') {
continue;
}
// skip comments
$line = rtrim($line) . " ";
if (!preg_match($regex, $line, $matches)) {
continue;
}
// no match to the extension
$fileMime = $matches[1];
}
}
if (empty($fileMime)) {
$fileMime = "application/octet-stream";
}
HTMLWriter::generateInlineHeaders(basename($file), $size, $fileMime);
} else {
HTMLWriter::generateAttachmentsHeader(basename($file), $size, false, false);
}
$outputStream = fopen("php://output", "a");
$this->executeCommandInStreams($git, $commandLine, $outputStream);
fclose($outputStream);
break;
break;
default:
break;
}
}
示例13: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
if (preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/MSIE 8/', $_SERVER['HTTP_USER_AGENT'])) {
// Force legacy theme for the moment
$this->pluginConf["GUI_THEME"] = "oxygen";
}
if (!defined("AJXP_THEME_FOLDER")) {
define("CLIENT_RESOURCES_FOLDER", AJXP_PLUGINS_FOLDER . "/gui.ajax/res");
define("AJXP_THEME_FOLDER", CLIENT_RESOURCES_FOLDER . "/themes/" . $this->pluginConf["GUI_THEME"]);
}
foreach ($httpVars as $getName => $getValue) {
${$getName} = AJXP_Utils::securePath($getValue);
}
if (isset($dir) && $action != "upload") {
$dir = SystemTextEncoding::fromUTF8($dir);
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// GET AN HTML TEMPLATE
//------------------------------------
case "get_template":
HTMLWriter::charsetHeader();
$folder = CLIENT_RESOURCES_FOLDER . "/html";
if (isset($httpVars["pluginName"])) {
$folder = AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/" . AJXP_Utils::securePath($httpVars["pluginName"]);
if (isset($httpVars["pluginPath"])) {
$folder .= "/" . AJXP_Utils::securePath($httpVars["pluginPath"]);
}
}
$crtTheme = $this->pluginConf["GUI_THEME"];
$thFolder = AJXP_THEME_FOLDER . "/html";
if (isset($template_name)) {
if (is_file($thFolder . "/" . $template_name)) {
include $thFolder . "/" . $template_name;
} else {
if (is_file($folder . "/" . $template_name)) {
include $folder . "/" . $template_name;
}
}
}
break;
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
case "get_i18n_messages":
$refresh = false;
if (isset($httpVars["lang"])) {
ConfService::setLanguage($httpVars["lang"]);
$refresh = true;
}
HTMLWriter::charsetHeader('text/javascript');
HTMLWriter::writeI18nMessagesClass(ConfService::getMessages($refresh));
break;
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
case "get_xml_registry":
$regDoc = AJXP_PluginsService::getXmlRegistry();
$changes = AJXP_Controller::filterActionsRegistry($regDoc);
if ($changes) {
AJXP_PluginsService::updateXmlRegistry($regDoc);
}
if (isset($_GET["xPath"])) {
$regPath = new DOMXPath($regDoc);
$nodes = $regPath->query($_GET["xPath"]);
AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $_GET["xPath"]));
if ($nodes->length) {
print AJXP_XMLWriter::replaceAjxpXmlKeywords($regDoc->saveXML($nodes->item(0)));
}
AJXP_XMLWriter::close("ajxp_registry_part");
} else {
AJXP_Utils::safeIniSet("zlib.output_compression", "4096");
header('Content-Type: application/xml; charset=UTF-8');
print AJXP_XMLWriter::replaceAjxpXmlKeywords($regDoc->saveXML());
}
break;
//------------------------------------
// DISPLAY DOC
//------------------------------------
//------------------------------------
// DISPLAY DOC
//------------------------------------
case "display_doc":
HTMLWriter::charsetHeader();
echo HTMLWriter::getDocFile(AJXP_Utils::securePath(htmlentities($_GET["doc_file"])));
break;
//------------------------------------
// GET BOOT GUI
//------------------------------------
//------------------------------------
//.........这里部分代码省略.........
示例14: roundSize
function roundSize($filesize)
{
$mess = ConfService::getMessages();
$size_unit = $mess["byte_unit_symbol"];
if ($filesize < 0) {
$filesize = sprintf("%u", $filesize);
}
if ($filesize >= 1073741824) {
$filesize = round($filesize / 1073741824 * 100) / 100 . " G" . $size_unit;
} elseif ($filesize >= 1048576) {
$filesize = round($filesize / 1048576 * 100) / 100 . " M" . $size_unit;
} elseif ($filesize >= 1024) {
$filesize = round($filesize / 1024 * 100) / 100 . " K" . $size_unit;
} else {
$filesize = $filesize . " " . $size_unit;
}
if ($filesize == 0) {
$filesize = "-";
}
return $filesize;
}
示例15: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
$xmlBuffer = "";
foreach ($httpVars as $getName => $getValue) {
${$getName} = AJXP_Utils::securePath($getValue);
}
if (isset($dir) && $action != "upload") {
$dir = SystemTextEncoding::fromUTF8($dir);
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// SWITCH THE ROOT REPOSITORY
//------------------------------------
case "switch_repository":
if (!isset($repository_id)) {
break;
}
$dirList = ConfService::getRepositoriesList();
/** @var $repository_id string */
if (!isset($dirList[$repository_id])) {
$errorMessage = "Trying to switch to an unkown repository!";
break;
}
ConfService::switchRootDir($repository_id);
// Load try to init the driver now, to trigger an exception
// if it's not loading right.
ConfService::loadRepositoryDriver();
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$user = AuthService::getLoggedUser();
$activeRepId = ConfService::getCurrentRepositoryId();
$user->setArrayPref("history", "last_repository", $activeRepId);
$user->save("user");
}
//$logMessage = "Successfully Switched!";
$this->logInfo("Switch Repository", array("rep. id" => $repository_id));
break;
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
case "get_xml_registry":
case "state":
$regDoc = AJXP_PluginsService::getXmlRegistry();
$changes = AJXP_Controller::filterRegistryFromRole($regDoc);
if ($changes) {
AJXP_PluginsService::updateXmlRegistry($regDoc);
}
$clone = $regDoc->cloneNode(true);
$clonePath = new DOMXPath($clone);
$serverCallbacks = $clonePath->query("//serverCallback|hooks");
foreach ($serverCallbacks as $callback) {
$callback->parentNode->removeChild($callback);
}
$xPath = '';
if (isset($httpVars["xPath"])) {
$xPath = ltrim(AJXP_Utils::securePath($httpVars["xPath"]), "/");
}
if (!empty($xPath)) {
$nodes = $clonePath->query($xPath);
if ($httpVars["format"] == "json") {
$data = AJXP_XMLWriter::xmlToArray($nodes->item(0));
HTMLWriter::charsetHeader("application/json");
echo json_encode($data);
} else {
AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $xPath));
if ($nodes->length) {
print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML($nodes->item(0)));
}
AJXP_XMLWriter::close("ajxp_registry_part");
}
} else {
AJXP_Utils::safeIniSet("zlib.output_compression", "4096");
if ($httpVars["format"] == "json") {
$data = AJXP_XMLWriter::xmlToArray($clone);
HTMLWriter::charsetHeader("application/json");
echo json_encode($data);
} else {
header('Content-Type: application/xml; charset=UTF-8');
print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML());
}
}
break;
//------------------------------------
// BOOKMARK BAR
//------------------------------------
//------------------------------------
// BOOKMARK BAR
//------------------------------------
case "get_bookmarks":
$bmUser = null;
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser = AuthService::getLoggedUser();
} else {
if (!AuthService::usersEnabled()) {
//.........这里部分代码省略.........