diff --git a/perllib/mySociety/WebTestHarness.pm b/perllib/mySociety/WebTestHarness.pm index 22a873ef..9a7e8967 100644 --- a/perllib/mySociety/WebTestHarness.pm +++ b/perllib/mySociety/WebTestHarness.pm @@ -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 ''); @@ -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 diff --git a/phplib/HTML/QuickForm/date.php b/phplib/HTML/QuickForm/date.php index 75634e7e..22c0e56c 100644 --- a/phplib/HTML/QuickForm/date.php +++ b/phplib/HTML/QuickForm/date.php @@ -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; diff --git a/phplib/admin-ratty.php b/phplib/admin-ratty.php index 032b4ed0..989d786f 100644 --- a/phplib/admin-ratty.php +++ b/phplib/admin-ratty.php @@ -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
. */ - 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"; diff --git a/phplib/admin.php b/phplib/admin.php index a9a48332..2ffdc7c1 100644 --- a/phplib/admin.php +++ b/phplib/admin.php @@ -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 "

$message in $file:$line

"; } err_set_handler_display('admin_display_error'); diff --git a/phplib/error.php b/phplib/error.php index e432fe3e..27dc0452 100644 --- a/phplib/error.php +++ b/phplib/error.php @@ -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 "
";
-#print_r($context);
-#error_log(print_r($context, TRUE));
-#print "
"; +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 @@ -110,9 +104,9 @@ 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; @@ -120,11 +114,11 @@ function err_global_handler($num, $str, $file, $line, $context) { $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); } diff --git a/phplib/rabx.php b/phplib/rabx.php index 298d1320..4d79c27c 100644 --- a/phplib/rabx.php +++ b/phplib/rabx.php @@ -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] diff --git a/phplib/simplexml44-0_4_4/class/IsterSimpleXMLElement.php b/phplib/simplexml44-0_4_4/class/IsterSimpleXMLElement.php index cc3ad536..83f1ea4d 100644 --- a/phplib/simplexml44-0_4_4/class/IsterSimpleXMLElement.php +++ b/phplib/simplexml44-0_4_4/class/IsterSimpleXMLElement.php @@ -155,14 +155,14 @@ function CDATA() switch( $child->___t ) { case ISTER_XML_CDATA: if( preg_match('/^()$/', $child->___n) ) - continue; + break; $txt .= $child->___n; break; case ISTER_XML_ENTITY: $txt .= $child->___ns; break; default: - continue; + break; } } return $txt;