mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-05 05:29:13 +01:00
replace egw_sharing with Api\Vfs\Sharing
This commit is contained in:
parent
209686013d
commit
fc2c4dae29
@ -5,11 +5,13 @@
|
|||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @package mail
|
* @package mail
|
||||||
* @author Stylite AG [info@stylite.de]
|
* @author Stylite AG [info@stylite.de]
|
||||||
* @copyright (c) 2013-2014 by Stylite AG <info-AT-stylite.de>
|
* @copyright (c) 2013-2016 by Stylite AG <info-AT-stylite.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api\Vfs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mail interface class for compose mails in popup
|
* Mail interface class for compose mails in popup
|
||||||
*/
|
*/
|
||||||
@ -327,10 +329,10 @@ class mail_compose
|
|||||||
foreach ($_content['selectFromVFSForCompose'] as $i => $path)
|
foreach ($_content['selectFromVFSForCompose'] as $i => $path)
|
||||||
{
|
{
|
||||||
$_content['uploadForCompose'][] = array(
|
$_content['uploadForCompose'][] = array(
|
||||||
'name' => egw_vfs::basename($path),
|
'name' => Vfs::basename($path),
|
||||||
'type' => egw_vfs::mime_content_type($path),
|
'type' => Vfs::mime_content_type($path),
|
||||||
'file' => egw_vfs::PREFIX.$path,
|
'file' => Vfs::PREFIX.$path,
|
||||||
'size' => filesize(egw_vfs::PREFIX.$path),
|
'size' => filesize(Vfs::PREFIX.$path),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
unset($_content['selectFromVFSForCompose']);
|
unset($_content['selectFromVFSForCompose']);
|
||||||
@ -352,9 +354,9 @@ class mail_compose
|
|||||||
unset($_content['uploadForCompose'][$i]);
|
unset($_content['uploadForCompose'][$i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_dir($upload['file']) && (!$_content['filemode'] || $_content['filemode'] == egw_sharing::ATTACH))
|
if (is_dir($upload['file']) && (!$_content['filemode'] || $_content['filemode'] == Vfs\Sharing::ATTACH))
|
||||||
{
|
{
|
||||||
$_content['filemode'] = egw_sharing::READONLY;
|
$_content['filemode'] = Vfs\Sharing::READONLY;
|
||||||
egw_framework::message(lang('Directories have to be shared.'), 'info');
|
egw_framework::message(lang('Directories have to be shared.'), 'info');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -879,8 +881,8 @@ class mail_compose
|
|||||||
if (isset($_REQUEST['preset']['file']))
|
if (isset($_REQUEST['preset']['file']))
|
||||||
{
|
{
|
||||||
$content['filemode'] = !empty($_REQUEST['preset']['filemode']) &&
|
$content['filemode'] = !empty($_REQUEST['preset']['filemode']) &&
|
||||||
isset(egw_sharing::$modes[$_REQUEST['preset']['filemode']]) ?
|
isset(Vfs\Sharing::$modes[$_REQUEST['preset']['filemode']]) ?
|
||||||
$_REQUEST['preset']['filemode'] : egw_sharing::ATTACH;
|
$_REQUEST['preset']['filemode'] : Vfs\Sharing::ATTACH;
|
||||||
|
|
||||||
$names = (array)$_REQUEST['preset']['name'];
|
$names = (array)$_REQUEST['preset']['name'];
|
||||||
$types = (array)$_REQUEST['preset']['type'];
|
$types = (array)$_REQUEST['preset']['type'];
|
||||||
@ -895,14 +897,14 @@ class mail_compose
|
|||||||
//error_log(__METHOD__.__LINE__.$path.'->'.array2string(parse_url($path,PHP_URL_SCHEME == 'vfs')));
|
//error_log(__METHOD__.__LINE__.$path.'->'.array2string(parse_url($path,PHP_URL_SCHEME == 'vfs')));
|
||||||
if (parse_url($path,PHP_URL_SCHEME == 'vfs'))
|
if (parse_url($path,PHP_URL_SCHEME == 'vfs'))
|
||||||
{
|
{
|
||||||
//egw_vfs::load_wrapper('vfs');
|
//Vfs::load_wrapper('vfs');
|
||||||
$type = egw_vfs::mime_content_type($path);
|
$type = Vfs::mime_content_type($path);
|
||||||
// special handling for attaching vCard of iCal --> use their link-title as name
|
// special handling for attaching vCard of iCal --> use their link-title as name
|
||||||
if (substr($path,-7) != '/.entry' ||
|
if (substr($path,-7) != '/.entry' ||
|
||||||
!(list($app,$id) = array_slice(explode('/',$path),-3)) ||
|
!(list($app,$id) = array_slice(explode('/',$path),-3)) ||
|
||||||
!($name = egw_link::title($app, $id)))
|
!($name = egw_link::title($app, $id)))
|
||||||
{
|
{
|
||||||
$name = egw_vfs::decodePath(egw_vfs::basename($path));
|
$name = Vfs::decodePath(Vfs::basename($path));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -912,12 +914,12 @@ class mail_compose
|
|||||||
$formData = array(
|
$formData = array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'file' => egw_vfs::decodePath($path),
|
'file' => Vfs::decodePath($path),
|
||||||
'size' => filesize(egw_vfs::decodePath($path)),
|
'size' => filesize(Vfs::decodePath($path)),
|
||||||
);
|
);
|
||||||
if ($formData['type'] == egw_vfs::DIR_MIME_TYPE && $content['filemode'] == egw_sharing::ATTACH)
|
if ($formData['type'] == Vfs::DIR_MIME_TYPE && $content['filemode'] == Vfs\Sharing::ATTACH)
|
||||||
{
|
{
|
||||||
$content['filemode'] = egw_sharing::READONLY;
|
$content['filemode'] = Vfs\Sharing::READONLY;
|
||||||
egw_framework::message(lang('Directories have to be shared.'), 'info');
|
egw_framework::message(lang('Directories have to be shared.'), 'info');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1241,7 +1243,7 @@ class mail_compose
|
|||||||
if (isset($content['mimeType'])) $preserv['mimeType'] = $content['mimeType'];
|
if (isset($content['mimeType'])) $preserv['mimeType'] = $content['mimeType'];
|
||||||
$sel_options['mimeType'] = self::$mimeTypes;
|
$sel_options['mimeType'] = self::$mimeTypes;
|
||||||
$sel_options['priority'] = self::$priorities;
|
$sel_options['priority'] = self::$priorities;
|
||||||
$sel_options['filemode'] = egw_sharing::$modes;
|
$sel_options['filemode'] = Vfs\Sharing::$modes;
|
||||||
if (!isset($content['priority']) || empty($content['priority'])) $content['priority']=3;
|
if (!isset($content['priority']) || empty($content['priority'])) $content['priority']=3;
|
||||||
//$GLOBALS['egw_info']['flags']['currentapp'] = 'mail';//should not be needed
|
//$GLOBALS['egw_info']['flags']['currentapp'] = 'mail';//should not be needed
|
||||||
$etpl = new etemplate_new('mail.compose');
|
$etpl = new etemplate_new('mail.compose');
|
||||||
@ -1416,7 +1418,7 @@ class mail_compose
|
|||||||
if(count($merge_ids) <= 1)
|
if(count($merge_ids) <= 1)
|
||||||
{
|
{
|
||||||
$results = $this->mail_bo->importMessageToMergeAndSend(
|
$results = $this->mail_bo->importMessageToMergeAndSend(
|
||||||
$document_merge, egw_vfs::PREFIX . $_REQUEST['document'], $merge_ids, $folder, $merged_mail_id
|
$document_merge, Vfs::PREFIX . $_REQUEST['document'], $merge_ids, $folder, $merged_mail_id
|
||||||
);
|
);
|
||||||
|
|
||||||
// Open compose
|
// Open compose
|
||||||
@ -1838,7 +1840,7 @@ class mail_compose
|
|||||||
//error_log(__METHOD__.__LINE__.array2string($_GET));
|
//error_log(__METHOD__.__LINE__.array2string($_GET));
|
||||||
if (parse_url($attachment['tmp_name'],PHP_URL_SCHEME) == 'vfs')
|
if (parse_url($attachment['tmp_name'],PHP_URL_SCHEME) == 'vfs')
|
||||||
{
|
{
|
||||||
egw_vfs::load_wrapper('vfs');
|
Vfs::load_wrapper('vfs');
|
||||||
}
|
}
|
||||||
// attachment data in temp_dir, only use basename of given name, to not allow path traversal
|
// attachment data in temp_dir, only use basename of given name, to not allow path traversal
|
||||||
else
|
else
|
||||||
@ -2304,7 +2306,7 @@ class mail_compose
|
|||||||
$signature = mail_bo::merge($signature,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
$signature = mail_bo::merge($signature,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if ($_formData['attachments'] && $_formData['filemode'] != egw_sharing::ATTACH && !$_autosaving)
|
if ($_formData['attachments'] && $_formData['filemode'] != Vfs\Sharing::ATTACH && !$_autosaving)
|
||||||
{
|
{
|
||||||
$attachment_links = $this->getAttachmentLinks($_formData['attachments'], $_formData['filemode'],
|
$attachment_links = $this->getAttachmentLinks($_formData['attachments'], $_formData['filemode'],
|
||||||
$_formData['mimeType'] == 'html',
|
$_formData['mimeType'] == 'html',
|
||||||
@ -2422,11 +2424,11 @@ class mail_compose
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// attach files not for autosaving
|
// attach files not for autosaving
|
||||||
elseif ($_formData['filemode'] == egw_sharing::ATTACH && !$_autosaving)
|
elseif ($_formData['filemode'] == Vfs\Sharing::ATTACH && !$_autosaving)
|
||||||
{
|
{
|
||||||
if (isset($attachment['file']) && parse_url($attachment['file'],PHP_URL_SCHEME) == 'vfs')
|
if (isset($attachment['file']) && parse_url($attachment['file'],PHP_URL_SCHEME) == 'vfs')
|
||||||
{
|
{
|
||||||
egw_vfs::load_wrapper('vfs');
|
Vfs::load_wrapper('vfs');
|
||||||
$tmp_path = $attachment['file'];
|
$tmp_path = $attachment['file'];
|
||||||
}
|
}
|
||||||
else // non-vfs file has to be in temp_dir
|
else // non-vfs file has to be in temp_dir
|
||||||
@ -2451,7 +2453,7 @@ class mail_compose
|
|||||||
* We only care about file attachments, not forwarded messages or parts
|
* We only care about file attachments, not forwarded messages or parts
|
||||||
*
|
*
|
||||||
* @param array $attachments
|
* @param array $attachments
|
||||||
* @param string $filemode egw_sharing::(ATTACH|LINK|READONL|WRITABLE)
|
* @param string $filemode Vfs\Sharing::(ATTACH|LINK|READONL|WRITABLE)
|
||||||
* @param boolean $html
|
* @param boolean $html
|
||||||
* @param array $recipients =array()
|
* @param array $recipients =array()
|
||||||
* @param string $expiration =null
|
* @param string $expiration =null
|
||||||
@ -2460,7 +2462,7 @@ class mail_compose
|
|||||||
*/
|
*/
|
||||||
protected function getAttachmentLinks(array $attachments, $filemode, $html, $recipients=array(), $expiration=null, $password=null)
|
protected function getAttachmentLinks(array $attachments, $filemode, $html, $recipients=array(), $expiration=null, $password=null)
|
||||||
{
|
{
|
||||||
if ($filemode == egw_sharing::ATTACH) return '';
|
if ($filemode == Vfs\Sharing::ATTACH) return '';
|
||||||
|
|
||||||
$links = array();
|
$links = array();
|
||||||
foreach($attachments as $attachment)
|
foreach($attachments as $attachment)
|
||||||
@ -2472,26 +2474,26 @@ class mail_compose
|
|||||||
$path = $GLOBALS['egw_info']['server']['temp_dir'].SEP.basename($path);
|
$path = $GLOBALS['egw_info']['server']['temp_dir'].SEP.basename($path);
|
||||||
}
|
}
|
||||||
// create share
|
// create share
|
||||||
if ($filemode == egw_sharing::WRITABLE || $expiration || $password)
|
if ($filemode == Vfs\Sharing::WRITABLE || $expiration || $password)
|
||||||
{
|
{
|
||||||
$share = stylite_sharing::create($path, $filemode, $attachment['name'], $recipients, $expiration, $password);
|
$share = stylite_sharing::create($path, $filemode, $attachment['name'], $recipients, $expiration, $password);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$share = egw_sharing::create($path, $filemode, $attachment['name'], $recipients);
|
$share = Vfs\Sharing::create($path, $filemode, $attachment['name'], $recipients);
|
||||||
}
|
}
|
||||||
$link = egw_sharing::share2link($share);
|
$link = Vfs\Sharing::share2link($share);
|
||||||
|
|
||||||
$name = egw_vfs::basename($attachment['name'] ? $attachment['name'] : $attachment['file']);
|
$name = Vfs::basename($attachment['name'] ? $attachment['name'] : $attachment['file']);
|
||||||
|
|
||||||
if ($html)
|
if ($html)
|
||||||
{
|
{
|
||||||
$links[] = html::a_href($name, $link).' '.
|
$links[] = html::a_href($name, $link).' '.
|
||||||
(is_dir($path) ? lang('Directory') : egw_vfs::hsize($attachment['size']));
|
(is_dir($path) ? lang('Directory') : Vfs::hsize($attachment['size']));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$links[] = $name.' '.egw_vfs::hsize($attachment['size']).': '.
|
$links[] = $name.' '.Vfs::hsize($attachment['size']).': '.
|
||||||
(is_dir($path) ? lang('Directory') : $link);
|
(is_dir($path) ? lang('Directory') : $link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3475,7 +3477,7 @@ class mail_compose
|
|||||||
// Actually do the merge
|
// Actually do the merge
|
||||||
$folder = $merged_mail_id = null;
|
$folder = $merged_mail_id = null;
|
||||||
$results = $this->mail_bo->importMessageToMergeAndSend(
|
$results = $this->mail_bo->importMessageToMergeAndSend(
|
||||||
$document_merge, egw_vfs::PREFIX . $_REQUEST['document'],
|
$document_merge, Vfs::PREFIX . $_REQUEST['document'],
|
||||||
// Send an extra non-numeric ID to force actual send of document
|
// Send an extra non-numeric ID to force actual send of document
|
||||||
// instead of save as draft
|
// instead of save as draft
|
||||||
array((int)$contact_id, ''),
|
array((int)$contact_id, ''),
|
||||||
|
@ -24,11 +24,10 @@ $GLOBALS['egw_info'] = array(
|
|||||||
'disable_Template_class' => True,
|
'disable_Template_class' => True,
|
||||||
'noheader' => True,
|
'noheader' => True,
|
||||||
'currentapp' => 'mail',
|
'currentapp' => 'mail',
|
||||||
'autocreate_session_callback' => 'egw_digest_auth::autocreate_session_callback',
|
'autocreate_session_callback' => 'EGroupware\\Api\\Header\\Authenticate::autocreate_session_callback',
|
||||||
'auth_realm' => 'EGroupware mail profile',
|
'auth_realm' => 'EGroupware mail profile',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
//require_once('../phpgwapi/inc/class.egw_digest_auth.inc.php');
|
|
||||||
include(dirname(__DIR__).'/header.inc.php');
|
include(dirname(__DIR__).'/header.inc.php');
|
||||||
|
|
||||||
$headertime = microtime(true);
|
$headertime = microtime(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user