* @access public
*/
private $charset = 'utf-8'; // should we be using iso-8859-1 ?
+
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ if (!BSApp::$input instanceof BSInput)
+ {
+ throw new Exception('BSApp::$input is not an instance of BSInput');
+ }
+ }
// ###################################################################
/**
throw new Exception('You need to specify an email address');
}
- // load the input sanitizer
- $input = BSApp::registry()->getType('Input');
- if ($input == null)
- {
- BSApp::debug(ISSO . '/Input not loaded, so manually doing so');
- $input = BSApp::load_module('Input');
- }
-
// make sure we have a mailer
// TODO - add support for SMTP
if (!@ini_get('sendmail_path'))
// sort out the to addresses
$address = $this->_fetchFirstLine($address);
- $address = trim($input->unsanitize($address));
+ $address = trim(BSApp::$input->unsanitize($address));
$name = $this->_fetchFirstLine($name);
- $name = trim($input->unsanitize($name));
+ $name = trim(BSApp::$input->unsanitize($name));
$tostring = ($name == null ? $address : "\"$name\" <$address>");
// sanitize the from field
$from = $this->_fetchFirstLine($this->from);
- $from = trim($input->unsanitize($from));
+ $from = trim(BSApp::$input->unsanitize($from));
if (empty($from))
{
throw new Exception('You need to specify a from email address');
// sanitize the from name
$fromName = $this->_fetchFirstLine($this->fromName);
- $fromName = ($fromName == '' ? $from : trim($input->unsanitize($fromName)));
+ $fromName = ($fromName == '' ? $from : trim(BSApp::$input->unsanitize($fromName)));
$fromName = $this->_encodeHeaderValue($this->fromName);
// sanitize the subject
$subject = $this->_fetchFirstLine($this->subject);
- $subject = trim($input->unsanitize($subject));
+ $subject = trim(BSApp::$input->unsanitize($subject));
if (empty($subject))
{
throw new Exception('You need to specify a subject for the message');
// sanitize the body
$bodyText = BSFunctions::convert_line_breaks($this->bodyText, $this->delim);
- $bodyText = trim($input->unsanitize($bodyText, true));
+ $bodyText = trim(BSApp::$input->unsanitize($bodyText, true));
if (empty($bodyText))
{
throw new Exception('You need to specify body text before sending the message');