From 76343fb91511b9f53e58b6c01b258bfe00ddb4c6 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 24 Oct 2014 08:31:47 +0200 Subject: Use an INI-style configuration file Replace web/lib/config.inc.php with an INI-style configuration file. This allows us to get rid of several globals and makes it easier to use the same configuration file in external scripts. Signed-off-by: Lukas Fleischer --- web/lib/DB.class.php | 17 +++++++++-- web/lib/acctfuncs.inc.php | 66 +++++++++++++++++++--------------------- web/lib/aur.inc.php | 26 +++++++++++----- web/lib/aurjson.class.php | 13 ++++---- web/lib/config.inc.php.proto | 72 -------------------------------------------- web/lib/confparser.inc.php | 20 ++++++++++++ web/lib/credentials.inc.php | 1 - web/lib/pkgbasefuncs.inc.php | 17 ++--------- web/lib/pkgfuncs.inc.php | 7 +---- web/lib/pkgreqfuncs.inc.php | 41 ++++++++++--------------- web/lib/routing.inc.php | 18 ++++++----- web/lib/translator.inc.php | 8 ++--- 12 files changed, 124 insertions(+), 182 deletions(-) delete mode 100644 web/lib/config.inc.php.proto create mode 100644 web/lib/confparser.inc.php (limited to 'web/lib') diff --git a/web/lib/DB.class.php b/web/lib/DB.class.php index 09759892..b538e0d3 100644 --- a/web/lib/DB.class.php +++ b/web/lib/DB.class.php @@ -1,5 +1,7 @@ exec("SET NAMES 'utf8' COLLATE 'utf8_general_ci';"); } catch (PDOException $e) { die('Error - Could not connect to AUR database'); diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 2272010d..1d38fe11 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -89,7 +89,7 @@ function display_account_form($A,$U="",$T="",$S="", */ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="", $P="",$C="",$R="",$L="",$I="",$K="",$J="",$UID=0) { - global $SUPPORTED_LANGS, $AUR_LOCATION; + global $SUPPORTED_LANGS; $error = ''; @@ -118,9 +118,11 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="", } if (!$error && !valid_username($U)) { + $length_min = config_get_int('options', 'username_min_len'); + $length_max = config_get_int('options', 'username_max_len'); + $error = __("The username is invalid.") . "