mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 20:31:31 +02:00
Format and switch to egw_info, et al.
This commit is contained in:
parent
0f40bc6b02
commit
9438655ca5
@ -40,7 +40,7 @@
|
|||||||
{
|
{
|
||||||
if(!$website)
|
if(!$website)
|
||||||
{
|
{
|
||||||
$this->template = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
|
$this->template = createobject('phpgwapi.Template',EGW_TEMPLATE_DIR);
|
||||||
$this->template->set_file(array(
|
$this->template->set_file(array(
|
||||||
'_nextmatchs' => 'nextmatchs.tpl'
|
'_nextmatchs' => 'nextmatchs.tpl'
|
||||||
));
|
));
|
||||||
@ -55,10 +55,10 @@
|
|||||||
$this->template->set_block('_nextmatchs','cats_search_filter');
|
$this->template->set_block('_nextmatchs','cats_search_filter');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
|
if(isset($GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']) &&
|
||||||
(int)$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
|
(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
|
else
|
||||||
{
|
{
|
||||||
@ -66,7 +66,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->_start = (int) get_var('start',array('GLOBAL','POST','GET'));
|
$this->_start = (int) get_var('start',array('GLOBAL','POST','GET'));
|
||||||
|
|
||||||
foreach(array('menuaction','filter','qfield','order','sort') as $name)
|
foreach(array('menuaction','filter','qfield','order','sort') as $name)
|
||||||
{
|
{
|
||||||
$var = '_'.$name;
|
$var = '_'.$name;
|
||||||
@ -76,9 +76,9 @@
|
|||||||
$this->$var = '';
|
$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(
|
$var = array(
|
||||||
'align' => $align,
|
'align' => $align,
|
||||||
'img' => $GLOBALS['phpgw']->common->image('phpgwapi',$img),
|
'img' => $GLOBALS['egw']->common->image('phpgwapi',$img),
|
||||||
'label' => lang($label),
|
'label' => lang($label),
|
||||||
'border' => 0
|
'border' => 0
|
||||||
);
|
);
|
||||||
@ -123,7 +123,7 @@
|
|||||||
$extras = implode($t_extras,'&');
|
$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(
|
$var = Array(
|
||||||
'align' => $align,
|
'align' => $align,
|
||||||
'action' => ($this->_menuaction?$this->page():$GLOBALS['phpgw']->link($link)),
|
'action' => ($this->_menuaction?$this->page():$GLOBALS['egw']->link($link)),
|
||||||
'form_name' => $img,
|
'form_name' => $img,
|
||||||
'hidden' => $GLOBALS['phpgw']->html->input_hidden($extravars),
|
'hidden' => $GLOBALS['egw']->html->input_hidden($extravars),
|
||||||
'img' => $GLOBALS['phpgw']->common->image('phpgwapi',$img),
|
'img' => $GLOBALS['egw']->common->image('phpgwapi',$img),
|
||||||
'label' => $alt,
|
'label' => $alt,
|
||||||
'border' => 0,
|
'border' => 0,
|
||||||
'start' => $extravars['start']
|
'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')
|
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);
|
$extravars = $this->split_extras($extravars,$extra);
|
||||||
|
|
||||||
$var = array(
|
$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_category' => lang('Category'),
|
||||||
'lang_all' => lang('All'),
|
'lang_all' => lang('All'),
|
||||||
'lang_select' => lang('Select'),
|
'lang_select' => lang('Select'),
|
||||||
'cat_field' => $cat_field,
|
'cat_field' => $cat_field,
|
||||||
'categories' => $GLOBALS['phpgw']->categories->formated_list('select','all',$cat_id,'True'),
|
'categories' => $GLOBALS['egw']->categories->formated_list('select','all',$cat_id,'True'),
|
||||||
'hidden' => $GLOBALS['phpgw']->html->input_hidden(array(
|
'hidden' => $GLOBALS['egw']->html->input_hidden(array(
|
||||||
'filter' => $this->_filter,
|
'filter' => $this->_filter,
|
||||||
'qfield' => $this->_qfield,
|
'qfield' => $this->_qfield,
|
||||||
'start' => (int)$localstart,
|
'start' => (int)$localstart,
|
||||||
@ -186,9 +186,9 @@
|
|||||||
'sort' => $this->_sort,
|
'sort' => $this->_sort,
|
||||||
'query' => $GLOBALS['query'],
|
'query' => $GLOBALS['query'],
|
||||||
)),
|
)),
|
||||||
'query_value' => $GLOBALS['phpgw']->html->htmlspecialchars($GLOBALS['query']),
|
'query_value' => $GLOBALS['egw']->html->htmlspecialchars($GLOBALS['query']),
|
||||||
'table_width' => $twidth,
|
'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),
|
'left' => $this->left($sn,(int)$localstart,$total,$extra),
|
||||||
'search' => ($showsearch?$this->search($search_obj):''),
|
'search' => ($showsearch?$this->search($search_obj):''),
|
||||||
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):''),
|
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):''),
|
||||||
@ -302,7 +302,7 @@
|
|||||||
|
|
||||||
$extravars = $this->split_extras($extravars,$extradata);
|
$extravars = $this->split_extras($extravars,$extradata);
|
||||||
$ret_str = '';
|
$ret_str = '';
|
||||||
|
|
||||||
$start = (int) $start;
|
$start = (int) $start;
|
||||||
|
|
||||||
if (($total > $this->maxmatches) &&
|
if (($total > $this->maxmatches) &&
|
||||||
@ -329,9 +329,9 @@
|
|||||||
function search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
|
function search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
|
||||||
{
|
{
|
||||||
$var = array(
|
$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)),
|
||||||
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
|
||||||
'hidden' => $GLOBALS['phpgw']->html->input_hidden(array(
|
'hidden' => $GLOBALS['egw']->html->input_hidden(array(
|
||||||
'filter' => $this->_filter,
|
'filter' => $this->_filter,
|
||||||
'qfield' => $this->_qfield,
|
'qfield' => $this->_qfield,
|
||||||
'start' => 0,
|
'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='')
|
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(
|
$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_category' => lang('Category'),
|
||||||
'lang_all' => lang('All'),
|
'lang_all' => lang('All'),
|
||||||
'lang_select' => lang('Select'),
|
'lang_select' => lang('Select'),
|
||||||
'cat_field' => $cat_field,
|
'cat_field' => $cat_field,
|
||||||
'categories' => $GLOBALS['phpgw']->categories->formated_list('select','all',(int)$cat_id,'True'),
|
'categories' => $GLOBALS['egw']->categories->formated_list('select','all',(int)$cat_id,'True'),
|
||||||
'hidden' => $GLOBALS['phpgw']->html->input_hidden(array(
|
'hidden' => $GLOBALS['egw']->html->input_hidden(array(
|
||||||
'filter' => $this->_filter,
|
'filter' => $this->_filter,
|
||||||
'qfield' => $this->_qfield,
|
'qfield' => $this->_qfield,
|
||||||
'start' => 0,
|
'start' => 0,
|
||||||
@ -372,7 +372,7 @@
|
|||||||
'sort' => $this->_sort,
|
'sort' => $this->_sort,
|
||||||
'query' => $GLOBALS['query'],
|
'query' => $GLOBALS['query'],
|
||||||
)),
|
)),
|
||||||
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
|
||||||
'search' => $this->search($search_obj),
|
'search' => $this->search($search_obj),
|
||||||
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
|
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
|
||||||
);
|
);
|
||||||
@ -406,7 +406,7 @@
|
|||||||
}
|
}
|
||||||
$var = array
|
$var = array
|
||||||
(
|
(
|
||||||
'query_value' => $GLOBALS['phpgw']->html->htmlspecialchars($_query),
|
'query_value' => $GLOBALS['egw']->html->htmlspecialchars($_query),
|
||||||
'lang_search' => lang('Search')
|
'lang_search' => lang('Search')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -431,12 +431,12 @@
|
|||||||
$filter_obj = array(array('none','show all'));
|
$filter_obj = array(array('none','show all'));
|
||||||
$index = 0;
|
$index = 0;
|
||||||
|
|
||||||
$GLOBALS['phpgw']->db->query("SELECT $idxfieldname, $strfieldname FROM $filtertable",__LINE__,__FILE__);
|
$GLOBALS['egw']->db->query("SELECT $idxfieldname, $strfieldname FROM $filtertable",__LINE__,__FILE__);
|
||||||
while($GLOBALS['phpgw']->db->next_record())
|
while($GLOBALS['egw']->db->next_record())
|
||||||
{
|
{
|
||||||
$index++;
|
$index++;
|
||||||
$filter_obj[$index][0] = $GLOBALS['phpgw']->db->f($idxfieldname);
|
$filter_obj[$index][0] = $GLOBALS['egw']->db->f($idxfieldname);
|
||||||
$filter_obj[$index][1] = $GLOBALS['phpgw']->db->f($strfieldname);
|
$filter_obj[$index][1] = $GLOBALS['egw']->db->f($strfieldname);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $filter_obj;
|
return $filter_obj;
|
||||||
@ -484,7 +484,7 @@
|
|||||||
{
|
{
|
||||||
if ($filter_obj == 1)
|
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);
|
$indexlimit = count($user_groups);
|
||||||
|
|
||||||
if ($yours)
|
if ($yours)
|
||||||
@ -612,13 +612,13 @@
|
|||||||
$currentcolor = @$GLOBALS['tr_color'];
|
$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
|
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'];
|
return $do_class ? $class : $GLOBALS['tr_color'];
|
||||||
@ -652,7 +652,7 @@
|
|||||||
{
|
{
|
||||||
$sort = $sort == 'ASC' ? 'DESC' : 'ASC';
|
$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
|
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;
|
$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)
|
if ($build_a_href)
|
||||||
{
|
{
|
||||||
@ -740,7 +740,7 @@
|
|||||||
|
|
||||||
$extravar = 'order='.$our_order.'&sort='.$new_sort.$extra;
|
$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>';
|
return '<a href="' .$link .'">' .$text .'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -842,14 +842,14 @@
|
|||||||
*/
|
*/
|
||||||
function set_link_imap($align,$img,$alt_text,$out_vars)
|
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">';
|
$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>';
|
return '<a href="'.$out_vars['common_uri'].'&start='.$out_vars['start'].'">'.$image_part.'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_icon_imap($align,$img,$alt_text)
|
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";
|
return '<img src="'.$img_full.'" border="0" width="12" height="12" alt="'.$alt_text.'">'."\r\n";
|
||||||
}
|
}
|
||||||
} // End of nextmatchs class
|
} // End of nextmatchs class
|
||||||
|
@ -1,171 +1,171 @@
|
|||||||
<?php
|
<?php
|
||||||
/**************************************************************************\
|
/**************************************************************************\
|
||||||
* eGroupWare API - smtp mailer using PHPMailer *
|
* eGroupWare API - smtp mailer using PHPMailer *
|
||||||
* This file written by RalfBecker@outdoor-training.de *
|
* This file written by RalfBecker@outdoor-training.de *
|
||||||
* ------------------------------------------------------------------------ *
|
* ------------------------------------------------------------------------ *
|
||||||
* This library is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* under the terms of the GNU Lesser General Public License as published by *
|
||||||
* the Free Software Foundation; either version 2.1 of the License, *
|
* the Free Software Foundation; either version 2.1 of the License, *
|
||||||
* or any later version. *
|
* or any later version. *
|
||||||
* This library is distributed in the hope that it will be useful, but *
|
* This library is distributed in the hope that it will be useful, but *
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU Lesser General Public License for more details. *
|
* See the GNU Lesser General Public License for more details. *
|
||||||
* You should have received a copy of the GNU Lesser General Public License *
|
* 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, *
|
* along with this library; if not, write to the Free Software Foundation, *
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
* 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, ...
|
* New eGW send-class. It implements the old interface (msg-method) on top of PHPMailer.
|
||||||
*
|
*
|
||||||
* 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,
|
* The configuration is read from Admin >> Site configuration and it does NOT depend on one of the email-apps anymore.
|
||||||
* else we do our constructors work.
|
*
|
||||||
*/
|
* @author RalfBecker@outdoor-training.de
|
||||||
function send()
|
*/
|
||||||
|
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();
|
if ($this->Subject || $this->Body || count($this->to))
|
||||||
}
|
|
||||||
$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))
|
|
||||||
{
|
{
|
||||||
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;
|
$lang = $nation;
|
||||||
$this->FromName = '';
|
|
||||||
}
|
}
|
||||||
|
$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];
|
list(,$this->FromName,$this->From) = $matches;
|
||||||
$addresses = $matches[2];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$addresses = split('[, ]',$$adr);
|
$this->From = $from;
|
||||||
$names = array();
|
$this->FromName = '';
|
||||||
}
|
|
||||||
$method = 'Add'.($adr == 'to' ? 'Address' : $adr);
|
|
||||||
|
|
||||||
foreach($addresses as $n => $address)
|
|
||||||
{
|
|
||||||
$this->$method($address,$names[$n]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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…
x
Reference in New Issue
Block a user