From d0a6e9a4fbe4d3c10cd4d95c3f80409e0d1f799f Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 4 Sep 2017 22:37:24 -0500 Subject: [PATCH] Progress: url paths In particular, begin initial work on output formats other than HTML. - This is initial work and is subject to change (currently a brainstorm). Add more common paths and appropriate files and classes. - Most of these classes are stubs and will be populated eventually. Cleanup the c_base_html class. Move pr_process_arguments() to c_standard_path where it resides alongside the $arguments class variable. Be more verbose with the function name pr_paths_create() (now called pr_paths_create_always()). Add additional columns to the file database table. --- common/base/classes/base_ajax.php | 37 ++ common/base/classes/base_file.php | 653 +++++++++++++++++++++ common/base/classes/base_html.php | 570 +++++++++--------- common/standard/classes/standard_index.php | 107 +++- common/standard/classes/standard_path.php | 18 + common/standard/classes/standard_paths.php | 280 +++++++-- common/standard/paths/a/administer_content.php | 122 ++++ .../a/{dashboard.php => administer_dashboard.php} | 15 +- common/standard/paths/a/administer_logs.php | 122 ++++ common/standard/paths/a/ja/administer_content.php | 29 + .../ja/{dashboard.php => administer_dashboard.php} | 2 +- common/standard/paths/a/ja/administer_logs.php | 29 + common/standard/paths/c/cache_error.php | 73 +++ common/standard/paths/c/cache_static.php | 74 +++ common/standard/paths/c/ja/cache_error.php | 11 + common/standard/paths/c/ja/cache_static.php | 11 + common/standard/paths/f/file_by_checksum.php | 37 ++ common/standard/paths/f/file_by_id.php | 37 ++ .../standard/paths/f/file_checksum_by_checksum.php | 37 ++ common/standard/paths/f/file_checksum_by_id.php | 37 ++ common/standard/paths/f/ja/file_by_checksum.php | 11 + common/standard/paths/f/ja/file_by_id.php | 11 + .../paths/f/ja/file_checksum_by_checksum.php | 11 + common/standard/paths/f/ja/file_checksum_by_id.php | 11 + common/standard/paths/m/ja/management_content.php | 29 + .../ja/{dashboard.php => management_dashboard.php} | 2 +- common/standard/paths/m/ja/management_logs.php | 29 + common/standard/paths/m/management_content.php | 122 ++++ .../m/{dashboard.php => management_dashboard.php} | 7 - common/standard/paths/m/management_logs.php | 122 ++++ common/standard/paths/s/ja/submit_form_id.php | 11 + common/standard/paths/s/submit_form_id.php | 37 ++ common/standard/paths/u/ja/user_contact.php | 0 common/standard/paths/u/ja/user_content.php | 0 common/standard/paths/u/ja/user_logs.php | 0 common/standard/paths/u/ja/user_reset.php | 0 common/standard/paths/u/user_contact.php | 0 common/standard/paths/u/user_content.php | 0 common/standard/paths/u/user_logs.php | 0 common/standard/paths/u/user_reset.php | 0 database/sql/standard/standard-files.sql | 12 +- documentation/url_paths.txt | 5 +- 42 files changed, 2330 insertions(+), 391 deletions(-) create mode 100644 common/base/classes/base_ajax.php create mode 100644 common/base/classes/base_file.php create mode 100644 common/standard/paths/a/administer_content.php rename common/standard/paths/a/{dashboard.php => administer_dashboard.php} (88%) create mode 100644 common/standard/paths/a/administer_logs.php create mode 100644 common/standard/paths/a/ja/administer_content.php rename common/standard/paths/a/ja/{dashboard.php => administer_dashboard.php} (90%) create mode 100644 common/standard/paths/a/ja/administer_logs.php create mode 100644 common/standard/paths/c/cache_error.php create mode 100644 common/standard/paths/c/cache_static.php create mode 100644 common/standard/paths/c/ja/cache_error.php create mode 100644 common/standard/paths/c/ja/cache_static.php create mode 100644 common/standard/paths/f/file_by_checksum.php create mode 100644 common/standard/paths/f/file_by_id.php create mode 100644 common/standard/paths/f/file_checksum_by_checksum.php create mode 100644 common/standard/paths/f/file_checksum_by_id.php create mode 100644 common/standard/paths/f/ja/file_by_checksum.php create mode 100644 common/standard/paths/f/ja/file_by_id.php create mode 100644 common/standard/paths/f/ja/file_checksum_by_checksum.php create mode 100644 common/standard/paths/f/ja/file_checksum_by_id.php create mode 100644 common/standard/paths/m/ja/management_content.php rename common/standard/paths/m/ja/{dashboard.php => management_dashboard.php} (90%) create mode 100644 common/standard/paths/m/ja/management_logs.php create mode 100644 common/standard/paths/m/management_content.php rename common/standard/paths/m/{dashboard.php => management_dashboard.php} (92%) create mode 100644 common/standard/paths/m/management_logs.php create mode 100644 common/standard/paths/s/ja/submit_form_id.php create mode 100644 common/standard/paths/s/submit_form_id.php create mode 100644 common/standard/paths/u/ja/user_contact.php create mode 100644 common/standard/paths/u/ja/user_content.php create mode 100644 common/standard/paths/u/ja/user_logs.php create mode 100644 common/standard/paths/u/ja/user_reset.php create mode 100644 common/standard/paths/u/user_contact.php create mode 100644 common/standard/paths/u/user_content.php create mode 100644 common/standard/paths/u/user_logs.php create mode 100644 common/standard/paths/u/user_reset.php diff --git a/common/base/classes/base_ajax.php b/common/base/classes/base_ajax.php new file mode 100644 index 0000000..0aecb97 --- /dev/null +++ b/common/base/classes/base_ajax.php @@ -0,0 +1,37 @@ +id = NULL; + $this->id_creator = NULL; + $this->id_creator_session = NULL; + $this->id_type = NULL; + $this->id_group = NULL; + + $this->name_machine = NULL; + $this->name_human = NULL; + $this->name_extension = NULL; + + $this->field_size = NULL; + $this->field_width = NULL; + $this->field_height = NULL; + + $this->date_created = NULL; + $this->date_changed = NULL; + $this->date_locked = NULL; + $this->date_deleted = NULL; + } + + /** + * Class destructor. + */ + public function __destruct() { + unset($this->id); + unset($this->id_creator); + unset($this->id_creator_session); + unset($this->id_type); + unset($this->id_group); + + unset($this->name_machine); + unset($this->name_human); + unset($this->name_extension); + + unset($this->field_size); + unset($this->field_width); + unset($this->field_height); + + unset($this->date_created); + unset($this->date_changed); + unset($this->date_locked); + unset($this->date_deleted); + + parent::__destruct(); + } + + /** + * @see: t_base_return_value::p_s_new() + */ + public static function s_new($value) { + return self::p_s_new($value, __CLASS__); + } + + /** + * @see: t_base_return_value::p_s_value() + */ + public static function s_value($return) { + return self::p_s_value($return, __CLASS__); + } + + /** + * @see: t_base_return_value_exact::p_s_value_exact() + */ + public static function s_value_exact($return) { + return self::p_s_value_exact($return, __CLASS__, ''); + } + + /** + * Assign the file id. + * + * @param int $id + * The file id. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_id($id) { + if (!is_int($id)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'id', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->id = $id; + return new c_base_return_true(); + } + + /** + * Assign the file creator. + * + * @param int $id_creator + * The file creator id. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_id_creator($id_creator) { + if (!is_int($id_creator)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'id_creator', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->id_creator = $id_creator; + return new c_base_return_true(); + } + + /** + * Assign the file creator (session). + * + * @param int $id_creator_session + * The file creator id. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_id_creator_session($id_creator_session) { + if (!is_int($id_creator_session)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'id_creator_session', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->id_creator_session = $id_creator_session; + return new c_base_return_true(); + } + + /** + * Assign a mime type. + * + * @param int $id_type + * The mime type code. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_id_type($id_type) { + if (!is_int($id_type)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'id_type', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->id_type = $id_type; + return new c_base_return_true(); + } + + /** + * Assign the file group id. + * + * @param int|null $id_group + * The group id or NULL if no group is assigned. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_id_group($id_group) { + if (!is_null($id_group) && !is_int($id_group)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'id_group', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->id_group = $id_group; + return new c_base_return_true(); + } + + /** + * Set the file machine name. + * + * @param int $name_machine + * The file machine name. + * + * @return c_base_return_status + * TRUE on success. + * FALSE with error bit set is returned on error. + */ + public function set_name_machine($name_machine) { + if (!is_string($name_machine)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'name_machine', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->name_machine = $name_machine; + return new c_base_return_true(); + } + + /** + * Set the file human name. + * + * @param int $name_human + * The file human name. + * + * @return c_base_return_status + * TRUE on success. + * FALSE with error bit set is returned on error. + */ + public function set_name_human($name_human) { + if (!is_string($name_human)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'name_human', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->name_human = $name_human; + return new c_base_return_true(); + } + + /** + * Set the file extension. + * + * @param int $name_extension + * The file extension. + * + * @return c_base_return_status + * TRUE on success. + * FALSE with error bit set is returned on error. + */ + public function set_name_extension($name_extension) { + if (!is_string($name_extension)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'name_extension', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->name_extension = $name_extension; + return new c_base_return_true(); + } + + /** + * Assign the file size. + * + * @param int $field_size + * The file size number. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_field_size($field_size) { + if (!is_int($field_size)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'field_size', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->field_size = $field_size; + return new c_base_return_true(); + } + + /** + * Assign the file width. + * + * @param int|null $field_width + * The file width (generally applies to images only). + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_field_width($field_width) { + if (!is_null($field_width) && !is_int($field_width)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'field_width', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->field_width = $field_width; + return new c_base_return_true(); + } + + /** + * Assign the file height. + * + * @param int|null $field_height + * The file height (generally applies to images only). + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_field_height($field_height) { + if (!is_null($field_height) && !is_int($field_height)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'field_height', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->field_height = $field_height; + return new c_base_return_true(); + } + + /** + * Set the created date. + * + * @param int|float $date_created + * The created date. + * + * @return c_base_return_status + * TRUE on success. + * FALSE with error bit set is returned on error. + */ + public function set_date_created($date_created) { + if (!is_int($date_created) && !is_float($date_created)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_created', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->date_created = $date_created; + return new c_base_return_true(); + } + + /** + * Set the changed date. + * + * @param int|float $date_changed + * The changed date. + * + * @return c_base_return_status + * TRUE on success. + * FALSE with error bit set is returned on error. + */ + public function set_date_changed($date_changed) { + if (!is_int($date_changed) && !is_float($date_changed)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_changed', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->date_changed = $date_changed; + return new c_base_return_true(); + } + + /** + * Set the locked date. + * + * @param int|float $date_locked + * The locked date. + * + * @return c_base_return_status + * TRUE on success. + * FALSE with error bit set is returned on error. + */ + public function set_date_locked($date_locked) { + if (!is_int($date_locked) && !is_float($date_locked)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_locked', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->date_locked = $date_locked; + return new c_base_return_true(); + } + + /** + * Set the deleted date. + * + * @param int|float $date_deleted + * The deleted date. + * + * @return c_base_return_status + * TRUE on success. + * FALSE with error bit set is returned on error. + */ + public function set_date_deleted($date_deleted) { + if (!is_int($date_deleted) && !is_float($date_deleted)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_deleted', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->date_deleted = $date_deleted; + return new c_base_return_true(); + } + + /** + * Get the file id. + * + * @return c_base_return_int|c_base_return_status + * The file id. + * FALSE is returned if no type is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_id() { + if (!is_int($this->id)) { + return new c_base_return_false(); + } + + return c_base_return_int::s_new($this->id); + } + + /** + * Get file creator id. + * + * @return c_base_return_int|c_base_return_status + * The file creator user id. + * FALSE is returned if no type is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_id_creator() { + if (!is_int($this->id_creator)) { + return new c_base_return_false(); + } + + return c_base_return_int::s_new($this->id_creator); + } + + /** + * Get the file id_creator_session. + * + * @return c_base_return_int|c_base_return_status + * The file creator (session). + * FALSE is returned if no type is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_id_creator_session() { + if (!is_int($this->id_creator_session)) { + return new c_base_return_false(); + } + + return c_base_return_int::s_new($this->id_creator_session); + } + + /** + * Get the mime type associated with this file. + * + * @return c_base_return_int|c_base_return_status + * The mime type code. + * FALSE is returned if no type is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_id_type() { + if (!is_int($this->id_type)) { + return new c_base_return_false(); + } + + return c_base_return_int::s_new($this->id_type); + } + + /** + * Get the file group id. + * + * @return c_base_return_int|c_base_return_null + * The group id. + * FALSE is returned if no group id is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_id_group() { + if (!is_int($this->id_group)) { + return new c_base_return_null(); + } + + return c_base_return_int::s_new($this->id_group); + } + + /** + * Get the machine name associated with the file. + * + * @return c_base_return_string|c_base_return_status + * The machine name. + * FALSE is returned if no machine name is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_name_machine() { + if (!is_string($this->name_machine)) { + return new c_base_return_false(); + } + + return c_base_return_string::s_new($this->name_machine); + } + + /** + * Get the human name associated with the file. + * + * @return c_base_return_string|c_base_return_status + * The human name. + * FALSE is returned if no machine name is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_name_human() { + if (!is_string($this->name_human)) { + return new c_base_return_false(); + } + + return c_base_return_string::s_new($this->name_human); + } + + /** + * Get the file name extension associated with the file. + * + * @return c_base_return_string|c_base_return_status + * The file name extension. + * FALSE is returned if no machine name is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_name_extension() { + if (!is_string($this->name_extension)) { + return new c_base_return_false(); + } + + return c_base_return_string::s_new($this->name_extension); + } + + /** + * Get the file size. + * + * @return c_base_return_int|c_base_return_status + * The file size. + * FALSE is returned if no file size is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_field_size() { + if (!is_int($this->field_size)) { + return new c_base_return_false(); + } + + return c_base_return_int::s_new($this->field_size); + } + + /** + * Get the file width (generally for images). + * + * @return c_base_return_int|c_base_return_null|c_base_return_status + * The file width. + * NULL is returned if no file width is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_field_width() { + if (!is_int($this->field_width)) { + return new c_base_return_null(); + } + + return c_base_return_int::s_new($this->field_width); + } + + /** + * Get the file height (generally for images). + * + * @return c_base_return_int|c_base_return_null|c_base_return_status + * The file height. + * NULL is returned if no file height is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_field_height() { + if (!is_int($this->field_height)) { + return new c_base_return_null(); + } + + return c_base_return_int::s_new($this->field_height); + } + + /** + * Gets the date created setting. + * + * @return c_base_return_float|c_base_return_status + * Date created on success. + * FALSE is returned if the date is not assigned. + * Error bit is set on error. + */ + public function get_date_created() { + if (!is_float($this->date_created)) { + return new c_base_return_false(); + } + + return c_base_return_float::s_new($this->date_created); + } + + /** + * Gets the date changed setting. + * + * @return c_base_return_float|c_base_return_status + * Date changed on success. + * FALSE is returned if the date is not assigned. + * Error bit is set on error. + */ + public function get_date_changed() { + if (!is_float($this->date_changed)) { + return new c_base_return_null(); + } + + return c_base_return_float::s_new($this->date_changed); + } + + /** + * Gets the date locked setting. + * + * @return c_base_return_float|c_base_return_status + * Date locked on success. + * NULL is returned if the date is not assigned. + * Error bit is set on error. + */ + public function get_date_locked() { + if (!is_float($this->date_locked)) { + return new c_base_return_null(); + } + + return c_base_return_float::s_new($this->date_locked); + } + + /** + * Gets the date deleted setting. + * + * @return c_base_return_float|c_base_return_status + * Date deleted on success. + * FALSE is returned if the date is not assigned. + * Error bit is set on error. + */ + public function get_date_deleted() { + if (!is_float($this->date_deleted)) { + return new c_base_return_false(); + } + + return c_base_return_float::s_new($this->date_deleted); + } +} diff --git a/common/base/classes/base_html.php b/common/base/classes/base_html.php index 2a04c3b..cdb883b 100644 --- a/common/base/classes/base_html.php +++ b/common/base/classes/base_html.php @@ -22,8 +22,6 @@ class c_base_html extends c_base_return { protected $id; protected $attributes; protected $attributes_body; - protected $type; - protected $method; protected $headers; protected $body; @@ -34,10 +32,12 @@ class c_base_html extends c_base_return { parent::__construct(); $this->id = NULL; - $this->attributes = array(); + + $this->attributes = array(); $this->attributes_body = array(); + $this->headers = array(); - $this->body = array(); + $this->body = array(); } /** @@ -45,8 +45,10 @@ class c_base_html extends c_base_return { */ public function __destruct() { unset($this->id); + unset($this->attributes); unset($this->attributes_body); + unset($this->headers); unset($this->body); @@ -141,22 +143,6 @@ class c_base_html extends c_base_return { } /** - * Get the unique id assigned to this HTML page. - * - * @return c_base_return_int|c_base_return_status - * The unique numeric id assigned to this object. - * FALSE is returned if no id is assigned. - * FALSE with error bit set is returned on error. - */ - public function get_id() { - if (!is_int($this->id)) { - return new c_base_return_false(); - } - - return c_base_return_int::s_new($this->id); - } - - /** * Assign the specified attribute. * * @param int $attribute @@ -201,6 +187,114 @@ class c_base_html extends c_base_return { } /** + * Assign a tag to the HTML. + * + * @param c_base_markup_tag $tag + * The html tag tp assign. + * @param int|null $delta + * (optional) A position in the page to assign the tag. + * If NULL, then the tag is appended. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + public function set_tag($tag, $delta = NULL) { + if (!($tag instanceof c_base_markup_tag)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'tag', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + if (!is_null($delta) && !is_int($delta)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'delta', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + if (!is_array($this->body)) { + $this->body = array(); + } + + if (is_null($delta)) { + $this->body[] = $tag; + } + else { + $this->body[$delta] = $tag; + } + return new c_base_return_true(); + } + + /** + * Assign a header to the HTML. + * + * @param c_base_markup_tag $header + * The html header tp assign. + * @param int|null $delta + * (optional) A position in the page to assign the header. + * If NULL, then the header is appended. + * + * @return c_base_return_int|c_base_return_status + * An integer representing the delta of where the header was added. + * FALSE with error bit set is returned on error. + */ + public function set_header($header, $delta = NULL) { + if (!($header instanceof c_base_markup_tag)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'header', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + if (!is_null($delta) && !is_int($delta)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'delta', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + // only certain header types are allowed. + $type = $header->get_type()->get_value_exact(); + switch ($type) { + case c_base_markup_tag::TYPE_BASE: + case c_base_markup_tag::TYPE_LINK: + case c_base_markup_tag::TYPE_META: + case c_base_markup_tag::TYPE_NO_SCRIPT: + case c_base_markup_tag::TYPE_SCRIPT: + case c_base_markup_tag::TYPE_STYLE: + case c_base_markup_tag::TYPE_TITLE: + break; + default: + return new c_base_retun_false(); + } + + if (!is_array($this->headers)) { + $this->headers = array(); + } + + if (is_null($delta)) { + $at = count($this->headers); + $this->headers[] = $header; + } + else { + $at = $delta; + $this->headers[$delta] = $header; + } + + return c_base_return_int::s_new($at); + } + + /** + * Get the unique id assigned to this HTML page. + * + * @return c_base_return_int|c_base_return_status + * The unique numeric id assigned to this object. + * FALSE is returned if no id is assigned. + * FALSE with error bit set is returned on error. + */ + public function get_id() { + if (!is_int($this->id)) { + return new c_base_return_false(); + } + + return c_base_return_int::s_new($this->id); + } + + /** * Get the attributes assigned to this object. * * @return c_base_return_array @@ -258,43 +352,6 @@ class c_base_html extends c_base_return { } /** - * Assign a tag to the HTML. - * - * @param c_base_markup_tag $tag - * The html tag tp assign. - * @param int|null $delta - * (optional) A position in the page to assign the tag. - * If NULL, then the tag is appended. - * - * @return c_base_return_status - * TRUE on success, FALSE otherwise. - * FALSE with error bit set is returned on error. - */ - public function set_tag($tag, $delta = NULL) { - if (!($tag instanceof c_base_markup_tag)) { - $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'tag', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); - return c_base_return_error::s_false($error); - } - - if (!is_null($delta) && !is_int($delta)) { - $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'delta', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); - return c_base_return_error::s_false($error); - } - - if (!is_array($this->body)) { - $this->body = array(); - } - - if (is_null($delta)) { - $this->body[] = $tag; - } - else { - $this->body[$delta] = $tag; - } - return new c_base_return_true(); - } - - /** * Get tag from the HTML. * * @param int $delta @@ -334,61 +391,6 @@ class c_base_html extends c_base_return { } /** - * Assign a header to the HTML. - * - * @param c_base_markup_tag $header - * The html header tp assign. - * @param int|null $delta - * (optional) A position in the page to assign the header. - * If NULL, then the header is appended. - * - * @return c_base_return_int|c_base_return_status - * An integer representing the delta of where the header was added. - * FALSE with error bit set is returned on error. - */ - public function set_header($header, $delta = NULL) { - if (!($header instanceof c_base_markup_tag)) { - $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'header', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); - return c_base_return_error::s_false($error); - } - - if (!is_null($delta) && !is_int($delta)) { - $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'delta', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); - return c_base_return_error::s_false($error); - } - - // only certain header types are allowed. - $type = $header->get_type()->get_value_exact(); - switch ($type) { - case c_base_markup_tag::TYPE_BASE: - case c_base_markup_tag::TYPE_LINK: - case c_base_markup_tag::TYPE_META: - case c_base_markup_tag::TYPE_NO_SCRIPT: - case c_base_markup_tag::TYPE_SCRIPT: - case c_base_markup_tag::TYPE_STYLE: - case c_base_markup_tag::TYPE_TITLE: - break; - default: - return new c_base_retun_false(); - } - - if (!is_array($this->headers)) { - $this->headers = array(); - } - - if (is_null($delta)) { - $at = count($this->headers); - $this->headers[] = $header; - } - else { - $at = $delta; - $this->headers[$delta] = $header; - } - - return c_base_return_int::s_new($at); - } - - /** * Get header from the HTML. * * @param int $delta @@ -555,45 +557,26 @@ class c_base_html extends c_base_return { } /** - * Get the value of a single attribute assigned to this object. + * Assign the specified tag. * * @param int $attribute * The attribute to assign. + * @param $value + * The value of the attribute. + * The actual value type is specific to each attribute type. * @param bool $body - * (optional) When TRUE, the body attributes are returned. - * When FALSE, the normal attributes are returned. + * (optional) When TRUE, the body attributes are assigned. + * When FALSE, the normal attributes are assigned. * - * @return c_base_return_int|c_base_return_string|c_base_return_bool|c_base_return_status - * The value assigned to the attribute (the data type is different per attribute). - * FALSE is returned if the element does not exist. + * @return c_base_return_status + * TRUE on success, FALSE otherwise. * FALSE with error bit set is returned on error. */ - private function p_get_attribute($attribute, $body = FALSE) { - if ($body) { - if (!isset($this->attributes_body) && !is_array($this->attributes_body)) { - $this->attributes_body = array(); - } - } - else { - if (!isset($this->attributes) && !is_array($this->attributes)) { - $this->attributes = array(); - } - } - - if ($body) { - if (!array_key_exists($attribute, $this->attributes_body)) { - return new c_base_return_false(); - } - } - else { - if (!array_key_exists($attribute, $this->attributes)) { - return new c_base_return_false(); - } - } - - switch ($attribute) { - case c_base_markup_attributes::ATTRIBUTE_NONE: - return new c_base_return_null(); + private function p_set_attribute($attribute, $value, $body = FALSE) { + switch ($attribute) { + case c_base_markup_attributes::ATTRIBUTE_NONE: + unset($this->attribute[$attribute]); + return new c_base_return_true(); case c_base_markup_attributes::ATTRIBUTE_ABBR: case c_base_markup_attributes::ATTRIBUTE_ACCESS_KEY: @@ -806,12 +789,18 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_XMLNS_XLINK: case c_base_markup_attributes::ATTRIBUTE_XML_SPACE: case c_base_markup_attributes::ATTRIBUTE_ZOOM_AND_PAN: - if ($body) { - return c_base_return_string::s_new($this->attributes_body[$attribute]); + if (!is_string($value)) { + return new c_base_return_false(); } - else { - return c_base_return_string::s_new($this->attributes[$attribute]); + break; + + case c_base_markup_attributes::ATTRIBUTE_XLINK_SHOW: + case c_base_markup_attributes::ATTRIBUTE_XLINK_ACTUATE: + case c_base_markup_attributes::ATTRIBUTE_XLINK_HREF: + if (!is_string($value)) { + return new c_base_return_false(); } + break; case c_base_markup_attributes::ATTRIBUTE_ARIA_ATOMIC: case c_base_markup_attributes::ATTRIBUTE_ARIA_AUTOCOMPLETE: @@ -848,22 +837,10 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_ARIA_VALUE_MINIMIM: case c_base_markup_attributes::ATTRIBUTE_ARIA_VALUE_NOW: case c_base_markup_attributes::ATTRIBUTE_ARIA_VALUE_TEXT: - if ($body) { - return c_base_return_string::s_new($this->attributes_body[$attribute]); - } - else { - return c_base_return_string::s_new($this->attributes[$attribute]); - } - - case c_base_markup_attributes::ATTRIBUTE_XLINK_SHOW: - case c_base_markup_attributes::ATTRIBUTE_XLINK_ACTUATE: - case c_base_markup_attributes::ATTRIBUTE_XLINK_HREF: - if ($body) { - return c_base_return_string::s_new($this->attributes_body[$attribute]); - } - else { - return c_base_return_string::s_new($this->attributes[$attribute]); + if (!is_string($value)) { + return new c_base_return_false(); } + break; case c_base_markup_attributes::ATTRIBUTE_ASYNCHRONOUS: case c_base_markup_attributes::ATTRIBUTE_ATTRIBUTE_NAME: @@ -890,49 +867,30 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_SORTABLE: case c_base_markup_attributes::ATTRIBUTE_SORTED: case c_base_markup_attributes::ATTRIBUTE_SPELLCHECK: - if ($body) { - return c_base_return_bool::s_new($this->attributes_body[$attribute]); - } - else { - return c_base_return_bool::s_new($this->attributes[$attribute]); + if (!is_bool($value)) { + return new c_base_return_false(); } + break; case c_base_markup_attributes::ATTRIBUTE_ACCEPT: case c_base_markup_attributes::ATTRIBUTE_FORM_ENCODE_TYPE: case c_base_markup_attributes::ATTRIBUTE_ENCODING_TYPE: case c_base_markup_attributes::ATTRIBUTE_TYPE: - if ($body) { - return c_base_return_int::s_new($this->attributes_body[$attribute]); - } - else { - return c_base_return_int::s_new($this->attributes[$attribute]); + if (!$this->pr_validate_value_mime_type($value)) { + return new c_base_return_false(); } + break; case c_base_markup_attributes::ATTRIBUTE_ACCEPT_CHARACTER_SET: case c_base_markup_attributes::ATTRIBUTE_CHARACTER_SET: - if ($body) { - return c_base_return_int::s_new($this->attributes_body[$attribute]); - } - else { - return c_base_return_int::s_new($this->attributes[$attribute]); + if (!$this->pr_validate_value_character_set($value)) { + return new c_base_return_false(); } + break; case c_base_markup_attributes::ATTRIBUTE_DIRECTION: - if ($body) { - if (is_int($this->attributes_body[$attribute])) { - return c_base_return_int::s_new($this->attributes_body[$attribute]); - } - elseif (is_null($this->attributes_body[$attribute])) { - return new c_base_return_null(); - } - } - else { - if (is_int($this->attributes[$attribute])) { - return c_base_return_int::s_new($this->attributes[$attribute]); - } - elseif (is_null($this->attributes[$attribute])) { - return new c_base_return_null(); - } + if (!is_null($value) && !is_int($value)) { + return new c_base_return_false(); } break; @@ -975,57 +933,96 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_Y: case c_base_markup_attributes::ATTRIBUTE_Y_1: case c_base_markup_attributes::ATTRIBUTE_Y_2: - if ($body) { - return c_base_return_int::s_new($this->attributes_body[$attribute]); - } - else { - return c_base_return_int::s_new($this->attributes[$attribute]); - } - - case c_base_markup_attributes::ATTRIBUTE_FORM_METHOD: - if ($body) { - return c_base_return_int::s_new($this->attributes_body[$attribute]); - } - else { - return c_base_return_int::s_new($this->attributes[$attribute]); + if (!is_int($value)) { + return new c_base_return_false(); } + break; case c_base_markup_attributes::ATTRIBUTE_CLASS: - if ($body) { - return c_base_return_array::s_new($this->attributes_body[$attribute]); + if (!is_array($value)) { + if (is_string($value)) { + if ($body) { + if (!isset($this->attributes_body[$attribute])) { + $this->attributes_body[$attribute] = array(); + } + + $this->attributes_body[$attribute][] = $value; + } + else { + if (!isset($this->attributes[$attribute])) { + $this->attributes[$attribute] = array(); + } + + $this->attributes[$attribute][] = $value; + } + + return new c_base_return_true(); + } + + return new c_base_return_false(); } - else { - return c_base_return_array::s_new($this->attributes[$attribute]); + break; + + case c_base_markup_attributes::ATTRIBUTE_FORM_METHOD: + if (!$this->pr_validate_value_http_method($value)) { + return new c_base_return_false(); } + break; default: return new c_base_return_false(); } - return new c_base_return_false(); + if ($body) { + $this->attributes_body[$attribute] = $value; + } + else { + $this->attributes[$attribute] = $value; + } + + return new c_base_return_true(); } /** - * Assign the specified tag. + * Get the value of a single attribute assigned to this object. * * @param int $attribute * The attribute to assign. - * @param $value - * The value of the attribute. - * The actual value type is specific to each attribute type. * @param bool $body - * (optional) When TRUE, the body attributes are assigned. - * When FALSE, the normal attributes are assigned. + * (optional) When TRUE, the body attributes are returned. + * When FALSE, the normal attributes are returned. * - * @return c_base_return_status - * TRUE on success, FALSE otherwise. + * @return c_base_return_int|c_base_return_string|c_base_return_bool|c_base_return_status + * The value assigned to the attribute (the data type is different per attribute). + * FALSE is returned if the element does not exist. * FALSE with error bit set is returned on error. */ - private function p_set_attribute($attribute, $value, $body = FALSE) { + private function p_get_attribute($attribute, $body = FALSE) { + if ($body) { + if (!isset($this->attributes_body) && !is_array($this->attributes_body)) { + $this->attributes_body = array(); + } + } + else { + if (!isset($this->attributes) && !is_array($this->attributes)) { + $this->attributes = array(); + } + } + + if ($body) { + if (!array_key_exists($attribute, $this->attributes_body)) { + return new c_base_return_false(); + } + } + else { + if (!array_key_exists($attribute, $this->attributes)) { + return new c_base_return_false(); + } + } + switch ($attribute) { case c_base_markup_attributes::ATTRIBUTE_NONE: - unset($this->attribute[$attribute]); - return new c_base_return_true(); + return new c_base_return_null(); case c_base_markup_attributes::ATTRIBUTE_ABBR: case c_base_markup_attributes::ATTRIBUTE_ACCESS_KEY: @@ -1238,18 +1235,12 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_XMLNS_XLINK: case c_base_markup_attributes::ATTRIBUTE_XML_SPACE: case c_base_markup_attributes::ATTRIBUTE_ZOOM_AND_PAN: - if (!is_string($value)) { - return new c_base_return_false(); + if ($body) { + return c_base_return_string::s_new($this->attributes_body[$attribute]); } - break; - - case c_base_markup_attributes::ATTRIBUTE_XLINK_SHOW: - case c_base_markup_attributes::ATTRIBUTE_XLINK_ACTUATE: - case c_base_markup_attributes::ATTRIBUTE_XLINK_HREF: - if (!is_string($value)) { - return new c_base_return_false(); + else { + return c_base_return_string::s_new($this->attributes[$attribute]); } - break; case c_base_markup_attributes::ATTRIBUTE_ARIA_ATOMIC: case c_base_markup_attributes::ATTRIBUTE_ARIA_AUTOCOMPLETE: @@ -1286,10 +1277,22 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_ARIA_VALUE_MINIMIM: case c_base_markup_attributes::ATTRIBUTE_ARIA_VALUE_NOW: case c_base_markup_attributes::ATTRIBUTE_ARIA_VALUE_TEXT: - if (!is_string($value)) { - return new c_base_return_false(); + if ($body) { + return c_base_return_string::s_new($this->attributes_body[$attribute]); + } + else { + return c_base_return_string::s_new($this->attributes[$attribute]); + } + + case c_base_markup_attributes::ATTRIBUTE_XLINK_SHOW: + case c_base_markup_attributes::ATTRIBUTE_XLINK_ACTUATE: + case c_base_markup_attributes::ATTRIBUTE_XLINK_HREF: + if ($body) { + return c_base_return_string::s_new($this->attributes_body[$attribute]); + } + else { + return c_base_return_string::s_new($this->attributes[$attribute]); } - break; case c_base_markup_attributes::ATTRIBUTE_ASYNCHRONOUS: case c_base_markup_attributes::ATTRIBUTE_ATTRIBUTE_NAME: @@ -1316,30 +1319,49 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_SORTABLE: case c_base_markup_attributes::ATTRIBUTE_SORTED: case c_base_markup_attributes::ATTRIBUTE_SPELLCHECK: - if (!is_bool($value)) { - return new c_base_return_false(); + if ($body) { + return c_base_return_bool::s_new($this->attributes_body[$attribute]); + } + else { + return c_base_return_bool::s_new($this->attributes[$attribute]); } - break; case c_base_markup_attributes::ATTRIBUTE_ACCEPT: case c_base_markup_attributes::ATTRIBUTE_FORM_ENCODE_TYPE: case c_base_markup_attributes::ATTRIBUTE_ENCODING_TYPE: case c_base_markup_attributes::ATTRIBUTE_TYPE: - if (!$this->pr_validate_value_mime_type($value)) { - return new c_base_return_false(); + if ($body) { + return c_base_return_int::s_new($this->attributes_body[$attribute]); + } + else { + return c_base_return_int::s_new($this->attributes[$attribute]); } - break; case c_base_markup_attributes::ATTRIBUTE_ACCEPT_CHARACTER_SET: case c_base_markup_attributes::ATTRIBUTE_CHARACTER_SET: - if (!$this->pr_validate_value_character_set($value)) { - return new c_base_return_false(); + if ($body) { + return c_base_return_int::s_new($this->attributes_body[$attribute]); + } + else { + return c_base_return_int::s_new($this->attributes[$attribute]); } - break; case c_base_markup_attributes::ATTRIBUTE_DIRECTION: - if (!is_null($value) && !is_int($value)) { - return new c_base_return_false(); + if ($body) { + if (is_int($this->attributes_body[$attribute])) { + return c_base_return_int::s_new($this->attributes_body[$attribute]); + } + elseif (is_null($this->attributes_body[$attribute])) { + return new c_base_return_null(); + } + } + else { + if (is_int($this->attributes[$attribute])) { + return c_base_return_int::s_new($this->attributes[$attribute]); + } + elseif (is_null($this->attributes[$attribute])) { + return new c_base_return_null(); + } } break; @@ -1382,53 +1404,33 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_Y: case c_base_markup_attributes::ATTRIBUTE_Y_1: case c_base_markup_attributes::ATTRIBUTE_Y_2: - if (!is_int($value)) { - return new c_base_return_false(); + if ($body) { + return c_base_return_int::s_new($this->attributes_body[$attribute]); } - break; - - case c_base_markup_attributes::ATTRIBUTE_CLASS: - if (!is_array($value)) { - if (is_string($value)) { - if ($body) { - if (!isset($this->attributes_body[$attribute])) { - $this->attributes_body[$attribute] = array(); - } - - $this->attributes_body[$attribute][] = $value; - } - else { - if (!isset($this->attributes[$attribute])) { - $this->attributes[$attribute] = array(); - } - - $this->attributes[$attribute][] = $value; - } - - return new c_base_return_true(); - } - - return new c_base_return_false(); + else { + return c_base_return_int::s_new($this->attributes[$attribute]); } - break; case c_base_markup_attributes::ATTRIBUTE_FORM_METHOD: - if (!$this->pr_validate_value_http_method($value)) { - return new c_base_return_false(); + if ($body) { + return c_base_return_int::s_new($this->attributes_body[$attribute]); + } + else { + return c_base_return_int::s_new($this->attributes[$attribute]); + } + + case c_base_markup_attributes::ATTRIBUTE_CLASS: + if ($body) { + return c_base_return_array::s_new($this->attributes_body[$attribute]); + } + else { + return c_base_return_array::s_new($this->attributes[$attribute]); } - break; default: return new c_base_return_false(); } - if ($body) { - $this->attributes_body[$attribute] = $value; - } - else { - $this->attributes[$attribute] = $value; - } - - return new c_base_return_true(); + return new c_base_return_false(); } } diff --git a/common/standard/classes/standard_index.php b/common/standard/classes/standard_index.php index 5f646fc..310f981 100644 --- a/common/standard/classes/standard_index.php +++ b/common/standard/classes/standard_index.php @@ -25,6 +25,11 @@ require_once('common/theme/classes/theme_html.php'); class c_standard_index extends c_base_return { protected const HTTP_RESPONSE_PROTOCOL = 'HTTP/1.1'; + protected const OUTPUT_TYPE_NONE = 0; + protected const OUTPUT_TYPE_HTML = 1; + protected const OUTPUT_TYPE_AJAX = 2; + protected const OUTPUT_TYPE_FILE = 3; + protected $settings; protected $http; @@ -35,8 +40,9 @@ class c_standard_index extends c_base_return { protected $lanaguages_all; // all languages used in the document. protected $paths; - protected $processed; // unrenderred output. - protected $output; // renderred output. + protected $processed; // unrenderred output. + protected $output; // renderred output. + protected $output_type; // index-specific mime types for output handling. private $original_output_buffering; @@ -103,6 +109,10 @@ class c_standard_index extends c_base_return { // This provides a way to still use

tags despite the implementation, usage, and context flaws. $this->settings['standards_issue-use_p_tags'] = FALSE; + // cache/static file paths + $this->settings['cache_static'] = ''; // example: '/var/www-static'; + $this->settings['cache_error'] = ''; // example: '/var/www-error'; + $this->http = new c_base_http(); $this->session = new c_base_session(); $this->database = new c_standard_database(); @@ -110,9 +120,10 @@ class c_standard_index extends c_base_return { $this->languages_selected = NULL; $this->languages_all = NULL; - $this->paths = NULL; - $this->processed = NULL; - $this->output = NULL; + $this->paths = NULL; + $this->processed = NULL; + $this->output = NULL; + $this->output_type = static::OUTPUT_TYPE_HTML; $this->original_output_buffering = NULL; } @@ -136,6 +147,7 @@ class c_standard_index extends c_base_return { unset($this->paths); unset($this->processed); unset($this->output); + unset($this->output_type); unset($this->original_output_buffering); @@ -529,7 +541,7 @@ class c_standard_index extends c_base_return { $this->session->set_user_current($user_current); } else { - // @todo: hanle errors. + // @todo: handle errors. } unset($user_current); @@ -538,7 +550,7 @@ class c_standard_index extends c_base_return { $this->session->set_user_current($user_session); } else { - // @todo: hanle errors. + // @todo: handle errors. } unset($user_session); @@ -615,12 +627,37 @@ class c_standard_index extends c_base_return { */ protected function pr_do_render_theme() { // @fixme: this needs to support more output types than just html. - $theme = new c_theme_html(); - $theme->set_html($this->processed); - $theme->set_http($this->http); - $theme->render_markup(); + if ($this->processed instanceof c_base_html) { + $theme = new c_theme_html(); + $theme->set_html($this->processed); + $theme->set_http($this->http); + $theme->render_markup(); + + $this->output = $theme->get_markup()->get_value_exact(); + $this->output_type = static::OUTPUT_TYPE_HTML; + } + elseif ($this->processed instanceof c_base_file) { + // @todo: write a class, such as c_theme_file, to handle formatting the file output. + $this->output = ''; + $this->output_type = static::OUTPUT_TYPE_FILE; + } + elseif ($this->processed instanceof c_base_ajax) { + // all ajax needs to respond with is a jsonized string. + $this->output = $this->processed->get_items_jsonized()->get_value_exact(); + if (!is_string($this->output)) { + // this happens on error. @todo: handle error. + $this->output = ''; + } + $this->output_type = static::OUTPUT_TYPE_AJAX; + } + else { + // nothing to output. + $this->output = ''; + return new c_base_return_false(); + } - $this->output = $theme->get_markup()->get_value_exact(); + // clear the processed variable to save resources. + $this->processed = NULL; return new c_base_return_true(); } @@ -637,7 +674,6 @@ class c_standard_index extends c_base_return { $this->http->set_response_content($this->output); - // send the session cookie if a session id is specified. $session_id = $this->session->get_session_id()->get_value_exact(); if (!empty($session_id)) { @@ -680,16 +716,41 @@ class c_standard_index extends c_base_return { ob_end_clean(); - $this->http->set_response_date(); - $this->http->set_response_content_type('text/html'); - #$this->http->set_response_etag(); - #$this->http->set_response_last_modified(strtotime('now')); - #$this->http->set_response_expires(strtotime('+30 minutes')); - $this->http->set_response_pragma('no-cache'); - $this->http->set_response_vary('Host'); - $this->http->set_response_vary('User-Agent'); - $this->http->set_response_vary('Accept'); - $this->http->set_response_vary('Accept-Language'); + + // build the http response headers. + if ($this->output_type === static::OUTPUT_TYPE_FILE) { + $this->http->set_response_date(); + $this->http->set_response_vary('Host'); + $this->http->set_response_vary('User-Agent'); + $this->http->set_response_vary('Accept'); + $this->http->set_response_vary('Accept-Language'); + + // @todo: assign file-specific headers + } + elseif ($this->output_type === static::OUTPUT_TYPE_AJAX) { + $this->http->set_response_date(); + $this->http->set_response_pragma('no-cache'); + $this->http->set_response_vary('Host'); + $this->http->set_response_vary('User-Agent'); + $this->http->set_response_vary('Accept'); + $this->http->set_response_vary('Accept-Language'); + + // @todo: assign ajax-related headers + } + else { + // use html output type on request and on fail. + $this->http->set_response_date(); + $this->http->set_response_content_type('text/html'); + #$this->http->set_response_etag(); + #$this->http->set_response_last_modified(strtotime('now')); + #$this->http->set_response_expires(strtotime('+30 minutes')); + $this->http->set_response_pragma('no-cache'); + $this->http->set_response_vary('Host'); + $this->http->set_response_vary('User-Agent'); + $this->http->set_response_vary('Accept'); + $this->http->set_response_vary('Accept-Language'); + } + #$this->http->set_response_warning('1234 This site is under active development.'); // finalize the content prior to sending headers to ensure header accuracy. diff --git a/common/standard/classes/standard_path.php b/common/standard/classes/standard_path.php index 4e90102..cd9683d 100644 --- a/common/standard/classes/standard_path.php +++ b/common/standard/classes/standard_path.php @@ -2067,5 +2067,23 @@ class c_standard_path extends c_base_path { // if unable to find, fallback to original class return new $class(); } + + /** + * Provides a standard argument handler function. + * + * 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. + * + * @return bool + * TRUE on success, FALSE otherwise. + */ + protected function pr_process_arguments(&$executed) { + $this->arguments = array(); + + return TRUE; + } } diff --git a/common/standard/classes/standard_paths.php b/common/standard/classes/standard_paths.php index 6808bdb..6d03402 100644 --- a/common/standard/classes/standard_paths.php +++ b/common/standard/classes/standard_paths.php @@ -14,70 +14,153 @@ require_once('common/standard/classes/standard_path.php'); */ class c_standard_paths extends c_base_return { const URI_HOME = ''; - const URI_DASHBOARD_MANAGEMENT = 'm/dashboard'; - const URI_DASHBOARD_ADMINISTER = 'a/dashboard'; - const URI_USER_CHECK = 'u/check'; - const URI_USER_CREATE = 'u/create'; - const URI_USER_DASHBOARD = 'u/dashboard'; - const URI_USER_DELETE = 'u/delete'; - const URI_USER_EDIT = 'u/edit'; - const URI_USER_LOCK = 'u/lock'; - const URI_USER_LOGIN = 'u/login'; - const URI_USER_LOGOUT = 'u/logout'; - const URI_USER_REFRESH = 'u/refresh'; - const URI_USER_SESSION = 'u/session'; - const URI_USER_SETTINGS = 'u/settings'; - const URI_USER_UNLOCK = 'u/unlock'; - const URI_USER_VIEW = 'u/view'; + const URI_ADMINISTER_DASHBOARD = 'a/dashboard'; + const URI_ADMINISTER_CONTENT = 'a/content'; + const URI_ADMINISTER_LOGS = 'a/logs'; + + #const URI_AJAX = 'x'; + + const URI_CACHE_STATIC = 'c/static'; + const URI_CACHE_ERROR = 'c/error'; + + const URI_FILE_BY_ID = 'f/i'; + const URI_FILE_BY_CHECKSUM = 'f/c'; + + const URI_FILE_CHECKSUM_BY_ID = 'f/s'; + const URI_FILE_CHECKSUM_BY_CHECKSUM = 'f/m'; + + const URI_MANAGEMENT_DASHBOARD = 'm/dashboard'; + const URI_MANAGEMENT_CONTENT = 'm/content'; + const URI_MANAGEMENT_LOGS = 'm/logs'; + + const URI_SUBMIT_FORM_ID = 's/form_id'; + + #const URI_THEME = 't'; + + const URI_USER_CHECK = 'u/check'; + const URI_USER_CONTACT = 'u/contact'; + const URI_USER_CONTENT = 'u/content'; + const URI_USER_CREATE = 'u/create'; + const URI_USER_DASHBOARD = 'u/dashboard'; + const URI_USER_DELETE = 'u/delete'; + const URI_USER_EDIT = 'u/edit'; + const URI_USER_LOCK = 'u/lock'; + const URI_USER_LOGIN = 'u/login'; + const URI_USER_LOGOUT = 'u/logout'; + const URI_USER_LOGS = 'u/logs'; + const URI_USER_REFRESH = 'u/refresh'; + const URI_USER_RESET = 'u/reset'; + const URI_USER_SESSION = 'u/session'; + const URI_USER_SETTINGS = 'u/settings'; + const URI_USER_UNLOCK = 'u/unlock'; + const URI_USER_VIEW = 'u/view'; + + protected const PATH_ADMINISTER = 'common/standard/paths/a/'; + protected const PATH_AJAX = 'common/standard/paths/x/'; + protected const PATH_CACHE = 'common/standard/paths/c/'; + protected const PATH_FILE = 'common/standard/paths/f/'; protected const PATH_INTERNAL = 'common/standard/internal/'; - protected const PATH_USER = 'common/standard/paths/u/'; protected const PATH_MANAGEMENT = 'common/standard/paths/m/'; - protected const PATH_ADMINISTER = 'common/standard/paths/a/'; + protected const PATH_SUBMIT = 'common/standard/paths/s/'; + protected const PATH_THEME = 'common/standard/paths/t/'; + protected const PATH_USER = 'common/standard/paths/u/'; - protected const NAME_ACCESS_DENIED = 'access_denied'; - protected const NAME_NOT_FOUND = 'not_found'; - protected const NAME_BAD_METHOD = 'bad_method'; - protected const NAME_SERVER_ERROR = 'server_error'; - protected const NAME_OPTIONS_METHOD = 'options'; - protected const NAME_DASHBOARD_MANAGEMENT = 'dashboard'; - protected const NAME_DASHBOARD_ADMINISTER = 'dashboard'; - protected const NAME_INDEX = 'index'; - protected const NAME_USER_CHECK = 'user_check'; - protected const NAME_USER_CREATE = 'user_create'; - protected const NAME_USER_DASHBOARD = 'user_dashboard'; - protected const NAME_USER_DELETE = 'user_delete'; - protected const NAME_USER_EDIT = 'user_edit'; - protected const NAME_USER_LOCK = 'user_lock'; - protected const NAME_USER_LOGIN = 'user_login'; - protected const NAME_USER_LOGOUT = 'user_logout'; - protected const NAME_USER_REFRESH = 'user_refresh'; - protected const NAME_USER_SESSION = 'user_session'; - protected const NAME_USER_SETTINGS = 'user_settings'; - protected const NAME_USER_UNLOCK = 'user_unlock'; - protected const NAME_USER_VIEW = 'user_view'; - - protected const HANDLER_NOT_FOUND = 'c_standard_path_not_found'; - protected const HANDLER_ACCESS_DENIED = 'c_standard_path_access_denied'; - protected const HANDLER_BAD_METHOD = 'c_standard_path_bad_method'; - protected const HANDLER_SERVER_ERROR = 'c_standard_path_server_error'; - protected const HANDLER_OPTIONS_METHOD = 'c_standard_path_options_method'; - protected const HANDLER_MANAGEMENT_DASHBOARD = 'c_standard_path_management_dashboard'; - protected const HANDLER_ADMINISTER_DASHBOARD = 'c_standard_path_administer_dashboard'; - protected const HANDLER_INDEX = 'c_standard_path_index'; - protected const HANDLER_USER_CHECK = 'c_standard_path_user_check'; - protected const HANDLER_USER_CREATE = 'c_standard_path_user_create'; - protected const HANDLER_USER_DASHBOARD = 'c_standard_path_user_dashboard'; - protected const HANDLER_USER_DELETE = 'c_standard_path_user_delete'; - protected const HANDLER_USER_EDIT = 'c_standard_path_user_edit'; - protected const HANDLER_USER_LOCK = 'c_standard_path_user_lock'; - protected const HANDLER_USER_LOGIN = 'c_standard_path_user_login'; - protected const HANDLER_USER_LOGOUT = 'c_standard_path_user_logout'; - protected const HANDLER_USER_REFRESH = 'c_standard_path_user_refresh'; - protected const HANDLER_USER_SESSION = 'c_standard_path_user_session'; - protected const HANDLER_USER_SETTINGS = 'c_standard_path_user_settings'; - protected const HANDLER_USER_UNLOCK = 'c_standard_path_user_unlock'; - protected const HANDLER_USER_VIEW = 'c_standard_path_user_view'; + protected const NAME_ACCESS_DENIED = 'access_denied'; + protected const NAME_BAD_METHOD = 'bad_method'; + protected const NAME_INDEX = 'index'; + protected const NAME_NOT_FOUND = 'not_found'; + protected const NAME_OPTIONS_METHOD = 'options'; + protected const NAME_SERVER_ERROR = 'server_error'; + + protected const NAME_ADMINISTER_DASHBOARD = 'administer_dashboard'; + protected const NAME_ADMINISTER_CONTENT = 'administer_content'; + protected const NAME_ADMINISTER_LOGS = 'administer_logs'; + + #protected const NAME_AJAX = 'ajax'; + + protected const NAME_CACHE_STATIC = 'cache_static'; + protected const NAME_CACHE_ERROR = 'cache_error'; + + protected const NAME_FILE_BY_ID = 'file_by_id'; + protected const NAME_FILE_BY_CHECKSUM = 'file_by_checksum'; + + protected const NAME_FILE_CHECKSUM_BY_ID = 'file_checksum_by_id'; + protected const NAME_FILE_CHECKSUM_BY_CHECKSUM = 'file_checksum_by_checksum'; + + protected const NAME_MANAGEMENT_DASHBOARD = 'management_dashboard'; + protected const NAME_MANAGEMENT_CONTENT = 'management_content'; + protected const NAME_MANAGEMENT_LOGS = 'management_logs'; + + protected const NAME_SUBMIT_FORM_ID = 'submit_form_id'; + + #protected const NAME_THEME = 'theme'; + + protected const NAME_USER_CHECK = 'user_check'; + protected const NAME_USER_CONTACT = 'user_contact'; + protected const NAME_USER_CONTENT = 'user_content'; + protected const NAME_USER_CREATE = 'user_create'; + protected const NAME_USER_DASHBOARD = 'user_dashboard'; + protected const NAME_USER_DELETE = 'user_delete'; + protected const NAME_USER_EDIT = 'user_edit'; + protected const NAME_USER_LOCK = 'user_lock'; + protected const NAME_USER_LOGIN = 'user_login'; + protected const NAME_USER_LOGOUT = 'user_logout'; + protected const NAME_USER_LOGS = 'user_logs'; + protected const NAME_USER_REFRESH = 'user_refresh'; + protected const NAME_USER_RESET = 'user_reset'; + protected const NAME_USER_SESSION = 'user_session'; + protected const NAME_USER_SETTINGS = 'user_settings'; + protected const NAME_USER_UNLOCK = 'user_unlock'; + protected const NAME_USER_VIEW = 'user_view'; + + protected const HANDLER_ACCESS_DENIED = 'c_standard_path_access_denied'; + protected const HANDLER_BAD_METHOD = 'c_standard_path_bad_method'; + protected const HANDLER_INDEX = 'c_standard_path_index'; + protected const HANDLER_NOT_FOUND = 'c_standard_path_not_found'; + protected const HANDLER_OPTIONS_METHOD = 'c_standard_path_options_method'; + protected const HANDLER_SERVER_ERROR = 'c_standard_path_server_error'; + + protected const HANDLER_ADMINISTER_DASHBOARD = 'c_standard_administer_dashboard'; + protected const HANDLER_ADMINISTER_CONTENT = 'c_standard_administer_content'; + protected const HANDLER_ADMINISTER_LOGS = 'c_standard_administer_logs'; + + #protected const HANDLER_AJAX = 'c_standard_ajax'; + + protected const HANDLER_CACHE_STATIC = 'c_standard_cache_static'; + protected const HANDLER_CACHE_ERROR = 'c_standard_cache_error'; + + protected const HANDLER_FILE_BY_ID = 'c_standard_file_by_id'; + protected const HANDLER_FILE_BY_CHECKSUM = 'c_standard_file_by_checksum'; + + protected const HANDLER_FILE_CHECKSUM_BY_ID = 'c_standard_file_checksum_by_id'; + protected const HANDLER_FILE_CHECKSUM_BY_CHECKSUM = 'c_standard_file_checksum_by_checksum'; + + protected const HANDLER_MANAGEMENT_DASHBOARD = 'c_standard_management_dashboard'; + protected const HANDLER_MANAGEMENT_CONTENT = 'c_standard_management_content'; + protected const HANDLER_MANAGEMENT_LOGS = 'c_standard_management_logs'; + + protected const HANDLER_SUBMIT_FORM_ID = 'c_standard_submit_form_id'; + + #protected const HANDLER_THEME = 'c_standard_theme'; + + protected const HANDLER_USER_CHECK = 'c_standard_path_user_check'; + protected const HANDLER_USER_CONTACT = 'c_standard_path_user_contact'; + protected const HANDLER_USER_CONTENT = 'c_standard_path_user_content'; + protected const HANDLER_USER_CREATE = 'c_standard_path_user_create'; + protected const HANDLER_USER_DASHBOARD = 'c_standard_path_user_dashboard'; + protected const HANDLER_USER_DELETE = 'c_standard_path_user_delete'; + protected const HANDLER_USER_EDIT = 'c_standard_path_user_edit'; + protected const HANDLER_USER_LOCK = 'c_standard_path_user_lock'; + protected const HANDLER_USER_LOGIN = 'c_standard_path_user_login'; + protected const HANDLER_USER_LOGOUT = 'c_standard_path_user_logout'; + protected const HANDLER_USER_LOGS = 'c_standard_path_user_logs'; + protected const HANDLER_USER_REFRESH = 'c_standard_path_user_refresh'; + protected const HANDLER_USER_RESET = 'c_standard_path_user_reset'; + protected const HANDLER_USER_SESSION = 'c_standard_path_user_session'; + protected const HANDLER_USER_SETTINGS = 'c_standard_path_user_settings'; + protected const HANDLER_USER_UNLOCK = 'c_standard_path_user_unlock'; + protected const HANDLER_USER_VIEW = 'c_standard_path_user_view'; protected const SCRIPT_EXTENSION = '.php'; protected const WILDCARD_PATH = '/%'; @@ -304,7 +387,7 @@ class c_standard_paths extends c_base_return { // load always available paths. - $this->pr_paths_create(); + $this->pr_paths_create_always(); // load the remaining paths based on the relative path to avoid generating and processing unnecessary paths. @@ -585,7 +668,7 @@ class c_standard_paths extends c_base_return { * * Add/modify paths here as desired. */ - protected function pr_paths_create() { + protected function pr_paths_create_always() { $this->paths = new c_base_paths(); // set root path. @@ -603,7 +686,20 @@ class c_standard_paths extends c_base_return { */ protected function pr_paths_create_administer() { // dashboards - $this->paths->add_path(static::URI_DASHBOARD_ADMINISTER, static::HANDLER_ADMINISTER_DASHBOARD, static::PATH_ADMINISTER, static::NAME_DASHBOARD_ADMINISTER); + $this->paths->add_path(static::URI_ADMINISTER_DASHBOARD, static::HANDLER_ADMINISTER_DASHBOARD, static::PATH_USER, static::NAME_ADMINISTER_DASHBOARD); + $this->paths->add_path(static::URI_ADMINISTER_DASHBOARD . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_DASHBOARD, static::PATH_ADMINISTER, static::NAME_ADMINISTER_DASHBOARD); + $this->paths->add_path(static::URI_ADMINISTER_DASHBOARD . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_DASHBOARD, static::PATH_ADMINISTER, static::NAME_ADMINISTER_DASHBOARD); + $this->paths->add_path(static::URI_ADMINISTER_DASHBOARD . static::WILDCARD_PATH . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_DASHBOARD, static::PATH_ADMINISTER, static::NAME_ADMINISTER_DASHBOARD); + + $this->paths->add_path(static::URI_ADMINISTER_CONTENT, static::HANDLER_ADMINISTER_CONTENT, static::PATH_USER, static::NAME_ADMINISTER_CONTENT); + $this->paths->add_path(static::URI_ADMINISTER_CONTENT . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_CONTENT, static::PATH_ADMINISTER, static::NAME_ADMINISTER_CONTENT); + $this->paths->add_path(static::URI_ADMINISTER_CONTENT . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_CONTENT, static::PATH_ADMINISTER, static::NAME_ADMINISTER_CONTENT); + $this->paths->add_path(static::URI_ADMINISTER_CONTENT . static::WILDCARD_PATH . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_CONTENT, static::PATH_ADMINISTER, static::NAME_ADMINISTER_CONTENT); + + $this->paths->add_path(static::URI_ADMINISTER_LOGS, static::HANDLER_ADMINISTER_LOGS, static::PATH_USER, static::NAME_ADMINISTER_LOGS); + $this->paths->add_path(static::URI_ADMINISTER_LOGS . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_LOGS, static::PATH_ADMINISTER, static::NAME_ADMINISTER_LOGS); + $this->paths->add_path(static::URI_ADMINISTER_LOGS . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_LOGS, static::PATH_ADMINISTER, static::NAME_ADMINISTER_LOGS); + $this->paths->add_path(static::URI_ADMINISTER_LOGS . static::WILDCARD_PATH . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_ADMINISTER_LOGS, static::PATH_ADMINISTER, static::NAME_ADMINISTER_LOGS); } /** @@ -612,6 +708,13 @@ class c_standard_paths extends c_base_return { * Add/modify paths here as desired. */ protected function pr_paths_create_cache() { + $this->paths->add_path(static::URI_CACHE_STATIC, static::HANDLER_CACHE_STATIC, static::PATH_USER, static::NAME_CACHE_STATIC); + $this->paths->add_path(static::URI_CACHE_STATIC . static::WILDCARD_PATH, static::HANDLER_CACHE_STATIC, static::PATH_USER, static::NAME_CACHE_STATIC); + $this->paths->add_path(static::URI_CACHE_STATIC . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_CACHE_STATIC, static::PATH_USER, static::NAME_CACHE_STATIC); + + $this->paths->add_path(static::URI_CACHE_ERROR, static::HANDLER_CACHE_ERROR, static::PATH_USER, static::NAME_CACHE_ERROR); + $this->paths->add_path(static::URI_CACHE_ERROR . static::WILDCARD_PATH, static::HANDLER_CACHE_ERROR, static::PATH_USER, static::NAME_CACHE_ERROR); + $this->paths->add_path(static::URI_CACHE_ERROR . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_CACHE_ERROR, static::PATH_USER, static::NAME_CACHE_ERROR); } /** @@ -628,6 +731,21 @@ class c_standard_paths extends c_base_return { * Add/modify paths here as desired. */ protected function pr_paths_create_file() { + $this->paths->add_path(static::URI_FILE_BY_ID, static::HANDLER_FILE_BY_ID, static::PATH_USER, static::NAME_FILE_BY_ID); + $this->paths->add_path(static::URI_FILE_BY_ID . static::WILDCARD_PATH, static::HANDLER_FILE_BY_ID, static::PATH_USER, static::NAME_FILE_BY_ID); + $this->paths->add_path(static::URI_FILE_BY_ID . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_FILE_BY_ID, static::PATH_USER, static::NAME_FILE_BY_ID); + + $this->paths->add_path(static::URI_FILE_BY_CHECKSUM, static::HANDLER_FILE_BY_CHECKSUM, static::PATH_USER, static::NAME_FILE_BY_CHECKSUM); + $this->paths->add_path(static::URI_FILE_BY_CHECKSUM . static::WILDCARD_PATH, static::HANDLER_FILE_BY_CHECKSUM, static::PATH_USER, static::NAME_FILE_BY_CHECKSUM); + $this->paths->add_path(static::URI_FILE_BY_CHECKSUM . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_FILE_BY_CHECKSUM, static::PATH_USER, static::NAME_FILE_BY_CHECKSUM); + + $this->paths->add_path(static::URI_FILE_CHECKSUM_BY_ID, static::HANDLER_FILE_CHECKSUM_BY_ID, static::PATH_USER, static::NAME_FILE_CHECKSUM_BY_ID); + $this->paths->add_path(static::URI_FILE_CHECKSUM_BY_ID . static::WILDCARD_PATH, static::HANDLER_FILE_CHECKSUM_BY_ID, static::PATH_USER, static::NAME_FILE_CHECKSUM_BY_ID); + $this->paths->add_path(static::URI_FILE_CHECKSUM_BY_ID . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_FILE_CHECKSUM_BY_ID, static::PATH_USER, static::NAME_FILE_CHECKSUM_BY_ID); + + $this->paths->add_path(static::URI_FILE_CHECKSUM_BY_CHECKSUM, static::HANDLER_FILE_CHECKSUM_BY_CHECKSUM, static::PATH_USER, static::NAME_FILE_CHECKSUM_BY_CHECKSUM); + $this->paths->add_path(static::URI_FILE_CHECKSUM_BY_CHECKSUM . static::WILDCARD_PATH, static::HANDLER_FILE_CHECKSUM_BY_CHECKSUM, static::PATH_USER, static::NAME_FILE_CHECKSUM_BY_CHECKSUM); + $this->paths->add_path(static::URI_FILE_CHECKSUM_BY_CHECKSUM . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_FILE_CHECKSUM_BY_CHECKSUM, static::PATH_USER, static::NAME_FILE_CHECKSUM_BY_CHECKSUM); } /** @@ -636,6 +754,9 @@ class c_standard_paths extends c_base_return { * Add/modify paths here as desired. */ protected function pr_paths_create_submit() { + $this->paths->add_path(static::URI_SUBMIT_FORM_ID, static::HANDLER_SUBMIT_FORM_ID, static::PATH_USER, static::NAME_SUBMIT_FORM_ID); + $this->paths->add_path(static::URI_SUBMIT_FORM_ID . static::WILDCARD_PATH, static::HANDLER_SUBMIT_FORM_ID, static::PATH_USER, static::NAME_SUBMIT_FORM_ID); + $this->paths->add_path(static::URI_SUBMIT_FORM_ID . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_SUBMIT_FORM_ID, static::PATH_USER, static::NAME_SUBMIT_FORM_ID); } /** @@ -645,7 +766,20 @@ class c_standard_paths extends c_base_return { */ protected function pr_paths_create_management() { // dashboards - $this->paths->add_path(static::URI_DASHBOARD_MANAGEMENT, static::HANDLER_MANAGEMENT_DASHBOARD, static::PATH_MANAGEMENT, static::NAME_DASHBOARD_MANAGEMENT); + $this->paths->add_path(static::URI_MANAGEMENT_DASHBOARD, static::HANDLER_MANAGEMENT_DASHBOARD, static::PATH_USER, static::NAME_MANAGEMENT_DASHBOARD); + $this->paths->add_path(static::URI_MANAGEMENT_DASHBOARD . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_DASHBOARD, static::PATH_USER, static::NAME_MANAGEMENT_DASHBOARD); + $this->paths->add_path(static::URI_MANAGEMENT_DASHBOARD . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_DASHBOARD, static::PATH_USER, static::NAME_MANAGEMENT_DASHBOARD); + $this->paths->add_path(static::URI_MANAGEMENT_DASHBOARD . static::WILDCARD_PATH . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_DASHBOARD, static::PATH_USER, static::NAME_MANAGEMENT_DASHBOARD); + + $this->paths->add_path(static::URI_MANAGEMENT_CONTENT, static::HANDLER_MANAGEMENT_CONTENT, static::PATH_USER, static::NAME_MANAGEMENT_CONTENT); + $this->paths->add_path(static::URI_MANAGEMENT_CONTENT . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_CONTENT, static::PATH_USER, static::NAME_MANAGEMENT_CONTENT); + $this->paths->add_path(static::URI_MANAGEMENT_CONTENT . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_CONTENT, static::PATH_USER, static::NAME_MANAGEMENT_CONTENT); + $this->paths->add_path(static::URI_MANAGEMENT_CONTENT . static::WILDCARD_PATH . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_CONTENT, static::PATH_USER, static::NAME_MANAGEMENT_CONTENT); + + $this->paths->add_path(static::URI_MANAGEMENT_LOGS, static::HANDLER_MANAGEMENT_LOGS, static::PATH_USER, static::NAME_MANAGEMENT_LOGS); + $this->paths->add_path(static::URI_MANAGEMENT_LOGS . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_LOGS, static::PATH_USER, static::NAME_MANAGEMENT_LOGS); + $this->paths->add_path(static::URI_MANAGEMENT_LOGS . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_LOGS, static::PATH_USER, static::NAME_MANAGEMENT_LOGS); + $this->paths->add_path(static::URI_MANAGEMENT_LOGS . static::WILDCARD_PATH . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_MANAGEMENT_LOGS, static::PATH_USER, static::NAME_MANAGEMENT_LOGS); } /** @@ -673,6 +807,8 @@ class c_standard_paths extends c_base_return { // dashboards $this->paths->add_path(static::URI_USER_DASHBOARD, static::HANDLER_USER_DASHBOARD, static::PATH_USER, static::NAME_USER_DASHBOARD); $this->paths->add_path(static::URI_USER_DASHBOARD . static::WILDCARD_PATH, static::HANDLER_USER_DASHBOARD, static::PATH_USER, static::NAME_USER_DASHBOARD); + $this->paths->add_path(static::URI_USER_DASHBOARD . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_DASHBOARD, static::PATH_USER, static::NAME_USER_DASHBOARD); + $this->paths->add_path(static::URI_USER_DASHBOARD . static::WILDCARD_PATH . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_DASHBOARD, static::PATH_USER, static::NAME_USER_DASHBOARD); // pages / forms @@ -680,6 +816,14 @@ class c_standard_paths extends c_base_return { $this->paths->add_path(static::URI_USER_CREATE . static::WILDCARD_PATH, static::HANDLER_USER_CREATE, static::PATH_USER, static::NAME_USER_CREATE); $this->paths->add_path(static::URI_USER_CREATE . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_CREATE, static::PATH_USER, static::NAME_USER_CREATE); + $this->paths->add_path(static::URI_USER_CONTACT, static::HANDLER_USER_CONTACT, static::PATH_USER, static::NAME_USER_CONTACT); + $this->paths->add_path(static::URI_USER_CONTACT . static::WILDCARD_PATH, static::HANDLER_USER_CONTACT, static::PATH_USER, static::NAME_USER_CONTACT); + $this->paths->add_path(static::URI_USER_CONTACT . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_CONTACT, static::PATH_USER, static::NAME_USER_CONTACT); + + $this->paths->add_path(static::URI_USER_CONTENT, static::HANDLER_USER_CONTENT, static::PATH_USER, static::NAME_USER_CONTENT); + $this->paths->add_path(static::URI_USER_CONTENT . static::WILDCARD_PATH, static::HANDLER_USER_CONTENT, static::PATH_USER, static::NAME_USER_CONTENT); + $this->paths->add_path(static::URI_USER_CONTENT . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_CONTENT, static::PATH_USER, static::NAME_USER_CONTENT); + $this->paths->add_path(static::URI_USER_DELETE, static::HANDLER_USER_DELETE, static::PATH_USER, static::NAME_USER_DELETE); $this->paths->add_path(static::URI_USER_DELETE . static::WILDCARD_PATH, static::HANDLER_USER_DELETE, static::PATH_USER, static::NAME_USER_DELETE); $this->paths->add_path(static::URI_USER_DELETE . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_DELETE, static::PATH_USER, static::NAME_USER_DELETE); @@ -692,6 +836,10 @@ class c_standard_paths extends c_base_return { $this->paths->add_path(static::URI_USER_SETTINGS . static::WILDCARD_PATH, static::HANDLER_USER_SETTINGS, static::PATH_USER, static::NAME_USER_SETTINGS); $this->paths->add_path(static::URI_USER_SETTINGS . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_SETTINGS, static::PATH_USER, static::NAME_USER_SETTINGS); + $this->paths->add_path(static::URI_USER_LOGS, static::HANDLER_USER_LOGS, static::PATH_USER, static::NAME_USER_LOGS); + $this->paths->add_path(static::URI_USER_LOGS . static::WILDCARD_PATH, static::HANDLER_USER_LOGS, static::PATH_USER, static::NAME_USER_LOGS); + $this->paths->add_path(static::URI_USER_LOGS . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_LOGS, static::PATH_USER, static::NAME_USER_LOGS); + $this->paths->add_path(static::URI_USER_VIEW, static::HANDLER_USER_VIEW, static::PATH_USER, static::NAME_USER_VIEW); $this->paths->add_path(static::URI_USER_VIEW . static::WILDCARD_PATH, static::HANDLER_USER_VIEW, static::PATH_USER, static::NAME_USER_VIEW); $this->paths->add_path(static::URI_USER_VIEW . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_VIEW, static::PATH_USER, static::NAME_USER_VIEW); @@ -710,6 +858,10 @@ class c_standard_paths extends c_base_return { $this->paths->add_path(static::URI_USER_REFRESH . static::WILDCARD_PATH, static::HANDLER_USER_REFRESH, static::PATH_USER, static::NAME_USER_REFRESH); $this->paths->add_path(static::URI_USER_REFRESH . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_REFRESH, static::PATH_USER, static::NAME_USER_REFRESH); + $this->paths->add_path(static::URI_USER_RESET, static::HANDLER_USER_RESET, static::PATH_USER, static::NAME_USER_RESET); + $this->paths->add_path(static::URI_USER_RESET . static::WILDCARD_PATH, static::HANDLER_USER_RESET, static::PATH_USER, static::NAME_USER_RESET); + $this->paths->add_path(static::URI_USER_RESET . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_RESET, static::PATH_USER, static::NAME_USER_RESET); + $this->paths->add_path(static::URI_USER_SESSION, static::HANDLER_USER_SESSION, static::PATH_USER, static::NAME_USER_SESSION); $this->paths->add_path(static::URI_USER_SESSION . static::WILDCARD_PATH, static::HANDLER_USER_SESSION, static::PATH_USER, static::NAME_USER_SESSION); $this->paths->add_path(static::URI_USER_SESSION . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_SESSION, static::PATH_USER, static::NAME_USER_SESSION); diff --git a/common/standard/paths/a/administer_content.php b/common/standard/paths/a/administer_content.php new file mode 100644 index 0000000..500423a --- /dev/null +++ b/common/standard/paths/a/administer_content.php @@ -0,0 +1,122 @@ +pr_process_arguments($executed)) { + return $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, array('arguments' => array(':{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 $executed; + } + + // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). + #$user = $this->session->get_user_current(); + #$roles_current = $user->get_roles()->get_value_exact(); + + // @todo: this function is currently disabled, so return a path not found. + $error = c_base_error::s_log(NULL, array('arguments' => array(':{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 $executed; + } + + /** + * Implementation of pr_build_breadcrumbs(). + */ + protected function pr_build_breadcrumbs() { + $path_administer_view = new c_standard_path_administer_dashboard(); + $path_administer_view->set_parameters($this->http, $this->database, $this->session, $this->settings); + $path_administer_view->set_path_tree($this->get_path_tree($this->path_tree)); + $this->breadcrumbs = $path_administer_view->get_breadcrumbs(); + unset($path_administer_view); + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $result = parent::pr_build_breadcrumbs(); + if ($result instanceof c_base_return_false) { + unset($result); + return new c_base_return_false(); + } + unset($result); + } + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $this->breadcrumbs = new c_base_menu_item(); + } + + $item = $this->pr_create_breadcrumbs_item($this->pr_get_text(0), self::PATH_SELF); + $this->breadcrumbs->set_item($item); + unset($item); + + return new c_base_return_true(); + } + + /** + * Implementation of pr_create_html_add_header_link_canonical(). + */ + protected function pr_create_html_add_header_link_canonical() { + $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical'); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF); + $this->html->set_header($tag); + + unset($tag); + } + + /** + * Implements pr_get_text(). + */ + protected function pr_get_text($code, $arguments = array()) { + $string = ''; + switch ($code) { + case 0: + $string = 'Content Administration'; + break; + } + + if (!empty($arguments)) { + $this->pr_process_replacements($string, $arguments); + } + + return $string; + } +} diff --git a/common/standard/paths/a/dashboard.php b/common/standard/paths/a/administer_dashboard.php similarity index 88% rename from common/standard/paths/a/dashboard.php rename to common/standard/paths/a/administer_dashboard.php index a84f491..7f1a08d 100644 --- a/common/standard/paths/a/dashboard.php +++ b/common/standard/paths/a/administer_dashboard.php @@ -12,9 +12,17 @@ require_once('common/standard/classes/standard_path.php'); require_once('common/theme/classes/theme_html.php'); +/** + * Provides a path handler for logs administration. + * + * This listens on: /a/dashboard + */ class c_standard_path_administer_dashboard extends c_standard_path { public const PATH_SELF = 'a/dashboard'; + #protected const NAME_MENU_CONTENT = 'menu_content_administer_dashboard'; + #protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_administer_dashboard'; + /** * Implements do_execute(). */ @@ -53,13 +61,6 @@ class c_standard_path_administer_dashboard extends c_standard_path { } /** - * Implements pr_get_title(). - */ - protected function pr_get_title($arguments = array()) { - return $this->pr_get_text(0, $arguments); - } - - /** * Implements pr_get_text(). */ protected function pr_get_text($code, $arguments = array()) { diff --git a/common/standard/paths/a/administer_logs.php b/common/standard/paths/a/administer_logs.php new file mode 100644 index 0000000..6231e9a --- /dev/null +++ b/common/standard/paths/a/administer_logs.php @@ -0,0 +1,122 @@ +pr_process_arguments($executed)) { + return $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, array('arguments' => array(':{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 $executed; + } + + // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). + #$user = $this->session->get_user_current(); + #$roles_current = $user->get_roles()->get_value_exact(); + + // @todo: this function is currently disabled, so return a path not found. + $error = c_base_error::s_log(NULL, array('arguments' => array(':{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 $executed; + } + + /** + * Implementation of pr_build_breadcrumbs(). + */ + protected function pr_build_breadcrumbs() { + $path_administer_view = new c_standard_path_administer_dashboard(); + $path_administer_view->set_parameters($this->http, $this->database, $this->session, $this->settings); + $path_administer_view->set_path_tree($this->get_path_tree($this->path_tree)); + $this->breadcrumbs = $path_administer_view->get_breadcrumbs(); + unset($path_administer_view); + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $result = parent::pr_build_breadcrumbs(); + if ($result instanceof c_base_return_false) { + unset($result); + return new c_base_return_false(); + } + unset($result); + } + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $this->breadcrumbs = new c_base_menu_item(); + } + + $item = $this->pr_create_breadcrumbs_item($this->pr_get_text(0), self::PATH_SELF); + $this->breadcrumbs->set_item($item); + unset($item); + + return new c_base_return_true(); + } + + /** + * Implementation of pr_create_html_add_header_link_canonical(). + */ + protected function pr_create_html_add_header_link_canonical() { + $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical'); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF); + $this->html->set_header($tag); + + unset($tag); + } + + /** + * Implements pr_get_text(). + */ + protected function pr_get_text($code, $arguments = array()) { + $string = ''; + switch ($code) { + case 0: + $string = 'Administration Logs'; + break; + } + + if (!empty($arguments)) { + $this->pr_process_replacements($string, $arguments); + } + + return $string; + } +} diff --git a/common/standard/paths/a/ja/administer_content.php b/common/standard/paths/a/ja/administer_content.php new file mode 100644 index 0000000..f2b7feb --- /dev/null +++ b/common/standard/paths/a/ja/administer_content.php @@ -0,0 +1,29 @@ +pr_process_replacements($string, $arguments); + } + + return $string; + } +} diff --git a/common/standard/paths/a/ja/dashboard.php b/common/standard/paths/a/ja/administer_dashboard.php similarity index 90% rename from common/standard/paths/a/ja/dashboard.php rename to common/standard/paths/a/ja/administer_dashboard.php index ae9a97e..f55d94c 100644 --- a/common/standard/paths/a/ja/dashboard.php +++ b/common/standard/paths/a/ja/administer_dashboard.php @@ -1,7 +1,7 @@ pr_process_replacements($string, $arguments); + } + + return $string; + } +} diff --git a/common/standard/paths/c/cache_error.php b/common/standard/paths/c/cache_error.php new file mode 100644 index 0000000..0c9d1fc --- /dev/null +++ b/common/standard/paths/c/cache_error.php @@ -0,0 +1,73 @@ +pr_process_arguments($executed)) { + return $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, array('arguments' => array(':{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 $executed; + } + + // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). + #$user = $this->session->get_user_current(); + #$roles_current = $user->get_roles()->get_value_exact(); + + // @todo: this function is currently disabled, so return a path not found. + $error = c_base_error::s_log(NULL, array('arguments' => array(':{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 $executed; + } + + /** + * Implementation of pr_create_html_add_header_link_canonical(). + */ + protected function pr_create_html_add_header_link_canonical() { + $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical'); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF); + $this->html->set_header($tag); + + unset($tag); + } +} diff --git a/common/standard/paths/c/cache_static.php b/common/standard/paths/c/cache_static.php new file mode 100644 index 0000000..0fd89dc --- /dev/null +++ b/common/standard/paths/c/cache_static.php @@ -0,0 +1,74 @@ +pr_process_arguments($executed)) { + return $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, array('arguments' => array(':{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 $executed; + } + + // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). + #$user = $this->session->get_user_current(); + #$roles_current = $user->get_roles()->get_value_exact(); + + // @todo: this function is currently disabled, so return a path not found. + $error = c_base_error::s_log(NULL, array('arguments' => array(':{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 $executed; + } + + /** + * Implementation of pr_create_html_add_header_link_canonical(). + */ + protected function pr_create_html_add_header_link_canonical() { + $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical'); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF); + $this->html->set_header($tag); + + unset($tag); + } +} diff --git a/common/standard/paths/c/ja/cache_error.php b/common/standard/paths/c/ja/cache_error.php new file mode 100644 index 0000000..69aa1f1 --- /dev/null +++ b/common/standard/paths/c/ja/cache_error.php @@ -0,0 +1,11 @@ +pr_process_replacements($string, $arguments); + } + + return $string; + } +} diff --git a/common/standard/paths/m/ja/dashboard.php b/common/standard/paths/m/ja/management_dashboard.php similarity index 90% rename from common/standard/paths/m/ja/dashboard.php rename to common/standard/paths/m/ja/management_dashboard.php index 359dccd..4629465 100644 --- a/common/standard/paths/m/ja/dashboard.php +++ b/common/standard/paths/m/ja/management_dashboard.php @@ -1,7 +1,7 @@ pr_process_replacements($string, $arguments); + } + + return $string; + } +} diff --git a/common/standard/paths/m/management_content.php b/common/standard/paths/m/management_content.php new file mode 100644 index 0000000..543bfda --- /dev/null +++ b/common/standard/paths/m/management_content.php @@ -0,0 +1,122 @@ +pr_process_arguments($executed)) { + return $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, array('arguments' => array(':{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 $executed; + } + + // @todo: this function needs to check to see if the user has management (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). + #$user = $this->session->get_user_current(); + #$roles_current = $user->get_roles()->get_value_exact(); + + // @todo: this function is currently disabled, so return a path not found. + $error = c_base_error::s_log(NULL, array('arguments' => array(':{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 $executed; + } + + /** + * Implementation of pr_build_breadcrumbs(). + */ + protected function pr_build_breadcrumbs() { + $path_management_view = new c_standard_path_management_dashboard(); + $path_management_view->set_parameters($this->http, $this->database, $this->session, $this->settings); + $path_management_view->set_path_tree($this->get_path_tree($this->path_tree)); + $this->breadcrumbs = $path_management_view->get_breadcrumbs(); + unset($path_management_view); + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $result = parent::pr_build_breadcrumbs(); + if ($result instanceof c_base_return_false) { + unset($result); + return new c_base_return_false(); + } + unset($result); + } + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $this->breadcrumbs = new c_base_menu_item(); + } + + $item = $this->pr_create_breadcrumbs_item($this->pr_get_text(0), self::PATH_SELF); + $this->breadcrumbs->set_item($item); + unset($item); + + return new c_base_return_true(); + } + + /** + * Implementation of pr_create_html_add_header_link_canonical(). + */ + protected function pr_create_html_add_header_link_canonical() { + $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical'); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF); + $this->html->set_header($tag); + + unset($tag); + } + + /** + * Implements pr_get_text(). + */ + protected function pr_get_text($code, $arguments = array()) { + $string = ''; + switch ($code) { + case 0: + $string = 'Content Management'; + break; + } + + if (!empty($arguments)) { + $this->pr_process_replacements($string, $arguments); + } + + return $string; + } +} diff --git a/common/standard/paths/m/dashboard.php b/common/standard/paths/m/management_dashboard.php similarity index 92% rename from common/standard/paths/m/dashboard.php rename to common/standard/paths/m/management_dashboard.php index e3cb862..f361b8e 100644 --- a/common/standard/paths/m/dashboard.php +++ b/common/standard/paths/m/management_dashboard.php @@ -53,13 +53,6 @@ class c_standard_path_management_dashboard extends c_standard_path { } /** - * Implements pr_get_title(). - */ - protected function pr_get_title($arguments = array()) { - return $this->pr_get_text(0, $arguments); - } - - /** * Implements pr_get_text(). */ protected function pr_get_text($code, $arguments = array()) { diff --git a/common/standard/paths/m/management_logs.php b/common/standard/paths/m/management_logs.php new file mode 100644 index 0000000..b52bed1 --- /dev/null +++ b/common/standard/paths/m/management_logs.php @@ -0,0 +1,122 @@ +pr_process_arguments($executed)) { + return $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, array('arguments' => array(':{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 $executed; + } + + // @todo: this function needs to check to see if the user has management (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). + #$user = $this->session->get_user_current(); + #$roles_current = $user->get_roles()->get_value_exact(); + + // @todo: this function is currently disabled, so return a path not found. + $error = c_base_error::s_log(NULL, array('arguments' => array(':{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 $executed; + } + + /** + * Implementation of pr_build_breadcrumbs(). + */ + protected function pr_build_breadcrumbs() { + $path_management_view = new c_standard_path_management_dashboard(); + $path_management_view->set_parameters($this->http, $this->database, $this->session, $this->settings); + $path_management_view->set_path_tree($this->get_path_tree($this->path_tree)); + $this->breadcrumbs = $path_management_view->get_breadcrumbs(); + unset($path_management_view); + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $result = parent::pr_build_breadcrumbs(); + if ($result instanceof c_base_return_false) { + unset($result); + return new c_base_return_false(); + } + unset($result); + } + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $this->breadcrumbs = new c_base_menu_item(); + } + + $item = $this->pr_create_breadcrumbs_item($this->pr_get_text(0), self::PATH_SELF); + $this->breadcrumbs->set_item($item); + unset($item); + + return new c_base_return_true(); + } + + /** + * Implementation of pr_create_html_add_header_link_canonical(). + */ + protected function pr_create_html_add_header_link_canonical() { + $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical'); + $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF); + $this->html->set_header($tag); + + unset($tag); + } + + /** + * Implements pr_get_text(). + */ + protected function pr_get_text($code, $arguments = array()) { + $string = ''; + switch ($code) { + case 0: + $string = 'Management Logs'; + break; + } + + if (!empty($arguments)) { + $this->pr_process_replacements($string, $arguments); + } + + return $string; + } +} diff --git a/common/standard/paths/s/ja/submit_form_id.php b/common/standard/paths/s/ja/submit_form_id.php new file mode 100644 index 0000000..517a7fc --- /dev/null +++ b/common/standard/paths/s/ja/submit_form_id.php @@ -0,0 +1,11 @@ + 0), constraint cc_files_name_machine check (name_machine ~ '[A-Za-z]\w*'), + constraint cc_files_name_extension check (name_extension ~ '[A-Za-z]\w*'), + constraint cc_field_size check (field_size >= 0), + constraint cc_field_width check (field_width >= 0), + constraint cc_field_height check (field_height >= 0), constraint cf_files_id_creator foreign key (id_creator) references s_tables.t_users (id) on delete cascade on update cascade, constraint cf_files_id_creator_session foreign key (id_creator_session) references s_tables.t_users (id) on delete cascade on update cascade, @@ -69,11 +77,11 @@ create index i_files_public on s_tables.t_files (id) create view s_users.v_files with (security_barrier=true) as with allowed_groups as (select id from s_users.v_groups_self) - select id, id_type, id_group, name_machine, name_human, is_private, date_created, date_changed from s_tables.t_files + select id, id_type, id_group, name_machine, name_human, name_extension, is_private, field_size, field_width, field_height, field_data, date_created, date_changed from s_tables.t_files where not is_deleted and (not is_locked or id_group in (select * from allowed_groups)) and (not is_private or (is_private and id_group in (select * from allowed_groups))); create view public.v_files with (security_barrier=true) as - select id, id_type, NULL::bigint as id_group, name_machine, name_human, NULL::bool as is_private, NULL::bool as date_created, NULL::bool as date_changed from s_tables.t_files + select id, id_type, NULL::bigint as id_group, name_machine, name_human, name_extension, NULL::bool as is_private, field_size, field_width, field_height, field_data, NULL::bool as date_created, NULL::bool as date_changed from s_tables.t_files where not is_deleted and not is_locked and not is_private; diff --git a/documentation/url_paths.txt b/documentation/url_paths.txt index 0057251..445cdb9 100644 --- a/documentation/url_paths.txt +++ b/documentation/url_paths.txt @@ -29,7 +29,8 @@ Example /d/ paths: Example /f/ paths: - /f/i/% - Load file '%' by file id. - /f/c/% - Load file '%' by file checksum. -- /f/s/% - Load checksum for file '%'. +- /f/s/% - Load checksum for file '%', using file id. +- /f/m/% - Load checksum for file '%', using file checksum. Example /m/ paths: - /m/dashboard - Dashboard @@ -39,7 +40,7 @@ Example /m/ paths: Example /s/ paths: - /s/login - Login form - /s/logout - Logout form -- /s/my_form_id/% - "My_form_id" form with parameter '%'. +- /s/form_id/% - "form_id" form with parameter '%'. Example /t/ paths: - /t/main/css/all.css - All css file from main theme. -- 1.8.3.1