From 171923dfbd09758b7cbf58aff40c5a358407061a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 27 Nov 2012 21:05:08 +0000 Subject: [PATCH] Added more config wrappers --- .gitattributes | 1 + inc/libs/doubler_functions.php | 12 ++++ inc/libs/menu_functions.php | 72 +++++++++++++++++++ inc/libs/order_functions.php | 24 +++++++ inc/libs/refback_functions.php | 42 ++++++++++- inc/load_config.php | 3 + inc/modules/admin/what-config_order.php | 3 - inc/modules/admin/what-config_user.php | 2 +- .../de/html/admin/admin_config_order.tpl | 2 +- templates/de/html/admin/admin_metadata.tpl | 2 +- 10 files changed, 156 insertions(+), 7 deletions(-) create mode 100644 inc/libs/menu_functions.php diff --git a/.gitattributes b/.gitattributes index 51d3c4e59d..30175d63d7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -376,6 +376,7 @@ inc/libs/jackpot_functions.php svneol=native#text/plain inc/libs/mailid_functions.php svneol=native#text/plain inc/libs/maintenance_functions.php svneol=native#text/plain inc/libs/mediadata_functions.php svneol=native#text/plain +inc/libs/menu_functions.php svneol=native#text/plain inc/libs/network_functions.php svneol=native#text/plain inc/libs/newsletter_functions.php svneol=native#text/plain inc/libs/nickname_functions.php svneol=native#text/plain diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index fc13a2f44c..6ca451b69a 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -265,5 +265,17 @@ function getDoublerCharge () { return $GLOBALS[__FUNCTION__]; } +// "Getter" for doubler_max_sent +function getDoublerMaxSent () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('doubler_max_sent'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // [EOF] ?> diff --git a/inc/libs/menu_functions.php b/inc/libs/menu_functions.php new file mode 100644 index 0000000000..39ea71630c --- /dev/null +++ b/inc/libs/menu_functions.php @@ -0,0 +1,72 @@ + diff --git a/inc/libs/order_functions.php b/inc/libs/order_functions.php index 696b9e01d5..27f3bbf7e6 100644 --- a/inc/libs/order_functions.php +++ b/inc/libs/order_functions.php @@ -94,5 +94,29 @@ function isOrderMultiPageEnabled () { return $GLOBALS[__FUNCTION__]; } +// Getter for 'order_mode' config entry +function getOrderMode () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('order_mode'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Getter for 'order_select' config entry +function getOrderSelect () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('order_select'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // [EOF] ?> diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 82746fe51d..8cb68e6926 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -361,12 +361,52 @@ function updateMemberRefbackPercents ($id, $percents, $note) { return $status; } +// ---------------------------------------------------------------------------- +// Wrapper functions for configuration entries +// ---------------------------------------------------------------------------- + +// Getter for refback_enabled +function getRefbackEnabled () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('refback_enabled'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // Checks whether refback is enabled function isRefbackEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it - $GLOBALS[__FUNCTION__] = (getConfig('refback_enabled') == 'Y'); + $GLOBALS[__FUNCTION__] = (getRefbackEnabled() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Getter for refback_max_perc +function getRefbackMaxPerc () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('refback_max_perc'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Getter for refback_min_perc +function getRefbackMinPerc () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('refback_min_perc'); } // END - if // Return cache diff --git a/inc/load_config.php b/inc/load_config.php index 483a4d270b..2d15e8e2d6 100644 --- a/inc/load_config.php +++ b/inc/load_config.php @@ -79,6 +79,9 @@ if ((isIncludeReadable(getCachePath() . 'config-local.php')) && (isIncludeReadab // Set output mode here setConfigEntry('OUTPUT_MODE', 'render'); +} else { + // This should not happen + reportBug(__FILE__, __LINE__, 'Was not able to load/detect configuration file and/or installation phase!'); } // Check if the user setups his database login stuff... diff --git a/inc/modules/admin/what-config_order.php b/inc/modules/admin/what-config_order.php index 0f6fd825f0..f7571f5bf7 100644 --- a/inc/modules/admin/what-config_order.php +++ b/inc/modules/admin/what-config_order.php @@ -62,9 +62,6 @@ if (isFormSent('save_config')) { $content[$entry . '_' . strtolower(getConfig($entry))] = ' selected="selected"'; } // END - foreach - // Selection list - $content['order_selection'] = addOrderSelectionOptions(getConfig('order_select')); - // Load template loadTemplate('admin_config_order', FALSE, $content); } diff --git a/inc/modules/admin/what-config_user.php b/inc/modules/admin/what-config_user.php index 4cf8ef12ab..29b349fb81 100644 --- a/inc/modules/admin/what-config_user.php +++ b/inc/modules/admin/what-config_user.php @@ -48,7 +48,7 @@ if (isFormSent('save_config')) { adminSaveSettingsFromPostData(); } else { // Prepare gender selection box - $content['tester_user_gender_selection'] = generateGenderSelectionBox(getConfig('tester_user_gender'), 'tester_user_gender'); + $content['tester_user_gender_selection'] = generateGenderSelectionBox(getTesterUserGender(), 'tester_user_gender'); // Load form template loadTemplate('admin_config_user', FALSE, $content); diff --git a/templates/de/html/admin/admin_config_order.tpl b/templates/de/html/admin/admin_config_order.tpl index 92d3968e9f..8aac624d26 100644 --- a/templates/de/html/admin/admin_config_order.tpl +++ b/templates/de/html/admin/admin_config_order.tpl @@ -80,7 +80,7 @@
diff --git a/templates/de/html/admin/admin_metadata.tpl b/templates/de/html/admin/admin_metadata.tpl index fddd9683c3..4633e1d71e 100644 --- a/templates/de/html/admin/admin_metadata.tpl +++ b/templates/de/html/admin/admin_metadata.tpl @@ -1 +1 @@ - \ No newline at end of file + -- 2.30.2