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

Commit 7e857f4

Browse files
committed
Merge branch 'develop' of http://github.com/pydio/pydio-core into develop
* 'develop' of http://github.com/pydio/pydio-core: Initiate release note and dist resources for 7.0.2 RolesManager loading role data : Make sure to remove invalid repos on error from shared repositories list. i18n new prompt exception mechanism Update trigger as mysql automatically pads varchars when comparing, creating a content instead of path in some case (trailing spaces). See #1253 Manual merge of #1292 (put encoding call directly inside win-dedicated function. Auth.ldap: add starttsl support. See #1248, should fix it. Fix zip operation when child drivers are remote (inc. smb) - Fix #1287 Fix base detection for archive Fix SMB access driver and custom smbclient path. Close #1290 Rewire ALLOWED_EXTENSIONS configs - Fix #1283 Fix #1288 Fix Imap & EML plugins - Warning php7 requires Mail_mimeDecode 1.5.6 - Fix #1282
2 parents edaa6b4 + d54df84 commit 7e857f4

File tree

46 files changed

+426
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+426
-79
lines changed

core/src/conf/RELEASE_NOTE

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,56 @@ Pydio 7.0.1 Fix main upgrade issues of 7.0
1313
. Check php version: 5.6 is finally required for enterprise dist, because of ioncube loaders.
1414
. Fix case sensitive rename (details)
1515

16+
Pydio 7.0.2 Bugfix release for Pydio 7
17+
--
18+
. Fix command line automatic comma-split, let it enabled only for -i and -r options, otherwise it can break some commands. (details)
19+
. Update current stable version (details)
20+
. Use a dedicated mbParseUrl() function instead of parse_url that may fail with utf-8 on some specific installs (inc. macos) (details)
21+
. Fix issue #1259: Zip on-the-fly option creates 0-sized empty files (apache compatibility) (details)
22+
. Users and groups deletion: use UsersService and RolesService instead of deleting directly in db to fix caching issues. (details)
23+
. Fix roles assignment when updating user groupPath (details)
24+
. JS UI: handle Prompt exception and dialog. (details)
25+
. New Middleware WorkspaceAuthRequired catches specific exception, sends JS prompt message and re-initialize request when form is submitted. (details)
26+
. changed invalid link to developer guide to v7 developer guide (details)
27+
. Reorganize MemorySafe. Add a context identifier to handle multiple credential sources. For storing when passed via ENV CLi. (details)
28+
. Tplus / Tminus were moved to subfolder. Fix #1255 (details)
29+
. Change docs editors orders. Fix #1264 (details)
30+
. Fix ChainCache declaring PatternClearable although subacaches may not have this feature. Fix #1265 (details)
31+
. Make sure to save repoId in session when loading minisite, can make some issues if shared user have other workspaces accesses. (details)
32+
. Sets a default provider for TaskService otherwise top-level errors of command line are not visible to task status. (details)
33+
. Fix slug issues - Fix #1273 (details)
34+
. Prevent enabling cache at install if apc/apcu is not enabled. Should fix #1261 (details)
35+
. Make sure to recompute readonly flag if current context has a permission mask, by using node.info.nocache hook. (details)
36+
. Change icon for dwg files, use cube. Fix #1230 (details)
37+
. Do not post "change" notifications or alerts when just copying a file to another workspace. Fix #1274 (details)
38+
. Silently ignore register channel on non-readable repository. Avoid sending events on write-only repositories, see #1256 (details)
39+
. Dav impl childExists function is highly inefficient, replace by a simple call to is_file on childnode. (details)
40+
. And WorkspaceAuthRequired instead of simple exception (details)
41+
. Fix meta.git download/preview. Fix #1275 (details). .
42+
. Fix Shared Files download, the associated method is no more switchAction but downloadAction. Fix #1276 (details)
43+
. Use file_exists instead of is_file (details)
44+
. CLI and task_id passed : make sure to update status by default, for actions that do not implement specific tasks management. Otherwise scheduler will show "Starting action.... " and nothing more. (details)
45+
. Missing context in cleanUserShares() could create an error on user deletion. Close #1279 (details)
46+
. Fix mbParseUrl if preg_replace returns null. (details)
47+
. Catch deleteById() exceptions in ElasticSearch (details)
48+
. Remote download was broken. Fix #1281 (details)
49+
. Auth.multi : when looking for shared users only, skip master driver. Auth.ldap : fix users count caching per baseGroup. (details)
50+
. Fix CSS on share dialog title. (details)
51+
. Add user if not in indexed URL. (details)
52+
. Meta.git: make sure to apply node.change after revert operation. (details)
53+
. Fix counting user on ldap (details)
54+
. Missing curly brace (details)
55+
. Fix Imap & EML plugins - Warning php7 requires Mail_mimeDecode 1.5.6 - Fix #1282 (details)
56+
. Fix #1288 (details)
57+
. Rewire ALLOWED_EXTENSIONS configs - Fix #1283 (details)
58+
. Fix SMB access driver and custom smbclient path. Close #1290 (details)
59+
. Fix zip operation when child drivers are remote (inc. smb) - Fix #1287 Fix base detection for archive (details)
60+
. Auth.ldap: add starttsl support. See #1248, should fix it. (details)
61+
. Manual merge of #1292 (put encoding call directly inside win-dedicated function. (details)
62+
. Update trigger as mysql automatically pads varchars when comparing, creating a content instead of path in some case (trailing spaces). See #1253 (details)
63+
. i18n new prompt exception mechanism (details)
64+
. RolesManager loading role data : Make sure to remove invalid repos on error from shared repositories list. (details)
65+
1666
**************
1767
New Features
1868
**************

core/src/core/src/pydio/Core/Exception/PydioPromptException.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Pydio\Core\Http\Middleware\WorkspaceAuthMiddleware;
2424
use Pydio\Core\Http\Response\JSONSerializableResponseChunk;
2525
use Pydio\Core\Http\Response\XMLSerializableResponseChunk;
26+
use Pydio\Core\Services\LocaleService;
2627

2728
defined('AJXP_EXEC') or die( 'Access not allowed');
2829

@@ -83,12 +84,15 @@ public function __construct($promptType, $data, $messageString, $messageId = fal
8384
* @return PydioPromptException
8485
*/
8586
public static function promptForWorkspaceCredentials($parameters, $postSubmitCallback = ""){
87+
$mess = LocaleService::getMessages();
8688
$inputs = [];
8789
foreach($parameters as $key => $value){
8890
if($key === WorkspaceAuthMiddleware::FORM_RESUBMIT_LOGIN) {
89-
$inputs[] = "<input type='text' name='$key' value='$value' placeholder='Login'>";
91+
$loginString = str_replace("'","\'", $mess['181']);
92+
$inputs[] = "<input type='text' name='$key' value='$value' placeholder='$loginString'>";
9093
}else if($key === WorkspaceAuthMiddleware::FORM_RESUBMIT_PASS){
91-
$inputs[] = "<input type='password' name='$key' value='' placeholder='Password' autocomplete='off'>";
94+
$passString = str_replace("'","\'", $mess['182']);
95+
$inputs[] = "<input type='password' name='$key' value='' placeholder='$passString' autocomplete='off'>";
9296
}else{
9397
$inputs[] = "<input type='hidden' name='$key' value='$value'>";
9498
}
@@ -97,8 +101,8 @@ public static function promptForWorkspaceCredentials($parameters, $postSubmitCal
97101
"confirm",
98102
array(
99103
"DIALOG" => "<div>
100-
<h3>Credentials Required</h3>
101-
<div class='dialogLegend'>Please provide a password to enter this workspace.</div>
104+
<h3>".$mess['557']."</h3>
105+
<div class='dialogLegend'>".$mess['558']."</div>
102106
<form autocomplete='off'>
103107
".implode("\n", $inputs)."
104108
</form>
@@ -112,7 +116,7 @@ public static function promptForWorkspaceCredentials($parameters, $postSubmitCal
112116
"EVAL" => ""
113117
)
114118
),
115-
"Credentials Needed");
119+
$mess['557']);
116120

117121
}
118122

core/src/core/src/pydio/Core/Exception/WorkspaceAuthRequired.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Pydio\Auth\Core\MemorySafe;
2525
use Pydio\Core\Model\Context;
2626
use Pydio\Core\Model\UserInterface;
27+
use Pydio\Core\Services\LocaleService;
2728

2829
defined('AJXP_EXEC') or die('Access not allowed');
2930

@@ -43,10 +44,13 @@ class WorkspaceAuthRequired extends PydioException {
4344
* @param boolean $requireLogin
4445
* @param string $message
4546
*/
46-
public function __construct($workspaceId, $requireLogin = false, $message = "Authentication required for this workspace")
47+
public function __construct($workspaceId, $requireLogin = false, $message = "")
4748
{
4849
$this->workspaceId = $workspaceId;
4950
$this->requireLogin = $requireLogin;
51+
if(empty($message)){
52+
$message = LocaleService::getMessages()['559'];
53+
}
5054
parent::__construct($message, false, null);
5155
}
5256

core/src/core/src/pydio/Core/Utils/Vars/PathUtils.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,43 @@ public static function unPatchPathForBaseDir($dirPath)
7373
return str_replace("__ZIP_EXTENSION__", ".zip", $dirPath);
7474
}
7575

76+
/**
77+
* Return highest common folder
78+
* @param $items
79+
* @return mixed
80+
*/
81+
public static function commonPath($items)
82+
{
83+
$arr = array();
84+
foreach($items as $i => $path)
85+
{
86+
$items[$i] = explode('/', $path);
87+
unset($items[$i][0]);
88+
89+
$arr[$i] = count($items[$i]);
90+
}
91+
92+
$min = min($arr);
93+
94+
for($i = 0; $i < count($items); $i++)
95+
{
96+
while(count($items[$i]) > $min)
97+
{
98+
array_pop($items[$i]);
99+
}
100+
101+
$items[$i] = '/' . implode('/' , $items[$i]);
102+
}
103+
104+
$items = array_unique($items);
105+
while(count($items) !== 1)
106+
{
107+
$items = array_map('dirname', $items);
108+
$items = array_unique($items);
109+
}
110+
reset($items);
111+
112+
return current($items);
113+
}
76114

77115
}

core/src/plugins/access.ajxp_conf/src/RolesManager.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,12 @@ public function rolesActions(ServerRequestInterface $requestInterface, ResponseI
233233
|| ($repositoryObject->getUniqueUser() != null && $repositoryObject->getUniqueUser() != $userObject->getId())
234234
)
235235
){
236+
if(isSet($sharedRepos[$repositoryId])) unset($sharedRepos[$repositoryId]);
236237
continue;
237238
}else if(empty($userObject) && (
238239
(empty($currentMainUser) && !$currentMainUser->canAdministrate($repositoryObject)) || $repositoryObject->isTemplate()
239240
)){
241+
if(isSet($sharedRepos[$repositoryId])) unset($sharedRepos[$repositoryId]);
240242
continue;
241243
}
242244
$meta = array();

core/src/plugins/access.fs/FsAccessDriver.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@ public function downloadAction(ServerRequestInterface &$request, ResponseInterfa
650650
} else {
651651
if(isset($httpVars["dir"])){
652652
$dir = InputFilter::decodeSecureMagic($httpVars["dir"], InputFilter::SANITIZE_DIRNAME);
653+
}else{
654+
$dir = $selection->commonDirFromSelection();
653655
}
654656
$base = basename(PathUtils::forwardSlashDirname($selection->getUniqueFile()));
655657
$zip = true;
@@ -2390,7 +2392,8 @@ public function makeZip (UserSelection $selection, $dest, $basedir, $taskId = nu
23902392
$filePaths = [];
23912393
$selectedNodes = $selection->buildNodes();
23922394
foreach ($selectedNodes as $node) {
2393-
$realFile = $node->getRealFile();
2395+
//$realFile = $node->getRealFile();
2396+
$realFile = MetaStreamWrapper::getRealFSReference($node->getUrl());
23942397
if (basename($node->getPath()) == "") {
23952398
$filePaths[] = [PCLZIP_ATT_FILE_NAME => $realFile];
23962399
} else {
@@ -2426,7 +2429,7 @@ public function makeZip (UserSelection $selection, $dest, $basedir, $taskId = nu
24262429
if($basedir == "__AJXP_ZIP_FLAT__/"){
24272430
$vList = $archive->create($filePaths, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_NO_COMPRESSION, PCLZIP_OPT_ADD_TEMP_FILE_ON, PCLZIP_CB_PRE_ADD, $preAddCallback);
24282431
}else{
2429-
$basedir = MetaStreamWrapper::getRealFSReference($selection->currentBaseUrl()).trim($basedir);
2432+
$basedir = rtrim(MetaStreamWrapper::getRealFSReference($selection->currentBaseUrl()), '/').trim($basedir);
24302433
$this->logDebug("Basedir", [$basedir]);
24312434
$vList = $archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $basedir, PCLZIP_OPT_NO_COMPRESSION, PCLZIP_OPT_ADD_TEMP_FILE_ON, PCLZIP_CB_PRE_ADD, $preAddCallback);
24322435
}

core/src/plugins/access.imap/ImapAccessDriver.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,35 @@ public function performChecks()
7171
}
7272
}
7373

74+
/**
75+
* @param $st1
76+
* @param $st2
77+
* @return int
78+
*/
7479
public static function inverseSort($st1, $st2)
7580
{
7681
return strnatcasecmp($st2, $st1);
7782
}
7883

84+
/**
85+
* @param $st1
86+
* @param $st2
87+
* @return int
88+
*/
7989
public static function sortInboxFirst($st1, $st2)
8090
{
8191
if($st1 == "INBOX") return -1;
8292
if($st2 == "INBOX") return 1;
8393
return strcmp($st1, $st2);
8494
}
8595

96+
/**
97+
* @param ServerRequestInterface $request
98+
* @param ResponseInterface $response
99+
* @throws PydioException
100+
* @throws \Exception
101+
* @throws \Pydio\Access\Core\Exception\FileNotWriteableException
102+
*/
86103
public function switchAction(ServerRequestInterface &$request, ResponseInterface &$response)
87104
{
88105
if ($request->getAttribute("action") == "ls") {

core/src/plugins/access.imap/ImapAccessWrapper.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
namespace Pydio\Access\Driver\StreamProvider\Imap;
2222

23-
use EmlParser;
23+
use Pydio\Editor\EML\EmlParser;
2424
use Pydio\Access\Core\IAjxpWrapper;
2525
use Pydio\Access\Core\Model\AJXP_Node;
2626

@@ -133,7 +133,6 @@ public function stream_open($path, $mode, $options, &$opened_path)
133133
$attachmentId = array_pop($ar);
134134
$this->currentAttachmentData = array("realPath" => $mailPath, "attachmentId" => $attachmentId);
135135
// EXTRACT ATTACHMENT AND RETURN
136-
require_once AJXP_INSTALL_PATH."/plugins/editor.eml/class.EmlParser.php";
137136
$emlParser = new EmlParser("", "");
138137
$attachMeta = array();
139138
$this->data = $emlParser->getAttachmentBody(
@@ -212,7 +211,6 @@ public function stream_read($count)
212211
if (empty($this->data)) {
213212
Logger::debug(__CLASS__,__FUNCTION__,"Attachement", $this->currentAttachmentData);
214213
// EXTRACT ATTACHMENT AND RETURN
215-
require_once AJXP_INSTALL_PATH."/plugins/editor.eml/class.EmlParser.php";
216214
$emlParser = new EmlParser("", "");
217215
$attachMeta = array();
218216
$this->data = $emlParser->getAttachmentBody(
@@ -309,7 +307,6 @@ public function dir_opendir($path, $options)
309307
self::$currentCount = count($this->mailboxes);
310308
$this->pos = $this->dir - 1;
311309
} else if ($this->fragment == "attachments") {
312-
require_once AJXP_INSTALL_PATH.'/plugins/editor.eml/class.EmlParser.php';
313310
$parser = new EmlParser("", "");
314311
$ar = explode("#", $path);
315312
$path = array_shift($ar);// remove fragment

core/src/plugins/access.smb/SMBAccessDriver.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@
2222
namespace Pydio\Access\Driver\StreamProvider\SMB;
2323

2424
use DOMNode;
25+
use PclZip;
26+
use Pydio\Access\Core\MetaStreamWrapper;
2527
use Pydio\Access\Core\Model\AJXP_Node;
28+
use Pydio\Access\Core\Model\UserSelection;
2629
use Pydio\Access\Core\RecycleBinManager;
2730
use Pydio\Access\Core\Model\Repository;
2831
use Pydio\Access\Driver\StreamProvider\FS\FsAccessDriver;
2932
use Pydio\Core\Model\ContextInterface;
3033
use Pydio\Core\Exception\PydioException;
34+
use Pydio\Core\Services\ConfService;
35+
use Pydio\Core\Utils\TextEncoder;
36+
use Pydio\Core\Utils\Vars\InputFilter;
37+
use Pydio\Tasks\Task;
38+
use Pydio\Tasks\TaskService;
3139

3240

3341
defined('AJXP_EXEC') or die( 'Access not allowed');
@@ -47,6 +55,16 @@ class SMBAccessDriver extends FsAccessDriver
4755
protected $wrapperClassName;
4856
protected $urlBase;
4957

58+
protected function loadExternalWrapper(){
59+
if(!empty($this->pluginConf['SMBCLIENT']) && !defined('SMB4PHP_SMBCLIENT')){
60+
define ('SMB4PHP_SMBCLIENT', $this->pluginConf["SMBCLIENT"]);
61+
}
62+
if(!empty($this->pluginConf['SMB_PATH_TMP']) && !defined('SMB_PATH_TMP')){
63+
define ('SMB4PHP_SMBTMP', $this->pluginConf["SMB_PATH_TMP"]);
64+
}
65+
require_once($this->getBaseDir()."/smb.php");
66+
}
67+
5068
/**
5169
* @param ContextInterface $contextInterface
5270
* @throws PydioException
@@ -59,13 +77,7 @@ protected function initRepository(ContextInterface $contextInterface)
5977
} else {
6078
$this->driverConf = array();
6179
}
62-
$smbclientPath = $this->driverConf["SMBCLIENT"];
63-
define ('SMB4PHP_SMBCLIENT', $smbclientPath);
64-
65-
$smbtmpPath = $this->driverConf["SMB_PATH_TMP"];
66-
define ('SMB4PHP_SMBTMP', $smbtmpPath);
67-
68-
require_once($this->getBaseDir()."/smb.php");
80+
$this->loadExternalWrapper();
6981

7082
//$create = $this->repository->getOption("CREATE");
7183
$recycle = $this->repository->getContextOption($contextInterface, "RECYCLE_BIN");
@@ -92,7 +104,7 @@ protected function initRepository(ContextInterface $contextInterface)
92104
public function detectStreamWrapper($register = false, ContextInterface $ctx = null)
93105
{
94106
if ($register) {
95-
require_once($this->getBaseDir()."/smb.php");
107+
$this->loadExternalWrapper();
96108
}
97109
return parent::detectStreamWrapper($register, $ctx);
98110
}

0 commit comments

Comments
 (0)