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.
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a class for managing AJAX responses.
+ */
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_array.php');
+
+/**
+ * A generic container for AJAX responses.
+ *
+ * @todo: implement a standard ajax response array structure to make response format and structure consistent.
+ */
+class c_base_ajax extends c_base_array {
+
+ /**
+ * @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__, '');
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a class for managing files.
+ *
+ * This is primarily intended to be used to store file data (of any format) prior to theme output.
+ */
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_mime.php');
+
+/**
+ * A generic container for files.
+ */
+class c_base_file extends c_base_return_value {
+ protected $id;
+ protected $id_creator;
+ protected $id_creator_session;
+ protected $id_type;
+ protected $id_group;
+
+ protected $name_machine;
+ protected $name_human;
+ protected $name_extension;
+
+ protected $field_size;
+ protected $field_width;
+ protected $field_height;
+
+ protected $is_private;
+ protected $is_locked;
+ protected $is_deleted;
+ protected $is_system;
+ protected $is_user;
+
+ protected $date_created;
+ protected $date_changed;
+ protected $date_locked;
+ protected $date_deleted;
+
+ /**
+ * Class constructor.
+ */
+ public function __construct() {
+ parent::__construct();
+
+ $this->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);
+ }
+}
protected $id;
protected $attributes;
protected $attributes_body;
- protected $type;
- protected $method;
protected $headers;
protected $body;
parent::__construct();
$this->id = NULL;
- $this->attributes = array();
+
+ $this->attributes = array();
$this->attributes_body = array();
+
$this->headers = array();
- $this->body = array();
+ $this->body = array();
}
/**
*/
public function __destruct() {
unset($this->id);
+
unset($this->attributes);
unset($this->attributes_body);
+
unset($this->headers);
unset($this->body);
}
/**
- * 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
}
/**
+ * 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
}
/**
- * 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
}
/**
- * 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
}
/**
- * 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:
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:
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:
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;
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:
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:
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:
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;
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();
}
}
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;
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;
// This provides a way to still use <p> 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();
$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;
}
unset($this->paths);
unset($this->processed);
unset($this->output);
+ unset($this->output_type);
unset($this->original_output_buffering);
$this->session->set_user_current($user_current);
}
else {
- // @todo: hanle errors.
+ // @todo: handle errors.
}
unset($user_current);
$this->session->set_user_current($user_session);
}
else {
- // @todo: hanle errors.
+ // @todo: handle errors.
}
unset($user_session);
*/
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();
}
$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)) {
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.
// 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;
+ }
}
*/
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 = '/%';
// 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.
*
* 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.
*/
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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
*/
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);
}
/**
// 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
$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);
$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);
$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);
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the administer content.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+require_once('common/standard/paths/a/administer_dashboard.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for content administration.
+ *
+ * This listens on: /a/content
+ */
+class c_standard_path_administer_content extends c_standard_path {
+ public const PATH_SELF = 'a/content';
+
+ #protected const NAME_MENU_CONTENT = 'menu_content_administer_content';
+ #protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_administer_content';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ if (!$this->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;
+ }
+}
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().
*/
}
/**
- * 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()) {
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the administer logs.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+require_once('common/standard/paths/a/administer_dashboard.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for logs administration.
+ *
+ * This listens on: /a/logs
+ */
+class c_standard_path_administer_logs extends c_standard_path {
+ public const PATH_SELF = 'a/logs';
+
+ #protected const NAME_MENU_CONTENT = 'menu_content_administer_logs';
+ #protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_administer_logs';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ if (!$this->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;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_administer_content().
+ */
+class c_standard_path_administer_content_ja extends c_standard_path_administer_content {
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = 'コンテンツ管理';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
<?php
/**
* @file
- * Provides path handler for the administer dashboard.
+ * Provides a language specific class.
*/
/**
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_administer_logs().
+ */
+class c_standard_path_administer_logs_ja extends c_standard_path_administer_logs {
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = '管理ログ';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the cached error pages.
+ *
+ * This could be used to load, alter, and sign (such as via PGP/GPG) a static file before output.
+ * Such a use is not truly static, but it can be used for some amount of optimization.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+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: /c/error
+ */
+class c_standard_path_cache_error extends c_standard_path {
+ public const PATH_SELF = 'c/error';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ if (!$this->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);
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the cached static pages.
+ *
+ * This could be used to load, alter, and sign (such as via PGP/GPG) a static file before output.
+ * Such a use is not truly static, but it can be used for some amount of optimization.
+ * This could also be used for dynamicly generated CSS and JS aggregation static files (as is done in Drupal).
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for statically cached content.
+ *
+ * This listens on: /c/static
+ */
+class c_standard_path_cache_static extends c_standard_path {
+ public const PATH_SELF = 'c/static';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ if (!$this->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);
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_cache_error().
+ */
+class c_standard_path_cache_error_ja extends c_standard_path_cache_error {
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_cache_static().
+ */
+class c_standard_path_cache_static_ja extends c_standard_path_cache_static {
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the files by checksum.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for files by checksum.
+ *
+ * This listens on: /f/c
+ */
+class c_standard_path_file_by_checksum extends c_standard_path {
+ public const PATH_SELF = 'f/c';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ // @todo
+
+ return $executed;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the files by id.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for files by id.
+ *
+ * This listens on: /f/i
+ */
+class c_standard_path_file_by_checksum extends c_standard_path {
+ public const PATH_SELF = 'f/i';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ // @todo
+
+ return $executed;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the file checksums by checksum.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for files by checksum.
+ *
+ * This listens on: /f/m
+ */
+class c_standard_path_file_checksum_by_checksum extends c_standard_path {
+ public const PATH_SELF = 'f/m';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ // @todo
+
+ return $executed;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the file checksums by file id.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for files by checksum.
+ *
+ * This listens on: /f/s
+ */
+class c_standard_path_file_checksum_by_checksum extends c_standard_path {
+ public const PATH_SELF = 'f/s';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ // @todo
+
+ return $executed;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_file_by_checksum().
+ */
+class c_standard_path_file_by_checksum_ja extends c_standard_path_file_by_checksum {
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_file_by_id().
+ */
+class c_standard_path_file_by_id_ja extends c_standard_path_file_by_id {
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_file_by_checksum_by_checksum().
+ */
+class c_standard_path_file_by_checksum_by_checksum_ja extends c_standard_path_file_by_checksum_by_checksum {
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_file_by_checksum_by_id().
+ */
+class c_standard_path_file_by_checksum_by_id_ja extends c_standard_path_file_by_checksum_by_id {
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_management_content().
+ */
+class c_standard_path_management_content_ja extends c_standard_path_management_content {
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = 'コンテンツ管理';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
<?php
/**
* @file
- * Provides path handler for the management dashboard.
+ * Provides a language specific class.
*/
/**
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_management_logs().
+ */
+class c_standard_path_management_logs_ja extends c_standard_path_management_logs {
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = '管理ログ';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the management content.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+require_once('common/standard/paths/m/management_dashboard.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for content administration.
+ *
+ * This listens on: /m/content
+ */
+class c_standard_path_management_content extends c_standard_path {
+ public const PATH_SELF = 'm/content';
+
+ #protected const NAME_MENU_CONTENT = 'menu_content_management_content';
+ #protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_management_content';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ if (!$this->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;
+ }
+}
}
/**
- * 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()) {
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the management logs.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+require_once('common/standard/paths/m/management_dashboard.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for logs administration.
+ *
+ * This listens on: /m/logs
+ */
+class c_standard_path_management_logs extends c_standard_path {
+ public const PATH_SELF = 'm/logs';
+
+ #protected const NAME_MENU_CONTENT = 'menu_content_management_logs';
+ #protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_management_logs';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ if (!$this->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;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a language specific class.
+ */
+
+/**
+ * Implements c_standard_path_submit_form_id().
+ */
+class c_standard_path_submit_form_id_ja extends c_standard_path_submit_form_id {
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for submit forms.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+/**
+ * Provides a path handler for files by checksum.
+ *
+ * This listens on: /s/form_id
+ */
+class c_standard_path_submit_form_id extends c_standard_path {
+ public const PATH_SELF = 's/form_id';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ // @todo
+
+ return $executed;
+ }
+}
name_machine varchar(128) not null,
name_human varchar(256) not null,
+ name_extension varchar(64) not null,
is_private boolean default true not null,
is_locked boolean default false not null,
is_system boolean default false not null,
is_user boolean default false not null,
+ field_size bigint not null,
+ field_width bigint,
+ field_height bigint,
field_data bytea not null,
date_created timestamp with time zone default current_timestamp not null,
constraint cc_files_id check (id > 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,
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;
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
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.