Fix a logic flaw in the regular expression handling of wildcard paths.
- paths with multiple '/%' where not being properly stripped and such paths (like 'u/view/%/%' where being incorrectly stripped into 'u/view%').
- This resulted in incorrect 'path not found' issues.
Move repeated user content into the core path, adding new class variables as necessary.
Make the default behavior in 'c_standard_path' to include $output_format as well as $arguments.
- $output_format represents the requested output format, the standard being 'html'.
- mime type integers are used, but strings are supported for non-mimetype presentations, such as 'print' for printer-friendly html.
- This will allow for every single path to potentially be presented in other formats.
- The most common formats being 'html', 'print', and 'pdf'.
- More advanced usage can be used via 'json', which is essentially for AJAX.
- Because all content may be represented in 'json', it also makes it possible for 3rd-party clients to render a complete page following a standard format without having to parse HTML.
- This allows for incredibly advanced functionality which can be later utilized by custom clients such as phone-apps that wish to present the data to the user.
- Furthermore, more advanced accessibility (in the context of ADA) can be used so that HTML does not need to be parsed and more content-specific material may be used with less overhead.
- This includes allowing for a client, such as a screen-reader, to make explicit content requests.
- I may, in the near future, implement a raspberry pi screen reader that utilizes this as a proof of concept.
- $arguments represents the processed arguments.
// the path wildcard is intentionally non-standard.
// remove it so that it does not cause the validator to fail.
- $without_wildcard = preg_replace('@(^%/|^%$|/%/|/%$)@', '', $sanitized);
+ $without_wildcard = preg_replace('@(^%/|^%$|(/%)+|/%/$|/%$)@', '', $sanitized);
if (!is_string($without_wildcard)) {
return FALSE;
}
$depth_total = count($path_parts);
// make sure the first path exists.
+ // note that 'paths' is not populated here, but is later used when being processed by self::find_path().
$path_part = array_shift($path_parts);
if (!array_key_exists($path_part, $path_tree)) {
$path_tree[$path_part] = array(
'methods' => isset($path_tree['methods']) ? $path_tree['methods'] : NULL,
);
- if ($depth_current == $depth_total) {
+ if ($depth_current == $depth_total) {
$found = array(
'include_directory' => $path_tree['include_directory'],
'include_name' => $path_tree['include_name'],
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_menu.php');
require_once('common/base/classes/base_markup.php');
+require_once('common/base/classes/base_mime.php');
/**
* Provides standard extensions to base paths.
protected $text_type;
protected $request_uri;
protected $breadcrumbs;
+ protected $arguments;
+ protected $output_format;
/**
$this->languages = array();
$this->language_alias = NULL;
- $this->text_type = NULL;
- $this->request_uri = NULL;
- $this->breadcrumbs = NULL;
+ $this->text_type = NULL;
+ $this->request_uri = NULL;
+ $this->breadcrumbs = NULL;
+ $this->arguments = array();
+ $this->output_format = c_base_mime::TYPE_TEXT_HTML;
}
/**
unset($this->text_type);
unset($this->request_uri);
unset($this->breadcrumbs);
+ unset($this->arguments);
+ unset($this->output_format);
parent::__destruct();
}
* Return the current path parts after the specified path.
*
* This is intended for handling the path parts as arguments.
+ * Processed path arguments are stored on the classes arguments variable.
*
* No sanitization is performed on these arguments.
*
* @param string $path_after
* The string to parse.
*
- * @return c_base_return_array
- * An array of url path parts.
- * An empty array with error bit set on error.
+ * @return bool
+ * TRUE on success, FALSE otherwise.
+ * On error, arguments is assigned to an empty array.
*/
- protected function pr_get_path_arguments($path_after) {
+ protected function pr_process_path_arguments($path_after) {
$path = $this->http->get_request_uri_relative($this->settings['base_path'])->get_value_exact();
$path = preg_replace('@^' . $path_after . '(/|$)@i', '', $path);
if (mb_strlen($path) == 0) {
unset($path);
- return array();
+ $this->arguments = array();
+ return FALSE;
}
- $path_parts = explode('/', $path);
+ $this->arguments = explode('/', $path);
unset($path);
- return $path_parts;
+ return TRUE;
}
/**
/**
* Provides user-specific extensions to standard paths.
+ *
+ * This extension specifically provides a user id and a user object that the path is expected to present the content of.
+ * This is not to be confused with the currently logged in user.
*/
class c_standard_path_user extends c_standard_path {
protected const ID_USER_MINIMUM = 1000;
protected const CLASS_ID_USER = 'id-user';
protected const CLASS_ID_USER_EXTERNAL = 'id-user-external';
+ protected $path_user;
+ protected $path_user_id;
+
+ /**
+ * Class constructor.
+ */
+ public function __construct() {
+ parent::__construct();
+
+ $this->path_user = NULL;
+ $this->path_user_id = NULL;
+ }
+
+ /**
+ * Class destructor.
+ */
+ public function __destruct() {
+ unset($this->path_user);
+ unset($this->path_user_id);
+
+ parent::__destruct();
+ }
+
/**
* Implements pr_get_text_title().
*/
protected function pr_get_text_title($arguments = array()) {
return $this->pr_get_text(0, $arguments);
}
+
+ /**
+ * Provides a standard argument handler function.
+ *
+ * This is generally intended to be called by do_execute().
+ *
+ * This will load and then validate the standard argument structure.
+ * The standard user path argument structure is as follows:
+ * - No Arguments: default user account and settings.
+ * - Argument 0 (optional): The user ID argument to present the content of (may also be non-numeric values of 'Argument 1' for current user).
+ * - Argument 1 (optional): Action argument, at the very least supports the following values 'html', 'rss', 'ical', 'pdf', 'ps', 'print', 'json', and 'text'.
+ *
+ * This alters the path_user and path_user_id class variables.
+ * - path_user is set to either the current user or the user specified by the url arguments.
+ * - path_user_id is either assigned to the id of the user represented by path_user or FALSE.
+ * - If FALSE, then the user ID is either invalid or is somehow unavailable.
+ *
+ * This alters the format_output class variable as follows:
+ * - provides output mime-type integer code for expected output format.
+ * - special case formats (non-integer/string values), such as 'print', are stored in this variable to represent print-friendly output.
+ *
+ * This will alter the current position of the arguments array as per PHP array functions.
+ * - This allows for child classes to process further arguments after calling this function without re-processing.
+ * - reset() should be called on the array argument to bypass this behavior.
+ *
+ * @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->path_user = $this->session->get_user_current();
+ $this->path_user_id = NULL;
+ $this->output_format = c_base_mime::TYPE_TEXT_HTML;
+
+ if ($this->pr_process_path_arguments(static::PATH_SELF)) {
+ $argument = reset($this->arguments);
+
+ if (is_numeric($argument)) {
+ $this->path_user_id = (int) $argument;
+
+ // do not allow view access to reserved/special accounts.
+ if ($this->path_user_id < static::ID_USER_MINIMUM) {
+ $this->path_user_id = FALSE;
+ unset($argument);
+
+ $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 FALSE;
+ }
+ }
+ else {
+ $argument = NULL;
+ }
+
+ $arguments_total = count($this->arguments);
+ if (is_null($argument) || $arguments_total > 1) {
+ if (is_null($argument)) {
+ $argument = current($this->arguments);
+ }
+ else {
+ $argument = next($this->arguments);
+ }
+
+ if ($argument == 'print') {
+ $this->output_format = 'print';
+ }
+ elseif ($argument == 'html') {
+ $this->output_format = c_base_mime::TYPE_TEXT_HTML;
+ }
+ elseif ($argument == 'pdf') {
+ $this->output_format = c_base_mime::TYPE_DOCUMENT_PDF;
+ }
+ elseif ($argument == 'ps') {
+ $this->output_format = c_base_mime::TYPE_TEXT_PS;
+ }
+ elseif ($argument == 'rss') {
+ $this->output_format = c_base_mime::TYPE_TEXT_RSS;
+ }
+ elseif ($argument == 'ical') {
+ $this->output_format = c_base_mime::TYPE_TEXT_ICAL;
+ }
+ elseif ($argument == 'text') {
+ $this->output_format = c_base_mime::TYPE_TEXT_PLAIN;
+ }
+ elseif ($argument == 'json') {
+ $this->output_format = c_base_mime::TYPE_TEXT_JSON;
+ }
+ else {
+ unset($argument);
+ unset($arguments_total);
+
+ $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 FALSE;
+ }
+ }
+ unset($argument);
+ unset($arguments_total);
+ }
+
+ if (is_null($this->path_user_id)) {
+ $this->path_user = $this->session->get_user_current();
+ $this->path_user_id = $this->path_user->get_id()->get_value_exact();
+
+ // do not allow view access to reserved/special accounts.
+ if ($this->path_user_id < static::ID_USER_MINIMUM) {
+ $this->path_user_id = FALSE;
+ }
+ }
+ else {
+ $this->path_user = new c_standard_users_user();
+
+ // @todo: handle database errors.
+ $loaded = $this->path_user->do_load($this->database, $this->path_user_id);
+ if ($loaded instanceof c_base_return_false) {
+ $this->path_user_id = FALSE;
+ }
+ else {
+ // @todo: check to see if user id is accessible.
+ }
+ unset($loaded);
+ }
+
+ if ($this->path_user_id === FALSE) {
+ $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 FALSE;
+ }
+
+ return TRUE;
+ }
}
const URI_USER_LOCK = 'u/lock';
const URI_USER_LOGIN = 'u/login';
const URI_USER_LOGOUT = 'u/logout';
- const URI_USER_PDF = 'u/pdf';
- const URI_USER_PRINT = 'u/print';
- const URI_USER_PS = 'u/ps';
const URI_USER_REFRESH = 'u/refresh';
const URI_USER_SESSION = 'u/session';
const URI_USER_SETTINGS = 'u/settings';
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_PDF = 'user_pdf';
- protected const NAME_USER_PRINT = 'user_print';
- protected const NAME_USER_PS = 'user_ps';
protected const NAME_USER_REFRESH = 'user_refresh';
protected const NAME_USER_SESSION = 'user_session';
protected const NAME_USER_SETTINGS = 'user_settings';
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_PDF = 'c_standard_path_user_pdf';
- protected const HANDLER_USER_PRINT = 'c_standard_path_user_print';
- protected const HANDLER_USER_PS = 'c_standard_path_user_ps';
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';
$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);
+
// pages / forms
$this->paths->add_path(static::URI_USER_CREATE, static::HANDLER_USER_CREATE, static::PATH_USER, static::NAME_USER_CREATE);
$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_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_EDIT, static::HANDLER_USER_EDIT, static::PATH_USER, static::NAME_USER_EDIT);
$this->paths->add_path(static::URI_USER_EDIT . static::WILDCARD_PATH, static::HANDLER_USER_EDIT, static::PATH_USER, static::NAME_USER_EDIT);
+ $this->paths->add_path(static::URI_USER_EDIT . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_EDIT, static::PATH_USER, static::NAME_USER_EDIT);
+
$this->paths->add_path(static::URI_USER_SETTINGS, static::HANDLER_USER_SETTINGS, static::PATH_USER, static::NAME_USER_SETTINGS);
$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_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);
+
// actions / triggers
$this->paths->add_path(static::URI_USER_CHECK, static::HANDLER_USER_CHECK, static::PATH_USER, static::NAME_USER_CHECK);
$this->paths->add_path(static::URI_USER_CHECK . static::WILDCARD_PATH, static::HANDLER_USER_CHECK, static::PATH_USER, static::NAME_USER_CHECK);
+ $this->paths->add_path(static::URI_USER_CHECK . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_CHECK, static::PATH_USER, static::NAME_USER_CHECK);
+
$this->paths->add_path(static::URI_USER_LOCK, static::HANDLER_USER_LOCK, static::PATH_USER, static::NAME_USER_LOCK);
$this->paths->add_path(static::URI_USER_LOCK . static::WILDCARD_PATH, static::HANDLER_USER_LOCK, static::PATH_USER, static::NAME_USER_LOCK);
+ $this->paths->add_path(static::URI_USER_LOCK . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_LOCK, static::PATH_USER, static::NAME_USER_LOCK);
+
$this->paths->add_path(static::URI_USER_REFRESH, static::HANDLER_USER_REFRESH, static::PATH_USER, static::NAME_USER_REFRESH);
$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_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);
+
$this->paths->add_path(static::URI_USER_UNLOCK, static::HANDLER_USER_UNLOCK, static::PATH_USER, static::NAME_USER_UNLOCK);
$this->paths->add_path(static::URI_USER_UNLOCK . static::WILDCARD_PATH, static::HANDLER_USER_UNLOCK, static::PATH_USER, static::NAME_USER_UNLOCK);
-
- // presentation / formats
- $this->paths->add_path(static::URI_USER_PDF, static::HANDLER_USER_PDF, static::PATH_USER, static::NAME_USER_PDF);
- $this->paths->add_path(static::URI_USER_PDF . static::WILDCARD_PATH, static::HANDLER_USER_PDF, static::PATH_USER, static::NAME_USER_PDF);
- $this->paths->add_path(static::URI_USER_PRINT, static::HANDLER_USER_PRINT, static::PATH_USER, static::NAME_USER_PRINT);
- $this->paths->add_path(static::URI_USER_PRINT . static::WILDCARD_PATH, static::HANDLER_USER_PRINT, static::PATH_USER, static::NAME_USER_PRINT);
- $this->paths->add_path(static::URI_USER_PS, static::HANDLER_USER_PS, static::PATH_USER, static::NAME_USER_PS);
- $this->paths->add_path(static::URI_USER_PS . static::WILDCARD_PATH, static::HANDLER_USER_PS, static::PATH_USER, static::NAME_USER_PS);
+ $this->paths->add_path(static::URI_USER_UNLOCK . static::WILDCARD_PATH . static::WILDCARD_PATH, static::HANDLER_USER_UNLOCK, static::PATH_USER, static::NAME_USER_UNLOCK);
}
/**
$this->settings = array();
}
}
+ else {
+ return new c_base_return_false();
+ }
unset($columns);
return new c_base_return_true();
protected const CLASS_USER_VIEW = 'user-view';
/**
- * Implements do_prepare().
+ * Implements do_build().
*/
public function do_build(&$http, &$database, &$session, $settings, $items = NULL) {
$result = parent::do_build($http, $database, $session, $settings);
+++ /dev/null
-<?php
-/**
- * @file
- * Provides path handler for the user pdf.
- */
-
-/**
- * Implements c_standard_path_user_pdf().
- */
-class c_standard_path_user_pdf_ja extends c_standard_path_user_pdf {
-
- /**
- * Implements pr_get_text().
- */
- protected function pr_get_text($code, $arguments = array()) {
- $string = '';
- switch ($code) {
- case 0:
- $string = '';
- break;
- default:
- unset($string);
- return parent::pr_get_text($code, $arguments);
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-}
+++ /dev/null
-<?php
-/**
- * @file
- * Provides path handler for the user print.
- */
-
-/**
- * Implements c_standard_path_user_print().
- */
-class c_standard_path_user_print_ja extends c_standard_path_user_print {
-
- /**
- * Implements pr_get_text().
- */
- protected function pr_get_text($code, $arguments = array()) {
- $string = '';
- switch ($code) {
- case 0:
- $string = '';
- break;
- default:
- unset($string);
- return parent::pr_get_text($code, $arguments);
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-}
+++ /dev/null
-<?php
-/**
- * @file
- * Provides path handler for the user dashboard.
- */
-
-/**
- * Implements c_standard_path_user_ps().
- */
-class c_standard_path_user_ps_ja extends c_standard_path_user_ps {
-
- /**
- * Implements pr_get_text().
- */
- protected function pr_get_text($code, $arguments = array()) {
- $string = '';
- switch ($code) {
- case 0:
- $string = '';
- break;
- default:
- unset($string);
- return parent::pr_get_text($code, $arguments);
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-}
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
-
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
-
- $this->pr_add_menus();
+ // @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();
- $executed->set_output($this->html);
- unset($this->html);
+ // @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;
}
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
+
+ // @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();
$wrapper = $this->pr_create_tag_section(array(1 => 0));
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
+
+ // @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();
$wrapper = $this->pr_create_tag_section(array(1 => 0));
$wrapper->set_tag($this->pr_create_tag_text_block(1));
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
+ // @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();
// initialize the content as HTML.
$this->pr_create_html();
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
+
+ // @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();
$wrapper = $this->pr_create_tag_section(array(1 => 0));
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
-
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
-
- $this->pr_add_menus();
+ // @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();
- $executed->set_output($this->html);
- unset($this->html);
+ // @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;
}
+++ /dev/null
-<?php
-/**
- * @file
- * Provides path handler for the user dashboard.
- */
-
-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/classes/standard_path_user.php');
-
-require_once('common/theme/classes/theme_html.php');
-
-/**
- * Provides a path handler for user in pdf format.
- *
- * @fixme: this should probably be renamed to c_standard_path_user_view_pdf.
- *
- * This listens on: /u/pdf
- */
-class c_standard_path_user_pdf extends c_standard_path_user_view {
- public const PATH_SELF = 'u/pdf'; // @fixme: make path 'u/pdf/view'.
-
- /**
- * 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;
- }
-
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
-
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
-
- $executed->set_output($this->html);
- unset($this->html);
-
- 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 user dashboard.
- */
-
-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/classes/standard_path_user.php');
-
-require_once('common/theme/classes/theme_html.php');
-
-/**
- * Provides a path handler for user print format (printer-friendly).
- *
- * @fixme: this should probably be renamed to c_standard_path_user_view_print.
- *
- * This listens on: /u/print
- */
-class c_standard_path_user_print extends c_standard_path_user_view {
- public const PATH_SELF = 'u/print'; // @fixme: make path 'u/print/view'.
-
- /**
- * 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;
- }
-
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
-
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
-
- $executed->set_output($this->html);
- unset($this->html);
-
- 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 user dashboard.
- */
-
-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/classes/standard_path_user.php');
-
-require_once('common/theme/classes/theme_html.php');
-
-/**
- * Provides a path handler for user postcript (postcript format).
- *
- * @fixme: this should probably be renamed to c_standard_path_user_view_ps.
- *
- * This listens on: /u/ps
- */
-class c_standard_path_user_ps extends c_standard_path_user_view {
- public const PATH_SELF = 'u/ps'; // @fixme: make path 'u/ps/view'.
-
- /**
- * 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;
- }
-
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
-
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
-
- $executed->set_output($this->html);
- unset($this->html);
-
- 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);
- }
-}
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
-
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
-
- $this->pr_add_menus();
+ // @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();
- $executed->set_output($this->html);
- unset($this->html);
+ // @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;
}
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
- // @todo: json responses are expected to be returned for ajax purposes.
- // this will very likely support u/session/(ajax_action_name) such as u/session/ping for keeping the session and therefore session cookie alive.
+ // @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;
}
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
- $this->p_do_execute_settings($executed, $user);
+ // @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();
+
+ $this->pr_do_execute_settings($executed);
unset($user);
return $executed;
*
* @param c_base_path_executed &$executed
* The execution results to be returned.
- * @param c_base_users_user $user_id
- * An object representing the user to view.
*
* @return null|array
* NULL is returned if no errors are found.
* An array of errors are returned if found.
*/
- protected function p_do_execute_settings(&$executed, $user) {
+ protected function pr_do_execute_settings(&$executed) {
$errors = NULL;
$arguments = array();
- $arguments[':{user_name}'] = $user->get_name_human()->get_first()->get_value_exact() . ' ' . $user->get_name_human()->get_last()->get_value_exact();
+ $arguments[':{user_name}'] = $this->path_user->get_name_human()->get_first()->get_value_exact() . ' ' . $this->path_user->get_name_human()->get_last()->get_value_exact();
if (mb_strlen($arguments[':{user_name}']) == 0) {
unset($arguments[':{user_name}']);
}
- $id_user = $user->get_id()->get_value();
- if (is_int($id_user)) {
- $text_id_user = $this->pr_create_tag_text('[id: ' . $id_user . ']', array(), NULL, static::CLASS_ID_USER);
+ if (is_int($this->path_user_id)) {
+ $text_id_user = $this->pr_create_tag_text('[id: ' . $this->path_user_id . ']', array(), NULL, static::CLASS_ID_USER);
$wrapper = $this->pr_create_tag_section(array(1 => array('text' => 0, 'append-inside' => $text_id_user)), $arguments);
unset($text_id_user);
}
}
$roles_current = $this->session->get_user_current()->get_roles()->get_value_exact();
- $roles = $user->get_roles()->get_value_exact();
+ $roles = $this->path_user->get_roles()->get_value_exact();
$full_view_access = FALSE;
- if ($id_user === $this->session->get_user_current()->get_id()->get_value_exact()) {
+ if ($this->path_user_id === $this->session->get_user_current()->get_id()->get_value_exact()) {
$full_view_access = TRUE;
}
elseif (isset($roles_current[c_base_roles::MANAGER]) || isset($roles_current[c_base_roles::ADMINISTER])) {
$fieldset = $this->pr_create_tag_fieldset(14, array(), static::CLASS_USER_SETTINGS_ACCOUNT, static::CLASS_USER_SETTINGS_ACCOUNT);
$content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, array(static::CSS_AS_FIELD_SET_CONTENT));
- $content->set_tag($this->pr_create_tag_field_row(18, '' . $id_user, array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 0, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(18, '' . $this->path_user_id, array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 0, TRUE));
- if ($full_view_access || !$user->get_address_email()->is_private()->get_value()) {
+ if ($full_view_access || !$this->path_user->get_address_email()->is_private()->get_value()) {
$count = 1;
if ($full_view_access) {
- $content->set_tag($this->pr_create_tag_field_row(19, '' . $user->get_id_external()->get_value(), array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(19, '' . $this->path_user->get_id_external()->get_value(), array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
$count++;
}
- $content->set_tag($this->pr_create_tag_field_row(20, '' . $user->get_name_machine()->get_value(), array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(20, '' . $this->path_user->get_name_machine()->get_value(), array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
$count++;
- $content->set_tag($this->pr_create_tag_field_row(21, '' . $user->get_address_email()->get_address()->get_value(), array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(21, '' . $this->path_user->get_address_email()->get_address()->get_value(), array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
$count++;
- if ($user->is_locked()->get_value_exact()) {
+ if ($this->path_user->is_locked()->get_value_exact()) {
$tag_text = $this->pr_get_text(33);
}
else {
$content->set_tag($this->pr_create_tag_field_row(24, $tag_text, array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
$count++;
- if ($user->is_private()->get_value_exact()) {
+ if ($this->path_user->is_private()->get_value_exact()) {
$tag_text = $this->pr_get_text(33);
}
else {
$content->set_tag($this->pr_create_tag_field_row(27, $tag_text, array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
$count++;
- if ($user->is_roler()->get_value_exact()) {
+ if ($this->path_user->is_roler()->get_value_exact()) {
$tag_text = $this->pr_get_text(33);
}
else {
$count++;
if (isset($roles_current[c_base_roles::MANAGER]) || isset($roles_current[c_base_roles::ADMINISTER])) {
- if ($user->is_deleted()->get_value_exact()) {
+ if ($this->path_user->is_deleted()->get_value_exact()) {
$tag_text = $this->pr_get_text(33);
}
else {
// date created
$date = NULL;
- if (!is_null($user->get_date_created()->get_value())) {
- $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $user->get_date_created()->get_value())->get_value_exact();
+ if (!is_null($this->path_user->get_date_created()->get_value())) {
+ $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $this->path_user->get_date_created()->get_value())->get_value_exact();
}
$content->set_tag($this->pr_create_tag_field_row(28, $date, array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
// date changed
$date = NULL;
- if (!is_null($user->get_date_changed()->get_value())) {
- $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $user->get_date_changed()->get_value())->get_value_exact();
+ if (!is_null($this->path_user->get_date_changed()->get_value())) {
+ $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $this->path_user->get_date_changed()->get_value())->get_value_exact();
}
$content->set_tag($this->pr_create_tag_field_row(29, $date, array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
// date synced
$date = NULL;
- if (!is_null($user->get_date_synced()->get_value())) {
- $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $user->get_date_synced()->get_value())->get_value_exact();
+ if (!is_null($this->path_user->get_date_synced()->get_value())) {
+ $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $this->path_user->get_date_synced()->get_value())->get_value_exact();
}
$content->set_tag($this->pr_create_tag_field_row(30, $date, array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
// date locked
$date = NULL;
- if (!is_null($user->get_date_locked()->get_value())) {
- $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $user->get_date_locked()->get_value())->get_value_exact();
+ if (!is_null($this->path_user->get_date_locked()->get_value())) {
+ $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $this->path_user->get_date_locked()->get_value())->get_value_exact();
}
$content->set_tag($this->pr_create_tag_field_row(31, '' . $date, array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
// date deleted
$date = NULL;
- if (!is_null($user->get_date_deleted()->get_value())) {
- $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $user->get_date_deleted()->get_value())->get_value_exact();
+ if (!is_null($this->path_user->get_date_deleted()->get_value())) {
+ $date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $this->path_user->get_date_deleted()->get_value())->get_value_exact();
}
$content->set_tag($this->pr_create_tag_field_row(32, '' . $date, array(), NULL, ($count % 2 == 0 ? c_standard_path::CSS_AS_ROW_EVEN : c_standard_path::CSS_AS_ROW_ODD), $count, TRUE));
unset($date);
}
else {
- $content->set_tag($this->pr_create_tag_field_row(20, '' . $user->get_name_machine()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_ODD, 1, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(20, '' . $this->path_user->get_name_machine()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_ODD, 1, TRUE));
$content->set_tag($this->pr_create_tag_field_row(21, $this->pr_get_text(43), array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 2, TRUE));
}
$this->html->set_tag($fieldset);
unset($fieldset);
- unset($id_user);
- if ($full_view_access || !$user->is_private()->get_value()) {
+ if ($full_view_access || !$this->path_user->is_private()->get_value()) {
// personal information
$fieldset = $this->pr_create_tag_fieldset(15, array(), static::CLASS_USER_SETTINGS_PERSONAL, static::CLASS_USER_SETTINGS_PERSONAL);
$content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, array(static::CSS_AS_FIELD_SET_CONTENT));
- $content->set_tag($this->pr_create_tag_field_row(37, '' . $user->get_name_human()->get_prefix()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 0, TRUE));
- $content->set_tag($this->pr_create_tag_field_row(38, '' . $user->get_name_human()->get_first()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_ODD, 1, TRUE));
- $content->set_tag($this->pr_create_tag_field_row(39, '' . $user->get_name_human()->get_middle()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 2, TRUE));
- $content->set_tag($this->pr_create_tag_field_row(40, '' . $user->get_name_human()->get_last()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_ODD, 3, TRUE));
- $content->set_tag($this->pr_create_tag_field_row(41, '' . $user->get_name_human()->get_suffix()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 4, TRUE));
- $content->set_tag($this->pr_create_tag_field_row(42, '' . $user->get_name_human()->get_complete()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_ODD, 5, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(37, '' . $this->path_user->get_name_human()->get_prefix()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 0, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(38, '' . $this->path_user->get_name_human()->get_first()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_ODD, 1, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(39, '' . $this->path_user->get_name_human()->get_middle()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 2, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(40, '' . $this->path_user->get_name_human()->get_last()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_ODD, 3, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(41, '' . $this->path_user->get_name_human()->get_suffix()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_EVEN, 4, TRUE));
+ $content->set_tag($this->pr_create_tag_field_row(42, '' . $this->path_user->get_name_human()->get_complete()->get_value(), array(), NULL, c_standard_path::CSS_AS_ROW_ODD, 5, TRUE));
$fieldset->set_tag($content);
unset($content);
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
-
- $wrapper = $this->pr_create_tag_section(array(1 => 1000));
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
-
- $this->pr_add_menus();
+ // @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();
- $executed->set_output($this->html);
- unset($this->html);
+ // @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;
}
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();
-
- $id_user = NULL;
- $arguments = $this->pr_get_path_arguments(static::PATH_SELF);
- if (!empty($arguments)) {
- $arguments_total = count($arguments);
- $argument = reset($arguments);
-
- if (is_numeric($argument)) {
- $id_user = (int) $argument;
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
-
- // @todo: check to see if user id is valid and accessible.
- // If the current viewer cannot access the user, then deny access to this page as appropriate.
- }
- else {
- unset($arguments_total);
- unset($argument);
- unset($id_user);
- unset($user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
-
- if ($arguments_total > 1) {
- $argument = next($arguments);
-
- if ($argument == 'print') {
- // @todo: execute custom print function and then return.
- $id_user = NULL;
- }
- #elseif ($argument == 'pdf') {
- # // @todo: execute custom pdf function and then return.
- # $id_user = NULL;
- #}
- #elseif ($argument == 'ps') {
- # // @todo: execute custom postscript function and then return.
- # $id_user = NULL;
- #}
- else {
- $id_user = FALSE;
- }
- }
- unset($arguments_total);
- unset($argument);
-
- if ($id_user === FALSE) {
- unset($user);
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
- $executed->set_error($error);
-
- unset($error);
- unset($arguments);
-
- return $executed;
- }
- }
-
- $user = NULL;
- if (is_null($id_user)) {
- $user = $this->session->get_user_current();
- $id_user = $user->get_id()->get_value_exact();
-
- // do not allow view access to reserved/special accounts.
- if ($id_user < static::ID_USER_MINIMUM) {
- $id_user = FALSE;
- }
- }
- else {
- $user = new c_standard_users_user();
-
- // @todo: handle database errors.
- $loaded = $user->do_load($this->database, $id_user);
- if ($loaded instanceof c_base_return_false) {
- $id_user = FALSE;
- }
- unset($loaded);
+ if (!$this->pr_process_arguments($executed)) {
+ return $executed;
}
- if ($id_user === FALSE) {
- unset($id_user);
-
- $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => static::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ // 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;
}
- unset($arguments);
- unset($id_user);
+
+ // @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();
$wrapper = $this->pr_create_tag_section(array(1 => 0));