Merge branch '1.0.x' into testing
This commit is contained in:
commit
0573c268d0
27
lib/mail.php
27
lib/mail.php
@ -71,18 +71,25 @@ function mail_backend()
|
|||||||
*/
|
*/
|
||||||
function mail_send($recipients, $headers, $body)
|
function mail_send($recipients, $headers, $body)
|
||||||
{
|
{
|
||||||
// XXX: use Mail_Queue... maybe
|
try {
|
||||||
$backend = mail_backend();
|
// XXX: use Mail_Queue... maybe
|
||||||
if (!isset($headers['Content-Type'])) {
|
$backend = mail_backend();
|
||||||
$headers['Content-Type'] = 'text/plain; charset=UTF-8';
|
|
||||||
}
|
if (!isset($headers['Content-Type'])) {
|
||||||
assert($backend); // throws an error if it's bad
|
$headers['Content-Type'] = 'text/plain; charset=UTF-8';
|
||||||
$sent = $backend->send($recipients, $headers, $body);
|
}
|
||||||
if (PEAR::isError($sent)) {
|
|
||||||
common_log(LOG_ERR, 'Email error: ' . $sent->getMessage());
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2011, StatusNet, Inc.
|
* Copyright (C) 2011, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* URL mapper
|
* URL mapper
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -40,7 +40,7 @@ if (!defined('STATUSNET')) {
|
|||||||
* Converts a path into a set of parameters, and vice versa
|
* 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.
|
* 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.
|
* NUM's vagaries are the main reason we have weirdnesses here.
|
||||||
*
|
*
|
||||||
* @category URL
|
* @category URL
|
||||||
@ -58,6 +58,7 @@ class URLMapper
|
|||||||
protected $statics = array();
|
protected $statics = array();
|
||||||
protected $variables = array();
|
protected $variables = array();
|
||||||
protected $reverse = array();
|
protected $reverse = array();
|
||||||
|
protected $allpaths = array();
|
||||||
|
|
||||||
function connect($path, $args, $paramPatterns=array())
|
function connect($path, $args, $paramPatterns=array())
|
||||||
{
|
{
|
||||||
@ -65,6 +66,8 @@ class URLMapper
|
|||||||
throw new Exception(sprintf("Can't connect %s; path has no action.", $path));
|
throw new Exception(sprintf("Can't connect %s; path has no action.", $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$allpaths[] = $path;
|
||||||
|
|
||||||
$action = $args[self::ACTION];
|
$action = $args[self::ACTION];
|
||||||
|
|
||||||
$paramNames = $this->getParamNames($path);
|
$paramNames = $this->getParamNames($path);
|
||||||
@ -119,7 +122,7 @@ class URLMapper
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception(sprintf('No match for path "%s"', $path));
|
throw new Exception(sprintf('No match for path "%s"', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +176,7 @@ class URLMapper
|
|||||||
$path = vsprintf($format, $toFormat);
|
$path = vsprintf($format, $toFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($qstring)) {
|
if (!empty($qstring)) {
|
||||||
$formatted = http_build_query($qstring);
|
$formatted = http_build_query($qstring);
|
||||||
$path .= '?' . $formatted;
|
$path .= '?' . $formatted;
|
||||||
}
|
}
|
||||||
@ -223,6 +226,11 @@ class URLMapper
|
|||||||
|
|
||||||
return $format;
|
return $format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPaths()
|
||||||
|
{
|
||||||
|
return $this->allpaths;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PatternReplacer
|
class PatternReplacer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user