Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions perllib/mySociety/WebTestHarness.pm
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ mails are found within a few seconds, or there is more than one match. The
email is returned with any quoted printable characters decoded.

=cut
sub email_get_containing($$) {
my ($self, $check) = @_;
sub email_get_containing($$;$) {
my ($self, $check, $regex) = @_;

die "STRING must be scalar or array" if (ref($check) ne 'ARRAY' && ref($check) ne '');
$check = [ $check ] if (ref($check) eq '');
Expand All @@ -688,7 +688,8 @@ sub email_get_containing($$) {
my $quoted_c = encode_qp($c, "");
push @params, $quoted_c;
}
$qfragment = join($bool, map { 'content like ?' } @params);
my $match_op = defined $regex ? 'content similar to ?' : 'content like ?';
$qfragment = join($bool, map { $match_op } @params);
$qdesc = join($bool, map { "'$_'" } @params);

# Provoke any sending of mails
Expand Down
2 changes: 1 addition & 1 deletion phplib/HTML/QuickForm/date.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ function _createElements()
$locale =& $this->_locale[$this->_options['language']];
$backslash = false;
for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
$sign = $this->_options['format']{$i};
$sign = $this->_options['format'][$i];
if ($backslash) {
$backslash = false;
$separator .= $sign;
Expand Down
10 changes: 9 additions & 1 deletion phplib/admin-ratty.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ class ADMIN_PAGE_RATTY {
* message field in rate-limiting rules (e.g., "HTML fragment to be
* displayed to user when rule fires."). The contents of MESSAGEBLURB will
* be displayed inside a <div>. */
function ADMIN_PAGE_RATTY($scope, $what, $description, $messageblurb) {

public $id;
public $navname;
public $scope;
public $scope_title;
public $scope_description;
public $scope_messageblurb;

function __construct($scope, $what, $description, $messageblurb) {
$this->id = "ratty-" . $scope;
$this->navname = "$what Rules";

Expand Down
2 changes: 1 addition & 1 deletion phplib/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// Error display
require_once dirname(__FILE__) . "/error.php";
function admin_display_error($num, $message, $file, $line, $context) {
function admin_display_error($num, $message, $file, $line) {
print "<p><strong>$message</strong> in $file:$line</p>";
}
err_set_handler_display('admin_display_error');
Expand Down
22 changes: 8 additions & 14 deletions phplib/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,14 @@ function err($str, $num = E_USER_ERROR) {
$i = 1;
if (!array_key_exists('file', $a[$i])) $a[$i]['file'] = '(unknown file)';
if (!array_key_exists('line', $a[$i])) $a[$i]['line'] = '(unknown line)';
err_global_handler($num, $str, $a[$i]['file'], $a[$i]['line'],
/* XXX We can't obtain the calling context AFAIK. */
null);
err_global_handler($num, $str, $a[$i]['file'], $a[$i]['line']);
exit(1); /* NOTREACHED */
}

/* err_log_webserver NUMBER STRING FILE LINE CONTEXT
/* err_log_webserver NUMBER STRING FILE LINE
* Log the error with the given parameters, trying to arrange that it reach the
* appropriate web server error log. */
function err_log_webserver($num, $str, $file, $line, $context) {
#print "<pre>";
#print_r($context);
#error_log(print_r($context, TRUE));
#print "</pre>";
function err_log_webserver($num, $str, $file, $line) {

/* Apache (and perhaps other webservers) logs errors preceded by a tag
* giving the time and "severity" of the error. The time is in the format
Expand Down Expand Up @@ -110,21 +104,21 @@ function err_log_webserver($num, $str, $file, $line, $context) {
$err_handler_display = null;
$err_handling_error = false; // true if currently handling an error

/* err_global_handler NUMBER STRING FILE LINE CONTEXT
/* err_global_handler NUMBER STRING FILE LINE
* Handler for all categories of errors. */
function err_global_handler($num, $str, $file, $line, $context) {
function err_global_handler($num, $str, $file, $line) {
global $err_handler_log;
global $err_handler_display;
global $err_handling_error;

$err_handling_error = true;

if (isset($err_handler_log) && $num != E_USER_NOTICE)
$err_handler_log($num, $str, $file, $line, $context);
$err_handler_log($num, $str, $file, $line);
if (isset($err_handler_display))
$err_handler_display($num, $str, $file, $line, $context);
$err_handler_display($num, $str, $file, $line);
else
$err_handler_log($num, "no error display handler set", $file, $line, $context);
$err_handler_log($num, "no error display handler set", $file, $line);
exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion phplib/rabx.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function microtime_float()


class RABX_Client {
var $ch, $url, $use_post = FALSE;
var $ch, $url, $use_post, $userpwd = FALSE;
var $lastt;

/* constructor URL [USERPWD]
Expand Down
4 changes: 2 additions & 2 deletions phplib/simplexml44-0_4_4/class/IsterSimpleXMLElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ function CDATA()
switch( $child->___t ) {
case ISTER_XML_CDATA:
if( preg_match('/^(<!\[CDATA\[|]]>)$/', $child->___n) )
continue;
break;
$txt .= $child->___n;
break;
case ISTER_XML_ENTITY:
$txt .= $child->___ns;
break;
default:
continue;
break;
}
}
return $txt;
Expand Down