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

Commit

Permalink
Merge branch 'develop' of http://github.com/pydio/pydio-core into dev…
Browse files Browse the repository at this point in the history
…elop

* '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
  • Loading branch information
ghecquet committed Nov 21, 2016
2 parents edaa6b4 + d54df84 commit 7e857f4
Show file tree
Hide file tree
Showing 46 changed files with 426 additions and 79 deletions.
50 changes: 50 additions & 0 deletions core/src/conf/RELEASE_NOTE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,56 @@ Pydio 7.0.1 Fix main upgrade issues of 7.0
. Check php version: 5.6 is finally required for enterprise dist, because of ioncube loaders.
. Fix case sensitive rename (details)

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

**************
New Features
**************
Expand Down
14 changes: 9 additions & 5 deletions core/src/core/src/pydio/Core/Exception/PydioPromptException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Pydio\Core\Http\Middleware\WorkspaceAuthMiddleware;
use Pydio\Core\Http\Response\JSONSerializableResponseChunk;
use Pydio\Core\Http\Response\XMLSerializableResponseChunk;
use Pydio\Core\Services\LocaleService;

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

Expand Down Expand Up @@ -83,12 +84,15 @@ public function __construct($promptType, $data, $messageString, $messageId = fal
* @return PydioPromptException
*/
public static function promptForWorkspaceCredentials($parameters, $postSubmitCallback = ""){
$mess = LocaleService::getMessages();
$inputs = [];
foreach($parameters as $key => $value){
if($key === WorkspaceAuthMiddleware::FORM_RESUBMIT_LOGIN) {
$inputs[] = "<input type='text' name='$key' value='$value' placeholder='Login'>";
$loginString = str_replace("'","\'", $mess['181']);
$inputs[] = "<input type='text' name='$key' value='$value' placeholder='$loginString'>";
}else if($key === WorkspaceAuthMiddleware::FORM_RESUBMIT_PASS){
$inputs[] = "<input type='password' name='$key' value='' placeholder='Password' autocomplete='off'>";
$passString = str_replace("'","\'", $mess['182']);
$inputs[] = "<input type='password' name='$key' value='' placeholder='$passString' autocomplete='off'>";
}else{
$inputs[] = "<input type='hidden' name='$key' value='$value'>";
}
Expand All @@ -97,8 +101,8 @@ public static function promptForWorkspaceCredentials($parameters, $postSubmitCal
"confirm",
array(
"DIALOG" => "<div>
<h3>Credentials Required</h3>
<div class='dialogLegend'>Please provide a password to enter this workspace.</div>
<h3>".$mess['557']."</h3>
<div class='dialogLegend'>".$mess['558']."</div>
<form autocomplete='off'>
".implode("\n", $inputs)."
</form>
Expand All @@ -112,7 +116,7 @@ public static function promptForWorkspaceCredentials($parameters, $postSubmitCal
"EVAL" => ""
)
),
"Credentials Needed");
$mess['557']);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Pydio\Auth\Core\MemorySafe;
use Pydio\Core\Model\Context;
use Pydio\Core\Model\UserInterface;
use Pydio\Core\Services\LocaleService;

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

Expand All @@ -43,10 +44,13 @@ class WorkspaceAuthRequired extends PydioException {
* @param boolean $requireLogin
* @param string $message
*/
public function __construct($workspaceId, $requireLogin = false, $message = "Authentication required for this workspace")
public function __construct($workspaceId, $requireLogin = false, $message = "")
{
$this->workspaceId = $workspaceId;
$this->requireLogin = $requireLogin;
if(empty($message)){
$message = LocaleService::getMessages()['559'];
}
parent::__construct($message, false, null);
}

Expand Down
38 changes: 38 additions & 0 deletions core/src/core/src/pydio/Core/Utils/Vars/PathUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,43 @@ public static function unPatchPathForBaseDir($dirPath)
return str_replace("__ZIP_EXTENSION__", ".zip", $dirPath);
}

/**
* Return highest common folder
* @param $items
* @return mixed
*/
public static function commonPath($items)
{
$arr = array();
foreach($items as $i => $path)
{
$items[$i] = explode('/', $path);
unset($items[$i][0]);

$arr[$i] = count($items[$i]);
}

$min = min($arr);

for($i = 0; $i < count($items); $i++)
{
while(count($items[$i]) > $min)
{
array_pop($items[$i]);
}

$items[$i] = '/' . implode('/' , $items[$i]);
}

$items = array_unique($items);
while(count($items) !== 1)
{
$items = array_map('dirname', $items);
$items = array_unique($items);
}
reset($items);

return current($items);
}

}
2 changes: 2 additions & 0 deletions core/src/plugins/access.ajxp_conf/src/RolesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@ public function rolesActions(ServerRequestInterface $requestInterface, ResponseI
|| ($repositoryObject->getUniqueUser() != null && $repositoryObject->getUniqueUser() != $userObject->getId())
)
){
if(isSet($sharedRepos[$repositoryId])) unset($sharedRepos[$repositoryId]);
continue;
}else if(empty($userObject) && (
(empty($currentMainUser) && !$currentMainUser->canAdministrate($repositoryObject)) || $repositoryObject->isTemplate()
)){
if(isSet($sharedRepos[$repositoryId])) unset($sharedRepos[$repositoryId]);
continue;
}
$meta = array();
Expand Down
7 changes: 5 additions & 2 deletions core/src/plugins/access.fs/FsAccessDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,8 @@ public function downloadAction(ServerRequestInterface &$request, ResponseInterfa
} else {
if(isset($httpVars["dir"])){
$dir = InputFilter::decodeSecureMagic($httpVars["dir"], InputFilter::SANITIZE_DIRNAME);
}else{
$dir = $selection->commonDirFromSelection();
}
$base = basename(PathUtils::forwardSlashDirname($selection->getUniqueFile()));
$zip = true;
Expand Down Expand Up @@ -2390,7 +2392,8 @@ public function makeZip (UserSelection $selection, $dest, $basedir, $taskId = nu
$filePaths = [];
$selectedNodes = $selection->buildNodes();
foreach ($selectedNodes as $node) {
$realFile = $node->getRealFile();
//$realFile = $node->getRealFile();
$realFile = MetaStreamWrapper::getRealFSReference($node->getUrl());
if (basename($node->getPath()) == "") {
$filePaths[] = [PCLZIP_ATT_FILE_NAME => $realFile];
} else {
Expand Down Expand Up @@ -2426,7 +2429,7 @@ public function makeZip (UserSelection $selection, $dest, $basedir, $taskId = nu
if($basedir == "__AJXP_ZIP_FLAT__/"){
$vList = $archive->create($filePaths, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_NO_COMPRESSION, PCLZIP_OPT_ADD_TEMP_FILE_ON, PCLZIP_CB_PRE_ADD, $preAddCallback);
}else{
$basedir = MetaStreamWrapper::getRealFSReference($selection->currentBaseUrl()).trim($basedir);
$basedir = rtrim(MetaStreamWrapper::getRealFSReference($selection->currentBaseUrl()), '/').trim($basedir);
$this->logDebug("Basedir", [$basedir]);
$vList = $archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $basedir, PCLZIP_OPT_NO_COMPRESSION, PCLZIP_OPT_ADD_TEMP_FILE_ON, PCLZIP_CB_PRE_ADD, $preAddCallback);
}
Expand Down
17 changes: 17 additions & 0 deletions core/src/plugins/access.imap/ImapAccessDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,35 @@ public function performChecks()
}
}

/**
* @param $st1
* @param $st2
* @return int
*/
public static function inverseSort($st1, $st2)
{
return strnatcasecmp($st2, $st1);
}

/**
* @param $st1
* @param $st2
* @return int
*/
public static function sortInboxFirst($st1, $st2)
{
if($st1 == "INBOX") return -1;
if($st2 == "INBOX") return 1;
return strcmp($st1, $st2);
}

/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @throws PydioException
* @throws \Exception
* @throws \Pydio\Access\Core\Exception\FileNotWriteableException
*/
public function switchAction(ServerRequestInterface &$request, ResponseInterface &$response)
{
if ($request->getAttribute("action") == "ls") {
Expand Down
5 changes: 1 addition & 4 deletions core/src/plugins/access.imap/ImapAccessWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
namespace Pydio\Access\Driver\StreamProvider\Imap;

use EmlParser;
use Pydio\Editor\EML\EmlParser;
use Pydio\Access\Core\IAjxpWrapper;
use Pydio\Access\Core\Model\AJXP_Node;

Expand Down Expand Up @@ -133,7 +133,6 @@ public function stream_open($path, $mode, $options, &$opened_path)
$attachmentId = array_pop($ar);
$this->currentAttachmentData = array("realPath" => $mailPath, "attachmentId" => $attachmentId);
// EXTRACT ATTACHMENT AND RETURN
require_once AJXP_INSTALL_PATH."/plugins/editor.eml/class.EmlParser.php";
$emlParser = new EmlParser("", "");
$attachMeta = array();
$this->data = $emlParser->getAttachmentBody(
Expand Down Expand Up @@ -212,7 +211,6 @@ public function stream_read($count)
if (empty($this->data)) {
Logger::debug(__CLASS__,__FUNCTION__,"Attachement", $this->currentAttachmentData);
// EXTRACT ATTACHMENT AND RETURN
require_once AJXP_INSTALL_PATH."/plugins/editor.eml/class.EmlParser.php";
$emlParser = new EmlParser("", "");
$attachMeta = array();
$this->data = $emlParser->getAttachmentBody(
Expand Down Expand Up @@ -309,7 +307,6 @@ public function dir_opendir($path, $options)
self::$currentCount = count($this->mailboxes);
$this->pos = $this->dir - 1;
} else if ($this->fragment == "attachments") {
require_once AJXP_INSTALL_PATH.'/plugins/editor.eml/class.EmlParser.php';
$parser = new EmlParser("", "");
$ar = explode("#", $path);
$path = array_shift($ar);// remove fragment
Expand Down
28 changes: 20 additions & 8 deletions core/src/plugins/access.smb/SMBAccessDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@
namespace Pydio\Access\Driver\StreamProvider\SMB;

use DOMNode;
use PclZip;
use Pydio\Access\Core\MetaStreamWrapper;
use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Access\Core\Model\UserSelection;
use Pydio\Access\Core\RecycleBinManager;
use Pydio\Access\Core\Model\Repository;
use Pydio\Access\Driver\StreamProvider\FS\FsAccessDriver;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Utils\TextEncoder;
use Pydio\Core\Utils\Vars\InputFilter;
use Pydio\Tasks\Task;
use Pydio\Tasks\TaskService;


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

protected function loadExternalWrapper(){
if(!empty($this->pluginConf['SMBCLIENT']) && !defined('SMB4PHP_SMBCLIENT')){
define ('SMB4PHP_SMBCLIENT', $this->pluginConf["SMBCLIENT"]);
}
if(!empty($this->pluginConf['SMB_PATH_TMP']) && !defined('SMB_PATH_TMP')){
define ('SMB4PHP_SMBTMP', $this->pluginConf["SMB_PATH_TMP"]);
}
require_once($this->getBaseDir()."/smb.php");
}

/**
* @param ContextInterface $contextInterface
* @throws PydioException
Expand All @@ -59,13 +77,7 @@ protected function initRepository(ContextInterface $contextInterface)
} else {
$this->driverConf = array();
}
$smbclientPath = $this->driverConf["SMBCLIENT"];
define ('SMB4PHP_SMBCLIENT', $smbclientPath);

$smbtmpPath = $this->driverConf["SMB_PATH_TMP"];
define ('SMB4PHP_SMBTMP', $smbtmpPath);

require_once($this->getBaseDir()."/smb.php");
$this->loadExternalWrapper();

//$create = $this->repository->getOption("CREATE");
$recycle = $this->repository->getContextOption($contextInterface, "RECYCLE_BIN");
Expand All @@ -92,7 +104,7 @@ protected function initRepository(ContextInterface $contextInterface)
public function detectStreamWrapper($register = false, ContextInterface $ctx = null)
{
if ($register) {
require_once($this->getBaseDir()."/smb.php");
$this->loadExternalWrapper();
}
return parent::detectStreamWrapper($register, $ctx);
}
Expand Down
Loading

0 comments on commit 7e857f4

Please sign in to comment.