\n".trim($comment,"\n\t ")."\n
\n\n";
saveWikiText($targetpage, $newrecord.$oldrecord, "New entry", true);
$lastline .= $this->getLang("viewonline").wl($ID,'', true).'?id='.$targetpage."#msg".$bytes."\n\n\n";
$this->statusMessage = $this->getLang("viewonline").''.$bytes."";
}
$comment .= "\n\n";
$comment .= '---------------------------------------------------------------'."\n";
$comment .= $this->getLang("sent by")." ".$name.' <'.$email.'>'."\n";
$comment .= $this->getLang("via").wl($ID,'',true)."\n";
$comment .= $lastline;
$to = $this->_email_list('toemail', 'touser', 'togroup');
if (count($to) == 0) {
array_push($to, $this->getConf('default'));
}
$ccs = array_diff($this->_email_list('ccemail', 'ccuser', 'ccgroup'), $to);
$bccs = array_diff($this->_email_list('bccemail', 'bccuser', 'bccgroup'), $to, $ccs);
// A bunch of tests to secure content
$this->_validate_value($name, 'name');
$this->_validate_value($email, 'email');
$this->_validate_value($subject, 'subject');
$this->_validate_value($to, 'to', True);
$this->_validate_value($css, 'cc', True);
$this->_validate_value($bccs, 'bcc', True);
$this->_validate_value($comment, 'content', False, True);
// Status has not changed.
if($this->status != 0) {
// send only if message is not empty
// this should never be the case anyway because the form has
// validation to ensure a non-empty comment
if (trim($comment, " \t") != ''){
if ($this->send_mail($to, $subject, $comment, $email, $ccs, $bccs)){
$this->statusMessage = $this->getLang("success")."\n".$this->statusMessage;
} else {
$this->_set_error('unknown');
}
}
}
return true;
}
/**
* Manage error messages.
*/
protected function _set_error($msgid, $args=Null, $type=Null) {
$lang = $this->getLang("error");
if (is_null($type)) $type=$msgid;
$msgstr = $lang[$msgid];
if (!is_null($args)){
$msgstr = vprintf($msgstr, $args);
}
$this->status = 0;
$this->statusMessage .= empty($this->statusMessage)?$msgstr:''.$this->statusMessage.'
'; $this->statusMessage = ''; $this->errorFlags = array(); return $res; } /** * Renders a form row. */ protected function _form_row($label, $name, $type, $default='') { $value = (isset($_POST['submit-'.$this->formId]) && $this->status == 0)?$_POST[$name]:$default; $class = ($this->errorFlags[$name])?'class="error_field"':''; $row = ''; if($type == 'textarea') $row .= ''; elseif($type == 'multiple_email') $row .= ''; elseif($type == 'required_email') $row .= ''; else $row .= ''; return $row; } }