Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	core/src/plugins/action.compression/PluginCompression.php
  • Loading branch information
snw35 committed Oct 5, 2016
2 parents 0389ee0 + b920b73 commit e4232e0
Show file tree
Hide file tree
Showing 116 changed files with 2,526 additions and 1,442 deletions.
5 changes: 5 additions & 0 deletions core/src/conf/RELEASE_NOTE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ Pydio ##VERSION_NUMBER## Release Note

TODO : This is a temporary package for testing upgrade from v6 to v7

Third Beta for Pydio 7

----
Pydio Core 6.5.2

Second beta for Pydio 7

----
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/lib/pclzip.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
if (!defined('PCLZIP_TEMPORARY_DIR')) {
define( 'PCLZIP_TEMPORARY_DIR', ApplicationState::getAjxpTmpDir() .DIRECTORY_SEPARATOR );
define( 'PCLZIP_TEMPORARY_DIR', ApplicationState::getTemporaryFolder() .DIRECTORY_SEPARATOR );
}

// ----- Optional threshold ratio for use of temporary files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ private function loadPluginsFromCache($cacheStorage) {
if(!empty($this->detectedPlugins)){
return true;
}
if(!empty($cacheStorage) && $this->_loadDetectedPluginsFromCache($cacheStorage)){
if($this->_loadDetectedPluginsFromCache($cacheStorage)){
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Services/ApplicationState.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static function getWorkspaceShortcutURL($repository)
* @static
* @return mixed|null|string
*/
public static function getAjxpTmpDir()
public static function getTemporaryFolder()
{
$conf = ConfService::getGlobalConf("AJXP_TMP_DIR");
if (!empty($conf)) {
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Utils/Http/BruteForceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BruteForceHelper
*/
public static function getBruteForceLoginArray()
{
$failedLog = ApplicationState::getAjxpTmpDir() . "/failedAJXP.log";
$failedLog = ApplicationState::getTemporaryFolder() . "/failedAJXP.log";
$loginAttempt = @file_get_contents($failedLog);
$loginArray = unserialize($loginAttempt);
$ret = array();
Expand All @@ -66,7 +66,7 @@ public static function setBruteForceLoginArray($loginArray, $validCurrent = fals
if($validCurrent && isSet($loginArray[$_SERVER["REMOTE_ADDR"]])){
unset($loginArray[$_SERVER["REMOTE_ADDR"]]);
}
$failedLog = ApplicationState::getAjxpTmpDir() . "/failedAJXP.log";
$failedLog = ApplicationState::getTemporaryFolder() . "/failedAJXP.log";
@file_put_contents($failedLog, serialize($loginArray));
}

Expand Down
3 changes: 2 additions & 1 deletion core/src/core/src/pydio/Core/Utils/Http/UserAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ public static function osFromUserAgent($useragent = null)
'PydioPro iOS Native Application' => 'Pydio-Native-iOS',
'Pydio Android Native Application' => 'Apache-HttpClient',
'PydioPro Android Native Application' => 'Pydio-Native-Android',
'Pydio Sync Client' => 'python-requests'
'Pydio Sync Client' => 'python-requests',
'Pydio Booster' => "Go-http-client"
);

if ($useragent == null) {
Expand Down
11 changes: 9 additions & 2 deletions core/src/core/src/pydio/Core/Utils/Vars/OptionsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function filterFormElementsFromMeta(ContextInterface $ctx, $metada
}
$value = "";
} else {
$file = ApplicationState::getAjxpTmpDir() . "/" . $value;
$file = ApplicationState::getTemporaryFolder() . "/" . $value;
if (file_exists($file)) {
$id = !empty($level["original_binary"]) ? $level["original_binary"] : null;
$id = ConfService::getConfStorageImpl()->saveBinary($binariesContext, $file, $id);
Expand Down Expand Up @@ -137,7 +137,7 @@ public static function parseStandardFormParameters(ContextInterface $ctx, &$repD
}
$value = "";
} else {
$file = ApplicationState::getAjxpTmpDir() . "/" . $value;
$file = ApplicationState::getTemporaryFolder() . "/" . $value;
if (file_exists($file)) {
$id = !empty($repDef[$key . "_original_binary"]) ? $repDef[$key . "_original_binary"] : null;
$id = ConfService::getConfStorageImpl()->saveBinary($binariesContext, $file, $id);
Expand Down Expand Up @@ -236,6 +236,13 @@ public static function cleanDibiDriverParameters($params)
$params["formatDate"] = "'Y-m-d'";
break;
}
if(strpos($params['host'], ':') !== false){
list($h, $portOrSocket) = explode(":", $params['host']);
if(!is_numeric($portOrSocket) && file_exists($portOrSocket)){
$params['host'] = $h;
$params['socket'] = $portOrSocket;
}
}
if (isSet($value)) {
self::$_dibiParamClean[$value] = $params;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Utils/Vars/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public static function regexpToLdap($regexp)
public static function createGUID()
{
if (function_exists('com_create_guid')) {
return com_create_guid();
return trim(com_create_guid(), "{}");
} else {
mt_srand((double)microtime() * 10000);//optional for php 4.2.0 and up.
$charid = strtoupper(md5(uniqid(rand(), true)));
Expand Down
27 changes: 15 additions & 12 deletions core/src/core/src/pydio/Core/Utils/Vars/VarsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ class VarsFilter
*/
public static function filter($value, ContextInterface $ctx)
{
// If AJXP_PARENT_OPTION, resolve and return directly, do not filter the real value.
if(is_string($value) && preg_match("/AJXP_PARENT_OPTION:([\w_-]*):/", $value, $matches)){
$repoObject = $ctx->getRepository();
$parentRepository = $repoObject->getParentRepository();
if(empty($parentRepository)){
throw new PydioException("Cannot resolve ".$matches[0]." without parent workspace");
}
$parentOwner = $ctx->getRepository()->getOwner();
$parentContext = Context::contextWithObjects(null, $parentRepository);
$parentContext->setUserId($parentOwner);
$parentPath = rtrim($parentRepository->getContextOption($parentContext, $matches[1]), "/");
$value = str_replace($matches[0], $parentPath, $value);
return $value;
}

if (is_string($value) && strpos($value, "AJXP_USER")!==false) {
if (UsersService::usersEnabled()) {
if(!$ctx->hasUser()){
Expand Down Expand Up @@ -85,18 +100,6 @@ public static function filter($value, ContextInterface $ctx)
if (is_string($value) && strstr($value, "AJXP_WORKSPACE_SLUG") !== false) {
$value = rtrim(str_replace("AJXP_WORKSPACE_SLUG", $ctx->getRepository()->getSlug(), $value), "/");
}
if(is_string($value) && preg_match("/AJXP_PARENT_OPTION:([\w_-]*):/", $value, $matches)){
$repoObject = $ctx->getRepository();
$parentRepository = $repoObject->getParentRepository();
if(empty($parentRepository)){
throw new PydioException("Cannot resolve ".$matches[0]." without parent workspace");
}
$parentOwner = $ctx->getRepository()->getOwner();
$parentContext = Context::contextWithObjects(null, $parentRepository);
$parentContext->setUserId($parentOwner);
$parentPath = rtrim($parentRepository->getContextOption($parentContext, $matches[1]), "/");
$value = str_replace($matches[0], $parentPath, $value);
}

$tab = array(&$value, $ctx);
Controller::applyIncludeHook("vars.filter", $tab);
Expand Down
26 changes: 26 additions & 0 deletions core/src/nginx.conf.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Debian 8 with default /etc/nginx/nginx.conf
# File name: /etc/nginx/sites-available/pydio.conf
server {
listen 80 default_server;
keepalive_requests 10;
keepalive_timeout 60 60;

client_max_body_size 800M;
client_body_buffer_size 128k;

# Document Root
root /usr/share/pydio;

if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}

# nginx configuration
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/lib/php5-fpm/www.sock;
}
}
types {
application/font-woff2 woff2;
}
4 changes: 2 additions & 2 deletions core/src/plugins/access.fs/FsAccessDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ public function downloadAction(ServerRequestInterface &$request, ResponseInterfa
if ($zip) {
// Make a temp zip and send it as download
$loggedUser = $ctx->getUser();
$file = ApplicationState::getAjxpTmpDir() ."/".($loggedUser?$loggedUser->getId():"shared")."_".time()."tmpDownload.zip";
$file = ApplicationState::getTemporaryFolder() ."/".($loggedUser?$loggedUser->getId():"shared")."_".time()."tmpDownload.zip";
$zipFile = $this->makeZip($selection, $file, empty($dir)?"/":$dir);
if(!$zipFile) throw new PydioException("Error while compressing");
$localName = (empty($base)?"Files":$base).".zip";
Expand Down Expand Up @@ -804,7 +804,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
} else {
$localName = (basename($dir)==""?"Files":basename($dir)).".zip";
}
$file = ApplicationState::getAjxpTmpDir() ."/".($loggedUser?$loggedUser->getId():"shared")."_".time()."tmpCompression.zip";
$file = ApplicationState::getTemporaryFolder() ."/".($loggedUser?$loggedUser->getId():"shared")."_".time()."tmpCompression.zip";
if(isSet($httpVars["compress_flat"])) $baseDir = "__AJXP_ZIP_FLAT__/";
else $baseDir = $dir;
$zipFile = $this->makeZip($selection, $file, $baseDir, $taskId);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/access.fs/FsAccessWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected static function initPath($path, $streamType, $storeOpenContext = false
//print($streamType.$path);
if ($streamType == "file") {
if (self::$crtZip == null || !is_array(self::$currentListingKeys)) {
$tmpDir = ApplicationState::getAjxpTmpDir() . DIRECTORY_SEPARATOR . md5(time()-rand());
$tmpDir = ApplicationState::getTemporaryFolder() . DIRECTORY_SEPARATOR . md5(time()-rand());
mkdir($tmpDir);
$tmpFileName = $tmpDir.DIRECTORY_SEPARATOR.basename($localPath);
Logger::debug(__CLASS__,__FUNCTION__,"Tmp file $tmpFileName");
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/access.fs/fsActions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<context selection="false" dir="true" recycle="hidden" actionBar="true"
contextMenu="true" infoPanel="false" actionBarGroup="put,minisite" inZip="false"/>
</gui>
<rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""/>
<rightsContext noUser="true" userLogged="only" read="false" write="true" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
modal.showDialogForm('Create', 'mkdir_form', function(form){
Expand Down Expand Up @@ -97,7 +97,7 @@
<context selection="false" dir="true" recycle="hidden" actionBar="true"
contextMenu="false" infoPanel="false" actionBarGroup="create" inZip="false"/>
</gui>
<rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""/>
<rightsContext noUser="true" userLogged="only" read="false" write="true" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
modal.showDialogForm('Create', 'mkfile_form', null, function(){
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/access.ftp/FtpAccessWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class FtpAccessWrapper implements IAjxpWrapper
*/
public static function getRealFSReference($path, $persistent = false)
{
$tmpFile = ApplicationState::getAjxpTmpDir() ."/".md5(time());
$tmpFile = ApplicationState::getTemporaryFolder() ."/".md5(time());
$tmpHandle = fopen($tmpFile, "wb");
self::copyFileInStream($path, $tmpHandle);
fclose($tmpHandle);
Expand Down
8 changes: 4 additions & 4 deletions core/src/plugins/access.inbox/InboxAccessDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ public static function getNodeData($nodePath){
$nodeObject = new AJXP_Node($nodePath);
$basename = $nodeObject->getLabel();
if($nodeObject->isRoot()){
return ['stat' => stat(ApplicationState::getAjxpTmpDir())];
return ['stat' => stat(ApplicationState::getTemporaryFolder())];
}
$allNodes = self::getNodes($nodeObject->getContext(), false);
$nodeData = $allNodes[$basename];
if(!isSet($nodeData["stat"])){
if(in_array(pathinfo($basename, PATHINFO_EXTENSION), ["error", "invitation"])){
$stat = stat(ApplicationState::getAjxpTmpDir());
$stat = stat(ApplicationState::getTemporaryFolder());
}else{
$url = $nodeData["url"];
$node = new AJXP_Node($url);
Expand All @@ -121,7 +121,7 @@ public static function getNodeData($nodePath){
Controller::applyHook("node.read", [&$node]);
$stat = stat($url);
}catch (\Exception $e){
$stat = stat(ApplicationState::getAjxpTmpDir());
$stat = stat(ApplicationState::getTemporaryFolder());
}
if(is_array($stat) && $nodeObject->getContext()->hasUser()){
$acl = $nodeObject->getContext()->getUser()->getMergedRole()->getAcl($nodeData["meta"]["shared_repository_id"]);
Expand Down Expand Up @@ -217,7 +217,7 @@ public static function getNodes(ContextInterface $parentContext, $checkStats = f
$remoteShare = $ocsStore->remoteShareById($linkId);
$status = $remoteShare->getStatus();
if($status == OCS_INVITATION_STATUS_PENDING){
$stat = stat(ApplicationState::getAjxpTmpDir());
$stat = stat(ApplicationState::getTemporaryFolder());
$ext = "invitation";
$meta["ajxp_mime"] = "invitation";
$meta["share_meta_type"] = 0;
Expand Down
8 changes: 4 additions & 4 deletions core/src/plugins/access.inbox/InboxAccessWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static function translateURL($path){
$node = $nodes[ltrim($nodePath, '/')];

if (empty($node) || ! isset($node['url'])) {
return ApplicationState::getAjxpTmpDir();
return ApplicationState::getTemporaryFolder();
}

$url = $node['url'];
Expand All @@ -149,7 +149,7 @@ public static function translateURL($path){
}

if(empty($nodePath)){
return ApplicationState::getAjxpTmpDir();
return ApplicationState::getTemporaryFolder();
}

if($pydioScheme){
Expand Down Expand Up @@ -181,14 +181,14 @@ public static function getRealFSReference($path, $persistent = false)
$realFilePointer = MetaStreamWrapper::getRealFSReference($url, true);
if(!$isRemote){
$ext = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION);
$tmpname = tempnam(ApplicationState::getAjxpTmpDir(), "real-file-inbox-pointer").".".$ext;
$tmpname = tempnam(ApplicationState::getTemporaryFolder(), "real-file-inbox-pointer").".".$ext;
copy($realFilePointer, $tmpname);
$realFilePointer = $tmpname;
}
self::$linkNode->getDriver();
return $realFilePointer;
}else{
$tmpname = tempnam(ApplicationState::getAjxpTmpDir(), "real-file-inbox-pointer");
$tmpname = tempnam(ApplicationState::getTemporaryFolder(), "real-file-inbox-pointer");
$source = fopen($url, "r");
$dest = fopen($tmpname, "w");
stream_copy_to_stream($source, $dest);
Expand Down
Loading

0 comments on commit e4232e0

Please sign in to comment.