本文整理汇总了PHP中AJXP_Controller类的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Controller类的具体用法?PHP AJXP_Controller怎么用?PHP AJXP_Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AJXP_Controller类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* Filter the very basic keywords from the XML : AJXP_USER, AJXP_INSTALL_PATH, AJXP_DATA_PATH
* Calls the vars.filter hooks.
* @static
* @param $value
* @return mixed|string
*/
public static function filter($value)
{
if (is_string($value) && strpos($value, "AJXP_USER") !== false) {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$loggedUser = $loggedUser->getId();
$value = str_replace("AJXP_USER", $loggedUser, $value);
} else {
return "";
}
} else {
$value = str_replace("AJXP_USER", "shared", $value);
}
}
if (is_string($value) && strpos($value, "AJXP_INSTALL_PATH") !== false) {
$value = str_replace("AJXP_INSTALL_PATH", AJXP_INSTALL_PATH, $value);
}
if (is_string($value) && strpos($value, "AJXP_DATA_PATH") !== false) {
$value = str_replace("AJXP_DATA_PATH", AJXP_DATA_PATH, $value);
}
$tab = array(&$value);
AJXP_Controller::applyIncludeHook("vars.filter", $tab);
return $value;
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:32,代码来源:class.AJXP_VarsFilter.php
示例2: switchAction
public function switchAction($action, $httpVars, $filesVars)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
return false;
}
if (!isset($this->pluginConf)) {
$this->pluginConf = array("GENERATE_THUMBNAIL" => false);
}
$streamData = $repository->streamData;
$this->streamData = $streamData;
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
if ($action == "preview_data_proxy") {
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
if (!file_exists($destStreamURL . $file)) {
header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($file)) . "; name=\"" . basename($file) . "\"");
header("Content-Length: 0");
return;
}
if (isset($httpVars["get_thumb"]) && $this->getFilteredOption("GENERATE_THUMBNAIL", $repository->getId())) {
$dimension = 200;
if (isset($httpVars["dimension"]) && is_numeric($httpVars["dimension"])) {
$dimension = $httpVars["dimension"];
}
$this->currentDimension = $dimension;
$cacheItem = AJXP_Cache::getItem("diaporama_" . $dimension, $destStreamURL . $file, array($this, "generateThumbnail"));
$data = $cacheItem->getData();
$cId = $cacheItem->getId();
header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($cId)) . "; name=\"" . basename($cId) . "\"");
header("Content-Length: " . strlen($data));
header('Cache-Control: public');
header("Pragma:");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time() - 10000) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 5 * 24 * 3600) . " GMT");
print $data;
} else {
//$filesize = filesize($destStreamURL.$file);
$node = new AJXP_Node($destStreamURL . $file);
$fp = fopen($destStreamURL . $file, "r");
$stat = fstat($fp);
$filesize = $stat["size"];
header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($file)) . "; name=\"" . basename($file) . "\"");
header("Content-Length: " . $filesize);
header('Cache-Control: public');
header("Pragma:");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time() - 10000) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 5 * 24 * 3600) . " GMT");
$class = $streamData["classname"];
$stream = fopen("php://output", "a");
call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
fflush($stream);
fclose($stream);
AJXP_Controller::applyHook("node.read", array($node));
}
}
}
开发者ID:biggtfish,项目名称:cms,代码行数:59,代码来源:class.ImagePreviewer.php
示例3: switchAction
public function switchAction($action, $httpVars, $postProcessData)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . "/";
if ($action == "audio_proxy") {
$file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
$cType = "audio/" . array_pop(explode(".", $file));
$localName = basename($file);
header("Content-Type: " . $cType . "; name=\"" . $localName . "\"");
header("Content-Length: " . filesize($destStreamURL . $file));
$stream = fopen("php://output", "a");
call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
fflush($stream);
fclose($stream);
$node = new AJXP_Node($destStreamURL . $file);
AJXP_Controller::applyHook("node.read", array($node));
//exit(1);
} else {
if ($action == "ls") {
if (!isset($httpVars["playlist"])) {
// This should not happen anyway, because of the applyCondition.
AJXP_Controller::passProcessDataThrough($postProcessData);
return;
}
// We transform the XML into XSPF
$xmlString = $postProcessData["ob_output"];
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($xmlString);
$xElement = $xmlDoc->documentElement;
header("Content-Type:application/xspf+xml;charset=UTF-8");
print '<?xml version="1.0" encoding="UTF-8"?>';
print '<playlist version="1" xmlns="http://xspf.org/ns/0/">';
print "<trackList>";
foreach ($xElement->childNodes as $child) {
$isFile = $child->getAttribute("is_file") == "true";
$label = $child->getAttribute("text");
$ar = explode(".", $label);
$ext = strtolower(end($ar));
if (!$isFile || $ext != "mp3") {
continue;
}
print "<track><location>" . AJXP_SERVER_ACCESS . "?secure_token=" . AuthService::getSecureToken() . "&get_action=audio_proxy&file=" . base64_encode($child->getAttribute("filename")) . "</location><title>" . $label . "</title></track>";
}
print "</trackList>";
AJXP_XMLWriter::close("playlist");
}
}
}
开发者ID:biggtfish,项目名称:cms,代码行数:56,代码来源:class.AudioPreviewer.php
示例4: 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;
}
}
开发者ID:projectesIF,项目名称:Ateneu,代码行数:53,代码来源:class.UserGuiController.php
示例5: switchAction
public function switchAction($actionName, $httpVars, $fileVars)
{
if ($actionName == "search-cart-download") {
// Pipe SEARCH + DOWNLOAD actions.
$indexer = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("index");
if ($indexer == false) {
return;
}
$httpVars["return_selection"] = true;
unset($httpVars["get_action"]);
$res = AJXP_Controller::findActionAndApply("search", $httpVars, $fileVars);
if (isset($res) && is_array($res)) {
$newHttpVars = array("selection_nodes" => $res, "dir" => "__AJXP_ZIP_FLAT__/", "archive_name" => $httpVars["archive_name"]);
AJXP_Controller::findActionAndApply("download", $newHttpVars, array());
}
}
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:17,代码来源:class.CartManager.php
示例6: filter
/**
* Filter the very basic keywords from the XML : AJXP_USER, AJXP_INSTALL_PATH, AJXP_DATA_PATH
* Calls the vars.filter hooks.
* @static
* @param $value
* @return mixed|string
*/
public static function filter($value)
{
if (is_string($value) && strpos($value, "AJXP_USER") !== false) {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
if ($loggedUser->hasParent() && $loggedUser->getResolveAsParent()) {
$loggedUserId = $loggedUser->getParent();
} else {
$loggedUserId = $loggedUser->getId();
}
$value = str_replace("AJXP_USER", $loggedUserId, $value);
} else {
return "";
}
} else {
$value = str_replace("AJXP_USER", "shared", $value);
}
}
if (is_string($value) && strpos($value, "AJXP_GROUP_PATH") !== false) {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$gPath = $loggedUser->getGroupPath();
$value = str_replace("AJXP_GROUP_PATH_FLAT", str_replace("/", "_", trim($gPath, "/")), $value);
$value = str_replace("AJXP_GROUP_PATH", $gPath, $value);
} else {
return "";
}
} else {
$value = str_replace(array("AJXP_GROUP_PATH", "AJXP_GROUP_PATH_FLAT"), "shared", $value);
}
}
if (is_string($value) && strpos($value, "AJXP_INSTALL_PATH") !== false) {
$value = str_replace("AJXP_INSTALL_PATH", AJXP_INSTALL_PATH, $value);
}
if (is_string($value) && strpos($value, "AJXP_DATA_PATH") !== false) {
$value = str_replace("AJXP_DATA_PATH", AJXP_DATA_PATH, $value);
}
$tab = array(&$value);
AJXP_Controller::applyIncludeHook("vars.filter", $tab);
return $value;
}
开发者ID:biggtfish,项目名称:cms,代码行数:50,代码来源:class.AJXP_VarsFilter.php
示例7: getNodeData
public static function getNodeData($nodePath)
{
$basename = basename(parse_url($nodePath, PHP_URL_PATH));
if (empty($basename)) {
return ['stat' => stat(AJXP_Utils::getAjxpTmpDir())];
}
$allNodes = self::getNodes(false);
$nodeData = $allNodes[$basename];
if (!isset($nodeData["stat"])) {
if (in_array(pathinfo($basename, PATHINFO_EXTENSION), array("error", "invitation"))) {
$stat = stat(AJXP_Utils::getAjxpTmpDir());
} else {
$url = $nodeData["url"];
$node = new AJXP_Node($nodeData["url"]);
$node->getRepository()->driverInstance = null;
try {
ConfService::loadDriverForRepository($node->getRepository());
$node->getRepository()->detectStreamWrapper(true);
if ($node->getRepository()->hasContentFilter()) {
$node->setLeaf(true);
}
AJXP_Controller::applyHook("node.read", array(&$node));
$stat = stat($url);
} catch (Exception $e) {
$stat = stat(AJXP_Utils::getAjxpTmpDir());
}
if (is_array($stat) && AuthService::getLoggedUser() != null) {
$acl = AuthService::getLoggedUser()->mergedRole->getAcl($nodeData["meta"]["shared_repository_id"]);
if ($acl == "r") {
self::disableWriteInStat($stat);
}
}
self::$output[$basename]["stat"] = $stat;
}
$nodeData["stat"] = $stat;
}
return $nodeData;
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:38,代码来源:class.inboxAccessDriver.php
示例8: postProcess
public function postProcess($action, $httpVars, $postProcessData)
{
if (!self::$active) {
return false;
}
$this->logDebug("FlexProc is active=" . self::$active, $postProcessData);
$result = $postProcessData["processor_result"];
if (isset($result["SUCCESS"]) && $result["SUCCESS"] === true) {
header('HTTP/1.0 200 OK');
if (isset($result["UPDATED_NODE"])) {
AJXP_Controller::applyHook("node.change", array($result["UPDATED_NODE"], $result["UPDATED_NODE"], false));
} else {
AJXP_Controller::applyHook("node.change", array(null, $result["CREATED_NODE"], false));
}
//die("200 OK");
} else {
if (isset($result["ERROR"]) && is_array($result["ERROR"])) {
$code = $result["ERROR"]["CODE"];
$message = $result["ERROR"]["MESSAGE"];
//header("HTTP/1.0 $code $message");
die("Error {$code} {$message}");
}
}
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:24,代码来源:class.FlexUploadProcessor.php
示例9: writePubliclet
/** Cypher the publiclet object data and write to disk.
* @param array $data The publiclet data array to write
* The data array must have the following keys:
* - DRIVER The driver used to get the file's content
* - OPTIONS The driver options to be successfully constructed (usually, the user and password)
* - FILE_PATH The path to the file's content
* - PASSWORD If set, the written publiclet will ask for this password before sending the content
* - ACTION If set, action to perform
* - USER If set, the AJXP user
* - EXPIRE_TIME If set, the publiclet will deny downloading after this time, and probably self destruct.
* - AUTHOR_WATCH If set, will post notifications for the publiclet author each time the file is loaded
* @param AbstractAccessDriver $accessDriver
* @param Repository $repository
* @param ShareStore $shareStore
* @param PublicAccessManager $publicAccessManager
* @return string|array An array containing the hash (0) and the generated url (1)
*/
public function writePubliclet(&$data, $accessDriver, $repository, $shareStore, $publicAccessManager)
{
$downloadFolder = $publicAccessManager->getPublicDownloadFolder();
$publicAccessManager->initFolder();
if (!is_dir($downloadFolder)) {
return "ERROR : Public URL folder does not exist!";
}
if (!function_exists("mcrypt_create_iv")) {
return "ERROR : MCrypt must be installed to use publiclets!";
}
$data["PLUGIN_ID"] = $accessDriver->getId();
$data["BASE_DIR"] = $accessDriver->getBaseDir();
//$data["REPOSITORY"] = $repository;
if (AuthService::usersEnabled()) {
$data["OWNER_ID"] = AuthService::getLoggedUser()->getId();
}
$shareStore->storeSafeCredentialsIfNeeded($data, $accessDriver, $repository);
// Force expanded path in publiclet
$copy = clone $repository;
$copy->addOption("PATH", $repository->getOption("PATH"));
$data["REPOSITORY"] = $copy;
if ($data["ACTION"] == "") {
$data["ACTION"] = "download";
}
try {
$hash = $shareStore->storeShare($repository->getId(), $data, "publiclet");
} catch (Exception $e) {
return $e->getMessage();
}
$shareStore->resetDownloadCounter($hash, AuthService::getLoggedUser()->getId());
$url = $publicAccessManager->buildPublicLink($hash);
AJXP_Logger::log2(LOG_LEVEL_INFO, __CLASS__, "New Share", array("file" => "'" . $copy->display . ":/" . $data['FILE_PATH'] . "'", "files" => "'" . $copy->display . ":/" . $data['FILE_PATH'] . "'", "url" => $url, "expiration" => $data['EXPIRE_TIME'], "limit" => $data['DOWNLOAD_LIMIT'], "repo_uuid" => $copy->uuid));
AJXP_Controller::applyHook("node.share.create", array('type' => 'file', 'repository' => &$copy, 'accessDriver' => &$accessDriver, 'data' => &$data, 'url' => $url));
return array($hash, $url);
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:52,代码来源:class.LegacyPubliclet.php
示例10: switchAction
public function switchAction($action, $httpVars, $filesVars)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
return false;
}
$convert = $this->getFilteredOption("IMAGE_MAGICK_CONVERT");
if (empty($convert)) {
return false;
}
$streamData = $repository->streamData;
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
$flyThreshold = 1024 * 1024 * intval($this->getFilteredOption("ONTHEFLY_THRESHOLD", $repository->getId()));
$selection = new UserSelection($repository);
$selection->initFromHttpVars($httpVars);
if ($action == "imagick_data_proxy") {
$this->extractAll = false;
if (isset($httpVars["all"])) {
$this->extractAll = true;
}
$file = $selection->getUniqueFile();
if (($size = filesize($destStreamURL . $file)) === false) {
return false;
} else {
if ($size > $flyThreshold) {
$this->useOnTheFly = true;
} else {
$this->useOnTheFly = false;
}
}
if ($this->extractAll) {
$node = new AJXP_Node($destStreamURL . $file);
AJXP_Controller::applyHook("node.read", array($node));
}
$cache = AJXP_Cache::getItem("imagick_" . ($this->extractAll ? "full" : "thumb"), $destStreamURL . $file, array($this, "generateJpegsCallback"));
$cacheData = $cache->getData();
if (!$this->useOnTheFly && $this->extractAll) {
// extract all on first view
$ext = pathinfo($file, PATHINFO_EXTENSION);
$prefix = str_replace(".{$ext}", "", $cache->getId());
$files = $this->listExtractedJpg($destStreamURL . $file, $prefix);
header("Content-Type: application/json");
print json_encode($files);
return false;
} else {
if ($this->extractAll) {
// on the fly extract mode
$ext = pathinfo($file, PATHINFO_EXTENSION);
$prefix = str_replace(".{$ext}", "", $cache->getId());
$files = $this->listPreviewFiles($destStreamURL . $file, $prefix);
header("Content-Type: application/json");
print json_encode($files);
return false;
} else {
header("Content-Type: image/jpeg; name=\"" . basename($file) . "\"");
header("Content-Length: " . strlen($cacheData));
header('Cache-Control: public');
header("Pragma:");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time() - 10000) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 5 * 24 * 3600) . " GMT");
print $cacheData;
return false;
}
}
} else {
if ($action == "get_extracted_page" && isset($httpVars["file"])) {
$file = (defined('AJXP_SHARED_CACHE_DIR') ? AJXP_SHARED_CACHE_DIR : AJXP_CACHE_DIR) . "/imagick_full/" . AJXP_Utils::decodeSecureMagic($httpVars["file"]);
if (!is_file($file)) {
$srcfile = AJXP_Utils::decodeSecureMagic($httpVars["src_file"]);
if ($repository->hasContentFilter()) {
$contentFilter = $repository->getContentFilter();
$srcfile = $contentFilter->filterExternalPath($srcfile);
}
$size = filesize($destStreamURL . "/" . $srcfile);
if ($size > $flyThreshold) {
$this->useOnTheFly = true;
} else {
$this->useOnTheFly = false;
}
if ($this->useOnTheFly) {
$this->onTheFly = true;
}
$this->generateJpegsCallback($destStreamURL . $srcfile, $file);
}
if (!is_file($file)) {
return false;
}
header("Content-Type: image/jpeg; name=\"" . basename($file) . "\"");
header("Content-Length: " . filesize($file));
header('Cache-Control: public');
readfile($file);
exit(1);
} else {
if ($action == "delete_imagick_data" && !$selection->isEmpty()) {
/*
$files = $this->listExtractedJpg(AJXP_CACHE_DIR."/".$httpVars["file"]);
foreach ($files as $file) {
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Ateneu,代码行数:101,代码来源:class.IMagickPreviewer.php
示例11: replaceAjxpXmlKeywords
/**
* Dynamically replace XML keywords with their live values.
* AJXP_SERVER_ACCESS, AJXP_MIMES_*,AJXP_ALL_MESSAGES, etc.
* @static
* @param string $xml
* @param bool $stripSpaces
* @return mixed
*/
public static function replaceAjxpXmlKeywords($xml, $stripSpaces = false)
{
$messages = ConfService::getMessages();
$confMessages = ConfService::getMessagesConf();
$matches = array();
if (isset($_SESSION["AJXP_SERVER_PREFIX_URI"])) {
//$xml = str_replace("AJXP_THEME_FOLDER", $_SESSION["AJXP_SERVER_PREFIX_URI"].AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", $_SESSION["AJXP_SERVER_PREFIX_URI"] . AJXP_SERVER_ACCESS, $xml);
} else {
//$xml = str_replace("AJXP_THEME_FOLDER", AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", AJXP_SERVER_ACCESS, $xml);
}
$xml = str_replace("AJXP_APPLICATION_TITLE", ConfService::getCoreConf("APPLICATION_TITLE"), $xml);
$xml = str_replace("AJXP_MIMES_EDITABLE", AJXP_Utils::getAjxpMimes("editable"), $xml);
$xml = str_replace("AJXP_MIMES_IMAGE", AJXP_Utils::getAjxpMimes("image"), $xml);
$xml = str_replace("AJXP_MIMES_AUDIO", AJXP_Utils::getAjxpMimes("audio"), $xml);
$xml = str_replace("AJXP_MIMES_ZIP", AJXP_Utils::getAjxpMimes("zip"), $xml);
$authDriver = ConfService::getAuthDriverImpl();
if ($authDriver != NULL) {
$loginRedirect = $authDriver->getLoginRedirect();
$xml = str_replace("AJXP_LOGIN_REDIRECT", $loginRedirect !== false ? "'" . $loginRedirect . "'" : "false", $xml);
}
$xml = str_replace("AJXP_REMOTE_AUTH", "false", $xml);
$xml = str_replace("AJXP_NOT_REMOTE_AUTH", "true", $xml);
$xml = str_replace("AJXP_ALL_MESSAGES", "MessageHash=" . json_encode(ConfService::getMessages()) . ";", $xml);
if (preg_match_all("/AJXP_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace("]", "", str_replace("[", "", $match[1]));
$xml = str_replace("AJXP_MESSAGE[{$messId}]", $messages[$messId], $xml);
}
}
if (preg_match_all("/CONF_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace(array("[", "]"), "", $match[1]);
$message = $messId;
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
$xml = str_replace("CONF_MESSAGE[{$messId}]", AJXP_Utils::xmlEntities($message), $xml);
}
}
if (preg_match_all("/MIXIN_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace(array("[", "]"), "", $match[1]);
$message = $messId;
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
$xml = str_replace("MIXIN_MESSAGE[{$messId}]", AJXP_Utils::xmlEntities($message), $xml);
}
}
if ($stripSpaces) {
$xml = preg_replace("/[\n\r]?/", "", $xml);
$xml = preg_replace("/\t/", " ", $xml);
}
$xml = str_replace(array('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', 'xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd"'), "", $xml);
$tab = array(&$xml);
AJXP_Controller::applyIncludeHook("xml.filter", $tab);
return $xml;
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:68,代码来源:class.AJXP_XMLWriter.php
示例12: recomputeQuotaUsage
public function recomputeQuotaUsage($oldNode = null, $newNode = null, $copy = false)
{
$repoOptions = $this->getWorkingRepositoryOptions();
$q = $this->accessDriver->directoryUsage("", $repoOptions);
$this->storeUsage($q);
$t = $this->getAuthorized();
AJXP_Controller::applyHook("msg.instant", array("<metaquota usage='{$q}' total='{$t}'/>", $this->accessDriver->repository->getId()));
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:8,代码来源:class.QuotaComputer.php
示例13: unifyChunks
public function unifyChunks($action, $httpVars, $fileVars)
{
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$dir = AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
$filename = AJXP_Utils::decodeSecureMagic($httpVars["file_name"]);
$chunks = array();
$index = 0;
while (isset($httpVars["chunk_" . $index])) {
$chunks[] = AJXP_Utils::decodeSecureMagic($httpVars["chunk_" . $index]);
$index++;
}
$newDest = fopen($destStreamURL . $filename, "w");
for ($i = 0; $i < count($chunks); $i++) {
$part = fopen($destStreamURL . $chunks[$i], "r");
while (!feof($part)) {
fwrite($newDest, fread($part, 4096));
}
fclose($part);
unlink($destStreamURL . $chunks[$i]);
}
fclose($newDest);
AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($newDest), false));
}
开发者ID:projectesIF,项目名称:Ateneu,代码行数:29,代码来源:class.SimpleUploadProcessor.php
示例14: copyOrMoveFile
/**
* We have to override the standard copyOrMoveFile, as feof() does
* not seem to work with ssh2.ftp stream...
* Maybe something to search hear http://www.mail-archive.com/[email protected]/msg169992.html?
*
* @param string $destDir
* @param string $srcFile
* @param array $error
* @param array $success
* @param boolean $move
*/
function copyOrMoveFile($destDir, $srcFile, &$error, &$success, $move = false)
{
$mess = ConfService::getMessages();
$destFile = $this->urlBase . $destDir . "/" . basename($srcFile);
$realSrcFile = $this->urlBase . $srcFile;
if (!file_exists($realSrcFile)) {
$error[] = $mess[100] . $srcFile;
return;
}
if (dirname($realSrcFile) == dirname($destFile)) {
if ($move) {
$error[] = $mess[101];
return;
} else {
$base = basename($srcFile);
$i = 1;
if (is_file($realSrcFile)) {
$dotPos = strrpos($base, ".");
if ($dotPos > -1) {
$radic = substr($base, 0, $dotPos);
$ext = substr($base, $dotPos);
}
}
// auto rename file
$i = 1;
$newName = $base;
while (file_exists($this->urlBase . $destDir . "/" . $newName)) {
$suffix = "-{$i}";
if (isset($radic)) {
$newName = $radic . $suffix . $ext;
} else {
$newName = $base . $suffix;
}
$i++;
}
$destFile = $this->urlBase . $destDir . "/" . $newName;
}
}
if (!is_file($realSrcFile)) {
$errors = array();
$succFiles = array();
if ($move) {
if (file_exists($destFile)) {
$this->deldir($destFile);
}
$res = rename($realSrcFile, $destFile);
} else {
$dirRes = $this->dircopy($realSrcFile, $destFile, $errors, $succFiles);
}
if (count($errors) || isset($res) && $res !== true) {
$error[] = $mess[114];
return;
}
} else {
if ($move) {
if (file_exists($destFile)) {
unlink($destFile);
}
$res = rename($realSrcFile, $destFile);
AJXP_Controller::applyHook("move.metadata", array($realSrcFile, $destFile, false));
} else {
try {
// BEGIN OVERRIDING
list($connection, $remote_base_path) = sftpAccessWrapper::getSshConnection($realSrcFile);
$remoteSrc = $remote_base_path . $srcFile;
$remoteDest = $remote_base_path . $destDir;
AJXP_Logger::debug("SSH2 CP", array("cmd" => 'cp ' . $remoteSrc . ' ' . $remoteDest));
ssh2_exec($connection, 'cp ' . $remoteSrc . ' ' . $remoteDest);
AJXP_Controller::applyHook("move.metadata", array($realSrcFile, $destFile, true));
// END OVERRIDING
} catch (Exception $e) {
$error[] = $e->getMessage();
return;
}
}
}
if ($move) {
// Now delete original
// $this->deldir($realSrcFile); // both file and dir
$messagePart = $mess[74] . " " . SystemTextEncoding::toUTF8($destDir);
if (RecycleBinManager::recycleEnabled() && $destDir == RecycleBinManager::getRelativeRecycle()) {
RecycleBinManager::fileToRecycle($srcFile);
$messagePart = $mess[123] . " " . $mess[122];
}
if (isset($dirRes)) {
$success[] = $mess[117] . " " . SystemTextEncoding::toUTF8(basename($srcFile)) . " " . $messagePart . " (" . SystemTextEncoding::toUTF8($dirRes) . " " . $mess[116] . ") ";
} else {
$success[] = $mess[34] . " " . SystemTextEncoding::toUTF8(basename($srcFile)) . " " . $messagePart;
}
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:101,代码来源:class.sftpAccessDriver.php
示例15: sleep
//echo("NEXT REPO ".$nextRepositories." (".$options["r"].")\n");
//echo("NEXT USERS ".$nextUsers." ( ".$originalOptUser." )\n");
if (!empty($nextUsers) || !empty($nextRepositories) || !empty($optUserQueue)) {
if (!empty($nextUsers)) {
sleep(1);
$process = AJXP_Controller::applyActionInBackground($options["r"], $optAction, $optArgs, $nextUsers, $optStatusFile);
if ($process != null && is_a($process, "UnixProcess") && isset($optStatusFile)) {
file_put_contents($optStatusFile, "RUNNING:" . $process->getPid());
}
}
if (!empty($optUserQueue)) {
sleep(1);
//echo("Should go to next with $optUserQueue");
$process = AJXP_Controller::applyActionInBackground($options["r"], $optAction, $optArgs, "queue:" . $optUserQueue, $optStatusFile);
if ($process != null && is_a($process, "UnixProcess") && isset($optStatusFile)) {
file_put_contents($optStatusFile, "RUNNING:" . $process->getPid());
}
}
if (!empty($nextRepositories)) {
sleep(1);
$process = AJXP_Controller::applyActionInBackground($nextRepositories, $optAction, $optArgs, $originalOptUser, $optStatusFile);
if ($process != null && is_a($process, "UnixProcess") && isset($optStatusFile)) {
file_put_contents($optStatusFile, "RUNNING:" . $process->getPid());
}
}
} else {
if (isset($optStatusFile)) {
$status = explode(":", file_get_contents($optStatusFile));
file_put_contents($optStatusFile, "FINISHED" . (in_array("QUEUED", $status) ? ":QUEUED" : ""));
}
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:31,代码来源:cmd.php
示例16: deleteRepositoryInst
/**
* See static method
* @param $repoId
* @return int
*/
public function deleteRepositoryInst($repoId)
{
AJXP_Controller::applyHook("workspace.before_delete", array($repoId));
$confStorage = self::getConfStorageImpl();
$res = $confStorage->deleteRepository($repoId);
if ($res == -1) {
return $res;
}
AJXP_Controller::applyHook("workspace.after_delete", array($repoId));
AJXP_Logger::info(__CLASS__, "Delete Repository", array("repo_id" => $repoId));
$this->invalidateLoadedRepositories();
}
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:17,代码来源:class.ConfService.php
示例17: header
//------------------------------------------------------------
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();
}
}
session_write_close();
开发者ID:rmxcc,项目名称:pydio-core,代码行数:31,代码来源:index.php
|
请发表评论