[Openupload-svn-update] SF.net SVN: openupload:[326] trunk/plugins/email.inc.php
Status: Beta
Brought to you by:
tsdogs
|
From: <ts...@us...> - 2009-06-16 16:43:19
|
Revision: 326
http://openupload.svn.sourceforge.net/openupload/?rev=326&view=rev
Author: tsdogs
Date: 2009-06-16 16:43:16 +0000 (Tue, 16 Jun 2009)
Log Message:
-----------
add possibility for multiple recipients of e-mail
Modified Paths:
--------------
trunk/plugins/email.inc.php
Modified: trunk/plugins/email.inc.php
===================================================================
--- trunk/plugins/email.inc.php 2009-06-16 16:39:05 UTC (rev 325)
+++ trunk/plugins/email.inc.php 2009-06-16 16:43:16 UTC (rev 326)
@@ -4,6 +4,10 @@
function emailPlugin() {
$this->description = tr('Add option to send e-mail to the uploader or to another e-mail address');
+ $this->options = array(
+ array('name' => 'multirecipients', 'description' => tr('allow multiple recipients (1 = enable)'), 'type' => 'text'),
+ );
+
}
function uploadOptions(&$finfo,$acl) {
@@ -17,6 +21,7 @@
if ($acl!='enable') return true;
/* do e-mail checking and so */
/* $this->display('upload'); */
+ $group = $this->getGroup('maxrecipients');
$finfo[0]['emailme']=$_POST['emailme'];
$finfo[0]['emailfrom']=app()->config['site']['email'];
$finfo[0]['emailto']=$_POST['emailto'];
@@ -35,11 +40,21 @@
$finfo[0]['emailfrom']=$_SESSION['user']['email'];
}
}
+ if (!isset($this->config['multirecipients'][$group]) and isset($this->config['multirecipients']['*'])) {
+ $this->config['multirecipients'][$group]=$this->config['multirecipients']['*'];
+ }
if ($finfo[0]['emailto']!='') {
- if (!validEmail($_POST['emailto'])) {
- app()->error(tr('Destination e-mail address isn\'t valid!'));
- return false;
+ if ($this->config['multirecipients'][$group]=='1') {
+ $emailto = split(';',$_POST['emailto']);
+ } else {
+ $emailto[0] = $_POST['emailto'];
}
+ foreach ($emailto as $destination) {
+ if (!validEmail($destination)) {
+ app()->error(tr('Destination e-mail address "%1" isn\'t valid!',$destination));
+ return false;
+ }
+ }
}
return true;
@@ -97,4 +112,4 @@
return true;
}
}
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|