From 0c061f2e46caaac99837c042bb93b7b236b8a8e4 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 2 Feb 2018 20:21:49 -0600 Subject: [PATCH] Update: standard path output format test should be available at the standard path level The output format is not specific to the user-level pages. The output format check should be a standard page-level check. --- common/standard/classes/standard_path.php | 28 ++++++++++++++++++++++++++ common/standard/classes/standard_path_user.php | 28 -------------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/common/standard/classes/standard_path.php b/common/standard/classes/standard_path.php index 42bf0d1..e8c5293 100644 --- a/common/standard/classes/standard_path.php +++ b/common/standard/classes/standard_path.php @@ -2674,5 +2674,33 @@ class c_standard_path extends c_base_path { protected function pr_process_access_denied(&$executed) { return FALSE; } + + /** + * Provides a standard access check handler function, specific for output format. + * + * This is generally intended to be called by do_execute(). + * + * @param c_base_path_executed &$executed + * The execution array for making changes to. + * Any detected errors are assigned to this. + * This often may have the output settings altered by this class implementation. + * + * @return bool + * FALSE on access granted, TRUE on access denied. + */ + protected function pr_process_output_format_denied(&$executed) { + + // only support HTML output unless otherwise needed. + // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). + if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { + $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); + $executed->set_error($error); + unset($error); + + return TRUE; + } + + return FALSE; + } } diff --git a/common/standard/classes/standard_path_user.php b/common/standard/classes/standard_path_user.php index 23a140a..200c18c 100644 --- a/common/standard/classes/standard_path_user.php +++ b/common/standard/classes/standard_path_user.php @@ -319,34 +319,6 @@ class c_standard_path_user extends c_standard_path { } /** - * Provides a standard access check handler function, specific for output format. - * - * This is generally intended to be called by do_execute(). - * - * @param c_base_path_executed &$executed - * The execution array for making changes to. - * Any detected errors are assigned to this. - * This often may have the output settings altered by this class implementation. - * - * @return bool - * FALSE on access granted, TRUE on access denied. - */ - protected function pr_process_output_format_denied(&$executed) { - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return TRUE; - } - - return FALSE; - } - - /** * Execution of the view path. * * @param c_base_path_executed &$executed -- 1.8.3.1