Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
0e4d522d
Commit
0e4d522d
authored
11 years ago
by
Vincent Petry
Browse files
Options
Downloads
Plain Diff
Merge pull request #7659 from owncloud/fix-7596
Fix 7596
parents
b0ec38e2
0de43f1f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/ajax/share.php
+9
-2
9 additions, 2 deletions
core/ajax/share.php
lib/private/mail.php
+1
-4
1 addition, 4 deletions
lib/private/mail.php
lib/private/share/mailnotifications.php
+13
-10
13 additions, 10 deletions
lib/private/share/mailnotifications.php
with
23 additions
and
16 deletions
core/ajax/share.php
+
9
−
2
View file @
0e4d522d
...
...
@@ -145,10 +145,17 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
}
$result
=
$mailNotification
->
sendLinkShareMail
(
$to_address
,
$file
,
$link
,
$expiration
);
if
(
$result
===
true
)
{
if
(
empty
(
$result
)
)
{
\OCP\JSON
::
success
();
}
else
{
\OCP\JSON
::
error
(
array
(
'data'
=>
array
(
'message'
=>
OC_Util
::
sanitizeHTML
(
$result
))));
$l
=
OC_L10N
::
get
(
'core'
);
OCP\JSON
::
error
(
array
(
'data'
=>
array
(
'message'
=>
$l
->
t
(
"Couldn't send mail to following users: %s "
,
implode
(
', '
,
$result
)
)
)
));
}
break
;
...
...
This diff is collapsed.
Click to expand it.
lib/private/mail.php
+
1
−
4
View file @
0e4d522d
...
...
@@ -72,11 +72,8 @@ class OC_Mail {
$mailo
->
From
=
$fromaddress
;
$mailo
->
FromName
=
$fromname
;;
$mailo
->
Sender
=
$fromaddress
;
$a
=
explode
(
' '
,
$toaddress
);
try
{
foreach
(
$a
as
$ad
)
{
$mailo
->
AddAddress
(
$ad
,
$toname
);
}
$mailo
->
AddAddress
(
$toaddress
,
$toname
);
if
(
$ccaddress
<>
''
)
$mailo
->
AddCC
(
$ccaddress
,
$ccname
);
if
(
$bcc
<>
''
)
$mailo
->
AddBCC
(
$bcc
);
...
...
This diff is collapsed.
Click to expand it.
lib/private/share/mailnotifications.php
+
13
−
10
View file @
0e4d522d
...
...
@@ -97,7 +97,7 @@ class MailNotifications {
try
{
\OCP\Util
::
sendMail
(
$to
,
$recipientDisplayName
,
$subject
,
$htmlMail
,
$this
->
from
,
$this
->
senderDisplayName
,
1
,
$alttextMail
);
}
catch
(
\Exception
$e
)
{
\OCP\Util
::
writeLog
(
'sharing'
,
"Can't send mail to inform the user ab
a
ut an internal share: "
.
$e
->
getMessage
()
,
\OCP\Util
::
ERROR
);
\OCP\Util
::
writeLog
(
'sharing'
,
"Can't send mail to inform the user ab
o
ut an internal share: "
.
$e
->
getMessage
()
,
\OCP\Util
::
ERROR
);
$noMail
[]
=
$recipientDisplayName
;
}
}
...
...
@@ -109,23 +109,26 @@ class MailNotifications {
/**
* @brief inform recipient about public link share
*
* @param string recipient recipient email address
* @param string
$
recipient recipient email address
* @param string $filename the shared file
* @param string $link the public link
* @param int $expiration expiration date (timestamp)
* @return
mixed
$result
true or error message
* @return
array
$result
of failed recipients
*/
public
function
sendLinkShareMail
(
$recipient
,
$filename
,
$link
,
$expiration
)
{
$subject
=
(
string
)
$this
->
l
->
t
(
'%s shared »%s« with you'
,
array
(
$this
->
senderDisplayName
,
$filename
));
list
(
$htmlMail
,
$alttextMail
)
=
$this
->
createMailBody
(
$filename
,
$link
,
$expiration
);
try
{
\OCP\Util
::
sendMail
(
$recipient
,
$recipient
,
$subject
,
$htmlMail
,
$this
->
from
,
$this
->
senderDisplayName
,
1
,
$alttextMail
);
}
catch
(
\Exception
$e
)
{
\OCP\Util
::
writeLog
(
'sharing'
,
"Can't send mail with public link: "
.
$e
->
getMessage
(),
\OCP\Util
::
ERROR
);
return
$e
->
getMessage
();
$rs
=
explode
(
' '
,
$recipient
);
$failed
=
array
();
foreach
(
$rs
as
$r
)
{
try
{
\OCP\Util
::
sendMail
(
$r
,
$r
,
$subject
,
$htmlMail
,
$this
->
from
,
$this
->
senderDisplayName
,
1
,
$alttextMail
);
}
catch
(
\Exception
$e
)
{
\OCP\Util
::
writeLog
(
'sharing'
,
"Can't send mail with public link to
$r
: "
.
$e
->
getMessage
(),
\OCP\Util
::
ERROR
);
$failed
[]
=
$r
;
}
}
return
true
;
return
$failed
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment