From 795f69050a7799b68fa5a7bb4350ec5f7d75a228 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Tue, 12 Jul 2016 10:44:53 +0900 Subject: [PATCH] Update edit user base, config template, class basic Class.Basic add general 8 char hash wrapper function (for adler32, fnv, jooa) Edit Users add first/last name to the basic user info Config template Update config template from current working template --- www/admin/edit_base.inc | 2 + www/admin/table_arrays/array_edit_users.inc | 52 ++++++++++++--------- www/configs/config.inc | 7 ++- www/configs/config.template.inc | 45 +++++++++++++++--- www/libs/Class.Basic.inc | 13 ++++++ 5 files changed, 87 insertions(+), 32 deletions(-) diff --git a/www/admin/edit_base.inc b/www/admin/edit_base.inc index a339f01e..43451457 100644 --- a/www/admin/edit_base.inc +++ b/www/admin/edit_base.inc @@ -230,6 +230,8 @@ $elements[] = $form->form_create_element("password"); $elements[] = $form->form_create_element("password_change_interval"); $elements[] = $form->form_create_element("email"); + $elements[] = $form->form_create_element("last_name"); + $elements[] = $form->form_create_element("first_name"); $elements[] = $form->form_create_element("edit_group_id"); $elements[] = $form->form_create_element("edit_access_right_id"); $elements[] = $form->form_create_element("strict"); diff --git a/www/admin/table_arrays/array_edit_users.inc b/www/admin/table_arrays/array_edit_users.inc index 1f0cd95e..8013de61 100644 --- a/www/admin/table_arrays/array_edit_users.inc +++ b/www/admin/table_arrays/array_edit_users.inc @@ -2,24 +2,24 @@ $edit_users = array ( "table_array" => array ( "edit_user_id" => array ( - "value" => $GLOBALS["edit_user_id"], + "value" => $GLOBALS["edit_user_id"], "type" => "hidden", "pk" => 1, "int" => 1 ), "username" => array ( - "value" => $GLOBALS["username"], - "output_name" => "Username", - "mandatory" => 1, + "value" => $GLOBALS["username"], + "output_name" => "Username", + "mandatory" => 1, "error_check" => "unique|alphanumericextended", "type" => "text" ), "password" => array ( - "value" => $GLOBALS["password"], + "value" => $GLOBALS["password"], "HIDDEN_value" => $GLOBALS["HIDDEN_password"], "CONFIRM_value" => $GLOBALS["CONFIRM_password"], - "output_name" => "Password", - "mandatory" => 1, + "output_name" => "Password", + "mandatory" => 1, "type" => "password", // later has to be password for encryption in database 'update' => array ( // connected field updates, and update data 'password_change_date' => array ( // db row to update @@ -40,12 +40,12 @@ ), // password reset force interval, if set, user needs to reset password after X time period "enabled" => array ( - "value" => $GLOBALS["enabled"], - "output_name" => "Enabled", - "type" => "binary", + "value" => $GLOBALS["enabled"], + "output_name" => "Enabled", + "type" => "binary", "int" => 1, "element_list" => array ( - "1" => "Yes", + "1" => "Yes", "0" => "No" ) ), @@ -80,28 +80,38 @@ ) ), "debug" => array ( - "value" => $GLOBALS["debug"], - "output_name" => "Debug", - "type" => "binary", + "value" => $GLOBALS["debug"], + "output_name" => "Debug", + "type" => "binary", "int" => 1, "element_list" => array ( - "1" => "Yes", + "1" => "Yes", "0" => "No" ) ), "db_debug" => array ( - "value" => $GLOBALS["db_debug"], - "output_name" => "DB Debug", - "type" => "binary", + "value" => $GLOBALS["db_debug"], + "output_name" => "DB Debug", + "type" => "binary", "int" => 1, "element_list" => array ( - "1" => "Yes", + "1" => "Yes", "0" => "No" ) ), "email" => array ( - "value" => $GLOBALS["email"], - "output_name" => "E-Mail", + "value" => $GLOBALS["email"], + "output_name" => "E-Mail", + "type" => "text" + ), + "last_name" => array ( + "value" => $GLOBALS["last_name"], + "output_name" => "Last Name", + "type" => "text" + ), + "first_name" => array ( + "value" => $GLOBALS["first_name"], + "output_name" => "First Name", "type" => "text" ), "edit_language_id" => array ( diff --git a/www/configs/config.inc b/www/configs/config.inc index a61ab562..edc0045d 100644 --- a/www/configs/config.inc +++ b/www/configs/config.inc @@ -258,12 +258,12 @@ { // where to search for the files to include $dirs = array ( - LIBDIR, + LIBDIR, SMARTYDIR, TABLEARRAYDIR, '', - LIBS, - SMARTY, + LIBS, + SMARTY, TABLE_ARRAYS, __DIR__.'/'.LIBS, __DIR__.'/'.SMARTY @@ -279,5 +279,4 @@ } return false; } - ?> diff --git a/www/configs/config.template.inc b/www/configs/config.template.inc index c6be6118..f2b6db00 100644 --- a/www/configs/config.template.inc +++ b/www/configs/config.template.inc @@ -1,10 +1,5 @@ ); - - // $Id: config.template.inc 4382 2013-02-18 07:27:24Z gullevek $ + + // function that will be called on top of each class include to load the class + function _spl_autoload($include_file) + { + // where to search for the files to include + $dirs = array ( + LIBDIR, + SMARTYDIR, + TABLEARRAYDIR, + '', + LIBS, + SMARTY, + TABLE_ARRAYS, + __DIR__.'/'.LIBS, + __DIR__.'/'.SMARTY + ); + // try to find and load the class ifle + foreach ($dirs as $folder) + { + if (file_exists($folder.$include_file)) + { + require_once($folder.$include_file); + return true; + } + } + return false; + } ?> diff --git a/www/libs/Class.Basic.inc b/www/libs/Class.Basic.inc index b3ab072b..79c058be 100644 --- a/www/libs/Class.Basic.inc +++ b/www/libs/Class.Basic.inc @@ -1442,6 +1442,19 @@ return $this->_crc32b($string); } + // METHOD: _hash + // PARAMS: string, type of hash to use + // RETURN: hashed string + // DESC : replacemend for _crc32b call (alternate) + // defaults to adler 32, fnv132, fnv1a32, joaat + // all that create 8 char long hashes + public function _hash($string, $hash_type = 'adler32') + { + if (!in_array($hash_type, array('adler32', 'fnv132', 'fnv1a32', 'joaat'))) + $hash_type = 'adler32'; + return hash($hash_type, $string); + } + // METHOD: checkPHPVersion // PARAMS: $min_version: minimum version. in format x, x.y or x.y.z // $max_version: default empty, else in same format as min version