本文整理汇总了PHP中ConfService::loadRepositoryDriver方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::loadRepositoryDriver方法的具体用法?PHP ConfService::loadRepositoryDriver怎么用?PHP ConfService::loadRepositoryDriver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::loadRepositoryDriver方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAccessDriver
/**
* @return AjxpWebdavProvider
* @throws ezcBaseFileNotFoundException
*/
protected function getAccessDriver()
{
if (!isset($this->accessDriver)) {
$confDriver = ConfService::getConfStorageImpl();
$this->accessDriver = ConfService::loadRepositoryDriver();
if (!$this->accessDriver instanceof AjxpWebdavProvider) {
throw new ezcBaseFileNotFoundException($this->repository->getUniqueId());
}
$wrapperData = $this->accessDriver->detectStreamWrapper(true);
$this->wrapperClassName = $wrapperData["classname"];
}
return $this->accessDriver;
}
示例2: writeBookmarks
/**
* List all bookmmarks as XML
* @static
* @param $allBookmarks
* @param bool $print
* @param string $format legacy|node_list
* @return string
*/
public static function writeBookmarks($allBookmarks, $print = true, $format = "legacy")
{
$driver = false;
if ($format == "node_list") {
$driver = ConfService::loadRepositoryDriver();
if (!is_a($driver, "AjxpWrapperProvider")) {
$driver = false;
}
}
$buffer = "";
foreach ($allBookmarks as $bookmark) {
$path = "";
$title = "";
if (is_array($bookmark)) {
$path = $bookmark["PATH"];
$title = $bookmark["TITLE"];
} else {
if (is_string($bookmark)) {
$path = $bookmark;
$title = basename($bookmark);
}
}
if ($format == "node_list") {
if ($driver) {
$node = new AJXP_Node($driver->getResourceUrl($path));
$buffer .= AJXP_XMLWriter::renderAjxpNode($node, true, false);
} else {
$buffer .= AJXP_XMLWriter::renderNode($path, $title, false, array('icon' => "mime_empty.png"), true, false);
}
} else {
$buffer .= "<bookmark path=\"" . AJXP_Utils::xmlEntities($path, true) . "\" title=\"" . AJXP_Utils::xmlEntities($title, true) . "\"/>";
}
}
if ($print) {
print $buffer;
return null;
} else {
return $buffer;
}
}
示例3: header
// SPECIAL HANDLING FOR FANCY UPLOADER RIGHTS FOR THIS ACTION
//------------------------------------------------------------
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($action == "upload" && ($loggedUser == null || !$loggedUser->canWrite(ConfService::getCurrentRepositoryId() . "")) && isset($_FILES['Filedata'])) {
header('HTTP/1.0 ' . '410 Not authorized');
die('Error 410 Not authorized!');
}
}
// THIS FIRST DRIVERS DO NOT NEED ID CHECK
//$ajxpDriver = AJXP_PluginsService::findPlugin("gui", "ajax");
$authDriver = ConfService::getAuthDriverImpl();
// DRIVERS BELOW NEED IDENTIFICATION CHECK
if (!AuthService::usersEnabled() || ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || AuthService::getLoggedUser() != null) {
$confDriver = ConfService::getConfStorageImpl();
$Driver = ConfService::loadRepositoryDriver();
}
AJXP_PluginsService::getInstance()->initActivePlugins();
require_once AJXP_BIN_FOLDER . "/class.AJXP_Controller.php";
$xmlResult = AJXP_Controller::findActionAndApply($action, array_merge($_GET, $_POST), $_FILES);
if ($xmlResult !== false && $xmlResult != "") {
AJXP_XMLWriter::header();
print $xmlResult;
AJXP_XMLWriter::close();
} else {
if (isset($requireAuth) && AJXP_Controller::$lastActionNeedsAuth) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
}
}
示例4: 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()) {
//.........这里部分代码省略.........
示例5: render
//.........这里部分代码省略.........
$images = array("button", "background_1");
$confs = $options;
$confs["CUSTOM_SHAREPAGE_BACKGROUND_ATTRIBUTES_1"] = "background-repeat:repeat;background-position:50% 50%;";
$confs["CUSTOM_SHAREPAGE_BACKGROUND_1"] = "plugins/action.share/res/hi-res/02.jpg";
$confs["CUSTOM_SHAREPAGE_TEXT_COLOR"] = "#ffffff";
$confs["CUSTOM_SHAREPAGE_TEXTSHADOW_COLOR"] = "rgba(0,0,0,5)";
foreach ($customs as $custom) {
$varName = "CUSTOM_SHAREPAGE_" . strtoupper($custom);
${$varName} = $confs[$varName];
}
$dlFolder = realpath(ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER"));
foreach ($images as $custom) {
$varName = "CUSTOM_SHAREPAGE_" . strtoupper($custom);
if (!empty($confs[$varName])) {
if (strpos($confs[$varName], "plugins/") === 0 && is_file(AJXP_INSTALL_PATH . "/" . $confs[$varName])) {
$realFile = AJXP_INSTALL_PATH . "/" . $confs[$varName];
copy($realFile, $dlFolder . "/binary-" . basename($realFile));
${$varName} = "binary-" . basename($realFile);
} else {
${$varName} = "binary-" . $confs[$varName];
if (is_file($dlFolder . "/binary-" . $confs[$varName])) {
continue;
}
$copiedImageName = $dlFolder . "/binary-" . $confs[$varName];
$imgFile = fopen($copiedImageName, "wb");
ConfService::getConfStorageImpl()->loadBinary(array(), $confs[$varName], $imgFile);
fclose($imgFile);
}
}
}
HTMLWriter::charsetHeader();
// Check password
if (strlen($data["PASSWORD"])) {
if (!isset($_POST['password']) || $_POST['password'] != $data["PASSWORD"]) {
$AJXP_LINK_HAS_PASSWORD = true;
$AJXP_LINK_WRONG_PASSWORD = isset($_POST['password']) && $_POST['password'] != $data["PASSWORD"];
include AJXP_INSTALL_PATH . "/plugins/action.share/res/public_links.php";
$res = '<div style="position: absolute;z-index: 10000; bottom: 0; right: 0; color: #666;font-family: HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size: 13px;text-align: right;padding: 6px; line-height: 20px;text-shadow: 0px 1px 0px white;" class="no_select_bg"><br>Build your own box with Pydio : <a style="color: #000000;" target="_blank" href="http://pyd.io/">http://pyd.io/</a><br/>Community - Free non supported version © C. du Jeu 2008-2014 </div>';
AJXP_Controller::applyHook("tpl.filter_html", array(&$res));
echo $res;
return;
}
} else {
if (!isset($_GET["dl"])) {
include AJXP_INSTALL_PATH . "/plugins/action.share/res/public_links.php";
$res = '<div style="position: absolute;z-index: 10000; bottom: 0; right: 0; color: #666;font-family: HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size: 13px;text-align: right;padding: 6px; line-height: 20px;text-shadow: 0px 1px 0px white;" class="no_select_bg"><br>Build your own box with Pydio : <a style="color: #000000;" target="_blank" href="http://pyd.io/">http://pyd.io/</a><br/>Community - Free non supported version © C. du Jeu 2008-2014 </div>';
AJXP_Controller::applyHook("tpl.filter_html", array(&$res));
echo $res;
return;
}
}
$filePath = AJXP_INSTALL_PATH . "/plugins/access." . $data["DRIVER"] . "/class." . $className . ".php";
if (!is_file($filePath)) {
die("Warning, cannot find driver for conf storage! ({$className}, {$filePath})");
}
require_once $filePath;
$driver = new $className($data["PLUGIN_ID"], $data["BASE_DIR"]);
$driver->loadManifest();
//$hash = md5(serialize($data));
$shareStore->incrementDownloadCounter($shortHash);
//AuthService::logUser($data["OWNER_ID"], "", true);
AuthService::logTemporaryUser($data["OWNER_ID"], $shortHash);
if (isset($data["SAFE_USER"]) && isset($data["SAFE_PASS"])) {
// FORCE SESSION MODE
AJXP_Safe::getInstance()->forceSessionCredentialsUsage();
AJXP_Safe::storeCredentials($data["SAFE_USER"], $data["SAFE_PASS"]);
}
$repoObject = $data["REPOSITORY"];
ConfService::switchRootDir($repoObject->getId());
ConfService::loadRepositoryDriver();
AJXP_PluginsService::getInstance()->initActivePlugins();
try {
$params = array("file" => SystemTextEncoding::toUTF8($data["FILE_PATH"]));
if (isset($data["PLUGINS_DATA"])) {
$params["PLUGINS_DATA"] = $data["PLUGINS_DATA"];
}
if (isset($_GET["ct"]) && $_GET["ct"] == "true") {
$mime = pathinfo($params["file"], PATHINFO_EXTENSION);
$editors = AJXP_PluginsService::searchAllManifests("//editor[contains(@mimes,'{$mime}') and @previewProvider='true']", "node", true, true, false);
if (count($editors)) {
foreach ($editors as $editor) {
$xPath = new DOMXPath($editor->ownerDocument);
$callbacks = $xPath->query("//action[@contentTypedProvider]", $editor);
if ($callbacks->length) {
$data["ACTION"] = $callbacks->item(0)->getAttribute("name");
if ($data["ACTION"] == "audio_proxy") {
$params["file"] = base64_encode($params["file"]);
}
break;
}
}
}
}
AJXP_Controller::findActionAndApply($data["ACTION"], $params, null);
register_shutdown_function(array("AuthService", "clearTemporaryUser"), $shortHash);
} catch (Exception $e) {
AuthService::clearTemporaryUser($shortHash);
die($e->getMessage());
}
}
示例6: switchAction
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::getCurrentRootDirIndex();
$user->setArrayPref("history", "last_repository", $activeRepId);
$user->save("user");
}
//$logMessage = "Successfully Switched!";
AJXP_Logger::logAction("Switch Repository", array("rep. id" => $repository_id));
break;
//------------------------------------
// BOOKMARK BAR
//------------------------------------
//------------------------------------
// BOOKMARK BAR
//------------------------------------
case "get_bookmarks":
$bmUser = null;
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser = AuthService::getLoggedUser();
} else {
if (!AuthService::usersEnabled()) {
$confStorage = ConfService::getConfStorageImpl();
$bmUser = $confStorage->createUserObject("shared");
}
}
if ($bmUser == null) {
exit(1);
}
if (isset($httpVars["bm_action"]) && isset($httpVars["bm_path"])) {
if ($httpVars["bm_action"] == "add_bookmark") {
$title = "";
if (isset($httpVars["bm_title"])) {
$title = $httpVars["bm_title"];
}
if ($title == "" && $httpVars["bm_path"] == "/") {
$title = ConfService::getCurrentRootDirDisplay();
}
$bmUser->addBookMark(SystemTextEncoding::magicDequote($httpVars["bm_path"]), SystemTextEncoding::magicDequote($title));
} else {
if ($httpVars["bm_action"] == "delete_bookmark") {
$bmUser->removeBookmark($httpVars["bm_path"]);
} else {
if ($httpVars["bm_action"] == "rename_bookmark" && isset($httpVars["bm_title"])) {
$bmUser->renameBookmark($httpVars["bm_path"], $httpVars["bm_title"]);
}
}
}
}
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser->save("user");
AuthService::updateUser($bmUser);
} else {
if (!AuthService::usersEnabled()) {
$bmUser->save("user");
}
}
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();
//.........这里部分代码省略.........
示例7: switchAction
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::getRootDirsList();
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::getCurrentRootDirIndex();
$user->setArrayPref("history", "last_repository", $activeRepId);
$user->save();
}
//$logMessage = "Successfully Switched!";
AJXP_Logger::logAction("Switch Repository", array("rep. id" => $repository_id));
break;
//------------------------------------
// BOOKMARK BAR
//------------------------------------
//------------------------------------
// BOOKMARK BAR
//------------------------------------
case "get_bookmarks":
$bmUser = null;
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$bmUser = AuthService::getLoggedUser();
} else {
if (!AuthService::usersEnabled()) {
$confStorage = ConfService::getConfStorageImpl();
$bmUser = $confStorage->createUserObject("shared");
}
}
if ($bmUser == null) {
exit(1);
}
if (isset($_GET["bm_action"]) && isset($_GET["bm_path"])) {
if ($_GET["bm_action"] == "add_bookmark") {
$title = "";
if (isset($_GET["bm_title"])) {
$title = $_GET["bm_title"];
}
if ($title == "" && $_GET["bm_path"] == "/") {
$title = ConfService::getCurrentRootDirDisplay();
}
$bmUser->addBookMark(SystemTextEncoding::magicDequote($_GET["bm_path"]), SystemTextEncoding::magicDequote($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();
$i = 0;
//.........这里部分代码省略.........
示例8: loadMinisite
public static function loadMinisite($data, $hash = '', $error = null)
{
if (isset($data["SECURITY_MODIFIED"]) && $data["SECURITY_MODIFIED"] === true) {
$mess = ConfService::getMessages();
$error = $mess['share_center.164'];
}
$repository = $data["REPOSITORY"];
AJXP_PluginsService::getInstance()->initActivePlugins();
$shareCenter = AJXP_PluginsService::findPlugin("action", "share");
$confs = $shareCenter->getConfigs();
$minisiteLogo = "plugins/gui.ajax/PydioLogo250.png";
if (!empty($confs["CUSTOM_MINISITE_LOGO"])) {
$logoPath = $confs["CUSTOM_MINISITE_LOGO"];
if (strpos($logoPath, "plugins/") === 0 && is_file(AJXP_INSTALL_PATH . "/" . $logoPath)) {
$minisiteLogo = $logoPath;
} else {
$minisiteLogo = "index_shared.php?get_action=get_global_binary_param&binary_id=" . $logoPath;
}
}
// Default value
if (isset($data["AJXP_TEMPLATE_NAME"])) {
$templateName = $data["AJXP_TEMPLATE_NAME"];
if ($templateName == "ajxp_film_strip" && AJXP_Utils::userAgentIsMobile()) {
$templateName = "ajxp_shared_folder";
}
}
if (isset($repository)) {
$repoObject = ConfService::getRepositoryById($repository);
if (!is_object($repoObject)) {
$mess = ConfService::getMessages();
$error = $mess["share_center.166"];
$templateName = "ajxp_unique_strip";
$repoObject = null;
}
}
if (!isset($templateName) && isset($repoObject)) {
$filter = $repoObject->getContentFilter();
if (!empty($filter) && count($filter->virtualPaths) == 1) {
$templateName = "ajxp_unique_strip";
} else {
$templateName = "ajxp_shared_folder";
}
}
if (!isset($templateName) && isset($error)) {
$templateName = "ajxp_unique_strip";
}
// UPDATE TEMPLATE
$html = file_get_contents(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/action.share/res/minisite.php");
AJXP_Controller::applyHook("tpl.filter_html", array(&$html));
$html = AJXP_XMLWriter::replaceAjxpXmlKeywords($html);
$html = str_replace("AJXP_MINISITE_LOGO", $minisiteLogo, $html);
$html = str_replace("AJXP_APPLICATION_TITLE", ConfService::getCoreConf("APPLICATION_TITLE"), $html);
$html = str_replace("PYDIO_APP_TITLE", ConfService::getCoreConf("APPLICATION_TITLE"), $html);
if (isset($repository) && isset($repoObject)) {
$html = str_replace("AJXP_START_REPOSITORY", $repository, $html);
$html = str_replace("AJXP_REPOSITORY_LABEL", ConfService::getRepositoryById($repository)->getDisplay(), $html);
}
$html = str_replace('AJXP_HASH_LOAD_ERROR', isset($error) ? $error : '', $html);
$html = str_replace("AJXP_TEMPLATE_NAME", $templateName, $html);
$html = str_replace("AJXP_LINK_HASH", $hash, $html);
$guiConfigs = AJXP_PluginsService::findPluginById("gui.ajax")->getConfigs();
$html = str_replace("AJXP_THEME", $guiConfigs["GUI_THEME"], $html);
if (isset($_GET["dl"]) && isset($_GET["file"])) {
AuthService::$useSession = false;
} else {
session_name("AjaXplorer_Shared" . str_replace(".", "_", $hash));
session_start();
AuthService::disconnect();
}
if (!empty($data["PRELOG_USER"])) {
AuthService::logUser($data["PRELOG_USER"], "", true);
$html = str_replace("AJXP_PRELOGED_USER", "ajxp_preloged_user", $html);
} else {
if (isset($data["PRESET_LOGIN"])) {
$_SESSION["PENDING_REPOSITORY_ID"] = $repository;
$_SESSION["PENDING_FOLDER"] = "/";
$html = str_replace("AJXP_PRELOGED_USER", $data["PRESET_LOGIN"], $html);
} else {
$html = str_replace("AJXP_PRELOGED_USER", "ajxp_legacy_minisite", $html);
}
}
if (isset($hash)) {
$_SESSION["CURRENT_MINISITE"] = $hash;
}
if (isset($_GET["dl"]) && isset($_GET["file"]) && (!isset($data["DOWNLOAD_DISABLED"]) || $data["DOWNLOAD_DISABLED"] === false)) {
ConfService::switchRootDir($repository);
ConfService::loadRepositoryDriver();
AJXP_PluginsService::deferBuildingRegistry();
AJXP_PluginsService::getInstance()->initActivePlugins();
AJXP_PluginsService::flushDeferredRegistryBuilding();
$errMessage = null;
try {
$params = $_GET;
$ACTION = "download";
if (isset($_GET["ct"])) {
$mime = pathinfo($params["file"], PATHINFO_EXTENSION);
$editors = AJXP_PluginsService::searchAllManifests("//editor[contains(@mimes,'{$mime}') and @previewProvider='true']", "node", true, true, false);
if (count($editors)) {
foreach ($editors as $editor) {
$xPath = new DOMXPath($editor->ownerDocument);
//.........这里部分代码省略.........
示例9: loadPubliclet
/**
* @static
* @param Array $data
* @return void
*/
static function loadPubliclet($data)
{
// create driver from $data
$className = $data["DRIVER"] . "AccessDriver";
$hash = md5(serialize($data));
if ($data["EXPIRE_TIME"] && time() > $data["EXPIRE_TIME"] || $data["DOWNLOAD_LIMIT"] && $data["DOWNLOAD_LIMIT"] > 0 && $data["DOWNLOAD_LIMIT"] <= PublicletCounter::getCount($hash)) {
// Remove the publiclet, it's done
if (strstr(realpath($_SERVER["SCRIPT_FILENAME"]), realpath(ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER"))) !== FALSE) {
PublicletCounter::delete($hash);
unlink($_SERVER["SCRIPT_FILENAME"]);
}
echo "Link is expired, sorry.";
exit;
}
// Load language messages
$language = "en";
if (isset($_GET["lang"])) {
$language = $_GET["lang"];
}
$messages = array();
if (is_file(dirname(__FILE__) . "/res/i18n/" . $language . ".php")) {
include dirname(__FILE__) . "/res/i18n/" . $language . ".php";
$messages = $mess;
} else {
include dirname(__FILE__) . "/res/i18n/en.php";
}
$AJXP_LINK_HAS_PASSWORD = false;
$AJXP_LINK_BASENAME = SystemTextEncoding::toUTF8(basename($data["FILE_PATH"]));
// Check password
if (strlen($data["PASSWORD"])) {
if (!isset($_POST['password']) || $_POST['password'] != $data["PASSWORD"]) {
$AJXP_LINK_HAS_PASSWORD = true;
$AJXP_LINK_WRONG_PASSWORD = isset($_POST['password']) && $_POST['password'] != $data["PASSWORD"];
include AJXP_INSTALL_PATH . "/plugins/action.share/res/public_links.php";
return;
}
} else {
if (!isset($_GET["dl"])) {
include AJXP_INSTALL_PATH . "/plugins/action.share/res/public_links.php";
return;
}
}
$filePath = AJXP_INSTALL_PATH . "/plugins/access." . $data["DRIVER"] . "/class." . $className . ".php";
if (!is_file($filePath)) {
die("Warning, cannot find driver for conf storage! ({$className}, {$filePath})");
}
require_once $filePath;
$driver = new $className($data["PLUGIN_ID"], $data["BASE_DIR"]);
$driver->loadManifest();
$hash = md5(serialize($data));
PublicletCounter::increment($hash);
AuthService::logUser($data["OWNER_ID"], "", true);
if ($driver->hasMixin("credentials_consumer") && isset($data["SAFE_USER"]) && isset($data["SAFE_PASS"])) {
// FORCE SESSION MODE
AJXP_Safe::getInstance()->forceSessionCredentialsUsage();
AJXP_Safe::storeCredentials($data["SAFE_USER"], $data["SAFE_PASS"]);
}
$repoObject = $data["REPOSITORY"];
ConfService::switchRootDir($repoObject->getId());
ConfService::loadRepositoryDriver();
ConfService::initActivePlugins();
try {
$params = array("file" => SystemTextEncoding::toUTF8($data["FILE_PATH"]));
if (isset($data["PLUGINS_DATA"])) {
$params["PLUGINS_DATA"] = $data["PLUGINS_DATA"];
}
AJXP_Controller::findActionAndApply($data["ACTION"], $params, null);
} catch (Exception $e) {
die($e->getMessage());
}
}
示例10: downloadFile
public function downloadFile($nodeName)
{
$nodeName = urldecode($nodeName);
//ob_start();
$alreadyInstanciated = true;
if (AuthService::getLoggedUser() == null) {
AuthService::logUser($this->authLogin, $this->authPwd, true);
$alreadyInstanciated = false;
}
$parts = explode("/", trim($nodeName, "/"));
$repoAlias = array_shift($parts);
$fileName = implode("/", $parts);
$nbRep = ConfService::getRepositoryByAlias($repoAlias);
$defaultRepoId = $nbRep->getId();
ConfService::switchRootDir($defaultRepoId);
ConfService::getConfStorageImpl();
ConfService::loadRepositoryDriver();
if (!$alreadyInstanciated) {
AJXP_PluginsService::getInstance()->initActivePlugins();
}
//ob_end_clean();
AJXP_Controller::findActionAndApply("download", array("file" => "/" . $fileName), array());
exit;
}