From 5033d533fc36a43cf5bc72724b948cfb7f2e8634 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 26 Apr 2017 08:21:32 -0500 Subject: [PATCH] Bugfix: internal pages were not processing language after redesign and use fix paths output handling When I wrote the language handling into the initial setting load function and then changed the output handling to be more dynamic, I forgot to update p_include_path(). Get rid of the loop when deciding the language include file suffix and only use the last entry in the aliases array (generally the shortest). There were some cases where I was still using $this->html instead of $this->content. Be more consistent by using $this->output instead of $this->content. --- program/reservation/reservation_paths.php | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/program/reservation/reservation_paths.php b/program/reservation/reservation_paths.php index 5ce5ee8..e6ee1ba 100644 --- a/program/reservation/reservation_paths.php +++ b/program/reservation/reservation_paths.php @@ -37,7 +37,7 @@ class c_reservation_paths { private $database = NULL; private $settings = NULL; private $session = NULL; - private $content = NULL; + private $output = NULL; private $logged_in = NULL; private $paths = NULL; @@ -49,7 +49,7 @@ class c_reservation_paths { $this->database = NULL; $this->settings = NULL; $this->session = NULL; - $this->content = NULL; + $this->output = NULL; $this->logged_in = NULL; $this->paths = NULL; $this->path = NULL; @@ -62,7 +62,7 @@ class c_reservation_paths { unset($this->http); unset($this->settings); unset($this->session); - unset($this->content); + unset($this->output); unset($this->logged_in); unset($this->paths); unset($this->path); @@ -119,7 +119,7 @@ class c_reservation_paths { $this->database = &$database; $this->settings = $settings; $this->session = &$session; - $this->content = NULL; + $this->output = NULL; $this->logged_in = $logged_in; @@ -430,6 +430,7 @@ class c_reservation_paths { $aliases = c_base_defaults_global::s_get_languages()::s_get_aliases_by_id($language)->get_value_exact(); } + unset($language); // use default if no aliases are found. if (empty($aliases)) { @@ -438,25 +439,20 @@ class c_reservation_paths { return new $class(); } - foreach ($aliases as $alias) { - // use include_once instead of require_require to allow for failsafe behavior. - @include_once($path . $alias . '/' . $name . '.php'); + $alias = end($aliases); + unset($aliases); - $language_class = $class . '_' . $alias; - if (class_exists($language_class)) { - unset($aliases); - unset($alias); + // use include_once instead of require_require to allow for failsafe behavior. + @include_once($path . $alias . '/' . $name . '.php'); - $this->html->set_attribute(c_base_markup_attributes::ATTRIBUTE_LANGUAGE, $language); - unset($language); + $language_class = $class . '_' . $alias; + if (class_exists($language_class)) { + unset($alias); - return new $language_class(); - } + return new $language_class(); } - unset($aliases); unset($alias); unset($language_class); - unset($language); // if unable to find, fallback to original class return new $class(); -- 1.8.3.1