mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Format and switch to egw_info, et al.
This commit is contained in:
parent
0f40bc6b02
commit
9438655ca5
@ -40,7 +40,7 @@
|
||||
{
|
||||
if(!$website)
|
||||
{
|
||||
$this->template = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
|
||||
$this->template = createobject('phpgwapi.Template',EGW_TEMPLATE_DIR);
|
||||
$this->template->set_file(array(
|
||||
'_nextmatchs' => 'nextmatchs.tpl'
|
||||
));
|
||||
@ -55,10 +55,10 @@
|
||||
$this->template->set_block('_nextmatchs','cats_search_filter');
|
||||
}
|
||||
|
||||
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
|
||||
(int)$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
|
||||
if(isset($GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']) &&
|
||||
(int)$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] > 0)
|
||||
{
|
||||
$this->maxmatches = (int)$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$this->maxmatches = (int)$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
$this->_start = (int) get_var('start',array('GLOBAL','POST','GET'));
|
||||
|
||||
|
||||
foreach(array('menuaction','filter','qfield','order','sort') as $name)
|
||||
{
|
||||
$var = '_'.$name;
|
||||
@ -76,9 +76,9 @@
|
||||
$this->$var = '';
|
||||
}
|
||||
}
|
||||
if (!is_object($GLOBALS['phpgw']->html))
|
||||
if (!is_object($GLOBALS['egw']->html))
|
||||
{
|
||||
$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
|
||||
$GLOBALS['egw']->html = CreateObject('phpgwapi.html');
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@
|
||||
{
|
||||
$var = array(
|
||||
'align' => $align,
|
||||
'img' => $GLOBALS['phpgw']->common->image('phpgwapi',$img),
|
||||
'img' => $GLOBALS['egw']->common->image('phpgwapi',$img),
|
||||
'label' => lang($label),
|
||||
'border' => 0
|
||||
);
|
||||
@ -123,7 +123,7 @@
|
||||
$extras = implode($t_extras,'&');
|
||||
}
|
||||
|
||||
return $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->_menuaction.$extras);
|
||||
return $GLOBALS['egw']->link('/index.php','menuaction='.$this->_menuaction.$extras);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -138,10 +138,10 @@
|
||||
{
|
||||
$var = Array(
|
||||
'align' => $align,
|
||||
'action' => ($this->_menuaction?$this->page():$GLOBALS['phpgw']->link($link)),
|
||||
'action' => ($this->_menuaction?$this->page():$GLOBALS['egw']->link($link)),
|
||||
'form_name' => $img,
|
||||
'hidden' => $GLOBALS['phpgw']->html->input_hidden($extravars),
|
||||
'img' => $GLOBALS['phpgw']->common->image('phpgwapi',$img),
|
||||
'hidden' => $GLOBALS['egw']->html->input_hidden($extravars),
|
||||
'img' => $GLOBALS['egw']->common->image('phpgwapi',$img),
|
||||
'label' => $alt,
|
||||
'border' => 0,
|
||||
'start' => $extravars['start']
|
||||
@ -165,20 +165,20 @@
|
||||
*/
|
||||
function show_tpl($sn,$localstart,$total,$extra, $twidth, $bgtheme,$search_obj=0,$filter_obj=1,$showsearch=1,$yours=0,$cat_id=0,$cat_field='fcat_id')
|
||||
{
|
||||
if (!is_object($GLOBALS['phpgw']->categories))
|
||||
if (!is_object($GLOBALS['egw']->categories))
|
||||
{
|
||||
$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
|
||||
$GLOBALS['egw']->categories = CreateObject('phpgwapi.categories');
|
||||
}
|
||||
$extravars = $this->split_extras($extravars,$extra);
|
||||
|
||||
$var = array(
|
||||
'form_action' => ($this->_menuaction?$this->page($extra):$GLOBALS['phpgw']->link($sn, $extra)),
|
||||
'form_action' => ($this->_menuaction?$this->page($extra):$GLOBALS['egw']->link($sn, $extra)),
|
||||
'lang_category' => lang('Category'),
|
||||
'lang_all' => lang('All'),
|
||||
'lang_select' => lang('Select'),
|
||||
'cat_field' => $cat_field,
|
||||
'categories' => $GLOBALS['phpgw']->categories->formated_list('select','all',$cat_id,'True'),
|
||||
'hidden' => $GLOBALS['phpgw']->html->input_hidden(array(
|
||||
'categories' => $GLOBALS['egw']->categories->formated_list('select','all',$cat_id,'True'),
|
||||
'hidden' => $GLOBALS['egw']->html->input_hidden(array(
|
||||
'filter' => $this->_filter,
|
||||
'qfield' => $this->_qfield,
|
||||
'start' => (int)$localstart,
|
||||
@ -186,9 +186,9 @@
|
||||
'sort' => $this->_sort,
|
||||
'query' => $GLOBALS['query'],
|
||||
)),
|
||||
'query_value' => $GLOBALS['phpgw']->html->htmlspecialchars($GLOBALS['query']),
|
||||
'query_value' => $GLOBALS['egw']->html->htmlspecialchars($GLOBALS['query']),
|
||||
'table_width' => $twidth,
|
||||
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
||||
'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
|
||||
'left' => $this->left($sn,(int)$localstart,$total,$extra),
|
||||
'search' => ($showsearch?$this->search($search_obj):''),
|
||||
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):''),
|
||||
@ -302,7 +302,7 @@
|
||||
|
||||
$extravars = $this->split_extras($extravars,$extradata);
|
||||
$ret_str = '';
|
||||
|
||||
|
||||
$start = (int) $start;
|
||||
|
||||
if (($total > $this->maxmatches) &&
|
||||
@ -329,9 +329,9 @@
|
||||
function search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
|
||||
{
|
||||
$var = array(
|
||||
'form_action' => ($this->_menuaction?$this->page($extra):$GLOBALS['phpgw']->link($sn, $extra)),
|
||||
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
||||
'hidden' => $GLOBALS['phpgw']->html->input_hidden(array(
|
||||
'form_action' => ($this->_menuaction?$this->page($extra):$GLOBALS['egw']->link($sn, $extra)),
|
||||
'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
|
||||
'hidden' => $GLOBALS['egw']->html->input_hidden(array(
|
||||
'filter' => $this->_filter,
|
||||
'qfield' => $this->_qfield,
|
||||
'start' => 0,
|
||||
@ -353,18 +353,18 @@
|
||||
*/
|
||||
function cats_search_filter($search_obj=0,$filter_obj=1,$yours=0,$cat_id=0,$cat_field='fcat_id',$link='',$extra='')
|
||||
{
|
||||
if (!is_object($GLOBALS['phpgw']->categories))
|
||||
if (!is_object($GLOBALS['egw']->categories))
|
||||
{
|
||||
$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
|
||||
$GLOBALS['egw']->categories = CreateObject('phpgwapi.categories');
|
||||
}
|
||||
$var = array(
|
||||
'form_action' => ($this->_menuaction?$this->page($extra):$GLOBALS['phpgw']->link($sn, $extra)),
|
||||
'form_action' => ($this->_menuaction?$this->page($extra):$GLOBALS['egw']->link($sn, $extra)),
|
||||
'lang_category' => lang('Category'),
|
||||
'lang_all' => lang('All'),
|
||||
'lang_select' => lang('Select'),
|
||||
'cat_field' => $cat_field,
|
||||
'categories' => $GLOBALS['phpgw']->categories->formated_list('select','all',(int)$cat_id,'True'),
|
||||
'hidden' => $GLOBALS['phpgw']->html->input_hidden(array(
|
||||
'categories' => $GLOBALS['egw']->categories->formated_list('select','all',(int)$cat_id,'True'),
|
||||
'hidden' => $GLOBALS['egw']->html->input_hidden(array(
|
||||
'filter' => $this->_filter,
|
||||
'qfield' => $this->_qfield,
|
||||
'start' => 0,
|
||||
@ -372,7 +372,7 @@
|
||||
'sort' => $this->_sort,
|
||||
'query' => $GLOBALS['query'],
|
||||
)),
|
||||
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
||||
'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
|
||||
'search' => $this->search($search_obj),
|
||||
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
|
||||
);
|
||||
@ -406,7 +406,7 @@
|
||||
}
|
||||
$var = array
|
||||
(
|
||||
'query_value' => $GLOBALS['phpgw']->html->htmlspecialchars($_query),
|
||||
'query_value' => $GLOBALS['egw']->html->htmlspecialchars($_query),
|
||||
'lang_search' => lang('Search')
|
||||
);
|
||||
|
||||
@ -431,12 +431,12 @@
|
||||
$filter_obj = array(array('none','show all'));
|
||||
$index = 0;
|
||||
|
||||
$GLOBALS['phpgw']->db->query("SELECT $idxfieldname, $strfieldname FROM $filtertable",__LINE__,__FILE__);
|
||||
while($GLOBALS['phpgw']->db->next_record())
|
||||
$GLOBALS['egw']->db->query("SELECT $idxfieldname, $strfieldname FROM $filtertable",__LINE__,__FILE__);
|
||||
while($GLOBALS['egw']->db->next_record())
|
||||
{
|
||||
$index++;
|
||||
$filter_obj[$index][0] = $GLOBALS['phpgw']->db->f($idxfieldname);
|
||||
$filter_obj[$index][1] = $GLOBALS['phpgw']->db->f($strfieldname);
|
||||
$filter_obj[$index][0] = $GLOBALS['egw']->db->f($idxfieldname);
|
||||
$filter_obj[$index][1] = $GLOBALS['egw']->db->f($strfieldname);
|
||||
}
|
||||
|
||||
return $filter_obj;
|
||||
@ -484,7 +484,7 @@
|
||||
{
|
||||
if ($filter_obj == 1)
|
||||
{
|
||||
// $user_groups = $GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']);
|
||||
// $user_groups = $GLOBALS['egw']->accounts->membership($GLOBALS['egw_info']['user']['account_id']);
|
||||
$indexlimit = count($user_groups);
|
||||
|
||||
if ($yours)
|
||||
@ -612,13 +612,13 @@
|
||||
$currentcolor = @$GLOBALS['tr_color'];
|
||||
}
|
||||
|
||||
if ($currentcolor == $GLOBALS['phpgw_info']['theme']['row_on'])
|
||||
if ($currentcolor == $GLOBALS['egw_info']['theme']['row_on'])
|
||||
{
|
||||
$GLOBALS['tr_color'] = $GLOBALS['phpgw_info']['theme'][$class='row_off'];
|
||||
$GLOBALS['tr_color'] = $GLOBALS['egw_info']['theme'][$class='row_off'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['tr_color'] = $GLOBALS['phpgw_info']['theme'][$class='row_on'];
|
||||
$GLOBALS['tr_color'] = $GLOBALS['egw_info']['theme'][$class='row_on'];
|
||||
}
|
||||
|
||||
return $do_class ? $class : $GLOBALS['tr_color'];
|
||||
@ -652,7 +652,7 @@
|
||||
{
|
||||
$sort = $sort == 'ASC' ? 'DESC' : 'ASC';
|
||||
|
||||
$text = '<b>'.$text.'</b> <img border="0" src="'.$GLOBALS['phpgw']->common->image('phpgwapi',$sort=='ASC'?'up':'down').'">';
|
||||
$text = '<b>'.$text.'</b> <img border="0" src="'.$GLOBALS['egw']->common->image('phpgwapi',$sort=='ASC'?'up':'down').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -666,7 +666,7 @@
|
||||
|
||||
$extravar = 'order='.$var.'&sort='.$sort.'&filter='.$this->_filter.'&qfield='.$this->_qfield.'&start='.$this->_start.'&query='.urlencode(stripslashes(@$GLOBALS['query'])).$extra;
|
||||
|
||||
$link = ($this->_menuaction?$this->page($extravar):$GLOBALS['phpgw']->link($program,$extravar));
|
||||
$link = ($this->_menuaction?$this->page($extravar):$GLOBALS['egw']->link($program,$extravar));
|
||||
|
||||
if ($build_a_href)
|
||||
{
|
||||
@ -740,7 +740,7 @@
|
||||
|
||||
$extravar = 'order='.$our_order.'&sort='.$new_sort.$extra;
|
||||
|
||||
$link = ($this->_menuaction?$this->page($extravar):$GLOBALS['phpgw']->link($program,$extravar));
|
||||
$link = ($this->_menuaction?$this->page($extravar):$GLOBALS['egw']->link($program,$extravar));
|
||||
return '<a href="' .$link .'">' .$text .'</a>';
|
||||
}
|
||||
|
||||
@ -842,14 +842,14 @@
|
||||
*/
|
||||
function set_link_imap($align,$img,$alt_text,$out_vars)
|
||||
{
|
||||
$img_full = $GLOBALS['phpgw']->common->image('phpgwapi',$img);
|
||||
$img_full = $GLOBALS['egw']->common->image('phpgwapi',$img);
|
||||
$image_part = '<img src="'.$img_full.'" border="0" alt="'.$alt_text.'" width="12" height="12">';
|
||||
return '<a href="'.$out_vars['common_uri'].'&start='.$out_vars['start'].'">'.$image_part.'</a>';
|
||||
}
|
||||
|
||||
function set_icon_imap($align,$img,$alt_text)
|
||||
{
|
||||
$img_full = $GLOBALS['phpgw']->common->image('phpgwapi',$img);
|
||||
$img_full = $GLOBALS['egw']->common->image('phpgwapi',$img);
|
||||
return '<img src="'.$img_full.'" border="0" width="12" height="12" alt="'.$alt_text.'">'."\r\n";
|
||||
}
|
||||
} // End of nextmatchs class
|
||||
|
@ -1,171 +1,171 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare API - smtp mailer using PHPMailer *
|
||||
* This file written by RalfBecker@outdoor-training.de *
|
||||
* ------------------------------------------------------------------------ *
|
||||
* This library is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as published by *
|
||||
* the Free Software Foundation; either version 2.1 of the License, *
|
||||
* or any later version. *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU Lesser General Public License for more details. *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this library; if not, write to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
\**************************************************************************/
|
||||
/**************************************************************************\
|
||||
* eGroupWare API - smtp mailer using PHPMailer *
|
||||
* This file written by RalfBecker@outdoor-training.de *
|
||||
* ------------------------------------------------------------------------ *
|
||||
* This library is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as published by *
|
||||
* the Free Software Foundation; either version 2.1 of the License, *
|
||||
* or any later version. *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU Lesser General Public License for more details. *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this library; if not, write to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
|
||||
require_once(PHPGW_API_INC.'/class.phpmailer.inc.php');
|
||||
require_once(EGW_API_INC.'/class.phpmailer.inc.php');
|
||||
|
||||
/**
|
||||
* New eGW send-class. It implements the old interface (msg-method) on top of PHPMailer.
|
||||
*
|
||||
* The configuration is read from Admin >> Site configuration and it does NOT depend on one of the email-apps anymore.
|
||||
*
|
||||
* @author RalfBecker@outdoor-training.de
|
||||
*/
|
||||
class send extends PHPMailer
|
||||
{
|
||||
var $err = array();
|
||||
var $to_res = array();
|
||||
|
||||
/**
|
||||
* eGW specific initialisation of the PHPMailer: charset, language, smtp-host, ...
|
||||
*
|
||||
* To be able to call PHPMailer's Send function, we check if a subject, body or address is set and call it in that case,
|
||||
* else we do our constructors work.
|
||||
*/
|
||||
function send()
|
||||
* New eGW send-class. It implements the old interface (msg-method) on top of PHPMailer.
|
||||
*
|
||||
* The configuration is read from Admin >> Site configuration and it does NOT depend on one of the email-apps anymore.
|
||||
*
|
||||
* @author RalfBecker@outdoor-training.de
|
||||
*/
|
||||
class send extends PHPMailer
|
||||
{
|
||||
if ($this->Subject || $this->Body || count($this->to))
|
||||
var $err = array();
|
||||
var $to_res = array();
|
||||
|
||||
/**
|
||||
* eGW specific initialisation of the PHPMailer: charset, language, smtp-host, ...
|
||||
*
|
||||
* To be able to call PHPMailer's Send function, we check if a subject, body or address is set and call it in that case,
|
||||
* else we do our constructors work.
|
||||
*/
|
||||
function send()
|
||||
{
|
||||
return PHPMailer::Send();
|
||||
}
|
||||
$this->CharSet = $GLOBALS['phpgw']->translation->charset();
|
||||
list($lang,$nation) = explode('-',$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
|
||||
$lang_path = PHPGW_SERVER_ROOT.'/phpgwapi/setup/';
|
||||
if ($nation && file_exists($lang_path."phpmailer.lang-$nation.php")) // atm. only for pt-br => br
|
||||
{
|
||||
$lang = $nation;
|
||||
}
|
||||
$this->SetLanguage($lang,$lang_path);
|
||||
|
||||
$this->IsSmtp();
|
||||
$this->Host = $GLOBALS['phpgw_info']['server']['smtp_server']?$GLOBALS['phpgw_info']['server']['smtp_server']:'localhost';
|
||||
$this->Port = $GLOBALS['phpgw_info']['server']['smtp_port']?$GLOBALS['phpgw_info']['server']['smtp_port']:25;
|
||||
$this->SMTPAuth = !empty($GLOBALS['phpgw_info']['server']['smtp_auth_user']);
|
||||
$this->Username = $GLOBALS['phpgw_info']['server']['smtp_auth_user'];
|
||||
$this->Password = $GLOBALS['phpgw_info']['server']['smtp_auth_passwd'];
|
||||
|
||||
$this->Hostname = $GLOBALS['phpgw_info']['server']['hostname'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all Settings to send multiple Messages
|
||||
*/
|
||||
function ClearAll()
|
||||
{
|
||||
$this->err = array();
|
||||
|
||||
$this->Subject = $this->Body = $this->AltBody = '';
|
||||
$this->IsHTML(False);
|
||||
$this->ClearAllRecipients();
|
||||
$this->ClearAttachments();
|
||||
$this->ClearCustomHeaders();
|
||||
|
||||
$this->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
|
||||
$this->From = $GLOBALS['phpgw_info']['user']['email'];
|
||||
$this->Sender = '';
|
||||
|
||||
$this->AddCustomHeader('X-Mailer:eGroupWare (http://www.eGroupWare.org)');
|
||||
}
|
||||
|
||||
/**
|
||||
* Emulating the old send::msg interface for compatibility with existing code
|
||||
*
|
||||
* You can either use that code or the PHPMailer variables and methods direct.
|
||||
*/
|
||||
function msg($service, $to, $subject, $body, $msgtype='', $cc='', $bcc='', $from='', $sender='', $content_type='', $boundary='Message-Boundary')
|
||||
{
|
||||
//echo "<p>send::msg(,to='$to',subject='$subject',,'$msgtype',cc='$cc',bcc='$bcc',from='$from',sender='$sender','$content_type','$boundary')<pre>$body</pre>\n";
|
||||
$this->ClearAll(); // reset everything to its default, we might be called more then once !!!
|
||||
|
||||
if ($service != 'email')
|
||||
{
|
||||
return False;
|
||||
}
|
||||
if ($from)
|
||||
{
|
||||
if (preg_match('/"?(.+)"?<(.+)>/',$from,$matches))
|
||||
if ($this->Subject || $this->Body || count($this->to))
|
||||
{
|
||||
list(,$this->FromName,$this->From) = $matches;
|
||||
return PHPMailer::Send();
|
||||
}
|
||||
else
|
||||
$this->CharSet = $GLOBALS['egw']->translation->charset();
|
||||
list($lang,$nation) = explode('-',$GLOBALS['egw_info']['user']['preferences']['common']['lang']);
|
||||
$lang_path = EGW_SERVER_ROOT.'/phpgwapi/setup/';
|
||||
if ($nation && file_exists($lang_path."phpmailer.lang-$nation.php")) // atm. only for pt-br => br
|
||||
{
|
||||
$this->From = $from;
|
||||
$this->FromName = '';
|
||||
$lang = $nation;
|
||||
}
|
||||
$this->SetLanguage($lang,$lang_path);
|
||||
|
||||
$this->IsSmtp();
|
||||
$this->Host = $GLOBALS['egw_info']['server']['smtp_server']?$GLOBALS['egw_info']['server']['smtp_server']:'localhost';
|
||||
$this->Port = $GLOBALS['egw_info']['server']['smtp_port']?$GLOBALS['egw_info']['server']['smtp_port']:25;
|
||||
$this->SMTPAuth = !empty($GLOBALS['egw_info']['server']['smtp_auth_user']);
|
||||
$this->Username = $GLOBALS['egw_info']['server']['smtp_auth_user'];
|
||||
$this->Password = $GLOBALS['egw_info']['server']['smtp_auth_passwd'];
|
||||
|
||||
$this->Hostname = $GLOBALS['egw_info']['server']['hostname'];
|
||||
}
|
||||
if ($sender)
|
||||
|
||||
/**
|
||||
* Reset all Settings to send multiple Messages
|
||||
*/
|
||||
function ClearAll()
|
||||
{
|
||||
$this->Sender = $sender;
|
||||
$this->err = array();
|
||||
|
||||
$this->Subject = $this->Body = $this->AltBody = '';
|
||||
$this->IsHTML(False);
|
||||
$this->ClearAllRecipients();
|
||||
$this->ClearAttachments();
|
||||
$this->ClearCustomHeaders();
|
||||
|
||||
$this->FromName = $GLOBALS['egw_info']['user']['fullname'];
|
||||
$this->From = $GLOBALS['egw_info']['user']['email'];
|
||||
$this->Sender = '';
|
||||
|
||||
$this->AddCustomHeader('X-Mailer:eGroupWare (http://www.eGroupWare.org)');
|
||||
}
|
||||
foreach(array('to','cc','bcc') as $adr)
|
||||
|
||||
/**
|
||||
* Emulating the old send::msg interface for compatibility with existing code
|
||||
*
|
||||
* You can either use that code or the PHPMailer variables and methods direct.
|
||||
*/
|
||||
function msg($service, $to, $subject, $body, $msgtype='', $cc='', $bcc='', $from='', $sender='', $content_type='', $boundary='Message-Boundary')
|
||||
{
|
||||
if ($$adr)
|
||||
//echo "<p>send::msg(,to='$to',subject='$subject',,'$msgtype',cc='$cc',bcc='$bcc',from='$from',sender='$sender','$content_type','$boundary')<pre>$body</pre>\n";
|
||||
$this->ClearAll(); // reset everything to its default, we might be called more then once !!!
|
||||
|
||||
if ($service != 'email')
|
||||
{
|
||||
if (preg_match_all('/"?(.+)"?<(.+)>,?/',$$adr,$matches))
|
||||
return False;
|
||||
}
|
||||
if ($from)
|
||||
{
|
||||
if (preg_match('/"?(.+)"?<(.+)>/',$from,$matches))
|
||||
{
|
||||
$names = $matches[1];
|
||||
$addresses = $matches[2];
|
||||
list(,$this->FromName,$this->From) = $matches;
|
||||
}
|
||||
else
|
||||
{
|
||||
$addresses = split('[, ]',$$adr);
|
||||
$names = array();
|
||||
}
|
||||
$method = 'Add'.($adr == 'to' ? 'Address' : $adr);
|
||||
|
||||
foreach($addresses as $n => $address)
|
||||
{
|
||||
$this->$method($address,$names[$n]);
|
||||
$this->From = $from;
|
||||
$this->FromName = '';
|
||||
}
|
||||
}
|
||||
if ($sender)
|
||||
{
|
||||
$this->Sender = $sender;
|
||||
}
|
||||
foreach(array('to','cc','bcc') as $adr)
|
||||
{
|
||||
if ($$adr)
|
||||
{
|
||||
if (preg_match_all('/"?(.+)"?<(.+)>,?/',$$adr,$matches))
|
||||
{
|
||||
$names = $matches[1];
|
||||
$addresses = $matches[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$addresses = split('[, ]',$$adr);
|
||||
$names = array();
|
||||
}
|
||||
$method = 'Add'.($adr == 'to' ? 'Address' : $adr);
|
||||
|
||||
foreach($addresses as $n => $address)
|
||||
{
|
||||
$this->$method($address,$names[$n]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($msgtype))
|
||||
{
|
||||
$this->AddCustomHeader('X-eGW-Type: '.$msgtype);
|
||||
}
|
||||
if ($content_type)
|
||||
{
|
||||
$this->ContentType = $content_type;
|
||||
}
|
||||
$this->Subject = $subject;
|
||||
$this->Body = $body;
|
||||
|
||||
//echo "PHPMailer = <pre>".print_r($this,True)."</pre>\n";
|
||||
if (!$this->Send())
|
||||
{
|
||||
$this->err = array(
|
||||
'code' => 1, // we dont get a numerical code from PHPMailer
|
||||
'msg' => $this->ErrorInfo,
|
||||
'desc' => $this->ErrorInfo,
|
||||
);
|
||||
return False;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
if (!empty($msgtype))
|
||||
|
||||
/**
|
||||
* encode 8-bit chars in subject-line
|
||||
*
|
||||
* This is not needed any more, as it is done be PHPMailer, but older code depend on it.
|
||||
*/
|
||||
function encode_subject($subject)
|
||||
{
|
||||
$this->AddCustomHeader('X-eGW-Type: '.$msgtype);
|
||||
return $subject;
|
||||
}
|
||||
if ($content_type)
|
||||
{
|
||||
$this->ContentType = $content_type;
|
||||
}
|
||||
$this->Subject = $subject;
|
||||
$this->Body = $body;
|
||||
|
||||
//echo "PHPMailer = <pre>".print_r($this,True)."</pre>\n";
|
||||
if (!$this->Send())
|
||||
{
|
||||
$this->err = array(
|
||||
'code' => 1, // we dont get a numerical code from PHPMailer
|
||||
'msg' => $this->ErrorInfo,
|
||||
'desc' => $this->ErrorInfo,
|
||||
);
|
||||
return False;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
/**
|
||||
* encode 8-bit chars in subject-line
|
||||
*
|
||||
* This is not needed any more, as it is done be PHPMailer, but older code depend on it.
|
||||
*/
|
||||
function encode_subject($subject)
|
||||
{
|
||||
return $subject;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user