From 8e87bbde3ae028999b73afe5545ceaceadd6133c Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 3 Apr 2017 22:50:50 -0500 Subject: [PATCH] Progress: major database work, begin adding path handling, and other changes More focus on database changes. Begin adding path handling. Custom utf8 function changes. Other changes. --- common/base/classes/base_http.php | 92 +++--- common/base/classes/base_mime.php | 4 +- common/base/classes/base_path.php | 260 +++++++++++++++ common/base/classes/base_utf8.php | 62 +++- common/theme/classes/theme_html.php | 1 + database/sql/reservation/order.install | 2 +- database/sql/reservation/reservation-files.sql | 4 +- database/sql/reservation/reservation-last.sql | 350 ++++++++++----------- database/sql/reservation/reservation-log_types.sql | 41 --- database/sql/reservation/reservation-log_users.sql | 6 +- database/sql/reservation/reservation-paths.sql | 94 ++---- .../sql/reservation/reservation-statistics.sql | 2 +- database/sql/reservation/reservation-types.sql | 65 +++- examples/test.php | 20 +- 14 files changed, 649 insertions(+), 354 deletions(-) create mode 100644 common/base/classes/base_path.php diff --git a/common/base/classes/base_http.php b/common/base/classes/base_http.php index 96d3efc..d6684c9 100644 --- a/common/base/classes/base_http.php +++ b/common/base/classes/base_http.php @@ -2121,7 +2121,7 @@ class c_base_http extends c_base_rfc_string { if ($weak) { // Keep the first 15 characters for 'partial:sha256:' plus the first 9 characters of the checksum. - $response['tag'] = substr($response['tag'], 0, 24); + $response['tag'] = mt_substr($response['tag'], 0, 24); } } else { @@ -4954,7 +4954,7 @@ class c_base_http extends c_base_rfc_string { } else { $c['language'] = $id->get_value_exact(); - $this->request[self::REQUEST_ACCEPT_LANGUAGE]['data']['weight'][$weight][$c['language']] = mb_strtolower($c['choice']); + $this->request[self::REQUEST_ACCEPT_LANGUAGE]['data']['weight'][$weight][$c['language']] = (string) c_base_utf8::s_lowercase($c['choice'])->get_value(); unset($c['choice']); } } @@ -5009,7 +5009,7 @@ class c_base_http extends c_base_rfc_string { // convert the known values into integers for improved processing. foreach ($this->request[self::REQUEST_ACCEPT_ENCODING]['data']['choices'] as $weight => &$choice) { foreach ($choice as $key => &$c) { - $lowercase = mb_strtolower($c['choice']); + $lowercase = (string) c_base_utf8::s_lowercase($c['choice'])->get_value(); if ($lowercase == 'chunked') { $c['encoding'] = self::ENCODING_CHUNKED; $this->request[self::REQUEST_ACCEPT_ENCODING]['data']['weight'][$weight][self::ENCODING_CHUNKED] = $lowercase; @@ -5120,7 +5120,7 @@ class c_base_http extends c_base_rfc_string { // convert the known values into integers for improved processing. foreach ($this->request[self::REQUEST_ACCEPT_CHARSET]['data']['choices'] as $weight => &$choice) { foreach ($choice as $key => &$c) { - $lowercase = mb_strtolower($c['choice']); + $lowercase = (string) c_base_utf8::s_lowercase($c['choice'])->get_value(); if ($lowercase == 'ascii') { $c['charset'] = c_base_charset::ASCII; $this->request[self::REQUEST_ACCEPT_CHARSET]['data']['weight'][$weight][c_base_charset::ASCII] = $lowercase; @@ -5274,7 +5274,7 @@ class c_base_http extends c_base_rfc_string { * @see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Access-Control-Request-Method */ private function p_load_request_access_control_request_method() { - $method_string = mb_strtolower($this->headers['access_control_request_method']); + $method_string = (string) c_base_utf8::s_lowercase($this->headers['access_control_request_method'])->get_value(); $method_string = str_replace(' ', '', $method_string); $methods = explode(',', $method_string); @@ -5454,7 +5454,7 @@ class c_base_http extends c_base_rfc_string { $parts = mb_split(', ', $cache_control); foreach ($parts as $part) { - $cleaned_up = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $part)); + $cleaned_up = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $part))->get_value(); if ($cleaned_up == 'no-cache') { $this->request[self::REQUEST_CACHE_CONTROL]['defined'] = TRUE; $this->request[self::REQUEST_CACHE_CONTROL]['data']['methods'][SELF::CACHE_CONTROL_NO_CACHE] = SELF::CACHE_CONTROL_NO_CACHE; @@ -5563,7 +5563,7 @@ class c_base_http extends c_base_rfc_string { return; } - $cleaned_up = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $pragma)); + $cleaned_up = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $pragma))->get_value(); if ($cleaned_up == 'no-cache') { $this->request[self::REQUEST_CACHE_CONTROL]['defined'] = TRUE; $this->request[self::REQUEST_CACHE_CONTROL]['data'][SELF::CACHE_CONTROL_NO_CACHE] = SELF::CACHE_CONTROL_NO_CACHE; @@ -5655,7 +5655,7 @@ class c_base_http extends c_base_rfc_string { } $content_type_parts = mb_split(';', $content_type); - $content_type_part = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $content_type_parts[0])); + $content_type_part = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $content_type_parts[0]))->get_value(); $this->request[self::REQUEST_CONTENT_TYPE]['defined'] = TRUE; $this->request[self::REQUEST_CONTENT_TYPE]['data'] = $content_type_part; @@ -6142,7 +6142,7 @@ class c_base_http extends c_base_rfc_string { // convert the known values into integers for improved processing. foreach ($this->request[self::REQUEST_TE]['data']['choices'] as $weight => &$choice) { foreach ($choice as $key => &$c) { - $lowercase = mb_strtolower($c['choice']); + $lowercase = (string) c_base_utf8::s_lowercase($c['choice'])->get_value(); if ($c['choice'] == 'compress') { $c['encoding'] = self::ENCODING_COMPRESS; } @@ -6592,11 +6592,9 @@ class c_base_http extends c_base_rfc_string { $this->request[$key]['defined'] = TRUE; $this->request[$key]['invalid'] = FALSE; - if (is_null($max_length)) { - $this->request[$key]['data'] = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $raw)); - } - else { - $this->request[$key]['data'] = mb_substr(mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $raw)), 0, $max_length); + $this->request[$key]['data'] = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $raw))->get_value(); + if (!is_null($max_length)) { + $this->request[$key]['data'] = c_base_utf8::s_substring($this->request[$key]['data'], 0, $max_length); } unset($raw); } @@ -6623,11 +6621,10 @@ class c_base_http extends c_base_rfc_string { $this->request[$key]['defined'] = TRUE; $this->request[$key]['invalid'] = FALSE; - if (is_null($max_length)) { - $this->request[$key]['data'][$field] = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $raw)); - } - else { - $this->request[$key]['data'][$field] = mb_substr(mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $raw)), 0, $max_length); + + $this->request[$key]['data'][$field] = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $raw))->get_value(); + if (!is_null($max_length)) { + $this->request[$key]['data'][$field] = c_base_utf8::s_substring($this->request[$key]['data'][$field], 0, $max_length); } unset($raw); } @@ -6657,10 +6654,10 @@ class c_base_http extends c_base_rfc_string { return FALSE; } - $raw = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $original)); + $raw = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $original))->get_value(); // rfc5322 is the preferred/recommended format. - $rfc5322 = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_5322, $timestamp))); + $rfc5322 = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_5322, $timestamp)))->get_value(); if ($raw == $rfc5322) { unset($raw); unset($timestamp); @@ -6669,7 +6666,7 @@ class c_base_http extends c_base_rfc_string { } unset($rfc5322); - $rfc1123 = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_1123, $timestamp))); + $rfc1123 = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_1123, $timestamp)))->get_value(); if ($raw == $rfc1123) { unset($raw); unset($timestamp); @@ -6678,7 +6675,7 @@ class c_base_http extends c_base_rfc_string { } unset($rfc1123); - $rfc850 = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_850, $timestamp))); + $rfc850 = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_850, $timestamp)))->get_value(); if ($raw == $rfc850) { unset($raw); unset($timestamp); @@ -6705,10 +6702,10 @@ class c_base_http extends c_base_rfc_string { private function p_process_accept_parts_sub($super, &$value, &$priority) { $parts_sub = mb_split(self::DELIMITER_ACCEPT_SUB, $super); - $part_sub_value = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $parts_sub[0])); + $part_sub_value = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $parts_sub[0]))->get_value(); $part_sub_priority = NULL; if (count($parts_sub) > 1) { - $part_sub_priority = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $parts_sub[1])); + $part_sub_priority = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $parts_sub[1]))->get_value(); } if (self::p_length_string($part_sub_value) > 2) { @@ -7044,8 +7041,8 @@ class c_base_http extends c_base_rfc_string { } if (isset($pieces[1])) { - $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[0])); - $lower_piece_2 = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[1])); + $lower_piece_1 = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value(); + $lower_piece_2 = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[1]))->get_value(); if ($lower_piece_1 == 'trident') { $result['engine_name_machine'] = 'trident'; @@ -7070,7 +7067,9 @@ class c_base_http extends c_base_rfc_string { unset($lower_piece_2); } elseif (isset($pieces[0])) { - $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[0])); + $lower_cased = (string) c_base_utf8::s_lowercase($pieces[0])->get_value(); + $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased); + unset($lower_cased); if (!empty($lower_piece_1)) { if (preg_match('/^msie \d/iu', $lower_piece_1)) { @@ -7121,8 +7120,13 @@ class c_base_http extends c_base_rfc_string { } if (isset($pieces[1])) { - $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[0])); - $lower_piece_2 = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[1])); + $lower_cased = (string) c_base_utf8::s_lowercase($pieces[0])->get_value(); + $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased); + unset($lower_cased); + + $lower_cased = (string) c_base_utf8::s_lowercase($pieces[1])->get_value(); + $lower_piece_2 = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased); + unset($lower_cased); if ($lower_piece_1 == 'applewebkit') { $result['engine_name_machine'] = 'webkit'; @@ -7267,7 +7271,9 @@ class c_base_http extends c_base_rfc_string { unset($lower_piece_2); } elseif (isset($pieces[0])) { - $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[0])); + $lower_cased = (string) c_base_utf8::s_lowercase($pieces[0])->get_value(); + $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased); + unset($lower_cased); if ($lower_piece_1 == 'opera') { $result['name_machine'] = 'opera'; @@ -7370,8 +7376,8 @@ class c_base_http extends c_base_rfc_string { $pieces = mb_split('/', $agent_matches[0]); $total_pieces = count($pieces); if ($total_pieces == 2) { - $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[0])); - $lower_piece_2 = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[1])); + $lower_piece_1 = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value(); + $lower_piece_2 = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[1]))->get_value(); if ($lower_piece_1 == 'curl') { $result['engine_name_machine'] = 'curl'; @@ -7438,7 +7444,7 @@ class c_base_http extends c_base_rfc_string { unset($lower_piece_2); } elseif ($total_pieces == 1) { - $lower_piece = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($pieces[0])); + $lower_piece = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value(); if ($lower_piece == 'links') { $result['engine_name_machine'] = 'links'; @@ -7488,7 +7494,7 @@ class c_base_http extends c_base_rfc_string { 'invalid' => FALSE, ); - $fixed_checksum = mb_strtolower(preg_replace('/(^\s+)|(\s+$)/us', '', $checksum)); + $fixed_checksum = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $checksum))->get_value(); if (empty($fixed_checksum)) { $result['invalid'] = TRUE; unset($fixed_checksum); @@ -7647,7 +7653,7 @@ class c_base_http extends c_base_rfc_string { 'invalid' => FALSE, ); - $fixed_checksum = mb_strtolower(preg_replace("/(^( |\t)+)|(( |\t)+$)/us", '', $checksum_headers)); + $fixed_checksum = (string) c_base_utf8::s_lowercase(preg_replace("/(^( |\t)+)|(( |\t)+$)/us", '', $checksum_headers))->get_value(); if (empty($fixed_checksum)) { $result['invalid'] = TRUE; unset($fixed_checksum); @@ -7750,7 +7756,8 @@ class c_base_http extends c_base_rfc_string { foreach ($all_headers as $key => $value) { // break the header name so that it is consistent until such time that PHP stops clobbering the header names. $broken = preg_replace('/-/u', '_', $key); - $this->headers[mb_strtolower($broken)] = $value; + $broken = (string) c_base_utf8::s_lowercase($broken)->get_value(); + $this->headers[$broken] = $value; unset($broken); } unset($broken); @@ -7761,13 +7768,13 @@ class c_base_http extends c_base_rfc_string { // non-apache, or calling php from command line. if (isset($_SERVER) && is_array($_SERVER) && !empty($_SERVER)) { foreach ($_SERVER as $key => $value) { - $part = mb_strtolower(mb_substr($key, 0, 5)); + $part = (string) c_base_utf8::s_lowercase(c_base_utf8::s_substring($key, 0, 5))->get_value(); if ($part != 'http_') { continue; } - $part = mb_strtolower(mb_substr($key, 5)); + $part = (string) c_base_utf8::s_lowercase(c_base_utf8::s_substring($key, 5))->get_value(); $this->headers[$part] = $value; } unset($part); @@ -8001,7 +8008,10 @@ class c_base_http extends c_base_rfc_string { */ private function p_prepare_token($token_name, $lower_case = TRUE) { if ($lower_case) { - $trimmed = preg_replace('/(^\s+)|(\s+$)/us', '', mb_strtolower($token_name)); + $lower_cased = (string) c_base_utf8::s_lowercase($token_name)->get_value(); + $trimmed = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased); + unset($lower_cased); + if ($trimmed === FALSE) { unset($trimmed); return FALSE; @@ -9439,7 +9449,7 @@ class c_base_http extends c_base_rfc_string { } elseif ($this->response[self::RESPONSE_CHECKSUM_HEADER]['what'] === self::CHECKSUM_WHAT_PARTIAL) { $header_output[self::RESPONSE_CHECKSUM_HEADER] .= 'partial:'; - $checkum_header = substr($checkum_header, 0, self::CHECKSUM_LENGTH_SHORTSUM); + $checkum_header = mt_substr($checkum_header, 0, self::CHECKSUM_LENGTH_SHORTSUM); } elseif ($this->response[self::RESPONSE_CHECKSUM_HEADER]['what'] === self::CHECKSUM_WHAT_SIGNED) { $header_output[self::RESPONSE_CHECKSUM_HEADER] .= 'signed:'; diff --git a/common/base/classes/base_mime.php b/common/base/classes/base_mime.php index 4d44c95..08b6784 100644 --- a/common/base/classes/base_mime.php +++ b/common/base/classes/base_mime.php @@ -379,7 +379,7 @@ class c_base_mime { * FALSE with the error bit set is returned on error. * FALSE without the error flag means for an invalid mime-type string. * - * @see: mb_strtolower() + * @see: c_base_utf8::s_lowercase() */ static function s_identify($mime, $lowercase = FALSE) { if (!is_string($mime)) { @@ -393,7 +393,7 @@ class c_base_mime { } if ($lowercase) { - $lower_mime = mb_strtolower($mime); + $lower_mime = (string) c_base_utf8::s_lowercase($mime)->get_value(); } else { $lower_mime = $mime; diff --git a/common/base/classes/base_path.php b/common/base/classes/base_path.php new file mode 100644 index 0000000..4e71177 --- /dev/null +++ b/common/base/classes/base_path.php @@ -0,0 +1,260 @@ +value (this is temporary notation and will be removed). + private $field_destination = NULL; + private $field_response_code = NULL; + + private $date_created = NULL; + private $date_changed = NULL; + private $date_locked = NULL; + + + /** + * Class constructor. + */ + public function __construct() { + parent::__construct(); + + $this->id = NULL; + $this->id_group = NULL; + + $this->name_machine = NULL; + $this->name_human = NULL; + + $this->is_content = TRUE; + $this->is_alias = FALSE; + $this->is_redirect = FALSE; + $this->is_coded = FALSE; + $this->is_dynamic = TRUE; + $this->is_user = FALSE; + $this->is_private = TRUE; + $this->is_locked = FALSE; + + $this->field_destination = NULL; + $this->field_response_code = NULL; + + $this->date_created = NULL; + $this->date_changed = NULL; + $this->date_locked = NULL; + } + + /** + * Class destructor. + */ + public function __destruct() { + unset($this->id); + unset($this->id_group); + + unset($this->name_machine); + unset($this->name_human); + + unset($this->is_content); + unset($this->is_alias); + unset($this->is_redirect); + unset($this->is_coded); + unset($this->is_dynamic); + unset($this->is_user); + unset($this->is_private); + unset($this->is_locked); + + unset($this->field_destination); + unset($this->field_response_code); + + unset($this->date_created); + unset($this->date_changed); + unset($this->date_locked); + + parent::__destruct(); + } + + /** + * @see: t_base_return_value::p_s_new() + */ + public static function s_new($value) { + return self::p_s_new($value, __CLASS__); + } + + /** + * @see: t_base_return_value::p_s_value() + */ + public static function s_value($return) { + return self::p_s_value($return, __CLASS__); + } + + /** + * @see: t_base_return_value_exact::p_s_value_exact() + */ + public static function s_value_exact($return) { + return self::p_s_value_exact($return, __CLASS__, array()); + } + + /** + * Create a content path. + * + * @param string $field_path + * The URL path assigned to this field. + * @param string $name_machine + * The machine name of the path. + * @param string $name_human + * The human-friendly name of the path. + * @param bool $is_dynamic + * (optional) When TRUE this designates that the path includes dynamic parts. + * When FALSE, there is no interpretation on the url and path is treated exactly as is. + * @param bool $is_private + * (optional) When TRUE, path is considered private and requires specific access privileges. + * When FALSE, the path is accessible without any access privileges. + * + * @return c_base_markup_tag|c_base_return_status + * A newly created tag is returned on success. + * FALSE with the error bit set is returned on error. + */ + public static function s_create_content($field_path, $name_machine, $name_human, $is_dynamic = TRUE, $is_private = TRUE) { + $path = new __CLASS__(); + + // @todo: write functions and handle return values. + $path->set_value($field_path); + $path->set_name_machine($name_machine); + $path->set_name_human($name_human); + + // @todo: .. + + return $path; + } + + /** + * Create an alias path. + * + * @param string $field_path + * The URL path assigned to this field. + * @param string $name_machine + * The machine name of the path. + * @param string $name_human + * The human-friendly name of the path. + * @param string $field_destination + * The url this content pretends to be. + * @param bool $is_dynamic + * (optional) When TRUE this designates that the path includes dynamic parts. + * When FALSE, there is no interpretation on the url and path is treated exactly as is. + * @param bool $is_private + * (optional) When TRUE, path is considered private and requires specific access privileges. + * When FALSE, the path is accessible without any access privileges. + * + * @return c_base_markup_tag|c_base_return_status + * A newly created tag is returned on success. + * FALSE with the error bit set is returned on error. + */ + public static function s_create_alias($field_path, $name_machine, $name_human, $field_destination, $is_dynamic = TRUE, $is_private = TRUE) { + $path = new __CLASS__(); + + // @todo: write functions and handle return values. + $path->set_value($field_path); + $path->set_name_machine($name_machine); + $path->set_name_human($name_human); + $path->set_field_destination($field_destination); + + // @todo: .. + + return $path; + } + + /** + * Create a redirect path. + * + * @param string $field_path + * The URL path assigned to this field. + * @param string $name_machine + * The machine name of the path. + * @param string $name_human + * The human-friendly name of the path. + * @param string $field_destination + * The url to redirect to. + * @param string $field_destination + * The redirect response code. + * Should be a 3xx url code. + * Usually one of: + * - 300 (Multiple Choices): + * - 301 (Moved Permanently): + * - 303 (See Other): + * @param bool $is_dynamic + * (optional) When TRUE this designates that the path includes dynamic parts. + * When FALSE, there is no interpretation on the url and path is treated exactly as is. + * @param bool $is_private + * (optional) When TRUE, path is considered private and requires specific access privileges. + * When FALSE, the path is accessible without any access privileges. + * + * @return c_base_markup_tag|c_base_return_status + * A newly created tag is returned on success. + * FALSE with the error bit set is returned on error. + */ + public static function s_create_content($field_path, $name_machine, $name_human, $field_destination, $field_response_code, $is_dynamic = TRUE, $is_private = TRUE) { + $path = new __CLASS__(); + + // @todo: write functions and handle return values. + $path->set_value($field_path); + $path->set_name_machine($name_machine); + $path->set_name_human($name_human); + $path->set_field_destination($field_destination); + $path->set_field_response_code($field_response_code); + + // @todo: .. + + return $path; + } +} diff --git a/common/base/classes/base_utf8.php b/common/base/classes/base_utf8.php index 2b0cc5c..28d312b 100644 --- a/common/base/classes/base_utf8.php +++ b/common/base/classes/base_utf8.php @@ -363,7 +363,7 @@ class c_base_utf8 { /** * UTF-8 aware substr(). * - * substr() works with bytes, while s_substring works with characters and are identical in all other aspects. + * All non-utf-8 characters are removed from the string. * * @param string $text * The string to obtain a substring from. @@ -395,6 +395,44 @@ class c_base_utf8 { } /** + * UTF-8 aware strtolower(). + * + * All non-utf-8 characters are removed from the string. + * + * @param string $text + * The string to transform to lowercase from. + * + * @see: mb_strtolower() + */ + public static function s_lowercase($text) { + if (!is_string($text)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + return c_base_return_string::s_new(self::p_s_lowercase($text)); + } + + /** + * UTF-8 aware strtoupper(). + * + * All non-utf-8 characters are removed from the string. + * + * @param string $text + * The string to transform to lowercase from. + * + * @see: mb_strtoupper() + */ + public static function s_uppercase($text) { + if (!is_string($text)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + return c_base_return_string::s_new(self::p_s_uppercase($text)); + } + + /** * Checks if the given string is a Byte Order Mark. * * @param string $text @@ -1048,6 +1086,28 @@ class c_base_utf8 { } /** + * Private version of s_lowercase(). + * + * @see: self::s_lowercase() + */ + private static function p_s_lowercase($text) { + $sanitized = self::p_s_clean($text); + + return mb_strtolower($sanitized); + } + + /** + * Private version of s_uppercase(). + * + * @see: self::s_uppercase() + */ + private static function p_s_uppercase($text) { + $sanitized = self::p_s_clean($text); + + return mb_strtoupper($sanitized); + } + + /** * Private version of s_encode_html_character(). * * @see: self::s_encode_html_character() diff --git a/common/theme/classes/theme_html.php b/common/theme/classes/theme_html.php index f51544d..be201f7 100644 --- a/common/theme/classes/theme_html.php +++ b/common/theme/classes/theme_html.php @@ -79,6 +79,7 @@ class c_theme_html extends c_base_return { /** * Create a tag with commonly used properties. + * * @param int $type * A c_base_markup_tag type id. * @param string|null $id diff --git a/database/sql/reservation/order.install b/database/sql/reservation/order.install index 7e3d828..c925a28 100644 --- a/database/sql/reservation/order.install +++ b/database/sql/reservation/order.install @@ -2,8 +2,8 @@ reservation-first reservation-main reservation-users reservation-groups -reservation-paths reservation-types +reservation-paths reservation-log_types reservation-log_groups reservation-log_problems diff --git a/database/sql/reservation/reservation-files.sql b/database/sql/reservation/reservation-files.sql index 953ddf3..944377f 100644 --- a/database/sql/reservation/reservation-files.sql +++ b/database/sql/reservation/reservation-files.sql @@ -44,14 +44,14 @@ create table s_tables.t_files ( constraint cf_files_id_creator foreign key (id_creator) references s_tables.t_users (id) on delete cascade on update cascade, constraint cf_files_id_creator_session foreign key (id_creator_session) references s_tables.t_users (id) on delete cascade on update cascade, - constraint cf_files_id_type foreign key (id_type) references s_tables.t_path_types (id) on delete restrict on update cascade, + constraint cf_files_id_type foreign key (id_type) references s_tables.t_file_types (id) on delete restrict on update cascade, constraint cf_files_id_group foreign key (id_group) references s_tables.t_groups (id) on delete restrict on update cascade ); create sequence s_tables.se_files_id owned by s_tables.t_files.id; alter table s_tables.t_files alter column id set default nextval('s_tables.se_files_id'::regclass); -grant select,insert,update on s_tables.t_path_types to r_reservation_administer; +grant select,insert,update on s_tables.t_files to r_reservation_administer; grant select on s_tables.t_files to r_reservation_manager, r_reservation_auditor; grant select,usage on s_tables.se_files_id to r_reservation_administer; grant usage on s_tables.se_files_id to r_reservation, r_reservation_system; diff --git a/database/sql/reservation/reservation-last.sql b/database/sql/reservation/reservation-last.sql index a1cbd68..280d09b 100644 --- a/database/sql/reservation/reservation-last.sql +++ b/database/sql/reservation/reservation-last.sql @@ -70,80 +70,74 @@ insert into s_tables.t_log_types (id, name_machine, name_human) values (43, 'unk -/* pre-populate the path types (note: this may be redesigned later once I have more type names). */ -insert into s_tables.t_path_types (id, name_machine, name_human) values (0, 'none', 'None'); -insert into s_tables.t_path_types (id, name_machine, name_human) values (1, 'system', 'System'); -insert into s_tables.t_path_types (id, name_machine, name_human) values (2, 'user', 'User'); - - /** create well known types that can then be user for indexes (all new types added should be considered for custom indexing). **/ -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (0, '0', 'Undefined'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (1, '1', 'Invalid'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (2, '2', 'Unknown'); - -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (100, '100', 'Continue'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (101, '101', 'Switching Protocols'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (102, '102', 'Processing'); - -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (200, '200', 'OK'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (201, '201', 'Created'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (202, '202', 'Accepted'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (203, '203', 'Non-Authoritative Information'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (204, '204', 'No Content'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (205, '205', 'Reset Content'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (206, '206', 'Partial Content'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (207, '207', 'Multi-Status'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (208, '208', 'Already Reported'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (226, '226', 'IM used'); - -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (300, '300', 'Multiple Choices'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (301, '301', 'Moved Permanently'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (302, '302', 'Found'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (303, '303', 'See Other'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (304, '304', 'Not Modified'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (305, '305', 'Use Proxy'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (306, '306', 'Switch Proxy'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (307, '307', 'Temporary Redirect'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (308, '308', 'Permanent Redirect'); - -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (400, '400', 'Bad Request'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (401, '401', 'Unauthorized'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (402, '402', 'Payment Required'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (403, '403', 'Forbidden'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (404, '404', 'Not Found'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (405, '405', 'Method Not Allowed'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (406, '406', 'Not Acceptable'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (407, '407', 'Proxy Authentication Required'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (408, '408', 'Request Timeout'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (409, '409', 'Conflict'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (410, '410', 'Gone'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (411, '411', 'Length Required'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (412, '412', 'Precondition Failed'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (413, '413', 'Payload Too Large'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (414, '414', 'Request-URI Too Long'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (415, '415', 'Unsupported Media Type'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (416, '416', 'Requested Range Not Satisfiable'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (417, '417', 'Expectation Failed'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (422, '422', 'Misdirected Request'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (423, '423', 'Locked'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (424, '424', 'Failed Dependency'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (426, '426', 'Upgrade Required'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (428, '428', 'Precondition Required'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (429, '429', 'Too Many Requests'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (431, '431', 'Request Header Fields Too Large'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (451, '451', 'Unavailable For Legal Reasons'); - -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (500, '500', 'Internal Server Error'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (501, '501', 'Not Implemented'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (502, '502', 'Bad Gateway'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (503, '503', 'Service Unavailable'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (504, '504', 'Gateway Timeout'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (505, '505', 'HTTP Version Not Supported'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (506, '506', 'Variant Also Negotiates'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (507, '507', 'Insufficient Storage'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (508, '508', 'Loop Detected'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (510, '510', 'Not Extended'); -insert into s_tables.t_log_type_http_status_codes (id, name_machine, name_human) values (511, '511', 'Network Authentication Required'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (0, '0', 'Undefined'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (1, '1', 'Invalid'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (2, '2', 'Unknown'); + +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (100, '100', 'Continue'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (101, '101', 'Switching Protocols'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (102, '102', 'Processing'); + +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (200, '200', 'OK'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (201, '201', 'Created'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (202, '202', 'Accepted'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (203, '203', 'Non-Authoritative Information'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (204, '204', 'No Content'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (205, '205', 'Reset Content'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (206, '206', 'Partial Content'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (207, '207', 'Multi-Status'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (208, '208', 'Already Reported'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (226, '226', 'IM used'); + +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (300, '300', 'Multiple Choices'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (301, '301', 'Moved Permanently'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (302, '302', 'Found'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (303, '303', 'See Other'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (304, '304', 'Not Modified'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (305, '305', 'Use Proxy'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (306, '306', 'Switch Proxy'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (307, '307', 'Temporary Redirect'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (308, '308', 'Permanent Redirect'); + +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (400, '400', 'Bad Request'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (401, '401', 'Unauthorized'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (402, '402', 'Payment Required'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (403, '403', 'Forbidden'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (404, '404', 'Not Found'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (405, '405', 'Method Not Allowed'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (406, '406', 'Not Acceptable'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (407, '407', 'Proxy Authentication Required'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (408, '408', 'Request Timeout'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (409, '409', 'Conflict'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (410, '410', 'Gone'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (411, '411', 'Length Required'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (412, '412', 'Precondition Failed'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (413, '413', 'Payload Too Large'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (414, '414', 'Request-URI Too Long'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (415, '415', 'Unsupported Media Type'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (416, '416', 'Requested Range Not Satisfiable'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (417, '417', 'Expectation Failed'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (422, '422', 'Misdirected Request'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (423, '423', 'Locked'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (424, '424', 'Failed Dependency'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (426, '426', 'Upgrade Required'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (428, '428', 'Precondition Required'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (429, '429', 'Too Many Requests'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (431, '431', 'Request Header Fields Too Large'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (451, '451', 'Unavailable For Legal Reasons'); + +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (500, '500', 'Internal Server Error'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (501, '501', 'Not Implemented'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (502, '502', 'Bad Gateway'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (503, '503', 'Service Unavailable'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (504, '504', 'Gateway Timeout'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (505, '505', 'HTTP Version Not Supported'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (506, '506', 'Variant Also Negotiates'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (507, '507', 'Insufficient Storage'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (508, '508', 'Loop Detected'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (510, '510', 'Not Extended'); +insert into s_tables.t_type_http_status_codes (id, name_machine, name_human) values (511, '511', 'Network Authentication Required'); /*** start the sequence count at 1000 to allow for < 1000 to be reserved for special uses ***/ @@ -164,111 +158,111 @@ insert into s_tables.t_log_type_severity_levels (id, name_machine, name_human) v -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human) values (0, 'none', 'None'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human) values (1, 'unknown', 'Unknown'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (2, 'provided', 'Provided', '*'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (3, 'stream', 'Stream', 'application'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (4, 'multipart', 'Multipart', 'multipart'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (5, 'text', 'Text', 'text'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (6, 'image', 'Image', 'image'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (7, 'audio', 'Audio', 'audio'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (8, 'video', 'Video', 'video'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (9, 'document', 'Document', 'application'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (10, 'container', 'Container', 'application'); -insert into s_tables.t_types_mime_categorys (id, name_machine, name_human, field_category) values (11, 'application', 'Application', 'application'); - - -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human) values (0, 0, 'none', 'None'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human) values (1, 1, 'unknown', 'Unknown'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided', 'Provided', NULL, '*/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_text', 'Provided Text', NULL, 'text/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_image', 'Provided Image', NULL, 'image/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_audio', 'Provided Audio', NULL, 'audio/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_video', 'Provided Video', NULL, 'video/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_application', 'Provided Application', NULL, 'application/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3, 3, 'stream', 'Stream', 'octect-stream', 'application/octect-stream'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4, 4, 'multipart', 'Form Data', 'form-data', 'multipart/form-data'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5, 11, 'application', 'URL Data', 'x-www-form-urlencoded', 'application/x-www-form-urlencoded'); - -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1000, 5, 'text', 'Text', NULL, 'text/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1001, 5, 'text_plain', 'Plain Text', 'txt', 'text/plain'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1002, 5, 'text_html', 'HTML', 'html', 'text/html'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1003, 5, 'text_rss', 'RSS', 'rss', 'text/rss'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1003, 5, 'text_rss_xml', 'RSS+XML', 'rss', 'text/rss+xml'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1003, 5, 'text_rdf_xml', 'RDF+XML', 'rss', 'text/rdf+xml'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1003, 5, 'text_atom_xml', 'ATOM+XML', 'rss', 'text/atom+xml'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1004, 5, 'text_ical', 'iCalendar', 'ics', 'text/calendar'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1005, 5, 'text_csv', 'CSV', 'csv', 'text/csv'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1006, 5, 'text_xml', 'XML', 'xml', 'text/xml'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1007, 5, 'text_css', 'CSS', 'css', 'text/css'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1008, 5, 'text_js', 'Javascript', 'js', 'text/js'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1008, 5, 'text_js', 'Javascript', 'js', 'application/js'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1009, 5, 'text_json', 'JSON', 'json', 'text/json'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1010, 5, 'text_rich', 'Rich Text', 'rtf', 'text/rich'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1011, 5, 'text_xhtml', 'XHTML', 'xhtml', 'text/xhtml'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1012, 5, 'text_ps', 'Postscript', 'ps', 'text/ps'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1013, 5, 'text_fss', 'FSS', 'setting', 'text/fss'); - -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2000, 6, 'image', 'Image', NULL, 'image/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2001, 6, 'image_png', 'PNG', 'png', 'image/png'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2002, 6, 'image_gif', 'GIF', 'gif', 'image/gif'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2003, 6, 'image_jpg', 'JPEG', 'jpg', 'image/jpg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2003, 6, 'image_jpg', 'JPEG', 'jpeg', 'image/jpg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2003, 6, 'image_jpg', 'JPEG', 'jpx', 'image/jpg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2004, 6, 'image_bmp', 'Bitmap', 'bmp', 'image/bmp'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2005, 6, 'image_svg', 'SVG', 'svg', 'image/svg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2006, 6, 'image_tiff', 'Tiff', 'tiff', 'image/tiff'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2006, 6, 'image_tiff', 'Tiff', 'tiff', 'image/tiff-fx'); - -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3000, 7, 'audio', 'Audio', NULL, 'audio/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3001, 7, 'audio_wav', 'Wave', 'wav', 'audio/wav'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3002, 7, 'audio_ogg', 'OGG', 'ogg', 'audio/ogg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3003, 7, 'audio_speex', 'Speex', 'spx', 'audio/speex'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3004, 7, 'audio_flac', 'FLAC', 'flac', 'audio/flac'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3005, 7, 'audio_mp3', 'MP3', 'mp3', 'audio/mpeg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3005, 7, 'audio_mp1', 'MP1', 'mp1', 'audio/mpeg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3005, 7, 'audio_mp2', 'MP2', 'mp2', 'audio/mpeg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3006, 7, 'audio_mp4', 'MP4', 'mp4', 'audio/mp4'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3007, 7, 'audio_midi', 'SVG', 'svg', 'audio/svg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3008, 7, 'audio_basic', 'Audio', 'au', 'audio/basic'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3008, 7, 'audio_basic', 'Audio', 'snd', 'audio/basic'); - -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4000, 8, 'video', 'Video', NULL, 'video/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4001, 8, 'video_mpeg', 'MPEG', 'mp4', 'video/mp4'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4001, 8, 'video_mpeg', 'MPEG', 'mpg', 'video/mp4'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4002, 8, 'video_ogg', 'OGG', 'ogg', 'video/ogg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4003, 8, 'video_h264', 'H264', 'h264', 'video/h264'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4003, 8, 'video_x264', 'X264', 'x264', 'video/x264'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4004, 8, 'video_quicktine', 'Quicktime', 'qt', 'video/qt'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4005, 8, 'video_dv', 'Digital Video', 'dv', 'video/dv'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4006, 8, 'video_jpeg', 'Motion JPEG', 'jpg', 'video/jpeg'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4006, 8, 'video_webm', 'Tiff', 'tiff', 'video/tiff-fx'); - -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5000, 9, 'document', 'Document', NULL, 'application/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5001, 9, 'document_libre_chart', 'LibreOffice Chart', 'odc', 'application/vnd.oasis.opendocument.chart'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5002, 9, 'document_libre_formula', 'LibreOffice Formula', 'odf', 'application/vnd.oasis.opendocument.formula'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5003, 9, 'document_libre_graphic', 'LibreOffice Graphic', 'odg', 'application/vnd.oasis.opendocument.graphics'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5004, 9, 'document_libre_presentation', 'LibreOffice Presentation', 'odp', 'application/vnd.oasis.opendocument.presentation'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5005, 9, 'document_libre_spreadsheet', 'LibreOffice Spreadsheet', 'ods', 'application/vnd.oasis.opendocument.spreadsheet'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5006, 9, 'document_libre_text', 'LibreOffice Text', 'odt', 'application/vnd.oasis.opendocument.text'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5007, 9, 'document_libre_html', 'LibreOffice HTML', 'odh', 'application/vnd.oasis.opendocument.text-web'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5008, 9, 'document_pdf', 'PDF', 'pdf', 'application/pdf'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5009, 9, 'document_abi_word', 'Abiword Text', 'abw', 'application/abiword-compressed'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5010, 9, 'document_ms_word', 'Microsoft Word', 'docx', 'application/msword'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5010, 9, 'document_ms_word', 'Microsoft Word', 'doc', 'application/msword'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5011, 9, 'document_ms_excel', 'Microsoft Excel', 'xlsx', 'application/ms-excel'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5011, 9, 'document_ms_excel', 'Microsoft Excel', 'xls', 'application/ms-excel'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5012, 9, 'document_ms_powerpoint', 'Microsoft Powerpoint', 'pptx', 'application/ms-powerpoint'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5012, 9, 'document_ms_powerpoint', 'Microsoft Powerpoint', 'ppt', 'application/ms-powerpoint'); - -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (6000, 10, 'container', 'Container', NULL, 'application/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (6001, 10, 'container_tar', 'Tar', 'tar', 'application/tar'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (6002, 10, 'container_cpio', 'CPIO', 'cpio', 'application/cpio'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (6003, 10, 'container_java', 'Java', 'jar', 'application/java'); - -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (7000, 11, 'application', 'Application', NULL, 'application/*'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (7001, 11, 'application_ocsp_request', 'OCSP Request', NULL, 'application/ocsp-request'); -insert into s_tables.t_types_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (7002, 11, 'application_ocsp_response', 'OCSP Response', NULL, 'application/ocsp-response'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human) values (0, 'none', 'None'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human) values (1, 'unknown', 'Unknown'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (2, 'provided', 'Provided', '*'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (3, 'stream', 'Stream', 'application'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (4, 'multipart', 'Multipart', 'multipart'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (5, 'text', 'Text', 'text'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (6, 'image', 'Image', 'image'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (7, 'audio', 'Audio', 'audio'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (8, 'video', 'Video', 'video'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (9, 'document', 'Document', 'application'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (10, 'container', 'Container', 'application'); +insert into s_tables.t_type_mime_categorys (id, name_machine, name_human, field_category) values (11, 'application', 'Application', 'application'); + + +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human) values (0, 0, 'none', 'None'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human) values (1, 1, 'unknown', 'Unknown'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided', 'Provided', NULL, '*/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_text', 'Provided Text', NULL, 'text/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_image', 'Provided Image', NULL, 'image/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_audio', 'Provided Audio', NULL, 'audio/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_video', 'Provided Video', NULL, 'video/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2, 2, 'provided_application', 'Provided Application', NULL, 'application/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3, 3, 'stream', 'Stream', 'octect-stream', 'application/octect-stream'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4, 4, 'multipart', 'Form Data', 'form-data', 'multipart/form-data'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5, 11, 'application', 'URL Data', 'x-www-form-urlencoded', 'application/x-www-form-urlencoded'); + +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1000, 5, 'text', 'Text', NULL, 'text/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1001, 5, 'text_plain', 'Plain Text', 'txt', 'text/plain'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1002, 5, 'text_html', 'HTML', 'html', 'text/html'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1003, 5, 'text_rss', 'RSS', 'rss', 'text/rss'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1003, 5, 'text_rss_xml', 'RSS+XML', 'rss', 'text/rss+xml'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1003, 5, 'text_rdf_xml', 'RDF+XML', 'rss', 'text/rdf+xml'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1003, 5, 'text_atom_xml', 'ATOM+XML', 'rss', 'text/atom+xml'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1004, 5, 'text_ical', 'iCalendar', 'ics', 'text/calendar'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1005, 5, 'text_csv', 'CSV', 'csv', 'text/csv'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1006, 5, 'text_xml', 'XML', 'xml', 'text/xml'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1007, 5, 'text_css', 'CSS', 'css', 'text/css'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1008, 5, 'text_js', 'Javascript', 'js', 'text/js'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1008, 5, 'text_js', 'Javascript', 'js', 'application/js'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1009, 5, 'text_json', 'JSON', 'json', 'text/json'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1010, 5, 'text_rich', 'Rich Text', 'rtf', 'text/rich'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1011, 5, 'text_xhtml', 'XHTML', 'xhtml', 'text/xhtml'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1012, 5, 'text_ps', 'Postscript', 'ps', 'text/ps'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (1013, 5, 'text_fss', 'FSS', 'setting', 'text/fss'); + +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2000, 6, 'image', 'Image', NULL, 'image/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2001, 6, 'image_png', 'PNG', 'png', 'image/png'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2002, 6, 'image_gif', 'GIF', 'gif', 'image/gif'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2003, 6, 'image_jpg', 'JPEG', 'jpg', 'image/jpg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2003, 6, 'image_jpg', 'JPEG', 'jpeg', 'image/jpg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2003, 6, 'image_jpg', 'JPEG', 'jpx', 'image/jpg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2004, 6, 'image_bmp', 'Bitmap', 'bmp', 'image/bmp'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2005, 6, 'image_svg', 'SVG', 'svg', 'image/svg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2006, 6, 'image_tiff', 'Tiff', 'tiff', 'image/tiff'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (2006, 6, 'image_tiff', 'Tiff', 'tiff', 'image/tiff-fx'); + +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3000, 7, 'audio', 'Audio', NULL, 'audio/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3001, 7, 'audio_wav', 'Wave', 'wav', 'audio/wav'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3002, 7, 'audio_ogg', 'OGG', 'ogg', 'audio/ogg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3003, 7, 'audio_speex', 'Speex', 'spx', 'audio/speex'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3004, 7, 'audio_flac', 'FLAC', 'flac', 'audio/flac'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3005, 7, 'audio_mp3', 'MP3', 'mp3', 'audio/mpeg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3005, 7, 'audio_mp1', 'MP1', 'mp1', 'audio/mpeg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3005, 7, 'audio_mp2', 'MP2', 'mp2', 'audio/mpeg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3006, 7, 'audio_mp4', 'MP4', 'mp4', 'audio/mp4'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3007, 7, 'audio_midi', 'SVG', 'svg', 'audio/svg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3008, 7, 'audio_basic', 'Audio', 'au', 'audio/basic'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (3008, 7, 'audio_basic', 'Audio', 'snd', 'audio/basic'); + +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4000, 8, 'video', 'Video', NULL, 'video/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4001, 8, 'video_mpeg', 'MPEG', 'mp4', 'video/mp4'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4001, 8, 'video_mpeg', 'MPEG', 'mpg', 'video/mp4'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4002, 8, 'video_ogg', 'OGG', 'ogg', 'video/ogg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4003, 8, 'video_h264', 'H264', 'h264', 'video/h264'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4003, 8, 'video_x264', 'X264', 'x264', 'video/x264'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4004, 8, 'video_quicktine', 'Quicktime', 'qt', 'video/qt'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4005, 8, 'video_dv', 'Digital Video', 'dv', 'video/dv'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4006, 8, 'video_jpeg', 'Motion JPEG', 'jpg', 'video/jpeg'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (4006, 8, 'video_webm', 'Tiff', 'tiff', 'video/tiff-fx'); + +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5000, 9, 'document', 'Document', NULL, 'application/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5001, 9, 'document_libre_chart', 'LibreOffice Chart', 'odc', 'application/vnd.oasis.opendocument.chart'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5002, 9, 'document_libre_formula', 'LibreOffice Formula', 'odf', 'application/vnd.oasis.opendocument.formula'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5003, 9, 'document_libre_graphic', 'LibreOffice Graphic', 'odg', 'application/vnd.oasis.opendocument.graphics'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5004, 9, 'document_libre_presentation', 'LibreOffice Presentation', 'odp', 'application/vnd.oasis.opendocument.presentation'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5005, 9, 'document_libre_spreadsheet', 'LibreOffice Spreadsheet', 'ods', 'application/vnd.oasis.opendocument.spreadsheet'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5006, 9, 'document_libre_text', 'LibreOffice Text', 'odt', 'application/vnd.oasis.opendocument.text'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5007, 9, 'document_libre_html', 'LibreOffice HTML', 'odh', 'application/vnd.oasis.opendocument.text-web'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5008, 9, 'document_pdf', 'PDF', 'pdf', 'application/pdf'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5009, 9, 'document_abi_word', 'Abiword Text', 'abw', 'application/abiword-compressed'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5010, 9, 'document_ms_word', 'Microsoft Word', 'docx', 'application/msword'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5010, 9, 'document_ms_word', 'Microsoft Word', 'doc', 'application/msword'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5011, 9, 'document_ms_excel', 'Microsoft Excel', 'xlsx', 'application/ms-excel'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5011, 9, 'document_ms_excel', 'Microsoft Excel', 'xls', 'application/ms-excel'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5012, 9, 'document_ms_powerpoint', 'Microsoft Powerpoint', 'pptx', 'application/ms-powerpoint'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (5012, 9, 'document_ms_powerpoint', 'Microsoft Powerpoint', 'ppt', 'application/ms-powerpoint'); + +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (6000, 10, 'container', 'Container', NULL, 'application/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (6001, 10, 'container_tar', 'Tar', 'tar', 'application/tar'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (6002, 10, 'container_cpio', 'CPIO', 'cpio', 'application/cpio'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (6003, 10, 'container_java', 'Java', 'jar', 'application/java'); + +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (7000, 11, 'application', 'Application', NULL, 'application/*'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (7001, 11, 'application_ocsp_request', 'OCSP Request', NULL, 'application/ocsp-request'); +insert into s_tables.t_type_mime_types (id, id_category, name_machine, name_human, field_extension, field_mime) values (7002, 11, 'application_ocsp_response', 'OCSP Response', NULL, 'application/ocsp-response'); diff --git a/database/sql/reservation/reservation-log_types.sql b/database/sql/reservation/reservation-log_types.sql index f306dcd..9bc2461 100644 --- a/database/sql/reservation/reservation-log_types.sql +++ b/database/sql/reservation/reservation-log_types.sql @@ -58,47 +58,6 @@ create trigger tr_log_types_date_changed_deleted_or_locked -/*** provide HTTP status codes ***/ -create table s_tables.t_log_type_http_status_codes ( - id smallint not null, - - name_machine varchar(128) not null, - name_human varchar(256) not null, - - is_locked boolean default false not null, - is_deleted boolean default false not null, - - date_created timestamp default localtimestamp not null, - date_changed timestamp default localtimestamp not null, - date_locked timestamp, - date_deleted timestamp, - - constraint cp_log_type_http_status_codes primary key (id), - - constraint cu_log_type_http_status_codes_user unique (name_machine), - - constraint cc_log_type_http_status_codes_id check (id >= 0 and id < 600) -); - -create sequence s_tables.se_log_type_http_status_codes_id owned by s_tables.t_log_type_http_status_codes.id; -alter table s_tables.t_log_type_http_status_codes alter column id set default nextval('s_tables.se_log_type_http_status_codes_id'::regclass); - -grant select,insert,update on s_tables.t_log_type_http_status_codes to r_reservation_administer; -grant select on s_tables.t_log_type_http_status_codes to r_reservation_manager, r_reservation_auditor; -grant select,usage on s_tables.se_log_type_http_status_codes_id to r_reservation_administer; - -create view public.v_log_type_http_status_codes with (security_barrier=true) as - select id, name_machine, name_human from s_tables.t_log_type_http_status_codes; - -grant select on public.v_log_type_http_status_codes to r_reservation, r_reservation_public, r_reservation_system; - - -create trigger tr_log_type_http_status_codes_date_changed_deleted_or_locked - before update on s_tables.t_log_type_http_status_codes - for each row execute procedure s_administers.f_common_update_date_changed_deleted_or_locked(); - - - /*** provide log severity level id and names ***/ create table s_tables.t_log_type_severity_levels ( id bigint not null, diff --git a/database/sql/reservation/reservation-log_users.sql b/database/sql/reservation/reservation-log_users.sql index c03371a..e28a1bf 100644 --- a/database/sql/reservation/reservation-log_users.sql +++ b/database/sql/reservation/reservation-log_users.sql @@ -1,5 +1,5 @@ /** Standardized SQL Structure - Logs */ -/** This depends on: reservation-users.sql **/ +/** This depends on: reservation-users.sql, reservation-types.sql **/ start transaction; @@ -35,7 +35,7 @@ create table s_tables.t_log_users ( constraint cf_log_users_id_user_session foreign key (id_user_session) references s_tables.t_users (id) on delete restrict on update cascade, constraint cf_log_users_log_type foreign key (log_type) references s_tables.t_log_types (id) on delete restrict on update cascade, constraint cf_log_users_log_severity foreign key (log_severity) references s_tables.t_log_type_severity_levels (id) on delete restrict on update cascade, - constraint cf_log_users_response_code foreign key (response_code) references s_tables.t_log_type_http_status_codes (id) on delete restrict on update cascade + constraint cf_log_users_response_code foreign key (response_code) references s_tables.t_type_http_status_codes (id) on delete restrict on update cascade ); create sequence s_tables.se_log_users_id owned by s_tables.t_log_users.id; @@ -167,7 +167,7 @@ create table s_tables.t_log_user_activity ( constraint cf_log_user_activity_id_user foreign key (id_user) references s_tables.t_users (id) on delete restrict on update cascade, constraint cf_log_user_activity_id_user_session foreign key (id_user_session) references s_tables.t_users (id) on delete restrict on update cascade, - constraint cf_log_user_activity_response_code foreign key (response_code) references s_tables.t_log_type_http_status_codes (id) on delete restrict on update cascade + constraint cf_log_user_activity_response_code foreign key (response_code) references s_tables.t_type_http_status_codes (id) on delete restrict on update cascade ); create sequence s_tables.se_log_user_activity_id owned by s_tables.t_log_user_activity.id; diff --git a/database/sql/reservation/reservation-paths.sql b/database/sql/reservation/reservation-paths.sql index a827a72..f22de34 100644 --- a/database/sql/reservation/reservation-paths.sql +++ b/database/sql/reservation/reservation-paths.sql @@ -1,5 +1,5 @@ /** Standardized SQL Structure - Content **/ -/** This depends on: reservation-groups.sql **/ +/** This depends on: reservation-groups.sql, reservation-types.sql **/ start transaction; @@ -11,81 +11,30 @@ set datestyle to us; -/*** provide path type id and names ***/ -create table s_tables.t_path_types ( - id bigint not null, - - name_machine varchar(128) not null, - name_human varchar(256) not null, - - is_locked boolean default false not null, - is_deleted boolean default false not null, - - date_created timestamp default localtimestamp not null, - date_changed timestamp default localtimestamp not null, - date_deleted timestamp, - date_locked timestamp, - - constraint cp_path_types primary key (id), - - constraint cu_path_types_name_machine unique (name_machine), - - constraint cc_path_types_id check (id > -1), - constraint cc_path_types_name_machine check (name_machine ~ '\w+') -); - -create sequence s_tables.se_path_types_id owned by s_tables.t_path_types.id; -alter table s_tables.t_path_types alter column id set default nextval('s_tables.se_path_types_id'::regclass); - -grant select,insert,update on s_tables.t_path_types to r_reservation_administer; -grant select on s_tables.t_path_types to r_reservation_manager, r_reservation_auditor; -grant select,usage on s_tables.se_path_types_id to r_reservation_administer; - -create index i_path_types_deleted_not on s_tables.t_path_types (id) - where not is_deleted; - -create index i_path_types_public on s_tables.t_path_types (id) - where not is_deleted and not is_locked; - - -create view s_managers.v_path_types with (security_barrier=true) as - select id, name_machine, name_human, is_locked, date_created, date_changed from s_tables.t_path_types - where not is_deleted and not is_locked; - -grant select on s_managers.v_path_types to r_reservation_manager; - - -create view public.v_path_types with (security_barrier=true) as - select id, name_machine, name_human, FALSE as is_locked, NULL::timestamp as date_created, NULL::timestamp as date_changed from s_tables.t_path_types - where not is_deleted and not is_locked; - -grant select on public.v_path_types to r_reservation, r_reservation_public, r_reservation_system; - - -create trigger tr_path_types_date_changed_deleted_or_locked - before update on s_tables.t_path_types - for each row execute procedure s_administers.f_common_update_date_changed_deleted_or_locked(); - - /* @todo: come up with a design for dynamic path management via users/managers (as opposed to hardcoded paths in source). */ /*** provide paths table (@todo: this is added as a stub and needs to be finished) ***/ create table s_tables.t_paths ( id bigint not null, id_creator bigint not null, id_creator_session bigint not null, - id_type bigint not null, id_group bigint, name_machine varchar(128) not null, name_human varchar(256) not null, + is_content boolean default true not null, + is_alias boolean default false not null, + is_redirect boolean default false not null, + is_coded boolean default false not null, + is_dynamic boolean default true not null, + is_user boolean default false not null, is_private boolean default true not null, is_locked boolean default false not null, is_deleted boolean default false not null, - is_system boolean default false not null, - is_user boolean default false not null, field_path varchar(256) not null, + field_destination varchar(256), + field_response_code smallint, date_created timestamp default localtimestamp not null, date_changed timestamp default localtimestamp not null, @@ -99,17 +48,18 @@ create table s_tables.t_paths ( constraint cc_paths_id check (id > 0), constraint cc_paths_name_machine check (name_machine ~ '\w+'), + constraint cc_paths_one_of_content_alias_redirect check ((is_content and not (is_alias or is_redirect)) or (is_alias and not (is_content or is_redirect))), constraint cf_paths_id_creator foreign key (id_creator) references s_tables.t_users (id) on delete cascade on update cascade, constraint cf_paths_id_creator_session foreign key (id_creator_session) references s_tables.t_users (id) on delete cascade on update cascade, - constraint cf_paths_id_type foreign key (id_type) references s_tables.t_path_types (id) on delete restrict on update cascade, - constraint cf_paths_id_group foreign key (id_group) references s_tables.t_groups (id) on delete restrict on update cascade + constraint cf_paths_id_group foreign key (id_group) references s_tables.t_groups (id) on delete restrict on update cascade, + constraint cf_paths_field_response_code foreign key (field_response_code) references s_tables.t_type_http_status_codes (id) on delete restrict on update cascade ); create sequence s_tables.se_paths_id owned by s_tables.t_paths.id; alter table s_tables.t_paths alter column id set default nextval('s_tables.se_paths_id'::regclass); -grant select,insert,update on s_tables.t_path_types to r_reservation_administer; +grant select,insert,update on s_tables.t_paths to r_reservation_administer; grant select on s_tables.t_paths to r_reservation_manager, r_reservation_auditor; grant select,usage on s_tables.se_paths_id to r_reservation_administer; grant usage on s_tables.se_paths_id to r_reservation, r_reservation_system; @@ -126,19 +76,29 @@ create index i_paths_locked_not on s_tables.t_paths (id) create index i_paths_public on s_tables.t_paths (id) where not is_deleted and not is_locked and not is_private; +create index i_paths_content on s_tables.t_paths (id) + where not is_deleted and is_content; + +create index i_paths_alias on s_tables.t_paths (id) + where not is_deleted and is_alias; + +create index i_paths_redirect on s_tables.t_paths (id) + where not is_deleted and is_redirect; + +/* @todo: provide management functionality for managers (for all user content) and users (for groups they belong to with appropriate can_manage role). */ create view s_users.v_paths with (security_barrier=true) as with allowed_groups as (select id from s_users.v_groups_self) - select id, id_type, id_group, name_machine, name_human, is_private, date_created, date_changed from s_tables.t_paths - where not is_deleted and (not is_locked or id_group in (select * from allowed_groups)) and (not is_private or (is_private and id_group in (select * from allowed_groups))); + select id, id_group, name_machine, name_human, is_content, is_alias, is_redirect, is_coded, is_dynamic, is_locked, is_private, field_path, field_destination, field_response_code, date_created, date_changed, date_locked from s_tables.t_paths + where not is_deleted and (not is_locked or not is_private or id_group in (select * from allowed_groups)); grant select on s_users.v_paths to r_reservation, r_reservation_system; create view public.v_paths with (security_barrier=true) as - select id, id_type, NULL::bigint as id_group, name_machine, name_human, NULL::bool as is_private, NULL::bool as date_created, NULL::bool as date_changed from s_tables.t_paths + select id, NULL::bigint as id_group, name_machine, name_human, is_content, is_alias, is_redirect, is_coded, is_dynamic, FALSE as is_locked, FALSE as is_private, field_path, field_destination, field_response_code, NULL::bool as date_created, NULL::bool as date_changed, NULL::bool as date_locked from s_tables.t_paths where not is_deleted and not is_locked and not is_private; -grant select on public.v_path_types to r_reservation, r_reservation_public, r_reservation_system; +grant select on public.v_paths to r_reservation_public; create trigger tr_paths_date_changed_deleted_or_locked diff --git a/database/sql/reservation/reservation-statistics.sql b/database/sql/reservation/reservation-statistics.sql index 195f435..1abab6a 100644 --- a/database/sql/reservation/reservation-statistics.sql +++ b/database/sql/reservation/reservation-statistics.sql @@ -26,7 +26,7 @@ create table s_tables.t_statistics_http_status_codes ( constraint cc_statistics_http_status_codes_count check (count >= 0), - constraint cf_statistics_http_status_codes_code foreign key (code) references s_tables.t_log_type_http_status_codes (id) on delete restrict on update cascade + constraint cf_statistics_http_status_codes_code foreign key (code) references s_tables.t_type_http_status_codes (id) on delete restrict on update cascade ); grant select,insert,update on s_tables.t_statistics_http_status_codes to r_reservation_manager, u_reservation_statistics_update; diff --git a/database/sql/reservation/reservation-types.sql b/database/sql/reservation/reservation-types.sql index d3b05ee..35d319e 100644 --- a/database/sql/reservation/reservation-types.sql +++ b/database/sql/reservation/reservation-types.sql @@ -11,8 +11,49 @@ set datestyle to us; +/*** provide HTTP status codes ***/ +create table s_tables.t_type_http_status_codes ( + id smallint not null, + + name_machine varchar(128) not null, + name_human varchar(256) not null, + + is_locked boolean default false not null, + is_deleted boolean default false not null, + + date_created timestamp default localtimestamp not null, + date_changed timestamp default localtimestamp not null, + date_locked timestamp, + date_deleted timestamp, + + constraint cp_log_type_http_status_codes primary key (id), + + constraint cu_log_type_http_status_codes_user unique (name_machine), + + constraint cc_log_type_http_status_codes_id check (id >= 0 and id < 600) +); + +create sequence s_tables.se_log_type_http_status_codes_id owned by s_tables.t_type_http_status_codes.id; +alter table s_tables.t_type_http_status_codes alter column id set default nextval('s_tables.se_log_type_http_status_codes_id'::regclass); + +grant select,insert,update on s_tables.t_type_http_status_codes to r_reservation_administer; +grant select on s_tables.t_type_http_status_codes to r_reservation_manager, r_reservation_auditor; +grant select,usage on s_tables.se_log_type_http_status_codes_id to r_reservation_administer; + +create view public.v_log_type_http_status_codes with (security_barrier=true) as + select id, name_machine, name_human from s_tables.t_type_http_status_codes; + +grant select on public.v_log_type_http_status_codes to r_reservation, r_reservation_public, r_reservation_system; + + +create trigger tr_log_type_http_status_codes_date_changed_deleted_or_locked + before update on s_tables.t_type_http_status_codes + for each row execute procedure s_administers.f_common_update_date_changed_deleted_or_locked(); + + + /*** provide mime type category id and names ***/ -create table s_tables.t_types_mime_categorys ( +create table s_tables.t_type_mime_categorys ( id bigint not null, name_machine varchar(128) not null, @@ -36,32 +77,32 @@ create table s_tables.t_types_mime_categorys ( constraint cc_types_mime_categorys_name_machine check (name_machine ~ '\w+') ); -grant select,insert,update on s_tables.t_types_mime_categorys to r_reservation_administer; +grant select,insert,update on s_tables.t_type_mime_categorys to r_reservation_administer; create view public.v_types_mime_categorys with (security_barrier=true) as - select id, name_machine, name_human, is_locked from s_tables.t_types_mime_categorys + select id, name_machine, name_human, is_locked from s_tables.t_type_mime_categorys where not is_deleted; grant select on public.v_types_mime_categorys to r_reservation, r_reservation_public, r_reservation_system; -grant select,insert,update on s_tables.t_types_mime_categorys to r_reservation_administer; +grant select,insert,update on s_tables.t_type_mime_categorys to r_reservation_administer; create view public.v_types_mime_categorys_locked_not with (security_barrier=true) as - select id, name_machine, name_human, field_category from s_tables.t_types_mime_categorys + select id, name_machine, name_human, field_category from s_tables.t_type_mime_categorys where not is_deleted and not is_locked; grant select on public.v_types_mime_categorys_locked_not to r_reservation, r_reservation_public, r_reservation_system; create trigger tr_types_mime_categorys_date_changed_deleted_or_locked - before update on s_tables.t_types_mime_categorys + before update on s_tables.t_type_mime_categorys for each row execute procedure s_administers.f_common_update_date_changed_deleted_or_locked(); /*** provide mime type ids and names ***/ -create table s_tables.t_types_mime_types ( +create table s_tables.t_type_mime_types ( id bigint not null, id_category bigint not null, @@ -83,26 +124,26 @@ create table s_tables.t_types_mime_types ( constraint cu_types_mime_types_mime_type unique (id, id_category, field_extension, field_mime), - constraint cf_types_mime_types_id foreign key (id_category) references s_tables.t_types_mime_categorys (id) on delete restrict on update cascade + constraint cf_types_mime_types_id foreign key (id_category) references s_tables.t_type_mime_categorys (id) on delete restrict on update cascade ); -grant select,insert,update on s_tables.t_types_mime_types to r_reservation_administer; +grant select,insert,update on s_tables.t_type_mime_types to r_reservation_administer; create view public.v_types_mime_types with (security_barrier=true) as - select id, id_category, name_machine, name_human, field_extension, field_mime, is_locked from s_tables.t_types_mime_types + select id, id_category, name_machine, name_human, field_extension, field_mime, is_locked from s_tables.t_type_mime_types where not is_deleted; grant select on public.v_types_mime_types to r_reservation, r_reservation_public, r_reservation_system; create view public.v_types_mime_types_locked_not with (security_barrier=true) as - select id, id_category, name_machine, name_human, field_extension, field_mime, is_locked from s_tables.t_types_mime_types + select id, id_category, name_machine, name_human, field_extension, field_mime, is_locked from s_tables.t_type_mime_types where not is_deleted and not is_locked; grant select on public.v_types_mime_types to r_reservation, r_reservation_public, r_reservation_system; create trigger tr_types_mime_types_date_changed_deleted_or_locked - before update on s_tables.t_types_mime_types + before update on s_tables.t_type_mime_types for each row execute procedure s_administers.f_common_update_date_changed_deleted_or_locked(); diff --git a/examples/test.php b/examples/test.php index b14620e..5f6ae0c 100755 --- a/examples/test.php +++ b/examples/test.php @@ -390,7 +390,7 @@ $stuff['cookie_login']['cookie'] = $cookie; } - ldap($stuff, $session->get_name()->get_value_exact()); + ldap_get_user($stuff, $session->get_name()->get_value_exact()); set_log_activity($database); if (!empty($session->get_name()->get_value_exact()) && $session->get_name()->get_value_exact() != 'u_reservation_public') { @@ -487,7 +487,7 @@ } $ldap_data = NULL; - ldap($stuff, $session->get_name()->get_value_exact()); + ldap_get_user($stuff, $session->get_name()->get_value_exact()); if (!empty($stuff['ldap']['data'])) { $ldap_data = $stuff['ldap']['data']; } @@ -558,7 +558,7 @@ $logged_in = TRUE; if (!isset($stuff['ldap']['markup'])) { - ldap($stuff, $session->get_name()->get_value_exact()); + ldap_get_user($stuff, $session->get_name()->get_value_exact()); } set_log_activity($database); @@ -689,6 +689,16 @@ return TRUE; } + // directly check to see if the current user exists in ldap (this is technically not necessary because postgresql will also do this). + $stuff_stub = array(); + $found_username = ldap_get_user($stuff_stub, $username); + unset($stuff_stub); + + if (!$found_username) { + unset($found_username); + return FALSE; + } + assign_database_string($database, $username, $password); $connected = connect_database($database); @@ -1304,11 +1314,11 @@ return c_base_return_int::s_new($response_value); } - function ldap(&$stuff, $username) { + function ldap_get_user(&$stuff, $username) { $stuff['ldap']['markup'] = ''; $stuff['ldap']['data'] = array(); - $ldap = new c_base_ldap(); + $ldap = new c_base_ldap_get_user(); $ldap->set_name('ldaps://127.0.0.1:1636/'); #$ldap->set_bind_name(''); #$ldap->set_bind_password(''); -- 1.8.3.1