forked from extern/egroupware
make optional $_scriptName last parameter and other cleanups
This commit is contained in:
parent
6b0b8b35fb
commit
b0800a1697
@ -9,12 +9,10 @@
|
|||||||
* @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$
|
||||||
*/
|
*/
|
||||||
include_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate.inc.php');
|
|
||||||
|
|
||||||
class mail_sieve
|
class mail_sieve
|
||||||
{
|
{
|
||||||
var $public_functions = array
|
var $public_functions = array(
|
||||||
(
|
|
||||||
'editVacation' => True,
|
'editVacation' => True,
|
||||||
'index' => True,
|
'index' => True,
|
||||||
'edit' => True,
|
'edit' => True,
|
||||||
@ -23,34 +21,6 @@ class mail_sieve
|
|||||||
|
|
||||||
var $errorStack;
|
var $errorStack;
|
||||||
|
|
||||||
/**
|
|
||||||
* etemplate object for sieve index
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
var $tmpl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* etemplate object for sieve edit popup
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
var $etmpl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* etemplate object for Vacation
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
var $vtmpl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* etemplate object for email notification
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
var $eNotitmpl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current Identitiy
|
* Current Identitiy
|
||||||
*
|
*
|
||||||
@ -81,14 +51,11 @@ class mail_sieve
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->displayCharset = translation::charset();
|
$this->displayCharset = translation::charset();
|
||||||
$profileID = 0;
|
$profileID = (int)$_GET['acc_id'];
|
||||||
$this->mail_admin = isset($GLOBALS['egw_info']['user']['apps']['emailadmin']);
|
$this->mail_admin = isset($GLOBALS['egw_info']['user']['apps']['emailadmin']);
|
||||||
|
|
||||||
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
|
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
|
||||||
@ -110,7 +77,6 @@ class mail_sieve
|
|||||||
*/
|
*/
|
||||||
function index(array $content=null,$msg=null)
|
function index(array $content=null,$msg=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Instantiate an etemplate_new object
|
//Instantiate an etemplate_new object
|
||||||
$tmpl = new etemplate_new('mail.sieve.index');
|
$tmpl = new etemplate_new('mail.sieve.index');
|
||||||
|
|
||||||
@ -191,7 +157,7 @@ class mail_sieve
|
|||||||
}
|
}
|
||||||
if (isset($content['externalEmail']) && !empty($content['externalEmail']))
|
if (isset($content['externalEmail']) && !empty($content['externalEmail']))
|
||||||
{
|
{
|
||||||
if (!$this->account->imapServer()->setEmailNotification(null, $newEmailNotification))
|
if (!$this->account->imapServer()->setEmailNotification($newEmailNotification))
|
||||||
{
|
{
|
||||||
$msg = lang("email notification update failed")."<br />";
|
$msg = lang("email notification update failed")."<br />";
|
||||||
break;
|
break;
|
||||||
@ -242,7 +208,6 @@ class mail_sieve
|
|||||||
/**
|
/**
|
||||||
* Sieve rules edit
|
* Sieve rules edit
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param {array} $content
|
* @param {array} $content
|
||||||
*/
|
*/
|
||||||
function edit ($content=null)
|
function edit ($content=null)
|
||||||
@ -334,7 +299,7 @@ class mail_sieve
|
|||||||
if($newRule['action'] && $this->rulesByID['priority'])
|
if($newRule['action'] && $this->rulesByID['priority'])
|
||||||
{
|
{
|
||||||
$this->rules[$ruleID] = $newRule;
|
$this->rules[$ruleID] = $newRule;
|
||||||
$ret = $this->account->imapServer()->setRules(null, $this->rules);
|
$ret = $this->account->imapServer()->setRules($this->rules);
|
||||||
if (!$ret && !empty($this->account->imapServer()->error))
|
if (!$ret && !empty($this->account->imapServer()->error))
|
||||||
{
|
{
|
||||||
$msg .= lang("Saving the rule failed:")."<br />".$this->account->imapServer()->error."<br />";
|
$msg .= lang("Saving the rule failed:")."<br />".$this->account->imapServer()->error."<br />";
|
||||||
@ -374,7 +339,6 @@ class mail_sieve
|
|||||||
egw_framework::window_close();
|
egw_framework::window_close();
|
||||||
common::egw_exit();
|
common::egw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$sel_options = array(//array_merge($sel_options,array(
|
$sel_options = array(//array_merge($sel_options,array(
|
||||||
'anyof' => array(
|
'anyof' => array(
|
||||||
@ -397,7 +361,6 @@ class mail_sieve
|
|||||||
$mailCompose = new mail_compose();
|
$mailCompose = new mail_compose();
|
||||||
$sel_options['action_folder_text'] = $mailCompose->ajax_searchFolder(0,true);
|
$sel_options['action_folder_text'] = $mailCompose->ajax_searchFolder(0,true);
|
||||||
|
|
||||||
|
|
||||||
return $etmpl->exec('mail.mail_sieve.edit',$content,$sel_options,$readonlys,array(),2);
|
return $etmpl->exec('mail.mail_sieve.edit',$content,$sel_options,$readonlys,array(),2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,6 +481,11 @@ class mail_sieve
|
|||||||
$this->is_admin_vac = true;
|
$this->is_admin_vac = true;
|
||||||
$preserv['account_id'] = $account_id;
|
$preserv['account_id'] = $account_id;
|
||||||
}
|
}
|
||||||
|
elseif(!is_array($content) && isset($_GET['acc_id']))
|
||||||
|
{
|
||||||
|
$this->account = emailadmin_account::read($_GET['acc_id']);
|
||||||
|
$preserv['acc_id'] = $this->account->acc_id;
|
||||||
|
}
|
||||||
|
|
||||||
$icServer = $this->account->imapServer($this->is_admin_vac ? $account_id : false);
|
$icServer = $this->account->imapServer($this->is_admin_vac ? $account_id : false);
|
||||||
|
|
||||||
@ -607,11 +575,11 @@ class mail_sieve
|
|||||||
{
|
{
|
||||||
if (isset($account_id) && $this->mail_admin)
|
if (isset($account_id) && $this->mail_admin)
|
||||||
{
|
{
|
||||||
$resSetvac = $icServer->setVacationUser($account_id,$this->scriptName, $newVacation);
|
$resSetvac = $icServer->setVacationUser($account_id, $this->scriptName, $newVacation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$resSetvac = $icServer->setVacation($this->scriptName, $newVacation);
|
$resSetvac = $icServer->setVacation($newVacation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$resSetvac)
|
if (!$resSetvac)
|
||||||
@ -620,9 +588,12 @@ class mail_sieve
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// schedule job to switch message on/off, if request and not already in past
|
// schedule job to switch message on/off, if request and not already in past
|
||||||
elseif ($newVacation['status'] == 'by_date' && $newVacation['end_date']+24*3600<time())
|
else
|
||||||
|
{
|
||||||
|
if ($newVacation['status'] == 'by_date' && $newVacation['end_date']+24*3600 > time())
|
||||||
{
|
{
|
||||||
self::setAsyncJob($newVacation);
|
self::setAsyncJob($newVacation);
|
||||||
|
}
|
||||||
$msg = lang('Vacation notice sucessfully updated.');
|
$msg = lang('Vacation notice sucessfully updated.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -836,14 +807,12 @@ class mail_sieve
|
|||||||
//Calling to referesh after move action
|
//Calling to referesh after move action
|
||||||
$response = egw_json_response::get();
|
$response = egw_json_response::get();
|
||||||
$response->call('app.mail.sieve_refresh');
|
$response->call('app.mail.sieve_refresh');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajax function to handle the server side content for refreshing the form
|
* Ajax function to handle the server side content for refreshing the form
|
||||||
*
|
*
|
||||||
* @param type $execId
|
* @param type $execId
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function ajax_sieve_egw_refresh($execId)
|
function ajax_sieve_egw_refresh($execId)
|
||||||
{
|
{
|
||||||
@ -878,7 +847,8 @@ class mail_sieve
|
|||||||
if ($checked === count($this->rules)-1)
|
if ($checked === count($this->rules)-1)
|
||||||
{
|
{
|
||||||
$msg = lang('rule with priority ') . $checked . lang(' deleted!');
|
$msg = lang('rule with priority ') . $checked . lang(' deleted!');
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$msg = lang('rule with priority ') . $checked . lang(' deleted!') . lang(' And the rule with priority %1, now got the priority %2',$checked+1,$checked);
|
$msg = lang('rule with priority ') . $checked . lang(' deleted!') . lang(' And the rule with priority %1, now got the priority %2',$checked+1,$checked);
|
||||||
@ -1101,8 +1071,6 @@ class mail_sieve
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Save session data
|
* Save session data
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function saveSessionData()
|
function saveSessionData()
|
||||||
{
|
{
|
||||||
@ -1114,19 +1082,16 @@ class mail_sieve
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the sieve script on mail server
|
* Update the sieve script on mail server
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function updateScript()
|
function updateScript()
|
||||||
{
|
{
|
||||||
if (!$this->account->imapServer()->setRules($this->scriptToEdit, $this->rules))
|
if (!$this->account->imapServer()->setRules($this->rules))
|
||||||
{
|
{
|
||||||
return "update failed";
|
return "update failed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getRules()
|
|
||||||
* Fetched rules save on array()rules.
|
* Fetched rules save on array()rules.
|
||||||
*
|
*
|
||||||
* @param {string} $ruleID Numeric Id of the rule if specify return the specitic rule| otherwise ruleByID would be null
|
* @param {string} $ruleID Numeric Id of the rule if specify return the specitic rule| otherwise ruleByID would be null
|
||||||
@ -1151,10 +1116,8 @@ class mail_sieve
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore session data
|
* Restore session data
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function restoreSessionData()
|
function restoreSessionData()
|
||||||
{
|
{
|
||||||
@ -1188,7 +1151,8 @@ class mail_sieve
|
|||||||
$row['class'] = 'mail_sieve_DISABLED';
|
$row['class'] = 'mail_sieve_DISABLED';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
//error_log(__METHOD__.'There are no rules or something is went wrong at getRules()!');
|
//error_log(__METHOD__.'There are no rules or something is went wrong at getRules()!');
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user