本文整理汇总了PHP中ConfService::detectRepositoryStreams方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::detectRepositoryStreams方法的具体用法?PHP ConfService::detectRepositoryStreams怎么用?PHP ConfService::detectRepositoryStreams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::detectRepositoryStreams方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
$inboxStatus = 0;
foreach ($accessible as $repoId => $repoObject) {
if (!$repoObject->hasContentFilter()) {
continue;
}
$accessStatus = $repoObject->getAccessStatus();
if (empty($accessStatus) && $loggedUser != null) {
$lastConnected = $loggedUser->getArrayPref("repository_last_connected", $repoId);
if (empty($lastConnected)) {
$accessStatus = 1;
}
}
if (!empty($accessStatus)) {
$inboxStatus++;
}
}
foreach ($accessible as $repoId => $repoObject) {
if (!isset($_SESSION["CURRENT_MINISITE"]) && $repoObject->hasContentFilter()) {
continue;
}
$accessStatus = '';
if ($repoObject->getAccessType() == "inbox") {
$accessStatus = $inboxStatus;
}
$xmlString = self::repositoryToXML($repoId, $repoObject, $exposed, $streams, $loggedUser, $accessStatus);
$st .= $xmlString;
}
$st .= "</repositories>";
return $st;
}
示例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: crossRepositoryCopy
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();
$origStreamURL = "ajxp.{$accessType}://{$repositoryId}";
$destRepoId = $httpVars["dest_repository_id"];
$destRepoObject = ConfService::getRepositoryById($destRepoId);
$destRepoAccess = $destRepoObject->getAccessType();
$destStreamURL = "ajxp.{$destRepoAccess}://{$destRepoId}";
// Check rights
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if (!$loggedUser->canRead($repositoryId) || !$loggedUser->canWrite($destRepoId)) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, "You do not have the right to access one of the repositories!");
AJXP_XMLWriter::close();
exit(1);
}
}
$messages = array();
foreach ($files as $file) {
$origFile = $origStreamURL . $file;
$destFile = $destStreamURL . $httpVars["dest"] . "/" . basename($file);
$origHandler = fopen($origFile, "r");
$destHandler = fopen($destFile, "w");
if ($origHandler === false || $destHandler === false) {
$errorMessages[] = AJXP_XMLWriter::sendMessage(null, $mess[114] . " ({$origFile} to {$destFile})", false);
continue;
}
while (!feof($origHandler)) {
fwrite($destHandler, fread($origHandler, 4096));
}
fflush($destHandler);
fclose($origHandler);
fclose($destHandler);
$messages[] = $mess[34] . " " . SystemTextEncoding::toUTF8(basename($origFile)) . " " . $mess[73] . " " . SystemTextEncoding::toUTF8($destFile);
}
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();
exit(0);
}
示例4: 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();
}
示例5: 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;
}
示例6: crossRepositoryCopy
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);
$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]);
}
}
$messages = array();
foreach ($files as $file) {
$origFile = $origStreamURL . $file;
$localName = "";
AJXP_Controller::applyHook("dl.localname", array($origFile, &$localName, $origWrapperData["classname"]));
$bName = basename($file);
if ($localName != "") {
$bName = $localName;
}
$destFile = $destStreamURL . SystemTextEncoding::fromUTF8($httpVars["dest"]) . "/" . $bName;
AJXP_Logger::debug("Copying {$origFile} to {$destFile}");
if (!is_file($origFile)) {
throw new Exception("Cannot find {$origFile}");
}
$origHandler = fopen($origFile, "r");
$destHandler = fopen($destFile, "w");
if ($origHandler === false || $destHandler === false) {
$errorMessages[] = AJXP_XMLWriter::sendMessage(null, $mess[114] . " ({$origFile} to {$destFile})", false);
continue;
}
while (!feof($origHandler)) {
fwrite($destHandler, fread($origHandler, 4096));
}
fflush($destHandler);
fclose($origHandler);
fclose($destHandler);
$messages[] = $mess[34] . " " . SystemTextEncoding::toUTF8(basename($origFile)) . " " . (isset($httpVars["moving_files"]) ? $mess[74] : $mess[73]) . " " . SystemTextEncoding::toUTF8($destFile);
}
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();
}
示例7: writeRepositoriesData
/**
* Write the repositories access rights in XML format
* @static
* @param AbstractAjxpUser|null $loggedUser
* @param bool $details
* @return string
*/
public static function writeRepositoriesData($loggedUser, $details = false)
{
$st = "<repositories>";
$streams = ConfService::detectRepositoryStreams(false);
foreach (ConfService::getAccessibleRepositories($loggedUser, $details, false) as $repoId => $repoObject) {
$toLast = false;
if ($repoObject->getAccessType() == "ajxp_conf") {
if (AuthService::usersEnabled() && !$loggedUser->isAdmin()) {
continue;
}
$toLast = true;
}
$rightString = "";
if ($details) {
$rightString = " r=\"" . ($loggedUser->canRead($repoId) ? "1" : "0") . "\" w=\"" . ($loggedUser->canWrite($repoId) ? "1" : "0") . "\"";
}
$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 = "";
$description = $repoObject->getDescription();
if (!empty($description)) {
$descTag = '<description>' . AJXP_Utils::xmlEntities($description, true) . '</description>';
}
$xmlString = "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$rightString} {$streamString} {$slugString} {$isSharedString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label>" . $descTag . $repoObject->getClientSettings() . "</repo>";
if ($toLast) {
$lastString = $xmlString;
} else {
$st .= $xmlString;
}
}
if (isset($lastString)) {
$st .= $lastString;
}
$st .= "</repositories>";
return $st;
}
示例8: writeRepositoriesData
/**
* Write the repositories access rights in XML format
* @static
* @param $loggedUser
* @param bool $details
* @return string
*/
static function writeRepositoriesData($loggedUser, $details = false)
{
$st = "";
$st .= "<repositories>";
$streams = ConfService::detectRepositoryStreams(false);
foreach (ConfService::getRepositoriesList() as $rootDirIndex => $rootDirObject) {
if ($rootDirObject->isTemplate) {
continue;
}
$toLast = false;
if ($rootDirObject->getAccessType() == "ajxp_conf") {
if (AuthService::usersEnabled() && !$loggedUser->isAdmin()) {
continue;
} else {
$toLast = true;
}
}
if ($rootDirObject->getAccessType() == "ajxp_shared" && !AuthService::usersEnabled()) {
continue;
}
if ($rootDirObject->getUniqueUser() && (!AuthService::usersEnabled() || $loggedUser->getId() == "shared" || $loggedUser->getId() != $rootDirObject->getUniqueUser())) {
continue;
}
if ($loggedUser == null || $loggedUser->canRead($rootDirIndex) || $loggedUser->canWrite($rootDirIndex) || $details) {
// Do not display standard repositories even in details mode for "sub"users
if ($loggedUser != null && $loggedUser->hasParent() && !($loggedUser->canRead($rootDirIndex) || $loggedUser->canWrite($rootDirIndex))) {
continue;
}
// Do not display shared repositories otherwise.
if ($loggedUser != null && $rootDirObject->hasOwner() && !$loggedUser->hasParent()) {
// Display the repositories if allow_crossusers is ok
if (ConfService::getCoreConf("ALLOW_CROSSUSERS_SHARING") !== true) {
continue;
}
// But still do not display its own shared repositories!
if ($rootDirObject->getOwner() == $loggedUser->getId()) {
continue;
}
}
if ($rootDirObject->hasOwner() && $loggedUser != null && $details && !($loggedUser->canRead($rootDirIndex) || $loggedUser->canWrite($rootDirIndex))) {
continue;
}
$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 ($rootDirObject->getUniqueUser()) {
$streamString .= " user_editable_repository=\"true\" ";
}
$slugString = "";
$slug = $rootDirObject->getSlug();
if (!empty($slug)) {
$slugString = "repositorySlug=\"{$slug}\"";
}
$isSharedString = $rootDirObject->hasOwner() ? "owner='" . $rootDirObject->getOwner() . "'" : "";
$xmlString = "<repo access_type=\"" . $rootDirObject->accessType . "\" id=\"" . $rootDirIndex . "\"{$rightString} {$streamString} {$slugString} {$isSharedString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($rootDirObject->getDisplay())) . "</label>" . $rootDirObject->getClientSettings() . "</repo>";
if ($toLast) {
$lastString = $xmlString;
} else {
$st .= $xmlString;
}
}
}
if (isset($lastString)) {
$st .= $lastString;
}
$st .= "</repositories>";
return $st;
}