本文整理汇总了PHP中AJXP_Utils::xmlEntities方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Utils::xmlEntities方法的具体用法?PHP AJXP_Utils::xmlEntities怎么用?PHP AJXP_Utils::xmlEntities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Utils
的用法示例。
在下文中一共展示了AJXP_Utils::xmlEntities方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseSpecificContributions
public function parseSpecificContributions(&$contribNode)
{
parent::parseSpecificContributions($contribNode);
if ($contribNode->nodeName != "actions") {
return;
}
$actionXpath = new DOMXPath($contribNode->ownerDocument);
$paramList = $actionXpath->query('action[@name="scheduler_addTask"]/processing/standardFormDefinition/param[@name="repository_id"]', $contribNode);
if (!$paramList->length) {
return;
}
$paramNode = $paramList->item(0);
$sVals = array();
$repos = ConfService::getRepositoriesList("all");
foreach ($repos as $repoId => $repoObject) {
$sVals[] = $repoId . "|" . AJXP_Utils::xmlEntities($repoObject->getDisplay());
}
$sVals[] = "*|All Repositories";
$paramNode->attributes->getNamedItem("choices")->nodeValue = implode(",", $sVals);
if (!AuthService::usersEnabled() || AuthService::getLoggedUser() == null) {
return;
}
$paramList = $actionXpath->query('action[@name="scheduler_addTask"]/processing/standardFormDefinition/param[@name="user_id"]', $contribNode);
if (!$paramList->length) {
return;
}
$paramNode = $paramList->item(0);
$paramNode->attributes->getNamedItem("default")->nodeValue = AuthService::getLoggedUser()->getId();
}
示例2: writeRepositoriesData
/**
* Write the repositories access rights in XML format
* @static
* @param AbstractAjxpUser|null $loggedUser * @internal param bool $details
* @return string
*/
public static function writeRepositoriesData($loggedUser)
{
$st = "<repositories>";
$streams = ConfService::detectRepositoryStreams(false);
$exposed = array();
$cacheHasExposed = AJXP_PluginsService::getInstance()->loadFromPluginQueriesCache("//server_settings/param[contains(@scope,'repository') and @expose='true']");
if ($cacheHasExposed !== null && is_array($cacheHasExposed)) {
$exposed = $cacheHasExposed;
} else {
$exposed_props = AJXP_PluginsService::searchAllManifests("//server_settings/param[contains(@scope,'repository') and @expose='true']", "node", false, false, true);
foreach ($exposed_props as $exposed_prop) {
$pluginId = $exposed_prop->parentNode->parentNode->getAttribute("id");
$paramName = $exposed_prop->getAttribute("name");
$paramDefault = $exposed_prop->getAttribute("default");
$exposed[] = array("PLUGIN_ID" => $pluginId, "NAME" => $paramName, "DEFAULT" => $paramDefault);
}
AJXP_PluginsService::getInstance()->storeToPluginQueriesCache("//server_settings/param[contains(@scope,'repository') and @expose='true']", $exposed);
}
$accessible = ConfService::getAccessibleRepositories($loggedUser, false, false);
foreach ($accessible as $repoId => $repoObject) {
$rightString = "";
$streamString = "";
if (in_array($repoObject->accessType, $streams)) {
$streamString = "allowCrossRepositoryCopy=\"true\"";
}
if ($repoObject->getUniqueUser()) {
$streamString .= " user_editable_repository=\"true\" ";
}
$slugString = "";
$slug = $repoObject->getSlug();
if (!empty($slug)) {
$slugString = "repositorySlug=\"{$slug}\"";
}
$isSharedString = "";
if ($repoObject->hasOwner()) {
$uId = $repoObject->getOwner();
$uObject = ConfService::getConfStorageImpl()->createUserObject($uId);
$label = $uObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $uId);
if (empty($label)) {
$label = $uId;
}
$isSharedString = 'owner="' . AJXP_Utils::xmlEntities($label) . '"';
}
$descTag = "";
$public = false;
if (!empty($_SESSION["CURRENT_MINISITE"])) {
$public = true;
}
$description = $repoObject->getDescription($public);
if (!empty($description)) {
$descTag = '<description>' . AJXP_Utils::xmlEntities($description, true) . '</description>';
}
$roleString = "";
if ($loggedUser != null) {
$merged = $loggedUser->mergedRole;
$params = array();
foreach ($exposed as $exposed_prop) {
$metaOptions = $repoObject->getOption("META_SOURCES");
if (!isset($metaOptions[$exposed_prop["PLUGIN_ID"]])) {
continue;
}
$value = $exposed_prop["DEFAULT"];
if (isset($metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]])) {
$value = $metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]];
}
$value = $merged->filterParameterValue($exposed_prop["PLUGIN_ID"], $exposed_prop["NAME"], $repoId, $value);
if ($value !== null) {
if ($value === true || $value === false) {
$value = $value === true ? "true" : "false";
}
$params[] = '<repository_plugin_param plugin_id="' . $exposed_prop["PLUGIN_ID"] . '" name="' . $exposed_prop["NAME"] . '" value="' . AJXP_Utils::xmlEntities($value) . '"/>';
$roleString .= str_replace(".", "_", $exposed_prop["PLUGIN_ID"]) . "_" . $exposed_prop["NAME"] . '="' . AJXP_Utils::xmlEntities($value) . '" ';
}
}
$roleString .= 'acl="' . $merged->getAcl($repoId) . '"';
if ($merged->hasMask($repoId)) {
$roleString .= ' hasMask="true" ';
}
}
$st .= "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$rightString} {$streamString} {$slugString} {$isSharedString} {$roleString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label>" . $descTag . $repoObject->getClientSettings() . "</repo>";
}
$st .= "</repositories>";
return $st;
}
示例3: upgradeFrom324
public static function upgradeFrom324($oldLocation, $dryRun = true)
{
$mess = ConfService::getMessages();
$logFile = AJXP_CACHE_DIR . "/import_from_324.log";
if ($dryRun) {
print "<b>" . $mess["updater.10"] . "</b><br><br>";
}
$itemsToCopy = array(array("mask" => "public/*.php", "target" => "data/public"), array("mask" => "public/.ajxp_publiclet_counters.ser", "target" => "data/public"), array("mask" => "server/logs/*.txt", "target" => "data/logs"), array("mask" => "server/conf/repo.ser", "target" => "data/plugins/conf.serial"), array("mask" => "server/conf/aliases.ser", "target" => "data/plugins/conf.serial"), array("mask" => "server/users/*", "target" => "data/plugins/auth.serial"));
$configToPluginsConf = array(array("type" => "constant", "name" => "ENABLE_USERS", "target" => "core.auth/ENABLE_USERS"), array("type" => "constant", "name" => "ALLOW_GUEST_BROWSING", "target" => "core.auth/ALLOW_GUEST_BROWSING"), array("type" => "constant", "name" => "AJXP_PASSWORD_MINLENGTH", "target" => "core.auth/PASSWORD_MINLENGTH"), array("type" => "variable", "name" => "AJXP_SESSION_SET_CREDENTIALS", "target" => "core.auth/SESSION_SET_CREDENTIALS"), array("type" => "constant", "name" => "PUBLIC_DOWNLOAD_FOLDER", "target" => "core.ajaxplorer/PUBLIC_DOWNLOAD_FOLDER"), array("type" => "constant", "name" => "PUBLIC_DOWNLOAD_URL", "target" => "core.ajaxplorer/PUBLIC_DOWNLOAD_URL"), array("type" => "variable", "name" => "default_language", "target" => "core.ajaxplorer/DEFAULT_LANGUAGE"), array("type" => "constant", "name" => "GZIP_DOWNLOAD", "target" => "core.ajaxplorer/GZIP_COMPRESSION"), array("type" => "constant", "name" => "GZIP_LIMIT", "target" => "core.ajaxplorer/GZIP_LIMIT"), array("type" => "constant", "name" => "DISABLE_ZIP_CREATION", "target" => "core.ajaxplorer/ZIP_CREATION", "modifier" => "NOT"), array("type" => "constant", "name" => "AJXP_WEBDAV_ENABLE", "target" => "core.ajaxplorer/WEBDAV_ENABLE"), array("type" => "constant", "name" => "AJXP_WEBDAV_BASEURI", "target" => "core.ajaxplorer/WEBDAV_BASEURI"), array("type" => "constant", "name" => "AJXP_WEBDAV_BASEHOST", "target" => "core.ajaxplorer/WEBDAV_BASEHOST"), array("type" => "constant", "name" => "AJXP_WEBDAV_DIGESTREALM", "target" => "core.ajaxplorer/WEBDAV_DIGESTREALM"), array("type" => "variable", "name" => "webmaster_email", "target" => "core.ajaxplorer/WEBMASTER_EMAIL"), array("type" => "variable", "name" => "max_caracteres", "target" => "core.ajaxplorer/NODENAME_MAX_LENGTH"), array("type" => "variable", "name" => "customTitle", "target" => "core.ajaxplorer/APPLICATION_TITLE"), array("type" => "constant", "name" => "HTTPS_POLICY_FILE", "target" => "uploader.flex/HTTPS_POLICY_FILE"), array("type" => "variable", "name" => "upload_max_number", "target" => "core.uploader/UPLOAD_MAX_NUMBER"), array("type" => "variable", "name" => "upload_max_size_per_file", "target" => "core.uploader/UPLOAD_MAX_SIZE"), array("type" => "variable", "name" => "upload_max_size_total", "target" => "core.uploader/UPLOAD_MAX_SIZE_TOTAL"), array("type" => "constant", "name" => "AJXP_CLIENT_TIMEOUT_TIME", "target" => "gui.ajax/CLIENT_TIMEOUT_TIME"), array("type" => "constant", "name" => "AJXP_CLIENT_TIMEOUT_WARN_BEFORE", "target" => "gui.ajax/CLIENT_TIMEOUT_WARN"), array("type" => "constant", "name" => "GOOGLE_ANALYTICS_ID", "target" => "gui.ajax/GOOGLE_ANALYTICS_ID"), array("type" => "constant", "name" => "GOOGLE_ANALYTICS_DOMAIN", "target" => "gui.ajax/GOOGLE_ANALYTICS_DOMAIN"), array("type" => "constant", "name" => "GOOGLE_ANALYTICS_EVENT", "target" => "gui.ajax/GOOGLE_ANALYTICS_EVENT"), array("type" => "variable", "name" => "customTitleFontSize", "target" => "gui.ajax/CUSTOM_FONT_SIZE"), array("type" => "variable", "name" => "customIcon", "target" => "gui.ajax/CUSTOM_ICON"), array("type" => "variable", "name" => "customIconWidth", "target" => "gui.ajax/CUSTOM_ICON_WIDTH"), array("type" => "variable", "name" => "welcomeCustomMessage", "target" => "gui.ajax/CUSTOM_WELCOME_MESSAGE"));
if (!$dryRun) {
$logFileHandle = fopen($logFile, "w");
}
foreach ($itemsToCopy as $item) {
$files = glob($oldLocation . "/" . $item["mask"]);
if ($files === false) {
continue;
}
foreach ($files as $fileOrFolder) {
$target = AJXP_INSTALL_PATH . "/" . $item["target"];
if (is_file($fileOrFolder)) {
$l = "Copy {$fileOrFolder} to " . $target . "/" . basename($fileOrFolder) . "\n";
if ($dryRun) {
print nl2br($l);
} else {
copy($fileOrFolder, $target . "/" . basename($fileOrFolder));
fwrite($logFileHandle, $l);
}
} else {
$l = "Copy recursively " . $fileOrFolder . " to " . $target . "/" . basename($fileOrFolder) . "\n";
if ($dryRun) {
print nl2br($l);
} else {
self::copy_r($fileOrFolder, $target . "/" . basename($fileOrFolder));
fwrite($logFileHandle, $l);
}
}
}
}
// FILTER THE CONF FILE TO REMOVE ALL CONSTANTS
$originalConfdir = $oldLocation . "/server/conf";
$lines = file($originalConfdir . "/conf.php");
$filteredLines = array();
$mutedConstants = array();
foreach ($lines as $line) {
if (preg_match('/define\\("(.*)", (.*)\\);/', $line, $matches)) {
//var_dump($matches);
$value = trim($matches[2]);
if (!empty($value)) {
if ($value[0] == "\"") {
$strValue = substr($value, 1, strlen($value) - 2);
if (!empty($strValue)) {
$mutedConstants[$matches[1]] = $strValue;
}
} else {
if ($value == "true") {
$mutedConstants[$matches[1]] = true;
} else {
if ($value == "false") {
$mutedConstants[$matches[1]] = false;
} else {
if (is_numeric($value)) {
$mutedConstants[$matches[1]] = intval($value);
} else {
eval("\$res = {$value};");
$mutedConstants[$matches[1]] = $res;
}
}
}
}
}
$filteredLines[] = "//" . $line;
} else {
$filteredLines[] = $line;
}
}
if (!$dryRun) {
fwrite($logFileHandle, "Writing alternate version of conf.php without constants.");
}
file_put_contents($originalConfdir . "/muted_conf.php", implode("", $filteredLines));
// NOW IMPORT THE MODIFIED CONF FILE AND GATHER ALL DATA
include $originalConfdir . "/muted_conf.php";
$allOptions = array();
foreach ($configToPluginsConf as $localConfig) {
$localConfigName = $localConfig["name"];
if ($localConfig["type"] == "constant" && isset($mutedConstants[$localConfigName])) {
$localConfig["value"] = $mutedConstants[$localConfigName];
} else {
if ($localConfig["type"] == "variable" && isset(${$localConfigName})) {
$localConfig["value"] = ${$localConfigName};
}
}
if (!isset($localConfig["value"]) || empty($localConfig["value"])) {
continue;
}
$l = "Should set " . $localConfig["target"] . " to value " . $localConfig["value"] . "\n";
if ($dryRun) {
$value = AJXP_Utils::xmlEntities($localConfig["value"]);
list($pluginId, $pluginOptionName) = explode("/", $localConfig["target"]);
$plug = AJXP_PluginsService::getInstance()->getPluginById($pluginId);
$options = $plug->getConfigs();
//.........这里部分代码省略.........
示例4: 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();
}
示例5: 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;
}
示例6: listRepositories
function listRepositories()
{
$repos = ConfService::getRepositoriesList();
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="ajxp_conf.9" attributeName="accessType" sortType="String"/></columns>');
$repoArray = array();
foreach ($repos as $repoIndex => $repoObject) {
if ($repoObject->getAccessType() == "ajxp_conf") {
continue;
}
$name = AJXP_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];
$metaData = array("repository_id" => $repoIndex, "accessType" => $repoObject->getAccessType(), "icon" => "folder_red.png", "openicon" => "folder_red.png", "parentname" => "/repositories", "ajxp_mime" => "repository" . ($repoObject->isWriteable() ? "_editable" : ""));
AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
}
}
示例7: 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
*/
function xmlLogs($parentDir, $date, $nodeName = "log")
{
$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 = array();
if (preg_match("/(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\$/", $line, $matches) !== false) {
$fileName = $parentDir . "/" . $matches[1];
foreach ($matches as $key => $match) {
$match = AJXP_Utils::xmlEntities($match);
$match = str_replace("\"", "'", $match);
$matches[$key] = $match;
}
print SystemTextEncoding::toUTF8("<{$nodeName} is_file=\"1\" filename=\"{$fileName}\" ajxp_mime=\"log\" date=\"{$matches['1']}\" ip=\"{$matches['2']}\" level=\"{$matches['3']}\" user=\"{$matches['4']}\" action=\"{$matches['5']}\" params=\"{$matches['6']}\" icon=\"toggle_log.png\" />");
}
}
return;
}
示例8: extractExif
public function extractExif($actionName, $httpVars, $fileVars)
{
$repo = $this->accessDriver->repository;
$userSelection = new UserSelection($this->accessDriver->repository, $httpVars);
$repo->detectStreamWrapper(true);
$selectedNode = $userSelection->getUniqueNode();
$realFile = AJXP_MetaStreamWrapper::getRealFSReference($selectedNode->getUrl());
AJXP_Utils::safeIniSet('exif.encode_unicode', 'UTF-8');
$exifData = @exif_read_data($realFile, 0, TRUE);
if ($exifData === false || !is_array($exifData)) {
return;
}
if ($exifData !== false && isset($exifData["GPS"])) {
$exifData["COMPUTED_GPS"] = $this->convertGPSData($exifData);
}
$iptc = $this->extractIPTC($realFile);
if (count($iptc)) {
$exifData["IPTC"] = $iptc;
}
$excludeTags = array();
// array("componentsconfiguration", "filesource", "scenetype", "makernote", "datadump");
$format = "xml";
if (isset($httpVars["format"]) && $httpVars["format"] == "json") {
$format = "json";
}
$filteredData = array();
foreach ($exifData as $section => $data) {
$filteredData[$section] = array();
foreach ($data as $key => $value) {
if (is_array($value)) {
$value = implode(",", $value);
}
if (in_array(strtolower($key), $excludeTags)) {
continue;
}
if (strpos($key, "UndefinedTag:") === 0) {
continue;
}
$value = preg_replace('/[^[:print:]]/', '', $value);
$filteredData[$section][$key] = SystemTextEncoding::toUTF8($value);
}
}
if ($format == "xml") {
AJXP_XMLWriter::header("metadata", array("file" => $selectedNode->getPath(), "type" => "EXIF"));
foreach ($filteredData as $section => $data) {
print "<exifSection name='{$section}'>";
foreach ($data as $key => $value) {
print "<exifTag name=\"{$key}\">" . AJXP_Utils::xmlEntities($value) . "</exifTag>";
}
print "</exifSection>";
}
AJXP_XMLWriter::close("metadata");
} else {
HTMLWriter::charsetHeader("application/json");
echo json_encode($filteredData);
}
}
示例9: switchAction
//.........这里部分代码省略.........
//------------------------------------
//------------------------------------
// XML LISTING
//------------------------------------
case "ls":
if (!isset($dir) || $dir == "/") {
$dir = "";
}
$lsOptions = $this->parseLsOptions(isset($httpVars["options"]) ? $httpVars["options"] : "a");
$startTime = microtime();
$dir = AJXP_Utils::securePath(SystemTextEncoding::magicDequote($dir));
$path = $this->urlBase . ($dir != "" ? "/" . $dir : "");
$threshold = $this->repository->getOption("PAGINATION_THRESHOLD");
if (!isset($threshold) || intval($threshold) == 0) {
$threshold = 500;
}
$limitPerPage = $this->repository->getOption("PAGINATION_NUMBER");
if (!isset($limitPerPage) || intval($limitPerPage) == 0) {
$limitPerPage = 200;
}
$countFiles = $this->countFiles($path, !$lsOptions["f"]);
if ($countFiles > $threshold) {
$offset = 0;
$crtPage = 1;
if (isset($page)) {
$offset = (intval($page) - 1) * $limitPerPage;
$crtPage = $page;
}
$totalPages = floor($countFiles / $limitPerPage) + 1;
} else {
$offset = $limitPerPage = 0;
}
$metaData = array();
$crtLabel = AJXP_Utils::xmlEntities(basename($dir), true);
if (RecycleBinManager::recycleEnabled()) {
if (RecycleBinManager::currentLocationIsRecycle($dir)) {
$metaData["ajxp_mime"] = "ajxp_recycle";
$crtLabel = AJXP_Utils::xmlEntities($mess[122]);
} else {
if ($dir == "") {
$metaData["repo_has_recycle"] = "true";
}
}
}
AJXP_XMLWriter::renderHeaderNode(AJXP_Utils::xmlEntities($dir, true), $crtLabel, false, $metaData);
if (isset($totalPages) && isset($crtPage)) {
AJXP_XMLWriter::renderPaginationData($countFiles, $crtPage, $totalPages);
if (!$lsOptions["f"]) {
AJXP_XMLWriter::close();
exit(1);
}
}
$cursor = 0;
$handle = opendir($path);
if (!$handle) {
throw new AJXP_Exception("Cannot open dir " . $path);
}
$fullList = array("d" => array(), "z" => array(), "f" => array());
while (strlen($nodeName = readdir($handle)) > 0) {
if ($nodeName == "." || $nodeName == "..") {
continue;
}
$isLeaf = is_file($path . "/" . $nodeName) || AJXP_Utils::isBrowsableArchive($nodeName);
if (!$this->filterNodeName($path, $nodeName, $isLeaf, $lsOptions)) {
continue;
}
示例10: printDiagnostic
function printDiagnostic()
{
$outputArray = array();
$testedParams = array();
$passed = AJXP_Utils::runTests($outputArray, $testedParams);
AJXP_Utils::testResultsToFile($outputArray, $testedParams);
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchDisplayMode="list" switchGridMode="fileList" template_name="ajxp_conf.diagnostic" defaultWidth="20%"><column messageId="ajxp_conf.23" attributeName="ajxp_label" sortType="String"/><column messageId="ajxp_conf.24" attributeName="data" sortType="String"/></columns>');
if (is_file(TESTS_RESULT_FILE)) {
include_once TESTS_RESULT_FILE;
if (isset($diagResults)) {
foreach ($diagResults as $id => $value) {
$value = AJXP_Utils::xmlEntities($value);
print "<tree icon=\"susehelpcenter.png\" is_file=\"1\" filename=\"{$id}\" text=\"{$id}\" data=\"{$value}\" ajxp_mime=\"testResult\"/>";
}
}
}
}
示例11: listRepositories
public function listRepositories()
{
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="user_dash.9" attributeName="parent_label" sortType="String"/><column messageId="user_dash.9" attributeName="repo_accesses" sortType="String"/></columns>');
$repoArray = array();
$loggedUser = AuthService::getLoggedUser();
$count = 0;
$repos = ConfService::listRepositoriesWithCriteria(array("owner_user_id" => $loggedUser->getId()), $count);
$searchAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf");
$displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
if ($searchAll || $displayAll) {
$baseGroup = "/";
} else {
$baseGroup = AuthService::filterBaseGroup("/");
}
AuthService::setGroupFiltering(false);
$users = AuthService::listUsers($baseGroup);
$minisites = $this->listSharedFiles("minisites");
foreach ($repos as $repoIndex => $repoObject) {
if ($repoObject->getAccessType() == "ajxp_conf") {
continue;
}
if (!$repoObject->hasOwner() || $repoObject->getOwner() != $loggedUser->getId()) {
continue;
}
if (is_numeric($repoIndex)) {
$repoIndex = "" . $repoIndex;
}
$name = (isset($minisites[$repoIndex]) ? "[Minisite] " : "") . AJXP_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];
$repoAccesses = array();
foreach ($users as $userId => $userObject) {
if ($userObject->getId() == $loggedUser->getId()) {
continue;
}
$label = $userObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $userId);
if (empty($label)) {
$label = $userId;
}
$acl = $userObject->mergedRole->getAcl($repoObject->getId());
if (!empty($acl)) {
$repoAccesses[] = $label . " (" . $acl . ")";
}
}
$parent = $repoObject->getParentId();
$parentRepo =& $repos[$parent];
$parentLabel = $this->metaIcon("folder-open") . $parentRepo->getDisplay();
$repoPath = $repoObject->getOption("PATH");
$parentPath = $parentRepo->getOption("PATH");
$parentLabel .= " (" . str_replace($parentPath, "", $repoPath) . ")";
$metaData = array("repository_id" => $repoIndex, "icon" => "document_open_remote.png", "openicon" => "document_open_remote.png", "parentname" => "/repositories", "parent_label" => $parentLabel, "repo_accesses" => count($repoAccesses) ? $this->metaIcon("share-sign") . implode(", ", $repoAccesses) : "", "ajxp_mime" => "shared_repository");
AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
}
}
示例12: switchAction
//.........这里部分代码省略.........
$currentPage = 1;
}
$query = "SELECT * FROM {$tableName}";
$searchQuery = false;
if ($tableName == "ajxpmysqldriver_searchresults") {
if (isset($_SESSION["LAST_SQL_QUERY"])) {
$query = $_SESSION["LAST_SQL_QUERY"];
$matches = array();
if (preg_match("/SELECT [\\S, ]* FROM (\\S*).*/i", $query, $matches) !== false) {
$tableName = $matches[1];
$searchQuery = true;
} else {
break;
}
} else {
break;
}
}
if (isset($order_column)) {
$query .= " ORDER BY {$order_column} " . strtoupper($order_direction);
if (!isset($_SESSION["AJXP_ORDER_DATA"])) {
$_SESSION["AJXP_ORDER_DATA"] = array();
}
$_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName] = array("column" => $order_column, "dir" => $order_direction);
} else {
if (isset($_SESSION["AJXP_ORDER_DATA"])) {
if (isset($_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName])) {
$order_column = $_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName]["column"];
$order_direction = $_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName]["dir"];
$query .= " ORDER BY {$order_column} " . strtoupper($order_direction);
}
}
}
try {
$result = $this->showRecords($query, $tableName, $currentPage);
} catch (AJXP_Exception $ex) {
unset($_SESSION["LAST_SQL_QUERY"]);
throw $ex;
}
AJXP_XMLWriter::header();
$blobCols = array();
$columnsString = '<columns switchDisplayMode="list" switchGridMode="grid">';
foreach ($result["COLUMNS"] as $col) {
$columnsString .= "<column messageString=\"" . $col["NAME"] . "\" attributeName=\"" . $col["NAME"] . "\" field_name=\"" . $col["NAME"] . "\" field_type=\"" . $col["TYPE"] . "\" field_size=\"" . $col["LENGTH"] . "\" field_flags=\"" . $this->cleanFlagString($col["FLAGS"]) . "\" field_pk=\"" . (preg_match("/primary/", $col["FLAGS"]) ? "1" : "0") . "\" field_null=\"" . (preg_match("/not_null/", $col["FLAGS"]) ? "NOT_NULL" : "NULL") . "\" sortType=\"" . $this->sqlTypeToSortType($col["TYPE"]) . "\" field_default=\"" . $col["DEFAULT"] . "\"/>";
if (stristr($col["TYPE"], "blob") !== false && ($col["FLAGS"] != "" && stristr($col["FLAGS"], "binary"))) {
$blobCols[] = $col["NAME"];
}
}
$columnsString .= '</columns>';
AJXP_XMLWriter::sendFilesListComponentConfig($columnsString);
//print '<pagination total="'.$result["TOTAL_PAGES"].'" current="'.$currentPage.'" remote_order="true" currentOrderCol="'.$order_column.'" currentOrderDir="'.$order_direction.'"/>';
if ($result["TOTAL_PAGES"] > 1) {
AJXP_XMLWriter::renderPaginationData($count, $currentPage, $result["TOTAL_PAGES"]);
}
foreach ($result["ROWS"] as $arbitIndex => $row) {
print '<tree ';
$pkString = "";
foreach ($row as $key => $value) {
if (in_array($key, $blobCols)) {
$sizeStr = " - NULL";
if (strlen($value)) {
$sizeStr = " - " . AJXP_Utils::roundSize(strlen($value));
}
print "{$key}=\"BLOB{$sizeStr}\" ";
} else {
$value = str_replace("\"", "", $value);
$value = AJXP_Utils::xmlEntities($value);
print $key . '="' . SystemTextEncoding::toUTF8($value) . '" ';
if ($result["HAS_PK"] > 0) {
if (in_array($key, $result["PK_FIELDS"])) {
$pkString .= $key . "__" . $value . ".";
}
}
}
}
if ($result["HAS_PK"] > 0) {
print 'filename="record.' . $pkString . 'pk" ';
print 'is_file="1" ajxp_mime="pk"/>';
} else {
print 'filename="record_' . $arbitIndex . '.no_pk" ';
print 'is_file="1" ajxp_mime="row"/>';
}
}
AJXP_XMLWriter::close();
}
$this->closeDbLink($link);
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" || isset($reload_file_list)) {
$xmlBuffer .= AJXP_XMLWriter::reloadDataNode("", "", false);
}
return $xmlBuffer;
}
示例13: writeRepositoriesData
function writeRepositoriesData($loggedUser, $details = false)
{
$st = "";
$st .= "<repositories>";
$streams = ConfService::detectRepositoryStreams(false);
foreach (ConfService::getRepositoriesList() as $rootDirIndex => $rootDirObject) {
$toLast = false;
if ($rootDirObject->getAccessType() == "ajxp_conf") {
if (AuthService::usersEnabled() && !$loggedUser->isAdmin()) {
continue;
} else {
$toLast = true;
}
}
if ($loggedUser == null || $loggedUser->canRead($rootDirIndex) || $details) {
$rightString = "";
if ($details) {
$rightString = " r=\"" . ($loggedUser->canRead($rootDirIndex) ? "1" : "0") . "\" w=\"" . ($loggedUser->canWrite($rootDirIndex) ? "1" : "0") . "\"";
}
$streamString = "";
if (in_array($rootDirObject->accessType, $streams)) {
$streamString = "allowCrossRepositoryCopy=\"true\"";
}
if ($toLast) {
$lastString = "<repo access_type=\"" . $rootDirObject->accessType . "\" id=\"" . $rootDirIndex . "\"{$rightString} {$streamString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($rootDirObject->getDisplay())) . "</label>" . $rootDirObject->getClientSettings() . "</repo>";
} else {
$st .= "<repo access_type=\"" . $rootDirObject->accessType . "\" id=\"" . $rootDirIndex . "\"{$rightString} {$streamString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($rootDirObject->getDisplay())) . "</label>" . $rootDirObject->getClientSettings() . "</repo>";
}
}
}
if (isset($lastString)) {
$st .= $lastString;
}
$st .= "</repositories>";
return $st;
}
示例14: formatXmlLogItem
/**
* Format a table row into an xml list of nodes for the log reader
*
* @param String $node Name of the xml node
* @param String $icon Icon to use for the list item
* @param String $dateattrib
* @param String $filename Source of the list, usually a filename
* @param String $remote_ip Client IP that was logged
* @param String $log_level Log level of the item
* @param String $user User who was logged in
* @param String $action The action the user performed.
* @param String $params Parameters to the action
* @param Integer $is_file 0|1 to indicate whether this list item is a file or not.
*
* @return String Formatted XML node for insertion into the log reader
*/
public function formatXmlLogItem($node, $icon, $dateattrib, $filename, $remote_ip, $log_level, $user, $source, $action, $params, $rootPath = "/logs")
{
$remote_ip = $this->inet_dtop($remote_ip);
$log_unixtime = strtotime($dateattrib);
$log_datetime = date("m-d-y", $log_unixtime) . " " . date("G:i:s", $log_unixtime);
$log_year = date('Y', $log_unixtime);
$log_month = date('m', $log_unixtime);
$log_date = date("m-d-y", $log_unixtime);
// Some actions or parameters can contain characters that need to be encoded, especially when a piece of code raises a notification or error.
$action = AJXP_Utils::xmlEntities($action);
$params = AJXP_Utils::xmlEntities($params);
$source = AJXP_Utils::xmlEntities($source);
return "<{$node} icon=\"{$icon}\" date=\"{$log_datetime}\" ajxp_modiftime=\"{$log_unixtime}\" is_file=\"true\" filename=\"{$rootPath}/{$log_year}/{$log_month}/{$log_date}/{$log_datetime}\" ajxp_mime=\"log\" ip=\"{$remote_ip}\" level=\"{$log_level}\" user=\"{$user}\" action=\"{$action}\" source=\"{$source}\" params=\"{$params}\"/>";
}
示例15: writeRoleRepositoriesData
/**
* Send repositories access for given role as XML
*
* @param AjxpRole $role
* @return string
*/
static function writeRoleRepositoriesData($role)
{
$st = "<repositories>";
foreach (ConfService::getRepositoriesList() as $repoId => $repoObject) {
$toLast = false;
if ($repoObject->getAccessType() == "ajxp_conf") {
continue;
}
if ($repoObject->getAccessType() == "ajxp_shared" && !AuthService::usersEnabled()) {
continue;
}
$rightString = " r=\"" . ($role->canRead($repoId) ? "1" : "0") . "\" w=\"" . ($role->canWrite($repoId) ? "1" : "0") . "\"";
$string = "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$rightString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label></repo>";
if ($toLast) {
$lastString = $string;
} else {
$st .= $string;
}
}
if (isset($lastString)) {
$st .= $lastString;
}
$st .= "</repositories>";
$st .= "<actions_rights>";
foreach ($role->getSpecificActionsRights("ajxp.all") as $actionId => $actionValue) {
$st .= "<action name=\"{$actionId}\" value=\"" . ($actionValue ? "true" : "false") . "\"/>";
}
$st .= "</actions_rights>";
return $st;
}