]> Kevux Git Server - koopa/commitdiff
Bugfix: mistakes in path parameters and return values, also add a return value to...
authorKevin Day <thekevinday@gmail.com>
Tue, 16 May 2017 04:48:51 +0000 (23:48 -0500)
committerKevin Day <thekevinday@gmail.com>
Tue, 16 May 2017 04:48:51 +0000 (23:48 -0500)
common/standard/classes/standard_path.php
common/standard/classes/standard_paths.php
common/standard/internal/access_denied.php
common/standard/internal/bad_method.php
common/standard/internal/index.php
common/standard/internal/not_found.php
common/standard/internal/server_error.php

index a9bc1ef67d6ada523c978f9b77cdf911ac4108ff..030d908c6443f232fcd336c4e247a07537986b77 100644 (file)
@@ -199,6 +199,10 @@ class c_standard_path extends c_base_path {
 
   /**
    * Build the breadcrumb.
+   *
+   * @return c_base_return_status
+   *   TRUE on success, FALSE otherwise.
+   *   FALSE with error bit set is returned on error.
    */
   protected function pr_build_breadcrumbs() {
     $this->breadcrumbs = new c_base_menu_item();
@@ -221,6 +225,8 @@ class c_standard_path extends c_base_path {
     #}
 
     #$this->get_breadcrumbs();
+
+    return new c_base_return_true();
   }
 
   /**
index 8384adcffc3d262da53d33d756f88546b6554ce5..5d6d5321573a499eeed8f143f497de59696c8452 100644 (file)
@@ -441,9 +441,11 @@ class c_standard_paths extends c_base_return {
 
       // execute path handler, using custom-language if defined.
       if (empty($handler_settings['handler'])) {
-        $path_server_error = $this->get_handler_server_error()->do_execute($this->http, $this->database, $this->session, $this->settings);
-        $path_server_error->set_path_tree($path_tree);
+        $handler_server_error = $this->get_handler_server_error();
+        $handler_server_error->set_path_tree($path_tree);
+        $path_server_error = $handler_server_error->do_execute($this->http, $this->database, $this->session, $this->settings);
 
+        unset($handler_server_error);
         unset($handler_settings);
         unset($path_tree);
 
@@ -463,9 +465,11 @@ class c_standard_paths extends c_base_return {
 
           // attempt to fallback to default handler if the language-specific handler class is not found.
           if (!class_exists($handler_settings['handler'])) {
-            $path_server_error = $this->get_handler_server_error()->do_execute($this->http, $this->database, $this->session, $this->settings);
-            $path_server_error->set_path_tree($path_tree);
+            $handler_server_error = $this->get_handler_server_error();
+            $handler_server_error->set_path_tree($path_tree);
+            $path_server_error = $handler_server_error->do_execute($this->http, $this->database, $this->session, $this->settings);
 
+            unset($handler_server_error);
             unset($handler_settings);
             unset($path_tree);
 
@@ -483,9 +487,11 @@ class c_standard_paths extends c_base_return {
           $this->handler->set_path_tree($path_tree);
         }
         else {
-          $path_server_error = $this->get_handler_server_error()->do_execute($this->http, $this->database, $this->session, $this->settings);
-          $path_server_error->set_path_tree($path_tree);
+          $handler_server_error = $this->get_handler_server_error();
+          $handler_server_error->set_path_tree($path_tree);
+          $path_server_error = $handler_server_error->do_execute($this->http, $this->database, $this->session, $this->settings);
 
+          unset($handler_server_error);
           unset($handler_settings);
           unset($path_tree);
 
@@ -533,17 +539,17 @@ class c_standard_paths extends c_base_return {
 
     // user paths
     $this->paths->add_path(self::URI_USER_CREATE, self::HANDLER_USER_CREATE, self::PATH_USER, self::NAME_USER_CREATE);
-    $this->paths->add_path(self::URI_USER_CREATE, self::HANDLER_USER_CREATE, self::PATH_USER . self::WILDCARD_PATH, self::NAME_USER_CREATE);
+    $this->paths->add_path(self::URI_USER_CREATE . self::WILDCARD_PATH, self::HANDLER_USER_CREATE, self::PATH_USER, self::NAME_USER_CREATE);
     $this->paths->add_path(self::URI_USER_VIEW, self::HANDLER_USER_VIEW, self::PATH_USER, self::NAME_USER_VIEW);
-    $this->paths->add_path(self::URI_USER_VIEW, self::HANDLER_USER_VIEW, self::PATH_USER . self::WILDCARD_PATH, self::NAME_USER_VIEW);
+    $this->paths->add_path(self::URI_USER_VIEW . self::WILDCARD_PATH, self::HANDLER_USER_VIEW, self::PATH_USER, self::NAME_USER_VIEW);
     $this->paths->add_path(self::URI_USER_SETTINGS, self::HANDLER_USER_SETTINGS, self::PATH_USER, self::NAME_USER_SETTINGS);
-    $this->paths->add_path(self::URI_USER_SETTINGS, self::HANDLER_USER_SETTINGS, self::PATH_USER . self::WILDCARD_PATH, self::NAME_USER_SETTINGS);
+    $this->paths->add_path(self::URI_USER_SETTINGS . self::WILDCARD_PATH, self::HANDLER_USER_SETTINGS, self::PATH_USER, self::NAME_USER_SETTINGS);
     $this->paths->add_path(self::URI_USER_LOCK, self::HANDLER_USER_LOCK, self::PATH_USER, self::NAME_USER_LOCK);
-    $this->paths->add_path(self::URI_USER_LOCK, self::HANDLER_USER_LOCK, self::PATH_USER . self::WILDCARD_PATH, self::NAME_USER_LOCK);
+    $this->paths->add_path(self::URI_USER_LOCK . self::WILDCARD_PATH, self::HANDLER_USER_LOCK, self::PATH_USER, self::NAME_USER_LOCK);
     $this->paths->add_path(self::URI_USER_UNLOCK, self::HANDLER_USER_UNLOCK, self::PATH_USER, self::NAME_USER_UNLOCK);
-    $this->paths->add_path(self::URI_USER_UNLOCK, self::HANDLER_USER_UNLOCK, self::PATH_USER . self::WILDCARD_PATH, self::NAME_USER_UNLOCK);
+    $this->paths->add_path(self::URI_USER_UNLOCK . self::WILDCARD_PATH, self::HANDLER_USER_UNLOCK, self::PATH_USER, self::NAME_USER_UNLOCK);
     $this->paths->add_path(self::URI_USER_DELETE, self::HANDLER_USER_DELETE, self::PATH_USER, self::NAME_USER_DELETE);
-    $this->paths->add_path(self::URI_USER_DELETE, self::HANDLER_USER_DELETE, self::PATH_USER . self::WILDCARD_PATH, self::NAME_USER_DELETE);
+    $this->paths->add_path(self::URI_USER_DELETE . self::WILDCARD_PATH, self::HANDLER_USER_DELETE, self::PATH_USER, self::NAME_USER_DELETE);
   }
 
   /**
index 9ff65a347340eca88b5efba9d90c5d1417a7478a..c299ef016d2bb30d2f1d50442f8ff7f35cff1e29 100644 (file)
@@ -14,10 +14,20 @@ require_once('common/theme/classes/theme_html.php');
 class c_standard_path_access_denied extends c_standard_path {
 
   /**
-   * Build the breadcrumb.
+   * Implementation of pr_build_breadcrumbs().
    */
   protected function pr_build_breadcrumbs() {
-    $handler_settings = $this->path_tree->get_item_reset()->get_value();
+    if (!is_object($this->path_tree)) {
+      return parent::pr_build_breadcrumbs();
+    }
+
+    $handler_settings = $this->path_tree->get_item_reset();
+    if ($handler_settings instanceof c_base_return_false) {
+      unset($handler_settings);
+      return parent::pr_build_breadcrumbs();
+    }
+
+    $handler_settings = $handler_settings->get_value();
 
     if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
       return parent::pr_build_breadcrumbs();
@@ -57,6 +67,8 @@ class c_standard_path_access_denied extends c_standard_path {
 
     $this->breadcrumbs = $handler->get_breadcrumbs();
     unset($handler);
+
+    return new c_base_return_true();
   }
 
   /**
index fe9f8a4d2186c0566634298b4b6b4d7ad55b472a..9bef3e08a02e913a2b05830d3ab32526f86c2600 100644 (file)
@@ -14,10 +14,20 @@ require_once('common/theme/classes/theme_html.php');
 class c_standard_path_bad_method extends c_standard_path {
 
   /**
-   * Build the breadcrumb.
+   * Implementation of pr_build_breadcrumbs().
    */
   protected function pr_build_breadcrumbs() {
-    $handler_settings = $this->path_tree->get_item_reset()->get_value();
+    if (!is_object($this->path_tree)) {
+      return parent::pr_build_breadcrumbs();
+    }
+
+    $handler_settings = $this->path_tree->get_item_reset();
+    if ($handler_settings instanceof c_base_return_false) {
+      unset($handler_settings);
+      return parent::pr_build_breadcrumbs();
+    }
+
+    $handler_settings = $handler_settings->get_value();
 
     if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
       return parent::pr_build_breadcrumbs();
@@ -57,6 +67,8 @@ class c_standard_path_bad_method extends c_standard_path {
 
     $this->breadcrumbs = $handler->get_breadcrumbs();
     unset($handler);
+
+    return new c_base_return_true();
   }
 
   /**
index 06ee70fb61fc269cab0152b8d358553ea9ccd616..587f94dc8c5c39bf1283b5929ab934cd1095390f 100644 (file)
@@ -15,7 +15,7 @@ require_once('common/theme/classes/theme_html.php');
 class c_standard_path_index extends c_standard_path {
 
   /**
-   * Build the breadcrumb.
+   * Implementation of pr_build_breadcrumbs().
    */
   protected function pr_build_breadcrumbs() {
     $this->breadcrumbs = new c_base_menu_item();
@@ -23,6 +23,8 @@ class c_standard_path_index extends c_standard_path {
     $item = $this->pr_create_breadcrumbs_item($this->pr_get_text_breadcrumbs(0), '');
     $this->breadcrumbs->set_item($item);
     unset($item);
+
+    return new c_base_return_true();
   }
 
   /**
index 7c63e896318b0f2c3036b6fc57e84371fa8c889e..621dc50e0a8af85011f02cda523a68392adcce66 100644 (file)
@@ -14,10 +14,20 @@ require_once('common/theme/classes/theme_html.php');
 class c_standard_path_not_found extends c_standard_path {
 
   /**
-   * Build the breadcrumb.
+   * Implementation of pr_build_breadcrumbs().
    */
   protected function pr_build_breadcrumbs() {
-    $handler_settings = $this->path_tree->get_item_reset()->get_value();
+    if (!is_object($this->path_tree)) {
+      return parent::pr_build_breadcrumbs();
+    }
+
+    $handler_settings = $this->path_tree->get_item_reset();
+    if ($handler_settings instanceof c_base_return_false) {
+      unset($handler_settings);
+      return parent::pr_build_breadcrumbs();
+    }
+
+    $handler_settings = $handler_settings->get_value();
 
     if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
       return parent::pr_build_breadcrumbs();
@@ -57,6 +67,8 @@ class c_standard_path_not_found extends c_standard_path {
 
     $this->breadcrumbs = $handler->get_breadcrumbs();
     unset($handler);
+
+    return new c_base_return_true();
   }
 
   /**
index ea313ce37599e78cba43aeb28519602e4c9c9b7c..09301453d185a8032e7841118e7dd7f6c6088c45 100644 (file)
@@ -14,10 +14,20 @@ require_once('common/theme/classes/theme_html.php');
 class c_standard_path_server_error extends c_standard_path {
 
   /**
-   * Build the breadcrumb.
+   * Implementation of pr_build_breadcrumbs().
    */
   protected function pr_build_breadcrumbs() {
-    $handler_settings = $this->path_tree->get_item_reset()->get_value();
+    if (!is_object($this->path_tree)) {
+      return parent::pr_build_breadcrumbs();
+    }
+
+    $handler_settings = $this->path_tree->get_item_reset();
+    if ($handler_settings instanceof c_base_return_false) {
+      unset($handler_settings);
+      return parent::pr_build_breadcrumbs();
+    }
+
+    $handler_settings = $handler_settings->get_value();
 
     if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
       return parent::pr_build_breadcrumbs();
@@ -57,6 +67,8 @@ class c_standard_path_server_error extends c_standard_path {
 
     $this->breadcrumbs = $handler->get_breadcrumbs();
     unset($handler);
+
+    return new c_base_return_true();
   }
 
   /**