1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

User-Extended work and Mail handler support for other SMTP ports.

This commit is contained in:
Cameron 2016-03-24 21:45:14 -07:00
parent a4583a4f52
commit 2e5cf2b05e
3 changed files with 49 additions and 41 deletions

View File

@ -194,17 +194,19 @@ if(E107_DEBUG_LEVEL > 0 )
'user_extended_struct_text' => array ( 'title' => EXTLAN_79, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'inline' => true, 'help' => '', 'readParms' => 'constant=1', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'user_extended_struct_type' => array ( 'title' => EXTLAN_2, 'type' => 'method', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'user_extended_struct_values' => array ( 'title' => "Values", 'type' => 'method', 'nolist'=>true, 'data' => 'str', 'width' => 'auto', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'user_extended_struct_default' => array ( 'title' => LAN_DEFAULT, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'field_include' => array('title'=> EXTLAN_15, 'tab'=>1, 'type'=>'textarea', 'data'=>false, 'help'=>EXTLAN_51, 'writeParms'=>array()),
'field_regex' => array('title'=> EXTLAN_52, 'tab'=>1, 'type'=>'text', 'data'=>false, 'help'=> EXTLAN_53, 'writeParms'=>array()),
'field_regexfail' => array('title'=> EXTLAN_54, 'tab'=>1, 'type'=>'text', 'data'=>false, 'help'=>EXTLAN_55, 'writeParms'=>array()),
'field_userhide' => array('title'=> EXTLAN_49, 'tab'=>1, 'type'=>'boolean', 'data'=>false, 'help'=>EXTLAN_50, 'writeParms'=>array()),
'field_placeholder' => array('title'=>'Placeholder', 'tab'=>1, 'type'=>'text', 'data'=>false, 'writeParms'=>array('size'=>'xlarge')),
'field_helptip' => array('title'=>'Help Tip', 'tab'=>1, 'type'=>'text', 'data'=>false, 'writeParms'=>array('size'=>'xlarge')),
'user_extended_struct_default' => array ( 'title' => EXTLAN_16, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'user_extended_struct_parent' => array ( 'title' => LAN_CATEGORY, 'type' => 'dropdown', 'tab'=>1, 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => array('size'=>'xxlarge'), 'class' => 'left', 'thclass' => 'left', ),
// These are combined into user_extended_struct_parms on submit.
'field_placeholder' => array('title'=>'Placeholder', 'tab'=>1, 'type'=>'text', 'data'=>false, 'writeParms'=>array('size'=>'xxlarge')),
'field_helptip' => array('title'=>'Help Tip', 'tab'=>1, 'type'=>'text', 'data'=>false, 'writeParms'=>array('size'=>'xxlarge')),
'field_include' => array('title'=> EXTLAN_15, 'tab'=>1, 'type'=>'textarea', 'data'=>false, 'help'=>EXTLAN_51, 'writeParms'=>array('size'=>'xxlarge')),
'field_regex' => array('title'=> EXTLAN_52, 'tab'=>1, 'type'=>'text', 'data'=>false, 'help'=> EXTLAN_53, 'writeParms'=>array('size'=>'xxlarge')),
'field_regexfail' => array('title'=> EXTLAN_54, 'tab'=>1, 'type'=>'text', 'data'=>false, 'help'=>EXTLAN_55, 'writeParms'=>array('size'=>'xxlarge')),
'field_userhide' => array('title'=> EXTLAN_49, 'tab'=>1, 'type'=>'boolean', 'data'=>false, 'help'=>EXTLAN_50, 'writeParms'=>array('size'=>'xxlarge')),
'user_extended_struct_required' => array ( 'title' => EXTLAN_18, 'type' => 'method', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'user_extended_struct_applicable' => array ( 'title' => EXTLAN_5, 'type' => 'userclass', 'data' => 'int', 'width' => '10%', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'user_extended_struct_parms' => array ( 'title' => "Params", 'type' => 'hidden', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
@ -223,24 +225,6 @@ if(E107_DEBUG_LEVEL > 0 )
private function make_delimited($var)
{
$tp = e107::getParser();
foreach($var as $k => $v)
{
$var[$k] = trim($v);
$var[$k] = str_replace(",", "[E_COMMA]", $var[$k]);
if($var[$k] == "")
{
unset($var[$k]);
}
}
$ret = implode(",", $var);
return $ret;
}
public function init()
{
@ -301,7 +285,7 @@ if(E107_DEBUG_LEVEL > 0 )
$new_data['user_extended_struct_values'] = implode(',',$new_data['user_extended_struct_values']);
e107::getMessage()->addInfo(print_a($new_data,true),'default', true);
// e107::getMessage()->addInfo(print_a($new_data,true),'default', true);
return $new_data;
}

View File

@ -210,6 +210,7 @@ class e107Email extends PHPMailer
$this->CharSet = 'utf-8';
$this->SetLanguage(CORE_LC);
$smtpPort = 465;
if (($overrides === FALSE) || !is_array($overrides))
{
@ -222,6 +223,13 @@ class e107Email extends PHPMailer
}
if(strpos($overrides['smtp_server'],':')!== false)
{
list($smtpServer,$smtpPort) = explode(":", $overrides['smtp_server']);
$overrides['smtp_server'] = $smtpServer;
}
$this->pause_amount = varset($pref['mail_pause'], 10);
$this->pause_time = varset($pref['mail_pausetime'], 1);
$this->allow_html = varset($pref['mail_sendstyle'],'textonly') == 'texthtml' ? true : 1;
@ -285,11 +293,11 @@ class e107Email extends PHPMailer
{
case 'TLS' :
$this->SMTPSecure = 'tls';
$this->Port = 465; // Can also use port 587, and maybe even 25
$this->Port = $smtpPort; // Can also use port 587, and maybe even 25
break;
case 'SSL' :
$this->SMTPSecure = 'ssl';
$this->Port = 465;
$this->Port = $smtpPort;
break;
default :
if ($this->debug) echo "Invalid option: {$smtp_options['secure']}<br />";
@ -1027,8 +1035,9 @@ class e107Email extends PHPMailer
$this->logLine('Error info: '.$this->ErrorInfo);
// Error sending email
$e107 = e107::getInstance();
$e107->admin_log->e_log_event(3,debug_backtrace(),"MAIL","Send Failed",$this->ErrorInfo,FALSE,LOG_TO_ROLLING);
e107::getLog()->e_log_event(3,debug_backtrace(),"MAIL","Send Failed",$this->ErrorInfo,FALSE,LOG_TO_ROLLING);
$this->TotalErrors++;
$this->closeLog();
return $this->ErrorInfo;
@ -1211,8 +1220,8 @@ class e107Exception extends Exception
public function __construct($message = '', $code = 0)
{
parent::__construct($message, $code);
$e107 = e107::getInstance();
$e107->admin_log->e_log_event(10,
e107::getLog()->e_log_event(10,
$this->getFile().'|@'.$this->getLine(),
'EXCEPT',
$this->getCode().':'.$this->getMessage(),

View File

@ -714,10 +714,23 @@ class e107_user_extended
$fname = "ue[user_".$struct['user_extended_struct_name']."]";
$required = vartrue($struct['user_extended_struct_required']) == 1 ? "required" : "";
$fid = $frm->name2id($fname);
$placeholder = (!empty($parms[4])) ? "placeholder=\"".$tp->toAttribute($parms[4])."\"" : "";
$class = "form-control tbox";
if(!empty($parms[5]))
{
$class .= " e-tip";
$title = "title=\"".$tp->toAttribute($parms[5])."\"";
}
else
{
$title = '';
}
if(strpos($include, 'class') === FALSE)
{
$include .= " class='form-control tbox' ";
$include .= " class='".$class."' ";
}
@ -725,7 +738,7 @@ class e107_user_extended
{
case EUF_TEXT : //textbox
case EUF_INTEGER : //integer
$ret = "<input id='{$fid}' type='text' name='{$fname}' value='{$curval}' {$include} {$required} />";
$ret = "<input id='{$fid}' type='text' name='{$fname}' {$title} value='{$curval}' {$include} {$required} {$placeholder} />";
return $ret;
break;
@ -777,6 +790,8 @@ class e107_user_extended
$curval = e107::unserialize($curval);
}
return e107::getForm()->checkboxes($fname.'[]',$choices, $curval, array('useLabelValues'=>1));
/*
@ -819,7 +834,7 @@ class e107_user_extended
break;
case EUF_DROPDOWN : //dropdown
$ret = "<select {$include} id='{$fid}' name='{$fname}' {$required} >\n";
$ret = "<select {$include} id='{$fid}' name='{$fname}' {$required} {$title} >\n";
$ret .= "<option value=''>&nbsp;</option>\n"; // ensures that the user chose it.
foreach($choices as $choice)
{
@ -880,7 +895,7 @@ class e107_user_extended
break;
case EUF_TEXTAREA : //textarea
return "<textarea id='{$fid}' {$include} name='{$fname}' {$required} >{$curval}</textarea>";
return "<textarea id='{$fid}' {$include} name='{$fname}' {$required} {$title}>{$curval}</textarea>";
break;
case EUF_DATE : //date