本文整理汇总了PHP中AJXP_XMLWriter::replaceAjxpXmlKeywords方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::replaceAjxpXmlKeywords方法的具体用法?PHP AJXP_XMLWriter::replaceAjxpXmlKeywords怎么用?PHP AJXP_XMLWriter::replaceAjxpXmlKeywords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_XMLWriter
的用法示例。
在下文中一共展示了AJXP_XMLWriter::replaceAjxpXmlKeywords方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
if (preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/MSIE 8/', $_SERVER['HTTP_USER_AGENT'])) {
// Force legacy theme for the moment
$this->pluginConf["GUI_THEME"] = "oxygen";
}
if (!defined("AJXP_THEME_FOLDER")) {
define("CLIENT_RESOURCES_FOLDER", AJXP_PLUGINS_FOLDER . "/gui.ajax/res");
define("AJXP_THEME_FOLDER", CLIENT_RESOURCES_FOLDER . "/themes/" . $this->pluginConf["GUI_THEME"]);
}
foreach ($httpVars as $getName => $getValue) {
${$getName} = AJXP_Utils::securePath($getValue);
}
if (isset($dir) && $action != "upload") {
$dir = SystemTextEncoding::fromUTF8($dir);
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// GET AN HTML TEMPLATE
//------------------------------------
case "get_template":
HTMLWriter::charsetHeader();
$folder = CLIENT_RESOURCES_FOLDER . "/html";
if (isset($httpVars["pluginName"])) {
$folder = AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/" . AJXP_Utils::securePath($httpVars["pluginName"]);
if (isset($httpVars["pluginPath"])) {
$folder .= "/" . AJXP_Utils::securePath($httpVars["pluginPath"]);
}
}
$crtTheme = $this->pluginConf["GUI_THEME"];
$thFolder = AJXP_THEME_FOLDER . "/html";
if (isset($template_name)) {
if (is_file($thFolder . "/" . $template_name)) {
include $thFolder . "/" . $template_name;
} else {
if (is_file($folder . "/" . $template_name)) {
include $folder . "/" . $template_name;
}
}
}
break;
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
case "get_i18n_messages":
$refresh = false;
if (isset($httpVars["lang"])) {
ConfService::setLanguage($httpVars["lang"]);
$refresh = true;
}
HTMLWriter::charsetHeader('text/javascript');
HTMLWriter::writeI18nMessagesClass(ConfService::getMessages($refresh));
break;
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
case "get_xml_registry":
$regDoc = AJXP_PluginsService::getXmlRegistry();
$changes = AJXP_Controller::filterActionsRegistry($regDoc);
if ($changes) {
AJXP_PluginsService::updateXmlRegistry($regDoc);
}
if (isset($_GET["xPath"])) {
$regPath = new DOMXPath($regDoc);
$nodes = $regPath->query($_GET["xPath"]);
AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $_GET["xPath"]));
if ($nodes->length) {
print AJXP_XMLWriter::replaceAjxpXmlKeywords($regDoc->saveXML($nodes->item(0)));
}
AJXP_XMLWriter::close("ajxp_registry_part");
} else {
AJXP_Utils::safeIniSet("zlib.output_compression", "4096");
header('Content-Type: application/xml; charset=UTF-8');
print AJXP_XMLWriter::replaceAjxpXmlKeywords($regDoc->saveXML());
}
break;
//------------------------------------
// DISPLAY DOC
//------------------------------------
//------------------------------------
// DISPLAY DOC
//------------------------------------
case "display_doc":
HTMLWriter::charsetHeader();
echo HTMLWriter::getDocFile(AJXP_Utils::securePath(htmlentities($_GET["doc_file"])));
break;
//------------------------------------
// GET BOOT GUI
//------------------------------------
//------------------------------------
//.........这里部分代码省略.........
示例2: uploadActions
public function uploadActions($action, $httpVars, $filesVars)
{
switch ($action) {
case "trigger_remote_copy":
if (!$this->hasFilesToCopy()) {
break;
}
$toCopy = $this->getFileNameToCopy();
AJXP_XMLWriter::header();
AJXP_XMLWriter::triggerBgAction("next_to_remote", array(), "Copying file " . $toCopy . " to ftp server");
AJXP_XMLWriter::close();
exit(1);
break;
case "next_to_remote":
if (!$this->hasFilesToCopy()) {
break;
}
$fData = $this->getNextFileToCopy();
$nextFile = '';
if ($this->hasFilesToCopy()) {
$nextFile = $this->getFileNameToCopy();
}
$this->logDebug("Base64 : ", array("from" => $fData["destination"], "to" => base64_decode($fData['destination'])));
$destPath = $this->urlBase . base64_decode($fData['destination']) . "/" . $fData['name'];
//$destPath = AJXP_Utils::decodeSecureMagic($destPath);
// DO NOT "SANITIZE", THE URL IS ALREADY IN THE FORM ajxp.ftp://repoId/filename
$destPath = SystemTextEncoding::fromPostedFileName($destPath);
$node = new AJXP_Node($destPath);
$this->logDebug("Copying file to server", array("from" => $fData["tmp_name"], "to" => $destPath, "name" => $fData["name"]));
try {
AJXP_Controller::applyHook("node.before_create", array(&$node));
$fp = fopen($destPath, "w");
$fSource = fopen($fData["tmp_name"], "r");
while (!feof($fSource)) {
fwrite($fp, fread($fSource, 4096));
}
fclose($fSource);
$this->logDebug("Closing target : begin ftp copy");
// Make sur the script does not time out!
@set_time_limit(240);
fclose($fp);
$this->logDebug("FTP Upload : end of ftp copy");
@unlink($fData["tmp_name"]);
AJXP_Controller::applyHook("node.change", array(null, &$node));
} catch (Exception $e) {
$this->logDebug("Error during ftp copy", array($e->getMessage(), $e->getTrace()));
}
$this->logDebug("FTP Upload : shoud trigger next or reload nextFile={$nextFile}");
AJXP_XMLWriter::header();
if ($nextFile != '') {
AJXP_XMLWriter::triggerBgAction("next_to_remote", array(), "Copying file " . SystemTextEncoding::toUTF8($nextFile) . " to remote server");
} else {
AJXP_XMLWriter::triggerBgAction("reload_node", array(), "Upload done, reloading client.");
}
AJXP_XMLWriter::close();
exit(1);
break;
case "upload":
$rep_source = AJXP_Utils::securePath("/" . $httpVars['dir']);
$this->logDebug("Upload : rep_source ", array($rep_source));
$logMessage = "";
foreach ($filesVars as $boxName => $boxData) {
if (substr($boxName, 0, 9) != "userfile_") {
continue;
}
$this->logDebug("Upload : rep_source ", array($rep_source));
$err = AJXP_Utils::parseFileDataErrors($boxData);
if ($err != null) {
$errorCode = $err[0];
$errorMessage = $err[1];
break;
}
if (isset($httpVars["auto_rename"])) {
$destination = $this->urlBase . $rep_source;
$boxData["name"] = fsAccessDriver::autoRenameForDest($destination, $boxData["name"]);
}
$boxData["destination"] = base64_encode($rep_source);
$destCopy = AJXP_XMLWriter::replaceAjxpXmlKeywords($this->repository->getOption("TMP_UPLOAD"));
$this->logDebug("Upload : tmp upload folder", array($destCopy));
if (!is_dir($destCopy)) {
if (!@mkdir($destCopy)) {
$this->logDebug("Upload error : cannot create temporary folder", array($destCopy));
$errorCode = 413;
$errorMessage = "Warning, cannot create folder for temporary copy.";
break;
}
}
if (!$this->isWriteable($destCopy)) {
$this->logDebug("Upload error: cannot write into temporary folder");
$errorCode = 414;
$errorMessage = "Warning, cannot write into temporary folder.";
break;
}
$this->logDebug("Upload : tmp upload folder", array($destCopy));
if (isset($boxData["input_upload"])) {
try {
$destName = tempnam($destCopy, "");
$this->logDebug("Begining reading INPUT stream");
$input = fopen("php://input", "r");
$output = fopen($destName, "w");
//.........这里部分代码省略.........
示例3: 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()) {
//.........这里部分代码省略.........
示例4: switchAction
//.........这里部分代码省略.........
// Make sure it's utf8
$data = array("ROLE" => $roleData, "ALL" => array("REPOSITORIES" => $repos));
if (isset($userObject)) {
$data["USER"] = array();
$data["USER"]["LOCK"] = $userObject->getLock();
$data["USER"]["PROFILE"] = $userObject->getProfile();
$data["ALL"]["PROFILES"] = array("standard|Standard", "admin|Administrator", "shared|Shared", "guest|Guest");
$data["USER"]["ROLES"] = array_keys($userObject->getRoles());
$data["ALL"]["ROLES"] = array_keys(AuthService::getRolesList(array(), true));
if (isset($userObject->parentRole)) {
$data["PARENT_ROLE"] = $userObject->parentRole->getDataArray();
}
} else {
if (isset($groupPath)) {
$data["GROUP"] = array("PATH" => $groupPath, "LABEL" => $groupLabel);
}
}
$scope = "role";
if ($roleGroup) {
$scope = "group";
} else {
if (isset($userObject)) {
$scope = "user";
}
}
$data["SCOPE_PARAMS"] = array();
$nodes = AJXP_PluginsService::getInstance()->searchAllManifests("//param[contains(@scope,'" . $scope . "')]|//global_param[contains(@scope,'" . $scope . "')]", "node", false, true, true);
foreach ($nodes as $node) {
$pId = $node->parentNode->parentNode->attributes->getNamedItem("id")->nodeValue;
$origName = $node->attributes->getNamedItem("name")->nodeValue;
$node->attributes->getNamedItem("name")->nodeValue = "AJXP_REPO_SCOPE_ALL/" . $pId . "/" . $origName;
$nArr = array();
foreach ($node->attributes as $attrib) {
$nArr[$attrib->nodeName] = AJXP_XMLWriter::replaceAjxpXmlKeywords($attrib->nodeValue);
}
$data["SCOPE_PARAMS"][] = $nArr;
}
echo json_encode($data);
}
break;
case "post_json_role":
$roleId = SystemTextEncoding::magicDequote($httpVars["role_id"]);
$roleGroup = false;
$userObject = $usrId = $filteredGroupPath = null;
if (strpos($roleId, "AJXP_GRP_") === 0) {
$groupPath = substr($roleId, strlen("AJXP_GRP_"));
$filteredGroupPath = AuthService::filterBaseGroup($groupPath);
$roleId = "AJXP_GRP_" . $filteredGroupPath;
$groups = AuthService::listChildrenGroups(AJXP_Utils::forwardSlashDirname($groupPath));
$key = "/" . basename($groupPath);
if (!array_key_exists($key, $groups)) {
throw new Exception("Cannot find group with this id!");
}
$groupLabel = $groups[$key];
$roleGroup = true;
}
if (strpos($roleId, "AJXP_USR_") === 0) {
$usrId = str_replace("AJXP_USR_/", "", $roleId);
$userObject = ConfService::getConfStorageImpl()->createUserObject($usrId);
if (!AuthService::canAdministrate($userObject)) {
throw new Exception("Cannot post role for user " . $usrId);
}
$originalRole = $userObject->personalRole;
} else {
// second param = create if not exists.
$originalRole = AuthService::getRole($roleId, $roleGroup);
示例5: getManifestDescription
/**
* Get the plugin description as defined in the manifest file (description attribute)
* @return mixed|string
*/
public function getManifestDescription()
{
if ($this->manifestXML != null) {
$this->unserializeManifest();
}
$l = $this->xPath->query("@description", $this->manifestDoc->documentElement);
if ($l->length) {
return AJXP_XMLWriter::replaceAjxpXmlKeywords($l->item(0)->nodeValue);
} else {
return "";
}
}
示例6: switchAction
public function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
if (preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT'])) {
// Force legacy theme for the moment
$this->pluginConf["GUI_THEME"] = "oxygen";
}
if (!defined("AJXP_THEME_FOLDER")) {
define("CLIENT_RESOURCES_FOLDER", AJXP_PLUGINS_FOLDER . "/gui.ajax/res");
define("AJXP_THEME_FOLDER", CLIENT_RESOURCES_FOLDER . "/themes/" . $this->pluginConf["GUI_THEME"]);
}
foreach ($httpVars as $getName => $getValue) {
${$getName} = AJXP_Utils::securePath($getValue);
}
if (isset($dir) && $action != "upload") {
$dir = SystemTextEncoding::fromUTF8($dir);
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// GET AN HTML TEMPLATE
//------------------------------------
case "get_template":
HTMLWriter::charsetHeader();
$folder = CLIENT_RESOURCES_FOLDER . "/html";
if (isset($httpVars["pluginName"])) {
$folder = AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/" . AJXP_Utils::securePath($httpVars["pluginName"]);
if (isset($httpVars["pluginPath"])) {
$folder .= "/" . AJXP_Utils::securePath($httpVars["pluginPath"]);
}
}
$crtTheme = $this->pluginConf["GUI_THEME"];
$thFolder = AJXP_THEME_FOLDER . "/html";
if (isset($template_name)) {
if (is_file($thFolder . "/" . $template_name)) {
include $thFolder . "/" . $template_name;
} else {
if (is_file($folder . "/" . $template_name)) {
include $folder . "/" . $template_name;
}
}
}
break;
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
case "get_i18n_messages":
$refresh = false;
if (isset($httpVars["lang"])) {
ConfService::setLanguage($httpVars["lang"]);
$refresh = true;
}
HTMLWriter::charsetHeader('text/javascript');
HTMLWriter::writeI18nMessagesClass(ConfService::getMessages($refresh));
break;
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
case "get_xml_registry":
$regDoc = AJXP_PluginsService::getXmlRegistry();
$changes = AJXP_Controller::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) {
$processing = $callback->parentNode->removeChild($callback);
}
if (isset($_GET["xPath"])) {
//$regPath = new DOMXPath($regDoc);
$nodes = $clonePath->query($_GET["xPath"]);
AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $_GET["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");
header('Content-Type: application/xml; charset=UTF-8');
print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML());
}
break;
//------------------------------------
// DISPLAY DOC
//------------------------------------
//------------------------------------
// DISPLAY DOC
//------------------------------------
case "display_doc":
HTMLWriter::charsetHeader();
//.........这里部分代码省略.........
示例7: unifyChunks
public function unifyChunks($action, &$httpVars, &$fileVars)
{
$filename = AJXP_Utils::decodeSecureMagic($httpVars["name"]);
$tmpName = $fileVars["file"]["tmp_name"];
$chunk = $httpVars["chunk"];
$chunks = $httpVars["chunks"];
//error_log("currentChunk:".$chunk." chunks: ".$chunks);
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$wrapperName = $streamData["classname"];
$dir = AJXP_Utils::securePath($httpVars["dir"]);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
$driver = ConfService::loadDriverForRepository($repository);
$remote = false;
if (method_exists($driver, "storeFileToCopy")) {
$remote = true;
$destCopy = AJXP_XMLWriter::replaceAjxpXmlKeywords($repository->getOption("TMP_UPLOAD"));
// Make tmp folder a bit more unique using secure_token
$tmpFolder = $destCopy . "/" . $httpVars["secure_token"];
if (!is_dir($tmpFolder)) {
@mkdir($tmpFolder, 0700, true);
}
$target = $tmpFolder . '/' . $filename;
$fileVars["file"]["destination"] = base64_encode($dir);
} else {
if (call_user_func(array($wrapperName, "isRemote"))) {
$remote = true;
$tmpFolder = AJXP_Utils::getAjxpTmpDir() . "/" . $httpVars["secure_token"];
if (!is_dir($tmpFolder)) {
@mkdir($tmpFolder, 0700, true);
}
$target = $tmpFolder . '/' . $filename;
} else {
$target = $destStreamURL . $filename;
}
}
//error_log("Directory: ".$dir);
// Clean the fileName for security reasons
//$filename = preg_replace('/[^\w\._]+/', '', $filename);
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"])) {
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
}
if (isset($_SERVER["CONTENT_TYPE"])) {
$contentType = $_SERVER["CONTENT_TYPE"];
}
// Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
if (strpos($contentType, "multipart") !== false) {
if (isset($tmpName) && is_uploaded_file($tmpName)) {
//error_log("tmpName: ".$tmpName);
// Open temp file
$out = fopen($target, $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen($tmpName, "rb");
if ($in) {
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
}
fclose($in);
fclose($out);
@unlink($tmpName);
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
}
} else {
// Open temp file
$out = fopen($target, $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen("php://input", "rb");
if ($in) {
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
}
fclose($in);
fclose($out);
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
}
/* we apply the hook if we are uploading the last chunk */
if ($chunk == $chunks - 1) {
if (!$remote) {
AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($destStreamURL . $filename), false));
} else {
if (method_exists($driver, "storeFileToCopy")) {
//.........这里部分代码省略.........
示例8: switchAction
//.........这里部分代码省略.........
if (is_array($customData) && count($customData) > 0) {
print "<custom_data>";
foreach ($customData as $custName => $custValue) {
print "<param name=\"{$custName}\" type=\"string\" label=\"{$custValue}\" description=\"\" value=\"\"/>";
}
print "</custom_data>";
}
AJXP_XMLWriter::close("admin_data");
break;
case "edit_user":
$confStorage = ConfService::getConfStorageImpl();
$userId = $httpVars["user_id"];
if (!AuthService::userExists($userId)) {
throw new Exception("Invalid user id!");
}
$userObject = $confStorage->createUserObject($userId);
//print_r($userObject);
AJXP_XMLWriter::header("admin_data");
AJXP_XMLWriter::sendUserData($userObject, true);
// Add CUSTOM USER DATA
$confDriver = ConfService::getConfStorageImpl();
$customData = $confDriver->options['CUSTOM_DATA'];
if (is_array($customData) && count($customData) > 0) {
$userCustom = $userObject->getPref("CUSTOM_PARAMS");
print "<custom_data>";
foreach ($customData as $custName => $custValue) {
$value = isset($userCustom[$custName]) ? $userCustom[$custName] : '';
print "<param name=\"{$custName}\" type=\"string\" label=\"{$custValue}\" description=\"\" value=\"{$value}\"/>";
}
print "</custom_data>";
}
// Add WALLET DATA : DEFINITIONS AND VALUES
print "<drivers>";
print AJXP_XMLWriter::replaceAjxpXmlKeywords(ConfService::availableDriversToXML("user_param"));
print "</drivers>";
$wallet = $userObject->getPref("AJXP_WALLET");
if (is_array($wallet) && count($wallet) > 0) {
print "<user_wallet>";
foreach ($wallet as $repoId => $options) {
foreach ($options as $optName => $optValue) {
print "<wallet_data repo_id=\"{$repoId}\" option_name=\"{$optName}\" option_value=\"{$optValue}\"/>";
}
}
print "</user_wallet>";
}
$editPass = $userId != "guest" ? "1" : "0";
$authDriver = ConfService::getAuthDriverImpl();
if (!$authDriver->passwordsEditable()) {
$editPass = "0";
}
print "<edit_options edit_pass=\"" . $editPass . "\" edit_admin_right=\"" . ($userId != "guest" && $userId != $loggedUser->getId() ? "1" : "0") . "\" edit_delete=\"" . ($userId != "guest" && $userId != $loggedUser->getId() && $authDriver->usersEditable() ? "1" : "0") . "\"/>";
print "<ajxp_roles>";
foreach (AuthService::getRolesList() as $roleId => $roleObject) {
print "<role id=\"" . AJXP_Utils::xmlEntities($roleId) . "\"/>";
}
print "</ajxp_roles>";
AJXP_XMLWriter::close("admin_data");
break;
case "create_user":
if (!isset($httpVars["new_user_login"]) || $httpVars["new_user_login"] == "" || !isset($httpVars["new_user_pwd"]) || $httpVars["new_user_pwd"] == "") {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $mess["ajxp_conf.61"]);
AJXP_XMLWriter::close();
return;
}
$new_user_login = AJXP_Utils::sanitize(SystemTextEncoding::magicDequote($httpVars["new_user_login"]), AJXP_SANITIZE_EMAILCHARS);
示例9: array
// die(AJXP_Utils::testResultsToTable($outputArray, $testedParams));
// }else{
// AJXP_Utils::testResultsToFile($outputArray, $testedParams);
// }
//}
$START_PARAMETERS = array("BOOTER_URL" => "cf_ajaxplorer_content.php?get_action=get_boot_conf", "MAIN_ELEMENT" => "ajxp_desktop", "SERVER_PREFIX_URI" => "../lib/ajaxplorer/");
if (AuthService::usersEnabled()) {
AuthService::preLogUser(isset($_GET["remote_session"]) ? $_GET["remote_session"] : "");
AuthService::bootSequence($START_PARAMETERS);
if (AuthService::getLoggedUser() != null || AuthService::logUser(null, null) == 1) {
$loggedUser = AuthService::getLoggedUser();
if (!$loggedUser->canRead(ConfService::getCurrentRootDirIndex()) && AuthService::getDefaultRootId() != ConfService::getCurrentRootDirIndex()) {
ConfService::switchRootDir(AuthService::getDefaultRootId());
}
}
}
AJXP_Utils::parseApplicationGetParameters($_GET, $START_PARAMETERS, $_SESSION);
$JSON_START_PARAMETERS = json_encode($START_PARAMETERS);
if (ConfService::getConf("JS_DEBUG")) {
$mess = ConfService::getMessages();
include_once INSTALL_PATH . "/" . CLIENT_RESOURCES_FOLDER . "/html/gui_debug.html";
} else {
$content = file_get_contents(CAMILA_DIR . '/templates/ajaxplorer_gui.html');
$content = AJXP_XMLWriter::replaceAjxpXmlKeywords($content, false);
if ($JSON_START_PARAMETERS) {
$content = str_replace("//AJXP_JSON_START_PARAMETERS", "startParameters = " . $JSON_START_PARAMETERS . ";", $content);
$content = str_replace("CAMILA_APPLICATION_NAME", CAMILA_APPLICATION_NAME, $content);
}
print $content;
}
}
示例10: switchAction
//.........这里部分代码省略.........
readfile(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/core.conf/" . $logo);
}
break;
case "get_user_templates_definition":
AJXP_XMLWriter::header("repository_templates");
$repositories = ConfService::getRepositoriesList();
$pServ = AJXP_PluginsService::getInstance();
foreach ($repositories as $repo) {
if (!$repo->isTemplate) {
continue;
}
if (!$repo->getOption("TPL_USER_CAN_CREATE")) {
continue;
}
$repoId = $repo->getUniqueId();
$repoLabel = $repo->getDisplay();
$repoType = $repo->getAccessType();
print "<template repository_id=\"{$repoId}\" repository_label=\"{$repoLabel}\" repository_type=\"{$repoType}\">";
$driverPlug = $pServ->getPluginByTypeName("access", $repoType);
$params = $driverPlug->getManifestRawContent("//param", "node");
$tplDefined = $repo->getOptionsDefined();
$defaultLabel = '';
foreach ($params as $paramNode) {
$name = $paramNode->getAttribute("name");
if (strpos($name, "TPL_") === 0) {
if ($name == "TPL_DEFAULT_LABEL") {
$defaultLabel = str_replace("AJXP_USER", AuthService::getLoggedUser()->getId(), $repo->getOption($name));
}
continue;
}
if (in_array($paramNode->getAttribute("name"), $tplDefined)) {
continue;
}
if ($paramNode->getAttribute('no_templates') == 'true') {
continue;
}
print AJXP_XMLWriter::replaceAjxpXmlKeywords($paramNode->ownerDocument->saveXML($paramNode));
}
// ADD LABEL
echo '<param name="DISPLAY" type="string" label="' . $mess[359] . '" description="' . $mess[429] . '" mandatory="true" default="' . $defaultLabel . '"/>';
print "</template>";
}
AJXP_XMLWriter::close("repository_templates");
break;
case "user_create_repository":
$tplId = $httpVars["template_id"];
$tplRepo = ConfService::getRepositoryById($tplId);
$options = array();
self::parseParameters($httpVars, $options);
$newRep = $tplRepo->createTemplateChild(AJXP_Utils::sanitize($httpVars["DISPLAY"]), $options, null, AuthService::getLoggedUser()->getId());
$res = ConfService::addRepository($newRep);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, $mess[426]);
} else {
$loggedUser = AuthService::getLoggedUser();
// Make sure we do not overwrite otherwise loaded rights.
$loggedUser->load();
$loggedUser->setRight($newRep->getUniqueId(), "rw");
$loggedUser->save("superuser");
AuthService::updateUser($loggedUser);
AJXP_XMLWriter::sendMessage($mess[425], null);
AJXP_XMLWriter::reloadDataNode("", $newRep->getUniqueId());
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
break;
case "user_delete_repository":
$repoId = $httpVars["repository_id"];
$repository = ConfService::getRepositoryById($repoId);
if (!$repository->getUniqueUser() || $repository->getUniqueUser() != AuthService::getLoggedUser()->getId()) {
throw new Exception("You are not allowed to perform this operation!");
}
$res = ConfService::deleteRepository($repoId);
AJXP_XMLWriter::header();
if ($res == -1) {
AJXP_XMLWriter::sendMessage(null, $mess[427]);
} else {
$loggedUser = AuthService::getLoggedUser();
// Make sure we do not override remotely set rights
$loggedUser->load();
$loggedUser->removeRights($repoId);
$loggedUser->save("superuser");
AuthService::updateUser($loggedUser);
AJXP_XMLWriter::sendMessage($mess[428], null);
AJXP_XMLWriter::reloadRepositoryList();
}
AJXP_XMLWriter::close();
break;
default:
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);
}
return $xmlBuffer;
}
示例11: 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($templateName)) {
$repoObject = ConfService::getRepositoryById($repository);
if (!is_object($repoObject)) {
$mess = ConfService::getMessages();
$error = $mess["share_center.166"];
$templateName = "ajxp_unique_strip";
} else {
$filter = $repoObject->getContentFilter();
if (!empty($filter) && count($filter->virtualPaths) == 1) {
$templateName = "ajxp_unique_strip";
} else {
$templateName = "ajxp_shared_folder";
}
}
}
// 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)) {
$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);
$callbacks = $xPath->query("//action[@contentTypedProvider]", $editor);
if ($callbacks->length) {
$ACTION = $callbacks->item(0)->getAttribute("name");
if ($ACTION == "audio_proxy") {
$params["file"] = "base64encoded:" . base64_encode($params["file"]);
//.........这里部分代码省略.........
示例12: switchAction
//.........这里部分代码省略.........
}
} else {
preg_match('/ws-(.)*\\/|settings|dashboard|welcome|user/', $root, $matches, PREG_OFFSET_CAPTURE);
if (count($matches)) {
$capture = $matches[0][1];
$root = substr($root, 0, $capture);
}
}
$START_PARAMETERS = array("BOOTER_URL" => "index.php?get_action=get_boot_conf", "MAIN_ELEMENT" => "ajxp_desktop", "APPLICATION_ROOT" => $root, "REBASE" => $root);
if (AuthService::usersEnabled()) {
AuthService::preLogUser(isset($httpVars["remote_session"]) ? $httpVars["remote_session"] : "");
AuthService::bootSequence($START_PARAMETERS);
if (AuthService::getLoggedUser() != null || AuthService::logUser(null, null) == 1) {
if (AuthService::getDefaultRootId() == -1) {
AuthService::disconnect();
} else {
$loggedUser = AuthService::getLoggedUser();
if (!$loggedUser->canRead(ConfService::getCurrentRepositoryId()) && AuthService::getDefaultRootId() != ConfService::getCurrentRepositoryId()) {
ConfService::switchRootDir(AuthService::getDefaultRootId());
}
}
}
}
AJXP_Utils::parseApplicationGetParameters($_GET, $START_PARAMETERS, $_SESSION);
$confErrors = ConfService::getErrors();
if (count($confErrors)) {
$START_PARAMETERS["ALERT"] = implode(", ", array_values($confErrors));
}
// PRECOMPUTE BOOT CONF
if (!preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT']) && !preg_match('/MSIE 8/', $_SERVER['HTTP_USER_AGENT'])) {
$preloadedBootConf = $this->computeBootConf();
AJXP_Controller::applyHook("loader.filter_boot_conf", array(&$preloadedBootConf));
$START_PARAMETERS["PRELOADED_BOOT_CONF"] = $preloadedBootConf;
}
// PRECOMPUTE REGISTRY
if (!isset($START_PARAMETERS["FORCE_REGISTRY_RELOAD"])) {
$clone = ConfService::getFilteredXMLRegistry(true, true);
$clonePath = new DOMXPath($clone);
$serverCallbacks = $clonePath->query("//serverCallback|hooks");
foreach ($serverCallbacks as $callback) {
$callback->parentNode->removeChild($callback);
}
$START_PARAMETERS["PRELOADED_REGISTRY"] = AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML());
}
$JSON_START_PARAMETERS = json_encode($START_PARAMETERS);
$crtTheme = $this->pluginConf["GUI_THEME"];
$additionalFrameworks = $this->getFilteredOption("JS_RESOURCES_BEFORE");
$ADDITIONAL_FRAMEWORKS = "";
if (!empty($additionalFrameworks)) {
$frameworkList = explode(",", $additionalFrameworks);
foreach ($frameworkList as $index => $framework) {
$frameworkList[$index] = '<script language="javascript" type="text/javascript" src="' . $framework . '"></script>' . "\n";
}
$ADDITIONAL_FRAMEWORKS = implode("", $frameworkList);
}
if (ConfService::getConf("JS_DEBUG")) {
if (!isset($mess)) {
$mess = ConfService::getMessages();
}
if (is_file(AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/themes/{$crtTheme}/html/gui_debug.html")) {
include AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/themes/{$crtTheme}/html/gui_debug.html";
} else {
include AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/html/gui_debug.html";
}
} else {
if (is_file(AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/themes/{$crtTheme}/html/gui.html")) {
$content = file_get_contents(AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/themes/{$crtTheme}/html/gui.html");
} else {
$content = file_get_contents(AJXP_INSTALL_PATH . "/plugins/gui.ajax/res/html/gui.html");
}
if (preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT'])) {
$ADDITIONAL_FRAMEWORKS = "";
}
$content = str_replace("AJXP_ADDITIONAL_JS_FRAMEWORKS", $ADDITIONAL_FRAMEWORKS, $content);
$content = AJXP_XMLWriter::replaceAjxpXmlKeywords($content, false);
$content = str_replace("AJXP_REBASE", isset($START_PARAMETERS["REBASE"]) ? '<base href="' . $START_PARAMETERS["REBASE"] . '"/>' : "", $content);
if ($JSON_START_PARAMETERS) {
$content = str_replace("//AJXP_JSON_START_PARAMETERS", "startParameters = " . $JSON_START_PARAMETERS . ";", $content);
}
print $content;
}
break;
//------------------------------------
// GET CONFIG FOR BOOT
//------------------------------------
//------------------------------------
// GET CONFIG FOR BOOT
//------------------------------------
case "get_boot_conf":
$out = array();
AJXP_Utils::parseApplicationGetParameters($_GET, $out, $_SESSION);
$config = $this->computeBootConf();
header("Content-type:application/json;charset=UTF-8");
print json_encode($config);
break;
default:
break;
}
return false;
}
示例13: switchAction
function switchAction($action, $httpVars, $fileVars)
{
if (!isset($this->actions[$action])) {
return;
}
foreach ($httpVars as $getName => $getValue) {
${$getName} = AJXP_Utils::securePath($getValue);
}
if (isset($dir) && $action != "upload") {
$dir = SystemTextEncoding::fromUTF8($dir);
}
$mess = ConfService::getMessages();
switch ($action) {
//------------------------------------
// GET AN HTML TEMPLATE
//------------------------------------
case "get_template":
HTMLWriter::charsetHeader();
$folder = CLIENT_RESOURCES_FOLDER . "/html";
if (isset($httpVars["pluginName"])) {
$folder = "plugins/" . $httpVars["pluginName"];
if (isset($httpVars["pluginPath"])) {
$folder .= "/" . $httpVars["pluginPath"];
}
}
if (isset($template_name) && is_file($folder . "/" . $template_name)) {
include $folder . "/" . $template_name;
}
break;
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
//------------------------------------
// GET I18N MESSAGES
//------------------------------------
case "get_i18n_messages":
HTMLWriter::charsetHeader('text/javascript');
HTMLWriter::writeI18nMessagesClass(ConfService::getMessages());
break;
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
//------------------------------------
// SEND XML REGISTRY
//------------------------------------
case "get_xml_registry":
$regDoc = AJXP_PluginsService::getXmlRegistry();
if (isset($_GET["xPath"])) {
$regPath = new DOMXPath($regDoc);
$nodes = $regPath->query($_GET["xPath"]);
AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $_GET["xPath"]));
if ($nodes->length) {
print AJXP_XMLWriter::replaceAjxpXmlKeywords($regDoc->saveXML($nodes->item(0)));
}
AJXP_XMLWriter::close("ajxp_registry_part");
} else {
header('Content-Type: application/xml; charset=UTF-8');
print AJXP_XMLWriter::replaceAjxpXmlKeywords($regDoc->saveXML());
}
break;
//------------------------------------
// DISPLAY DOC
//------------------------------------
//------------------------------------
// DISPLAY DOC
//------------------------------------
case "display_doc":
HTMLWriter::charsetHeader();
echo HTMLWriter::getDocFile(htmlentities($_GET["doc_file"]));
break;
//------------------------------------
// CHECK UPDATE
//------------------------------------
//------------------------------------
// CHECK UPDATE
//------------------------------------
case "check_software_update":
$content = @file_get_contents(SOFTWARE_UPDATE_SITE . "ajxp.version");
$message = $mess["345"];
if (isset($content) && $content != "") {
if (strstr($content, "::URL::") !== false) {
list($version, $downloadUrl) = explode("::URL::", $content);
} else {
$version = $content;
$downloadUrl = "http://www.ajaxplorer.info/";
}
$compare = version_compare(AJXP_VERSION, $content);
if ($compare >= 0) {
$message = $mess["346"];
} else {
$link = '<a target="_blank" href="' . $downloadUrl . '">' . $downloadUrl . '</a>';
$message = sprintf($mess["347"], $version, $link);
}
}
HTMLWriter::charsetHeader("text/plain");
print $message;
break;
//------------------------------------
// GET CONFIG FOR BOOT
//------------------------------------
//.........这里部分代码省略.........
示例14: loadInstallerForm
/**
* Transmit to the ajxp_conf load_plugin_manifest action
* @param $action
* @param $httpVars
* @param $fileVars
*/
public function loadInstallerForm($action, $httpVars, $fileVars)
{
if (isset($httpVars["lang"])) {
ConfService::setLanguage($httpVars["lang"]);
}
AJXP_XMLWriter::header("admin_data");
$fullManifest = $this->getManifestRawContent("", "xml");
$xPath = new DOMXPath($fullManifest->ownerDocument);
$addParams = "";
$pInstNodes = $xPath->query("server_settings/global_param[contains(@type, 'plugin_instance:')]");
foreach ($pInstNodes as $pInstNode) {
$type = $pInstNode->getAttribute("type");
$instType = str_replace("plugin_instance:", "", $type);
$fieldName = $pInstNode->getAttribute("name");
$pInstNode->setAttribute("type", "group_switch:" . $fieldName);
$typePlugs = AJXP_PluginsService::getInstance()->getPluginsByType($instType);
foreach ($typePlugs as $typePlug) {
if ($typePlug->getId() == "auth.multi") {
continue;
}
$checkErrorMessage = "";
try {
$typePlug->performChecks();
} catch (Exception $e) {
$checkErrorMessage = " (Warning : " . $e->getMessage() . ")";
}
$tParams = AJXP_XMLWriter::replaceAjxpXmlKeywords($typePlug->getManifestRawContent("server_settings/param"));
$addParams .= '<global_param group_switch_name="' . $fieldName . '" name="instance_name" group_switch_label="' . $typePlug->getManifestLabel() . $checkErrorMessage . '" group_switch_value="' . $typePlug->getId() . '" default="' . $typePlug->getId() . '" type="hidden"/>';
$addParams .= str_replace("<param", "<global_param group_switch_name=\"{$fieldName}\" group_switch_label=\"" . $typePlug->getManifestLabel() . $checkErrorMessage . "\" group_switch_value=\"" . $typePlug->getId() . "\" ", $tParams);
$addParams .= AJXP_XMLWriter::replaceAjxpXmlKeywords($typePlug->getManifestRawContent("server_settings/global_param"));
}
}
$allParams = AJXP_XMLWriter::replaceAjxpXmlKeywords($fullManifest->ownerDocument->saveXML($fullManifest));
$allParams = str_replace('type="plugin_instance:', 'type="group_switch:', $allParams);
$allParams = str_replace("</server_settings>", $addParams . "</server_settings>", $allParams);
echo $allParams;
AJXP_XMLWriter::close("admin_data");
}
示例15: uploadActions
public function uploadActions($action, $httpVars, $filesVars)
{
switch ($action) {
case "trigger_remote_copy":
if (!$this->hasFilesToCopy()) {
break;
}
$toCopy = $this->getFileNameToCopy();
$this->logDebug("trigger_remote", $toCopy);
AJXP_XMLWriter::header();
AJXP_XMLWriter::triggerBgAction("next_to_remote", array(), "Copying file " . $toCopy . " to remote server");
AJXP_XMLWriter::close();
exit(1);
break;
case "next_to_remote":
if (!$this->hasFilesToCopy()) {
break;
}
$fData = $this->getNextFileToCopy();
$nextFile = '';
if ($this->hasFilesToCopy()) {
$nextFile = $this->getFileNameToCopy();
}
$crtRep = ConfService::getRepository();
session_write_close();
$secureToken = "";
$httpClient = $this->getRemoteConnexion($secureToken);
//$httpClient->setDebug(true);
$postData = array("get_action" => "upload", "dir" => base64_encode($fData["destination"]), "secure_token" => $secureToken);
$httpClient->postFile($crtRep->getOption("URI") . "?", $postData, "Filedata", $fData);
if (strpos($httpClient->getHeader("content-type"), "text/xml") !== false && strpos($httpClient->getContent(), "require_auth") != false) {
$httpClient = $this->getRemoteConnexion($secureToken, true);
$postData["secure_token"] = $secureToken;
$httpClient->postFile($crtRep->getOption("URI"), $postData, "Filedata", $fData);
}
unlink($fData["tmp_name"]);
$response = $httpClient->getContent();
AJXP_XMLWriter::header();
$this->logDebug("next_to_remote", $nextFile);
if (intval($response) >= 400) {
AJXP_XMLWriter::sendMessage(null, "Error : " . intval($response));
} else {
if ($nextFile != '') {
AJXP_XMLWriter::triggerBgAction("next_to_remote", array(), "Copying file " . SystemTextEncoding::toUTF8($nextFile) . " to remote server");
} else {
AJXP_XMLWriter::triggerBgAction("reload_node", array(), "Upload done, reloading client.");
}
}
AJXP_XMLWriter::close();
exit(1);
break;
case "upload":
$rep_source = AJXP_Utils::securePath("/" . $httpVars['dir']);
$this->logDebug("Upload : rep_source ", array($rep_source));
$logMessage = "";
foreach ($filesVars as $boxName => $boxData) {
if (substr($boxName, 0, 9) != "userfile_") {
continue;
}
$this->logDebug("Upload : rep_source ", array($rep_source));
$err = AJXP_Utils::parseFileDataErrors($boxData);
if ($err != null) {
$errorCode = $err[0];
$errorMessage = $err[1];
break;
}
$boxData["destination"] = $rep_source;
$destCopy = AJXP_XMLWriter::replaceAjxpXmlKeywords($this->repository->getOption("TMP_UPLOAD"));
$this->logDebug("Upload : tmp upload folder", array($destCopy));
if (!is_dir($destCopy)) {
if (!@mkdir($destCopy)) {
$this->logDebug("Upload error : cannot create temporary folder", array($destCopy));
$errorCode = 413;
$errorMessage = "Warning, cannot create folder for temporary copy.";
break;
}
}
if (!is_writeable($destCopy)) {
$this->logDebug("Upload error: cannot write into temporary folder");
$errorCode = 414;
$errorMessage = "Warning, cannot write into temporary folder.";
break;
}
$this->logDebug("Upload : tmp upload folder", array($destCopy));
if (isset($boxData["input_upload"])) {
try {
$destName = tempnam($destCopy, "");
$this->logDebug("Begining reading INPUT stream");
$input = fopen("php://input", "r");
$output = fopen($destName, "w");
$sizeRead = 0;
while ($sizeRead < intval($boxData["size"])) {
$chunk = fread($input, 4096);
$sizeRead += strlen($chunk);
fwrite($output, $chunk, strlen($chunk));
}
fclose($input);
fclose($output);
$boxData["tmp_name"] = $destName;
$this->storeFileToCopy($boxData);
//.........这里部分代码省略.........