*/
function mail_send($recipients, $headers, $body)
{
- // XXX: use Mail_Queue... maybe
- $backend = mail_backend();
- if (!isset($headers['Content-Type'])) {
- $headers['Content-Type'] = 'text/plain; charset=UTF-8';
- }
- assert($backend); // throws an error if it's bad
- $sent = $backend->send($recipients, $headers, $body);
- if (PEAR::isError($sent)) {
- common_log(LOG_ERR, 'Email error: ' . $sent->getMessage());
+ try {
+ // XXX: use Mail_Queue... maybe
+ $backend = mail_backend();
+
+ if (!isset($headers['Content-Type'])) {
+ $headers['Content-Type'] = 'text/plain; charset=UTF-8';
+ }
+
+ assert($backend); // throws an error if it's bad
+ $sent = $backend->send($recipients, $headers, $body);
+ return true;
+ } catch (PEAR_Exception $e) {
+ common_log(
+ LOG_ERR,
+ "Unable to send email - '{$e->getMessage()}'. "
+ . 'Is your mail subsystem set up correctly?'
+ );
return false;
}
- return true;
}
/**
* Copyright (C) 2011, StatusNet, Inc.
*
* URL mapper
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* Converts a path into a set of parameters, and vice versa
*
* We used to use Net_URL_Mapper, so there's a wrapper class at Router, q.v.
- *
+ *
* NUM's vagaries are the main reason we have weirdnesses here.
*
* @category URL
protected $statics = array();
protected $variables = array();
protected $reverse = array();
+ protected $allpaths = array();
function connect($path, $args, $paramPatterns=array())
{
throw new Exception(sprintf("Can't connect %s; path has no action.", $path));
}
+ $allpaths[] = $path;
+
$action = $args[self::ACTION];
$paramNames = $this->getParamNames($path);
return $results;
}
}
-
+
throw new Exception(sprintf('No match for path "%s"', $path));
}
$path = vsprintf($format, $toFormat);
}
- if (!empty($qstring)) {
+ if (!empty($qstring)) {
$formatted = http_build_query($qstring);
$path .= '?' . $formatted;
}
return $format;
}
+
+ public function getPaths()
+ {
+ return $this->allpaths;
+ }
}
class PatternReplacer