This enables the use of PHP namespaces.
The namespaces must be prefixed with 'n_'.
The parent namespace for koopa is 'n_koopa'.
I intend to only use a single depth namespace of n_koopa to keep it simple.
All other names remain unchanged.
This introduces a few problems/caveats:
1) Functions being stored as strings to be called dynamically now need to have '/n_koopa/' in front of them.
2) The standard index file in implementing projects, such as reservations, must still use namespace 'n_koopa' even if their project is different.
- This is because the base classes will call the c_base_defaults_global class.
- All other implementing project files can have their own namespace.
3) Core PHP classes very likely need to have '\' prefixed to them (will update as I encounter them).
This introduced new resolutions:
1) Using namespaces revealed a bug in my code where a class function get_roles() is called on an object that may potentially be a c_base_return_false object.
- I have to review the code and confirm whether or not the code should always be returning the appropriate class or allow other returns.
- For now, I am just adding a quick instance check.
* @file
* Provides a class for managing system access.
*/
+namespace n_koopa;
// include required files.
require_once('common/base/classes/base_error.php');
* @file
* Provides a class for managing addresses.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides a class for managing AJAX responses.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_array.php');
* - Only the return values of the core c_base_return_* functions return direct/raw values.
* - All other functions are expected to return some class or sub-class of c_base_return.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_rfc_string.php');
* Provides a class for managing ASCII.
*/
+namespace n_koopa;
+
/**
* A class for managing ASCII.
*/
* @file
* Provides a class for managing common charsets.
*/
+namespace n_koopa;
/**
* A class for managing common rfc character sets.
*
* @see: https://www.w3.org/TR/html5/
*/
+namespace n_koopa;
* @file
* Provides a class for managing cookies.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
*
* @see: http://php.net/manual/en/features.persistent-connections.php
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_warning.php');
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides a class for performing debugging.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
*
* It is recommended to set PHP precision setting to at least 16 for microtime values.
*/
+namespace n_koopa;
/**
$now = self::s_get_timestamp_session()->get_value_exact();
$microseconds = (int) (($now - ((int) $now)) * 1000000);
- $date = new DateTime(date('Y/m/d h:i:s', (int) $now) . '.' . $microseconds . date(' P', (int) $now));
+ $date = new \DateTime(date('Y/m/d h:i:s', (int) $now) . '.' . $microseconds . date(' P', (int) $now));
unset($now);
}
else {
$microseconds = 0;
}
- $date = new DateTime(date('Y/m/d h:i:s', (int) $timestamp) . '.' . $microseconds . date(' P', (int) $timestamp));
+ $date = new \DateTime(date('Y/m/d h:i:s', (int) $timestamp) . '.' . $microseconds . date(' P', (int) $timestamp));
}
unset($microseconds);
- if (!($date instanceof DateTime)) {
+ if (!($date instanceof \DateTime)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':{operation_name}' => 'date', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
if (!is_null(self::$s_timezone)) {
date_default_timezone_set(self::$s_timezone);
- $date->setTimeZone(new DateTimeZone(self::$s_timezone));
+ $date->setTimeZone(new \DateTimeZone(self::$s_timezone));
}
$formatted = $date->format($string);
}
// To ensure support for microseconds (and milliseconds), datetime must be initialized woth microseconds.
- $date = DateTime::createFromFormat($format, $string);
+ $date = \DateTime::createFromFormat($format, $string);
- if (!($date instanceof DateTime)) {
+ if (!($date instanceof \DateTime)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':{operation_name}' => 'date', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
return c_base_return_error::s_value(0.0, 'c_base_return_float', $error);
}
* @file
* Provides a class for managing e-mail related functionality.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_ascii.php');
* @file
* Provides a class for managing return values.
*/
+namespace n_koopa;
/**
* A generic class for managing errors.
* @file
* Implements english language support for common error messages.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_languages.php');
* I have also noticed that the presence of a period '.' at the end of the string changes translation.
* This may require a completely different approach to generating than what works with english.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_languages.php');
*
* This is primarily intended to be used to store file data (of any format) prior to theme output.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_mime.php');
* @file
* Provides a class for managing forms.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
*
* @see: https://www.w3.org/TR/html5/
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_markup.php');
* @file
* Provides a class for managing the HTTP protocol.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_charset.php');
* @file
* Provides a class for managing the HTTP protocol status codes.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides a class for managing the different supported languages.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
*
* This is initially designed just to select/read from the ldap and not meant to modify or manage ldap databases.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides a class for managing the logs.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides a class for html markup.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_mime.php');
* @file
* Provides a class for managing the menus.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_rfc_string.php');
* @file
* Provides a class for managing mime-type information.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* Then, for very specific cases, users should then be granted the ability to create path aliases.
* However, aliases should not be able to override pre-define paths or the performance gains are lost by requiring loading of the aliases before each static path.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_utf8.php');
* @file
* Provides a class for managing hard coded and dynamic paths.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http.php');
* Functions defined in this class will return the normal TRUE/FALSE and not the class-based TRUE/FALSE as an exception to this rule.
* - This is done because this class defines those objects.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
/**
* @file
* Provides a class for managing common rfc character testing cases.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_ascii.php');
require_once('common/base/classes/base_utf8.php');
* @file
* Provides a class for managing common rfc string testing cases.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_ascii.php');
require_once('common/base/classes/base_utf8.php');
* @file
* Provides a class for managing system roles.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides a class for managing sessions.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_form.php');
* @file
* Provides a class for managing system roles.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_address.php');
* @file
* Provides UTF-8 support.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
*
* This is for providing a common api for loading views from the database.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_database.php');
* @file
* Provides a class for managing PHP warnings.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_return.php');
/**
* @file
* Provides the standard database class.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_database.php');
* @file
* Provides the standard site index class.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_users.php');
* @file
* Provides a class for managing the menus.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_menu.php');
/**
* @file
* Provides the standard path handling class.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_menu.php');
protected const NAME_MENU_CONTENT = 'menu_content';
protected const NAME_MENU_FOOTER = 'menu_footer';
- protected const HANDLER_MENU_HEADER = 'c_standard_menu_header';
- protected const HANDLER_MENU_UTILITY = 'c_standard_menu_utility';
- protected const HANDLER_MENU_BREADCRUMBS = 'c_standard_menu_breadcrumbs';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content';
- protected const HANDLER_MENU_FOOTER = 'c_standard_menu_footer';
+ protected const HANDLER_MENU_HEADER = '\n_koopa\c_standard_menu_header';
+ protected const HANDLER_MENU_UTILITY = '\n_koopa\c_standard_menu_utility';
+ protected const HANDLER_MENU_BREADCRUMBS = '\n_koopa\c_standard_menu_breadcrumbs';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content';
+ protected const HANDLER_MENU_FOOTER = '\n_koopa\c_standard_menu_footer';
protected const SCRIPT_EXTENSION = '.php';
* @file
* Provides the standard path handling for exceptional cases.
*/
+namespace n_koopa;
+
require_once('common/standard/classes/standard_path.php');
/**
* @file
* Provides the standard path handling class with user-path specific parts.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides the standard site index class.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_paths.php');
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 HANDLER_ACCESS_DENIED = '\n_koopa\c_standard_path_access_denied';
+ protected const HANDLER_BAD_METHOD = '\n_koopa\c_standard_path_bad_method';
+ protected const HANDLER_INDEX = '\n_koopa\c_standard_path_index';
+ protected const HANDLER_NOT_FOUND = '\n_koopa\c_standard_path_not_found';
+ protected const HANDLER_OPTIONS_METHOD = '\n_koopa\c_standard_path_options_method';
+ protected const HANDLER_SERVER_ERROR = '\n_koopa\c_standard_path_server_error';
+
+ protected const HANDLER_ADMINISTER_DASHBOARD = '\n_koopa\c_standard_administer_dashboard';
+ protected const HANDLER_ADMINISTER_CONTENT = '\n_koopa\c_standard_administer_content';
+ protected const HANDLER_ADMINISTER_LOGS = '\n_koopa\c_standard_administer_logs';
+
+ #protected const HANDLER_AJAX = '\n_koopa\c_standard_ajax';
+
+ protected const HANDLER_CACHE_STATIC = '\n_koopa\c_standard_cache_static';
+ protected const HANDLER_CACHE_ERROR = '\n_koopa\c_standard_cache_error';
+
+ protected const HANDLER_FILE_BY_ID = '\n_koopa\c_standard_file_by_id';
+ protected const HANDLER_FILE_BY_CHECKSUM = '\n_koopa\c_standard_file_by_checksum';
+
+ protected const HANDLER_FILE_CHECKSUM_BY_ID = '\n_koopa\c_standard_file_checksum_by_id';
+ protected const HANDLER_FILE_CHECKSUM_BY_CHECKSUM = '\n_koopa\c_standard_file_checksum_by_checksum';
+
+ protected const HANDLER_MANAGEMENT_DASHBOARD = '\n_koopa\c_standard_management_dashboard';
+ protected const HANDLER_MANAGEMENT_CONTENT = '\n_koopa\c_standard_management_content';
+ protected const HANDLER_MANAGEMENT_LOGS = '\n_koopa\c_standard_management_logs';
+
+ protected const HANDLER_SUBMIT_FORM_ID = '\n_koopa\c_standard_submit_form_id';
+
+ #protected const HANDLER_THEME = '\n_koopa\c_standard_theme';
+
+ protected const HANDLER_USER_CHECK = '\n_koopa\c_standard_path_user_check';
+ protected const HANDLER_USER_CONTACT = '\n_koopa\c_standard_path_user_contact';
+ protected const HANDLER_USER_CONTENT = '\n_koopa\c_standard_path_user_content';
+ protected const HANDLER_USER_CREATE = '\n_koopa\c_standard_path_user_create';
+ protected const HANDLER_USER_DASHBOARD = '\n_koopa\c_standard_path_user_dashboard';
+ protected const HANDLER_USER_DELETE = '\n_koopa\c_standard_path_user_delete';
+ protected const HANDLER_USER_EDIT = '\n_koopa\c_standard_path_user_edit';
+ protected const HANDLER_USER_LOCK = '\n_koopa\c_standard_path_user_lock';
+ protected const HANDLER_USER_LOGIN = '\n_koopa\c_standard_path_user_login';
+ protected const HANDLER_USER_LOGOUT = '\n_koopa\c_standard_path_user_logout';
+ protected const HANDLER_USER_LOGS = '\n_koopa\c_standard_path_user_logs';
+ protected const HANDLER_USER_REFRESH = '\n_koopa\c_standard_path_user_refresh';
+ protected const HANDLER_USER_RESET = '\n_koopa\c_standard_path_user_reset';
+ protected const HANDLER_USER_SESSION = '\n_koopa\c_standard_path_user_session';
+ protected const HANDLER_USER_SETTINGS = '\n_koopa\c_standard_path_user_settings';
+ protected const HANDLER_USER_UNLOCK = '\n_koopa\c_standard_path_user_unlock';
+ protected const HANDLER_USER_VIEW = '\n_koopa\c_standard_path_user_view';
protected const SCRIPT_EXTENSION = '.php';
protected const WILDCARD_PATH = '/%';
* @file
* Provides a class for managing system roles.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_roles.php');
* @file
* Provides path handler for the access denied pages.
*/
+namespace n_koopa;
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http_status.php');
* @file
* Provides path handler for the not found pages.
*/
+namespace n_koopa;
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http_status.php');
* @file
* Provides path handler for the site index.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the access denied pages.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_access_denied().
* @file
* Provides path handler for the not found pages.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_bad_method().
* @file
* Provides path handler for the index page.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_index().
* @file
* Provides path handler for the not found pages.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_not_found().
* @file
* Provides path handler for the server error pages.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_server_error().
* @file
* Provides path handler for the not found pages.
*/
+namespace n_koopa;
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http_status.php');
* @file
* Provides path handler for the server rror pages.
*/
+namespace n_koopa;
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the server rror pages.
*/
+namespace n_koopa;
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http_status.php');
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
+
require_once('common/standard/menus/menu_breadcrumbs.php');
/**
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
+
require_once('common/standard/menus/menu_content.php');
/**
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
+
require_once('common/standard/menus/menu_content.php');
/**
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
+
require_once('common/standard/menus/menu_footer.php');
/**
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
+
require_once('common/standard/menus/menu_header.php');
/**
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
+
require_once('common/standard/menus/menu_utility.php');
/**
* This is a menu that shows a navigation history on how to get to the current page via links.
* This does not have to be a link to every path in the current url.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_markup.php');
require_once('common/standard/classes/standard_menu.php');
* This is the navigation menu that is intended to be used for navigating the site.
* This is (generally) specific to each page or url path.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_markup.php');
require_once('common/standard/classes/standard_menu.php');
* @file
* Provides a class for a path-specific content menu.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_markup.php');
require_once('common/standard/classes/standard_menu.php');
$menu->set_tag($item);
unset($item);
- $roles = $session->get_user_current()->get_roles()->get_value_exact();
+ if ($session->get_user_current() instanceof c_base_users_user) {
+ $roles = $session->get_user_current()->get_roles()->get_value_exact();
+ }
+ else {
+ $roles = new c_base_users_user();
+ }
+
if (array_key_exists(c_base_roles::MANAGER, $roles) || array_key_exists(c_base_roles::ADMINISTER, $roles)) {
// @todo: only show lock user if account is unlocked.
$item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(7), $settings['base_path'] . c_standard_paths::URI_USER_LOCK . $path_id_user);
* A footer menu is a menu that is intended to be displayed in the footer of a page.
* This is (generally) a global menu that is displayed on most pages.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_markup.php');
require_once('common/standard/classes/standard_menu.php');
* A header menu is a menu that is intended to be displayed in the header of a page.
* This is (generally) a global menu that is displayed on most pages.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_markup.php');
require_once('common/standard/classes/standard_menu.php');
* This includes dashboard links, profile, links, etc..
* This is not intended for site navigation.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_markup.php');
require_once('common/standard/classes/standard_menu.php');
}
unset($result);
- $roles = $session->get_user_current()->get_roles()->get_value_exact();
+ if ($session->get_user_current() instanceof c_base_users_user) {
+ $roles = $session->get_user_current()->get_roles()->get_value_exact();
+ }
+ else {
+ $roles = new c_base_users_user();
+ }
$menu = $this->pr_create_html_create_menu($settings['base_css'] . static::CLASS_NAME, $this->pr_get_text(0));
* @file
* Provides path handler for the administer content.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
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';
+ #protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_administer_content';
/**
* Implements do_execute().
* @file
* Provides path handler for the administer dashboard.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the administer logs.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
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';
+ #protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_administer_logs';
/**
* Implements do_execute().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_administer_content().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_administer_dashboard().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_administer_logs().
* 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.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* 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).
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_cache_error().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_cache_static().
* @file
* Provides path handler for the files by checksum.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the files by id.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the file checksums by checksum.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the file checksums by file id.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_file_by_checksum().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_file_by_id().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_file_by_checksum_by_checksum().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_file_by_checksum_by_id().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_management_content().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_management_dashboard().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_management_logs().
* @file
* Provides path handler for the management content.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
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';
+ #protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_management_content';
/**
* Implements do_execute().
* @file
* Provides path handler for the manager dashboard.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the management logs.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
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';
+ #protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_management_logs';
/**
* Implements do_execute().
* @file
* Provides a language specific class.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_submit_form_id().
* @file
* Provides path handler for submit forms.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the user checks.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_check().
* @file
* Provides path handler for the user dashboard.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_dashboard().
* @file
* Provides path handler for the user dashboard.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_delete().
* @file
* Provides path handler for the user edit.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_edit().
* @file
* Provides path handler for the user dashboard.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_lock().
* @file
* Provides path handler for the login process.
*/
-
+namespace n_koopa;
/**
* Implements c_standard_path_user_login().
* @file
* Provides path handler for the logout process.
*/
-
+namespace n_koopa;
/**
* Implements c_standard_path_user_logout().
* @file
* Provides path handler for the user refreshes.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_refresh().
* @file
* Provides path handler for the user session actions.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_session().
* @file
* Provides path handler for the user dashboard.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_dashboard().
* @file
* Provides path handler for the user unlock.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_unlock().
* @file
* Provides path handler for the user view.
*/
+namespace n_koopa;
/**
* Implements c_standard_path_user_dashboard().
* This is generally intended to be used to trigger one or more checks against a user account or related data.
* This could be a simple reaction as is common with ajax but could also be a page containing forms.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
public const PATH_SELF = 'u/check';
protected const NAME_MENU_CONTENT = 'menu_content_user_view';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_user_view';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view';
/**
* Implements do_execute().
* @file
* Provides path handler for the user create/copy.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the user dashboard.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
$wrapper = $this->pr_create_tag_section(array(1 => 0));
$wrapper->set_tag($this->pr_create_tag_text_block(1));
- $roles = $session->get_user_current()->get_roles()->get_value_exact();
+ if ($session->get_user_current() instanceof c_base_users_user) {
+ $roles = $session->get_user_current()->get_roles()->get_value_exact();
+ }
+ else {
+ $roles = new c_base_users_user();
+ }
$wrapper->set_tag($this->pr_create_tag_text_block($this->pr_get_text(2, array('@{user}' => $session->get_name()->get_value_exact()))));
* @file
* Provides path handler for the user delete.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
public const PATH_SELF = 'u/delete';
protected const NAME_MENU_CONTENT = 'menu_content_user_view';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_user_view';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view';
/**
* Implements do_execute().
* @file
* Provides path handler for the user edit.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
public const PATH_SELF = 'u/edit';
protected const NAME_MENU_CONTENT = 'menu_content_user_view';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_user_view';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view';
protected const CLASS_USER_EDIT_ACCOUNT = 'user_settings-account';
protected const CLASS_USER_EDIT_PERSONAL = 'user_settings-personal';
* @file
* Provides path handler for the user lock.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
public const PATH_SELF = 'u/lock';
protected const NAME_MENU_CONTENT = 'menu_content_user_view';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_user_view';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view';
/**
* Implements do_execute().
* @file
* Provides path handler for the login process.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the user logout process.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* This is generally intended to be used to trigger one or more refreshes against a user account or related data.
* This could be a simple reaction as is common with ajax but could also be a page containing forms.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
public const PATH_SELF = 'u/refresh';
protected const NAME_MENU_CONTENT = 'menu_content_user_view';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_user_view';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view';
/**
* Implements do_execute().
* This is generally intended to be used to trigger one or more session actions against a user account or related data.
* This could be a simple reaction as is common with ajax but could also be a page containing forms.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
* @file
* Provides path handler for the user settings.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
public const PATH_SELF = 'u/settings';
protected const NAME_MENU_CONTENT = 'menu_content_user_view';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_user_view';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view';
protected const CLASS_USER_SETTINGS_ACCOUNT = 'user_settings-account';
protected const CLASS_USER_SETTINGS_PERSONAL = 'user_settings-personal';
* @file
* Provides path handler for the user unlock.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
public const PATH_SELF = 'u/unlock';
protected const NAME_MENU_CONTENT = 'menu_content_user_view';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_user_view';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view';
/**
* Implements do_execute().
* @file
* Provides path handler for the user view.
*/
+namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
public const PATH_SELF = 'u/view';
protected const NAME_MENU_CONTENT = 'menu_content_user_view';
- protected const HANDLER_MENU_CONTENT = 'c_standard_menu_content_user_view';
+ protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view';
protected const CLASS_USER_VIEW_IMAGE = 'user_view-image';
protected const CLASS_USER_VIEW_INFORMATION = 'user_view-information';
*
* This is currently a draft/brainstorm and is subject to be completely rewritten/redesigned.
*/
+namespace n_koopa;
// include required files.
require_once('common/base/classes/base_error.php');
*
* @see: https://www.w3.org/TR/html5/
*/
+namespace n_koopa;
// include required files.
require_once('common/base/classes/base_error.php');
*
* @see: https://www.w3.org/TR/html5/
*/
+namespace n_koopa;
// include required files.
require_once('common/base/classes/base_error.php');
* - May only contain the following tags: <tag>.
* - example:
*/
+namespace n_koopa;
// include required files.
require_once('common/base/classes/base_error.php');
*
* This is for providing a common api for loading views from the database.
*/
+namespace n_koopa;
+
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_view.php');
- f_: This represent a function.
- c_: This represents a class name.
- t_: This represents a class trait.
+ - n_: This represents a namespace name.
Within a class object, special rules apply:
1) f_ is not prefixed on function names.
<?php
+ namespace n_koopa;
+
// make sure the class files can be loaded (be sure to customize this as necessary).
set_include_path('/var/www/koopa');
// test error message handling using english or japanese.
$supported_languages = array(
- i_base_languages::ENGLISH_US => 'c_base_error_messages_english',
- i_base_languages::ENGLISH => 'c_base_error_messages_english',
- i_base_languages::JAPANESE => 'c_base_error_messages_japanese',
+ i_base_languages::ENGLISH_US => '\n_koopa\c_base_error_messages_english',
+ i_base_languages::ENGLISH => '\n_koopa\c_base_error_messages_english',
+ i_base_languages::JAPANESE => '\n_koopa\c_base_error_messages_japanese',
);
$stuff['http']->set_response_content_language(i_base_languages::ENGLISH_US);
<?php
+namespace n_reservation;
+use n_koopa;
+
// assign custom include path.
set_include_path('/var/git/koopa');
/**
* The standard class for use in index.php or equivalent.
*/
-class c_reservation_index extends c_standard_index {
+class c_reservation_index extends \n_koopa\c_standard_index {
/**
* Class constructor.
*
* It is recommended to set PHP precision setting to at least 16 for microtime values.
*/
+namespace n_koopa;
/**
const ERROR_BACKTRACE_ARGUMENTS = FALSE;
// provide a language to fallback to if none is set.
- const LANGUAGE_CLASS_DEFAULT = 'c_base_languages_limited';
+ const LANGUAGE_CLASS_DEFAULT = '\n_koopa\c_base_languages_limited';
// reserved path groups: array(97, 99, 100, 102, 109, 115, 116, 120, 121).
const RESERVED_PATH_GROUP = array(c_base_ascii::LOWER_A, c_base_ascii::LOWER_C, c_base_ascii::LOWER_D, c_base_ascii::LOWER_F, c_base_ascii::LOWER_M, c_base_ascii::LOWER_S, c_base_ascii::LOWER_T, c_base_ascii::LOWER_U, c_base_ascii::LOWER_X);
$now = self::s_get_timestamp_session()->get_value_exact();
$microseconds = (int) (($now - ((int) $now)) * 1000000);
- $date = new DateTime(date('Y/m/d h:i:s', (int) $now) . '.' . $microseconds . date(' P', (int) $now));
+ $date = new \DateTime(date('Y/m/d h:i:s', (int) $now) . '.' . $microseconds . date(' P', (int) $now));
unset($now);
}
else {
$microseconds = 0;
}
- $date = new DateTime(date('Y/m/d h:i:s', (int) $timestamp) . '.' . $microseconds . date(' P', (int) $timestamp));
+ $date = new \DateTime(date('Y/m/d h:i:s', (int) $timestamp) . '.' . $microseconds . date(' P', (int) $timestamp));
}
unset($microseconds);
- if (!($date instanceof DateTime)) {
+ if (!($date instanceof \DateTime)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':{operation_name}' => 'date', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
if (!is_null(self::$s_timezone)) {
date_default_timezone_set(self::$s_timezone);
- $date->setTimeZone(new DateTimeZone(self::$s_timezone));
+ $date->setTimeZone(new \DateTimeZone(self::$s_timezone));
}
$formatted = $date->format($string);
}
// To ensure support for microseconds (and milliseconds), datetime must be initialized woth microseconds.
- $date = DateTime::createFromFormat($format, $string);
+ $date = \DateTime::createFromFormat($format, $string);
- if (!($date instanceof DateTime)) {
+ if (!($date instanceof \DateTime)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':{operation_name}' => 'date', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
return c_base_return_error::s_value(0.0, 'c_base_return_float', $error);
}