本文整理汇总了PHP中SystemTextEncoding类的典型用法代码示例。如果您正苦于以下问题:PHP SystemTextEncoding类的具体用法?PHP SystemTextEncoding怎么用?PHP SystemTextEncoding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SystemTextEncoding类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: initFromArray
function initFromArray($array)
{
if (!is_array($array)) {
return;
}
if (isset($array[$this->varPrefix]) && $array[$this->varPrefix] != "") {
$this->files[] = Utils::securePath(SystemTextEncoding::fromPostedFileName($array[$this->varPrefix]));
$this->isUnique = true;
//return ;
}
if (isset($array[$this->varPrefix . "_0"])) {
$index = 0;
while (isset($array[$this->varPrefix . "_" . $index])) {
$this->files[] = Utils::securePath(SystemTextEncoding::fromPostedFileName($array[$this->varPrefix . "_" . $index]));
$index++;
}
$this->isUnique = false;
if (count($this->files) == 1) {
$this->isUnique = true;
}
//return ;
}
if (isset($array[$this->dirPrefix])) {
$this->dir = Utils::securePath($array[$this->dirPrefix]);
if ($test = $this->detectZip($this->dir)) {
$this->inZip = true;
$this->zipFile = $test[0];
$this->localZipPath = $test[1];
}
}
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:31,代码来源:class.UserSelection.php
示例2: switchAction
function switchAction($action, $httpVars, $filesVars)
{
$sessionId = "";
$crtRep = ConfService::getRepository();
$httpClient = $this->getRemoteConnexion($sessionId);
//$httpClient->setDebug(true);
if ($crtRep->getOption("USE_AUTH")) {
$httpVars["ajxp_sessid"] = $sessionId;
}
$method = "get";
if ($action == "put_content") {
$method = "post";
}
if ($method == "get") {
if ($action == "download" || $action == "image_proxy" || $action == "mp3_proxy") {
$httpClient->directForwarding = true;
}
$result = $httpClient->get($crtRep->getOption("URI"), $httpVars);
} else {
$result = $httpClient->post($crtRep->getOption("URI"), $httpVars);
}
// check if session is expired
if (strpos($httpClient->getHeader("content-type"), "text/xml") !== false && strpos($httpClient->getContent(), "require_auth") != false) {
$httpClient = $this->getRemoteConnexion($sessionId, true);
$httpVars["ajxp_sessid"] = $sessionId;
$method = "get";
if ($method == "get") {
if ($action == "download") {
$httpClient->directForwarding = true;
}
$result = $httpClient->get($crtRep->getOption("URI"), $httpVars);
} else {
$result = $httpClient->post($crtRep->getOption("URI"), $httpVars);
}
}
if ($result === false && isset($httpClient->errormsg)) {
throw new Exception(SystemTextEncoding::toUTF8($httpClient->errormsg));
}
switch ($action) {
case "image_proxy":
case "download":
case "mp3_proxy":
session_write_close();
exit;
break;
case "get_content":
header("Content-type:text/plain");
break;
default:
header("Content-type: text/xml");
break;
}
print $httpClient->getContent();
session_write_close();
exit;
}
开发者ID:umbecr,项目名称:camilaframework,代码行数:56,代码来源:class.remote_fsAccessDriver.php
示例3: preProcess
public function preProcess($action, &$httpVars, &$fileVars)
{
if (!isset($httpVars["xhr_uploader"])) {
return false;
}
AJXP_Logger::debug("SimpleUpload::preProcess", $httpVars);
$headersCheck = isset($_SERVER['CONTENT_TYPE'], $_SERVER['CONTENT_LENGTH'], $_SERVER['HTTP_X_FILE_SIZE'], $_SERVER['HTTP_X_FILE_NAME']) && $_SERVER['CONTENT_TYPE'] === 'multipart/form-data' && $_SERVER['CONTENT_LENGTH'] === $_SERVER['HTTP_X_FILE_SIZE'];
$fileNameH = $_SERVER['HTTP_X_FILE_NAME'];
$fileSizeH = $_SERVER['HTTP_X_FILE_SIZE'];
if ($headersCheck) {
// create the object and assign property
$fileVars["userfile_0"] = array("input_upload" => true, "name" => SystemTextEncoding::fromUTF8(basename($fileNameH)), "size" => $fileSizeH);
} else {
exit("Warning, missing headers!");
}
}
开发者ID:umbecr,项目名称:camilaframework,代码行数:16,代码来源:class.SimpleUploadProcessor.php
示例4: preProcess
public function preProcess($action, &$httpVars, &$fileVars)
{
if (!isset($httpVars["input_stream"]) || isset($httpVars["force_post"])) {
return false;
}
$headersCheck = isset($_SERVER['CONTENT_LENGTH'], $_SERVER['HTTP_X_FILE_NAME']);
if (isset($_SERVER['HTTP_X_FILE_SIZE'])) {
if ($_SERVER['CONTENT_LENGTH'] != $_SERVER['HTTP_X_FILE_SIZE']) {
exit('Warning, wrong headers');
}
}
$fileNameH = $_SERVER['HTTP_X_FILE_NAME'];
$fileSizeH = $_SERVER['CONTENT_LENGTH'];
if (dirname($httpVars["dir"]) == "/" && basename($httpVars["dir"]) == $fileNameH) {
$httpVars["dir"] = "/";
}
$this->logDebug("SimpleUpload::preProcess", $httpVars);
if ($headersCheck) {
// create the object and assign property
$fileVars["userfile_0"] = array("input_upload" => true, "name" => SystemTextEncoding::fromUTF8(basename($fileNameH)), "size" => $fileSizeH);
} else {
exit("Warning, missing headers!");
}
}
开发者ID:projectesIF,项目名称:Ateneu,代码行数:24,代码来源:class.SimpleUploadProcessor.php
示例5: preProcess
public function preProcess($action, &$httpVars, &$fileVars)
{
$repository = ConfService::getRepository();
$skipDecoding = false;
if ($repository->detectStreamWrapper(false)) {
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
if ($streamData["protocol"] == "ajxp.ftp" || $streamData["protocol"] == "ajxp.remotefs") {
AJXP_Logger::debug("Skip decoding");
$skipDecoding = true;
}
}
if (isset($fileVars["Filedata"])) {
self::$active = true;
AJXP_Logger::debug("Dir before base64", $httpVars);
$httpVars["dir"] = base64_decode(urldecode($httpVars["dir"]));
if (!$skipDecoding) {
$fileVars["Filedata"]["name"] = SystemTextEncoding::fromUTF8($fileVars["Filedata"]["name"]);
}
$fileVars["userfile_0"] = $fileVars["Filedata"];
unset($fileVars["Filedata"]);
AJXP_Logger::debug("Setting FlexProc active");
}
}
开发者ID:firstcoder55,项目名称:Webkey,代码行数:24,代码来源:class.FlexUploadProcessor.php
示例6: 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()) {
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.AbstractConfDriver.php
示例7: migrateLegacyMeta
/**
* @param ShareCenter $shareCenter
* @param ShareStore $shareStore
* @param ShareRightsManager $shareRightManager
*/
public static function migrateLegacyMeta($shareCenter, $shareStore, $shareRightManager, $dryRun = true)
{
$metaStoreDir = AJXP_DATA_PATH . "/plugins/metastore.serial";
$publicFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
$metastores = glob($metaStoreDir . "/ajxp_meta_0");
if ($dryRun) {
print "RUNNING A DRY RUN FOR META MIGRATION";
}
foreach ($metastores as $store) {
if (strpos($store, ".bak") !== false) {
continue;
}
// Backup store
if (!$dryRun) {
copy($store, $store . ".bak");
}
$data = unserialize(file_get_contents($store));
foreach ($data as $filePath => &$metadata) {
foreach ($metadata as $userName => &$meta) {
if (!AuthService::userExists($userName)) {
continue;
}
$userObject = ConfService::getConfStorageImpl()->createUserObject($userName);
if (isset($meta["ajxp_shared"]) && isset($meta["ajxp_shared"]["element"])) {
print "\n\nItem {$filePath} requires upgrade :";
$share = $meta["ajxp_shared"];
$element = $meta["ajxp_shared"]["element"];
if (is_array($element)) {
$element = array_shift(array_keys($element));
}
// Take the first one only
$legacyLinkFile = $publicFolder . "/" . $element . ".php";
if (file_exists($legacyLinkFile)) {
// Load file, move it to DB and move the meta
$publiclet = $shareStore->loadShare($element);
rename($legacyLinkFile, $legacyLinkFile . ".migrated");
if (isset($share["minisite"])) {
print "\n--Migrate legacy minisite to new minisite?";
try {
$sharedRepoId = $publiclet["REPOSITORY"];
$sharedRepo = ConfService::getRepositoryById($sharedRepoId);
if ($sharedRepo == null) {
print "\n--ERROR: Cannot find repository with id " . $sharedRepoId;
continue;
}
$shareLink = new ShareLink($shareStore, $publiclet);
$user = $shareLink->getUniqueUser();
if (AuthService::userExists($user)) {
$userObject = ConfService::getConfStorageImpl()->createUserObject($user);
$userObject->setHidden(true);
print "\n--Should set existing user {$user} as hidden";
if (!$dryRun) {
$userObject->save();
}
}
$shareLink->parseHttpVars(["custom_handle" => $element]);
$shareLink->setParentRepositoryId($sharedRepo->getParentId());
print "\n--Creating the following share object";
print_r($shareLink->getJsonData($shareCenter->getPublicAccessManager(), ConfService::getMessages()));
if (!$dryRun) {
$shareLink->save();
}
$meta["ajxp_shared"] = ["shares" => [$element => ["type" => "minisite"], $sharedRepoId => ["type" => "repository"]]];
} catch (Exception $e) {
print "\n-- Error " . $e->getMessage();
}
} else {
print "\n--Should migrate legacy link to new minisite with ContentFilter";
try {
$link = new ShareLink($shareStore);
$link->setOwnerId($userName);
$parameters = array("custom_handle" => $element, "simple_right_download" => true);
if (isset($publiclet["EXPIRE_TIME"])) {
$parameters["expiration"] = $publiclet["EXPIRE_TIME"];
}
if (isset($publiclet["DOWNLOAD_LIMIT"])) {
$parameters["downloadlimit"] = $publiclet["DOWNLOAD_LIMIT"];
}
$link->parseHttpVars($parameters);
$parentRepositoryObject = $publiclet["REPOSITORY"];
$driverInstance = AJXP_PluginsService::findPlugin("access", $parentRepositoryObject->getAccessType());
if (empty($driverInstance)) {
print "\n-- ERROR: Cannot find driver instance!";
continue;
}
$options = $driverInstance->makeSharedRepositoryOptions(["file" => "/"], $parentRepositoryObject);
$options["SHARE_ACCESS"] = "private";
$newRepo = $parentRepositoryObject->createSharedChild(basename($filePath), $options, $parentRepositoryObject->getId(), $userObject->getId(), null);
$gPath = $userObject->getGroupPath();
if (!empty($gPath) && !ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf")) {
$newRepo->setGroupPath($gPath);
}
$newRepo->setDescription("");
// Smells like dirty hack!
$newRepo->options["PATH"] = SystemTextEncoding::fromStorageEncoding($newRepo->options["PATH"]);
//.........这里部分代码省略.........
开发者ID:Nanomani,项目名称:pydio-core,代码行数:101,代码来源:class.LegacyPubliclet.php
示例8: replaceVars
protected function replaceVars($tplString, $mess, $rich = true)
{
$tplString = SystemTextEncoding::fromUTF8($tplString);
$repoId = $this->getNode()->getRepositoryId();
if (ConfService::getRepositoryById($repoId) != null) {
$repoLabel = ConfService::getRepositoryById($repoId)->getDisplay();
} else {
$repoLabel = "Repository";
}
$uLabel = "";
if (array_key_exists($this->getAuthor(), self::$usersCaches)) {
if (self::$usersCaches[$this->getAuthor()] != 'AJXP_USER_DONT_EXISTS') {
$uLabel = self::$usersCaches[$this->getAuthor()];
}
} else {
if (strstr($tplString, "AJXP_USER") !== false) {
if (AuthService::userExists($this->getAuthor())) {
$obj = ConfService::getConfStorageImpl()->createUserObject($this->getAuthor());
$uLabel = $obj->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, "");
self::$usersCaches[$this->getAuthor()] = $uLabel;
} else {
self::$usersCaches[$this->getAuthor()] = 'AJXP_USER_DONT_EXISTS';
}
}
}
if (empty($uLabel)) {
$uLabel = $this->getAuthor();
}
$em = $rich ? "<em>" : "";
$me = $rich ? "</em>" : "";
$replaces = array("AJXP_NODE_PATH" => $em . $this->getRoot($this->getNode()->getPath()) . $me, "AJXP_NODE_LABEL" => $em . $this->getNode()->getLabel() . $me, "AJXP_PARENT_PATH" => $em . $this->getRoot(dirname($this->getNode()->getPath())) . $me, "AJXP_PARENT_LABEL" => $em . $this->getRoot(basename(dirname($this->getNode()->getPath()))) . $me, "AJXP_REPOSITORY_ID" => $em . $repoId . $me, "AJXP_REPOSITORY_LABEL" => $em . $repoLabel . $me, "AJXP_LINK" => $this->getMainLink(), "AJXP_USER" => $uLabel, "AJXP_DATE" => SystemTextEncoding::fromUTF8(AJXP_Utils::relativeDate($this->getDate(), $mess)));
if ($replaces["AJXP_NODE_LABEL"] == $em . $me) {
$replaces["AJXP_NODE_LABEL"] = $em . "[" . $replaces["AJXP_REPOSITORY_LABEL"] . "]" . $me;
}
if ($replaces["AJXP_PARENT_LABEL"] == $em . $me) {
$replaces["AJXP_PARENT_LABEL"] = $em . "[" . $replaces["AJXP_REPOSITORY_LABEL"] . "]" . $me;
}
if ((strstr($tplString, "AJXP_TARGET_FOLDER") !== false || strstr($tplString, "AJXP_SOURCE_FOLDER")) && isset($this->secondaryNode)) {
$p = $this->secondaryNode->getPath();
if ($this->secondaryNode->isLeaf()) {
$p = $this->getRoot(dirname($p));
}
$replaces["AJXP_TARGET_FOLDER"] = $replaces["AJXP_SOURCE_FOLDER"] = $em . $p . $me;
}
if ((strstr($tplString, "AJXP_TARGET_LABEL") !== false || strstr($tplString, "AJXP_SOURCE_LABEL") !== false) && isset($this->secondaryNode)) {
$replaces["AJXP_TARGET_LABEL"] = $replaces["AJXP_SOURCE_LABEL"] = $em . $this->secondaryNode->getLabel() . $me;
}
return str_replace(array_keys($replaces), array_values($replaces), $tplString);
}
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:49,代码来源:class.AJXP_Notification.php
示例9: crossRepositoryCopy
function crossRepositoryCopy($httpVars)
{
ConfService::detectRepositoryStreams(true);
$mess = ConfService::getMessages();
$selection = new UserSelection();
$selection->initFromHttpVars($httpVars);
$files = $selection->getFiles();
$accessType = $this->repository->getAccessType();
$repositoryId = $this->repository->getId();
$origStreamURL = "ajxp.{$accessType}://{$repositoryId}";
$destRepoId = $httpVars["dest_repository_id"];
$destRepoObject = ConfService::getRepositoryById($destRepoId);
$destRepoAccess = $destRepoObject->getAccessType();
$destStreamURL = "ajxp.{$destRepoAccess}://{$destRepoId}";
// Check rights
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if (!$loggedUser->canRead($repositoryId) || !$loggedUser->canWrite($destRepoId)) {
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, "You do not have the right to access one of the repositories!");
AJXP_XMLWriter::close();
exit(1);
}
}
$messages = array();
foreach ($files as $file) {
$origFile = $origStreamURL . $file;
$destFile = $destStreamURL . $httpVars["dest"] . "/" . basename($file);
$origHandler = fopen($origFile, "r");
$destHandler = fopen($destFile, "w");
if ($origHandler === false || $destHandler === false) {
$errorMessages[] = AJXP_XMLWriter::sendMessage(null, $mess[114] . " ({$origFile} to {$destFile})", false);
continue;
}
while (!feof($origHandler)) {
fwrite($destHandler, fread($origHandler, 4096));
}
fflush($destHandler);
fclose($origHandler);
fclose($destHandler);
$messages[] = $mess[34] . " " . SystemTextEncoding::toUTF8(basename($origFile)) . " " . $mess[73] . " " . SystemTextEncoding::toUTF8($destFile);
}
AJXP_XMLWriter::header();
if (count($errorMessages)) {
AJXP_XMLWriter::sendMessage(null, join("\n", $errorMessages), true);
}
AJXP_XMLWriter::sendMessage(join("\n", $messages), null, true);
AJXP_XMLWriter::close();
exit(0);
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:50,代码来源:class.AbstractAccessDriver.php
示例10: foreach
}
foreach ($_POST as $getName => $getValue) {
${$getName} = Utils::securePath($getValue);
}
$selection = new UserSelection();
$selection->initFromHttpVars();
if (isset($action) || isset($get_action)) {
$action = isset($get_action) ? $get_action : $action;
} else {
$action = "";
}
if (isset($dir) && $action != "upload") {
$dir = SystemTextEncoding::fromUTF8($dir);
}
if (isset($dest)) {
$dest = SystemTextEncoding::fromUTF8($dest);
}
//------------------------------------------------------------
// SPECIAL HANDLING FOR FANCY UPLOADER RIGHTS FOR THIS ACTION
//------------------------------------------------------------
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($action == "upload" && ($loggedUser == null || !$loggedUser->canWrite(ConfService::getCurrentRootDirIndex() . "")) && isset($_FILES['Filedata'])) {
header('HTTP/1.0 ' . '410 Not authorized');
die('Error 410 Not authorized!');
}
}
// Look for the action in the "fixed" drivers : AjxpClient, Auth & Conf
$ajxpDriver = new AJXP_ClientDriver(ConfService::getRepository());
$ajxpDriver->applyIfExistsAndExit($action, array_merge($_GET, $_POST), $_FILES);
$authDriver = ConfService::getAuthDriverImpl();
开发者ID:projectesIF,项目名称:Ateneu,代码行数:31,代码来源:content.php
示例11: copyOrMoveFile
function copyOrMoveFile($destDir, $srcFile, &$error, &$success, $move = false)
{
$mess = ConfService::getMessages();
$destFile = $this->repository->getOption("PATH") . $destDir . "/" . basename($srcFile);
$realSrcFile = $this->repository->getOption("PATH") . "{$srcFile}";
$recycle = $this->repository->getOption("RECYCLE_BIN");
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->repository->getOption("PATH") . $destDir . "/" . $newName)) {
$suffix = "-{$i}";
if (isset($radic)) {
$newName = $radic . $suffix . $ext;
} else {
$newName = $base . $suffix;
}
$i++;
}
$destFile = $this->repository->getOption("PATH") . $destDir . "/" . $newName;
}
}
if (is_dir($realSrcFile)) {
$errors = array();
$succFiles = array();
if ($move) {
if (is_file($destFile)) {
unlink($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 (is_file($destFile)) {
unlink($destFile);
}
$res = rename($realSrcFile, $destFile);
} else {
$res = copy($realSrcFile, $destFile);
}
if ($res != 1) {
$error[] = $mess[114];
return;
}
}
if ($move) {
// Now delete original
// $this->deldir($realSrcFile); // both file and dir
$messagePart = $mess[74] . " " . SystemTextEncoding::toUTF8($destDir);
if (RecycleBinManager::recycleEnabled() && $destDir == "/" . $recycle) {
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;
}
} else {
if (RecycleBinManager::recycleEnabled() && $destDir == "/" . $this->repository->getOption("RECYCLE_BIN")) {
RecycleBinManager::fileToRecycle($srcFile);
}
if (isset($dirRes)) {
$success[] = $mess[117] . " " . SystemTextEncoding::toUTF8(basename($srcFile)) . " " . $mess[73] . " " . SystemTextEncoding::toUTF8($destDir) . " (" . SystemTextEncoding::toUTF8($dirRes) . " " . $mess[116] . ")";
} else {
$success[] = $mess[34] . " " . SystemTextEncoding::toUTF8(basename($srcFile)) . " " . $mess[73] . " " . SystemTextEncoding::toUTF8($destDir);
}
}
}
开发者ID:projectesIF,项目名称:Ateneu,代码行数:92,代码来源:class.fsAccessDriver.php
示例12: xmlContentEntities
/**
* Replace specific chars by their XML Entities, for use inside attributes value
* @static
* @param $string
* @param bool $toUtf8
* @return mixed|string
*/
public static function xmlContentEntities($string, $toUtf8 = false)
{
$xmlSafe = str_replace(array("&", "<", ">", "\""), array("&", "<", ">", """), $string);
if ($toUtf8) {
return SystemTextEncoding::toUTF8($xmlSafe);
} else {
return $xmlSafe;
}
}
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:16,代码来源:class.AJXP_Utils.php
示例13: switchAction
public function switchAction($action, $httpVars, $filesVars)
{
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
return false;
}
$selection = new UserSelection($repository, $httpVars);
$selectedNode = $selection->getUniqueNode();
$selectedNodeUrl = $selectedNode->getUrl();
if ($action == "post_to_server") {
// Backward compat
if (strpos($httpVars["file"], "base64encoded:") !== 0) {
$legacyFilePath = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
$selectedNode = new AJXP_Node($selection->currentBaseUrl() . $legacyFilePath);
$selectedNodeUrl = $selectedNode->getUrl();
}
$target = rtrim(base64_decode($httpVars["parent_url"]), '/') . "/plugins/editor.pixlr";
$tmp = AJXP_MetaStreamWrapper::getRealFSReference($selectedNodeUrl);
$tmp = SystemTextEncoding::fromUTF8($tmp);
$this->logInfo('Preview', 'Sending content of ' . $selectedNodeUrl . ' to Pixlr server.', array("files" => $selectedNodeUrl));
AJXP_Controller::applyHook("node.read", array($selectedNode));
$saveTarget = $target . "/fake_save_pixlr.php";
if ($this->getFilteredOption("CHECK_SECURITY_TOKEN", $repository->getId())) {
$saveTarget = $target . "/fake_save_pixlr_" . md5($httpVars["secure_token"]) . ".php";
}
$params = array("referrer" => "Pydio", "method" => "get", "loc" => ConfService::getLanguage(), "target" => $saveTarget, "exit" => $target . "/fake_close_pixlr.php", "title" => urlencode(basename($selectedNodeUrl)), "locktarget" => "false", "locktitle" => "true", "locktype" => "source");
require_once AJXP_BIN_FOLDER . "/http_class/http_class.php";
$arguments = array();
$httpClient = new http_class();
$httpClient->request_method = "POST";
$httpClient->GetRequestArguments("https://pixlr.com/editor/", $arguments);
$arguments["PostValues"] = $params;
$arguments["PostFiles"] = array("image" => array("FileName" => $tmp, "Content-Type" => "automatic/name"));
$err = $httpClient->Open($arguments);
if (empty($err)) {
$err = $httpClient->SendRequest($arguments);
if (empty($err)) {
$response = "";
while (true) {
$header = array();
$error = $httpClient->ReadReplyHeaders($header, 1000);
if ($error != "" || $header != null) {
break;
}
$response .= $header;
}
}
}
header("Location: {$header['location']}");
//$response");
} else {
if ($action == "retrieve_pixlr_image") {
$file = AJXP_Utils::decodeSecureMagic($httpVars["original_file"]);
$selectedNode = new AJXP_Node($selection->currentBaseUrl() . $file);
$selectedNode->loadNodeInfo();
$this->logInfo('Edit', 'Retrieving content of ' . $file . ' from Pixlr server.', array("files" => $file));
AJXP_Controller::applyHook("node.before_change", array(&$selectedNode));
$url = $httpVars["new_url"];
$urlParts = parse_url($url);
$query = $urlParts["query"];
if ($this->getFilteredOption("CHECK_SECURITY_TOKEN", $repository->getId())) {
$scriptName = basename($urlParts["path"]);
$token = str_replace(array("fake_save_pixlr_", ".php"), "", $scriptName);
if ($token != md5($httpVars["secure_token"])) {
throw new AJXP_Exception("Invalid Token, this could mean some security problem!");
}
}
$params = array();
parse_str($query, $params);
$image = $params['image'];
$headers = get_headers($image, 1);
$content_type = explode("/", $headers['Content-Type']);
if ($content_type[0] != "image") {
throw new AJXP_Exception("Invalid File Type");
}
$content_length = intval($headers["Content-Length"]);
if ($content_length != 0) {
AJXP_Controller::applyHook("node.before_change", array(&$selectedNode, $content_length));
}
$orig = fopen($image, "r");
$target = fopen($selectedNode->getUrl(), "w");
if (is_resource($orig) && is_resource($target)) {
while (!feof($orig)) {
fwrite($target, fread($orig, 4096));
}
fclose($orig);
fclose($target);
}
clearstatcache(true, $selectedNode->getUrl());
$selectedNode->loadNodeInfo(true);
AJXP_Controller::applyHook("node.change", array(&$selectedNode, &$selectedNode));
}
}
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:94,代码来源:class.PixlrEditor.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: array
ConfService::init();
ConfService::start();
$confStorageDriver = ConfService::getConfStorageImpl();
require_once $confStorageDriver->getUserClassFileName();
//session_name("AjaXplorer");
//session_start();
$optArgs = array();
$options = array();
$regex = '/^-(-?)([a-zA-z0-9_]*)=(.*)/';
foreach ($argv as $key => $argument) {
//echo("$key => $argument \n");
if (preg_match($regex, $argument, $matches)) {
if ($matches[1] == "-") {
$optArgs[trim($matches[2])] = SystemTextEncoding::toUTF8(trim($matches[3]));
} else {
$options[trim($matches[2])] = SystemTextEncoding::toUTF8(trim($matches[3]));
}
}
}
$optUser = $options["u"];
if (!empty($optUser)) {
if (isset($options["p"])) {
$optPass = $options["p"];
} else {
// Consider "u" is a crypted version of u:p
$optToken = $options["t"];
$cKey = ConfService::getCoreConf("AJXP_CLI_SECRET_KEY", "conf");
if (empty($cKey)) {
$cKey = "CDAFx¨op#";
}
$optUser = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($optToken . $cKey), base64_decode($optUser), MCRYPT_MODE_ECB), "");
开发者ID:Nanomani,项目名称:pydio-core,代码行数:31,代码来源:cmd.php
|
请发表评论