]> git.wh0rd.org - tt-rss.git/commitdiff
Make Handler::before() hierarchy consistent
authorJohn Keeping <john@keeping.me.uk>
Thu, 5 Jul 2012 18:43:44 +0000 (19:43 +0100)
committerJohn Keeping <john@keeping.me.uk>
Thu, 5 Jul 2012 18:43:44 +0000 (19:43 +0100)
In API, the before() method (inherited from Handler) takes a $method
argument, although this is not declared for the before method() in
handler.  PHP in strict mode treats this as an error.

Since call sites already pass the $method argument, change
Handler::before() and the before() method in all other subclasses to
take this argument.

classes/dlg.php
classes/handler.php
classes/pref_instances.php
classes/pref_users.php
classes/protected_handler.php

index 0a5412fb539d348accd87eff2e70c2901caaf9da..4d5068ba6d6fc9061063fa309d44ff4e1964439e 100644 (file)
@@ -2,8 +2,8 @@
 class Dlg extends Protected_Handler {
        private $param;
 
-       function before() {
-               if (parent::before()) {
+       function before($method) {
+               if (parent::before($method)) {
                        header("Content-Type: text/xml; charset=utf-8");
                        $this->param = db_escape_string($_REQUEST["param"]);
                        print "<dlg>";
index 404b8306b8e269d3c544aecd6f361b3e184d376f..9d6c99e0da27162f8166bf2fb072599746ee29a7 100644 (file)
@@ -12,7 +12,7 @@ class Handler {
                return true;
        }
 
-       function before() {
+       function before($method) {
                return true;
        }
 
index aae5bbafb48bdbc9a7859925a73b023262f4bf76..fec95780a19bdfe85fec7789c9d034d9d8096ef1 100644 (file)
@@ -7,8 +7,8 @@ class Pref_Instances extends Protected_Handler {
                return array_search($method, $csrf_ignored) !== false;
        }
 
-       function before() {
-               if (parent::before()) {
+       function before($method) {
+               if (parent::before($method)) {
                        if ($_SESSION["access_level"] < 10) {
                                print __("Your access level is insufficient to open this tab.");
                                return false;
index 94ee270d37175c4d8bc3cf54480a72ded0846c4e..8f8f819f37a60998437f5db86bb3fa9acb29cbe8 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 class Pref_Users extends Protected_Handler {
-               function before() {
-                       if (parent::before()) {
+               function before($method) {
+                       if (parent::before($method)) {
                                if ($_SESSION["access_level"] < 10) {
                                        print __("Your access level is insufficient to open this tab.");
                                        return false;
index e8a6d40a7e41aa8b6ae868fafcaa686b183a68ed..5d8d690c39d0180c02bd6595fc309d8ecc36c843 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 class Protected_Handler extends Handler {
 
-       function before() {
-               return parent::before() && $_SESSION['uid'];
+       function before($method) {
+               return parent::before($method) && $_SESSION['uid'];
        }
 }
 ?>