From a39205eb2ce8514510dcecb7bd0fdf4444ab5c05 Mon Sep 17 00:00:00 2001 From: quix0r Date: Mon, 4 Jul 2011 00:01:11 +0000 Subject: [PATCH] Extension ext-grade continued, a lot renames: - All 'remove' renamed to 'do_delete' - A lot 'change' renamed to 'do_edit', both renames will become important for the next full refacturing of all (list|edit|delete)_foo formulars to the XML based system - Extension ext-grade continued, only a function-less script has been added - TODOs.txt updated --- .gitattributes | 1 + DOCS/TODOs.txt | 2 +- inc/libs/network_functions.php | 4 +- inc/libs/order_functions.php | 32 +++++- inc/modules/admin/what-admins_edit.php | 8 +- inc/modules/admin/what-admins_mails.php | 4 +- inc/modules/admin/what-config_mods.php | 4 +- inc/modules/admin/what-config_payouts.php | 4 +- .../admin/what-config_rallye_prices.php | 4 +- inc/modules/admin/what-extensions.php | 2 +- inc/modules/admin/what-list_admins_acls.php | 4 +- inc/modules/admin/what-list_bank_package.php | 2 +- inc/modules/admin/what-list_country.php | 4 +- .../admin/what-list_point_accounts.php | 47 +++++++++ inc/modules/admin/what-list_rallyes.php | 4 +- inc/modules/admin/what-list_sponsor_pay.php | 10 +- inc/modules/admin/what-list_yoomedia_tm.php | 2 +- inc/modules/member/what-cash_coupon.php | 2 +- inc/modules/member/what-order.php | 97 +++++++++++++++---- inc/modules/order.php | 12 ++- inc/wrapper-functions.php | 12 +++ .../de/emails/admin/admin_order_normal.tpl | 1 + .../de/emails/member/member_order_normal.tpl | 1 + .../de/html/admin/admin_admins_mails_edit.tpl | 2 +- .../de/html/admin/admin_config_rallye_del.tpl | 2 +- .../html/admin/admin_config_rallye_edit.tpl | 2 +- .../de/html/admin/admin_del_bank_packages.tpl | 2 +- .../de/html/admin/admin_delete_admins.tpl | 2 +- .../html/admin/admin_delete_admins_acls.tpl | 2 +- .../admin/admin_delete_network_params.tpl | 2 +- .../html/admin/admin_delete_network_types.tpl | 2 +- .../de/html/admin/admin_delete_networks.tpl | 2 +- .../de/html/admin/admin_delete_payouts.tpl | 2 +- templates/de/html/admin/admin_edit_admins.tpl | 2 +- .../de/html/admin/admin_edit_admins_acls.tpl | 2 +- templates/de/html/admin/admin_edit_mods.tpl | 2 +- .../html/admin/admin_edit_network_params.tpl | 2 +- .../html/admin/admin_edit_network_types.tpl | 2 +- .../de/html/admin/admin_edit_networks.tpl | 2 +- .../de/html/admin/admin_edit_payouts.tpl | 2 +- .../de/html/admin/admin_edit_rallyes.tpl | 2 +- templates/de/html/admin/admin_extensions.tpl | 2 +- .../de/html/admin/admin_extensions_delete.tpl | 2 +- .../html/admin/admin_list_sponsor_pay_del.tpl | 2 +- .../admin/admin_list_sponsor_pay_edit.tpl | 2 +- .../html/admin/admin_list_yoomedia_tm_row.tpl | 2 +- 46 files changed, 235 insertions(+), 74 deletions(-) create mode 100644 inc/modules/admin/what-list_point_accounts.php diff --git a/.gitattributes b/.gitattributes index b928345c9a..5000e2d9d7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -520,6 +520,7 @@ inc/modules/admin/what-list_network_types.php svneol=native#text/plain inc/modules/admin/what-list_networks.php svneol=native#text/plain inc/modules/admin/what-list_notifications.php svneol=native#text/plain inc/modules/admin/what-list_payouts.php svneol=native#text/plain +inc/modules/admin/what-list_point_accounts.php svneol=native#text/plain inc/modules/admin/what-list_primera.php svneol=native#text/plain inc/modules/admin/what-list_rallyes.php svneol=native#text/plain inc/modules/admin/what-list_refs.php svneol=native#text/plain diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index f4ede999e5..55b9d06a2e 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -167,7 +167,7 @@ ./inc/modules/member/what-bonus.php:55: // @TODO Rewrite this to a filter ./inc/modules/member/what-categories.php:131: // @TODO Rewrite this to use $OUT .= ... ./inc/modules/member/what-logout.php:17: * @TODO Rewrite the code to a filter * -./inc/modules/member/what-order.php:427: // @TODO Rewrite this to a filter +./inc/modules/member/what-order.php:488: // @TODO Rewrite this to a filter ./inc/modules/member/what-order.php:85: // @TODO Rewrite this to SQL_FETCHARRAY() ./inc/modules/member/what-payout.php:194: // @TODO Rewrite this to a filter ./inc/modules/member/what-points.php:55:// @TODO Should we rewrite this to a filter? diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index 326c48b3dc..a8ccb8aad8 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -53,7 +53,7 @@ function getCurrentNetworkId () { // Handle a (maybe) sent form here function doNetworkHandleForm () { // Was the form sent? - if ((isFormSent()) || (isFormSent('edit')) || (isFormSent('delete')) || (isFormSent('change')) || (isFormSent('remove'))) { + if ((isFormSent()) || (isFormSent('edit')) || (isFormSent('delete')) || (isFormSent('do_edit')) || (isFormSent('do_delete'))) { // Do we have a 'do'? if (isGetRequestParameterSet('do')) { // Process the request @@ -68,7 +68,7 @@ function doNetworkHandleForm () { // Processes an admin form function doAdminNetworkProcessForm () { // Form really sent? - if ((!isFormSent()) && (!isFormSent('edit')) && (!isFormSent('delete')) && (!isFormSent('change')) && (!isFormSent('remove'))) { + if ((!isFormSent()) && (!isFormSent('edit')) && (!isFormSent('delete')) && (!isFormSent('do_edit')) && (!isFormSent('do_delete'))) { // Abort here loadTemplate('admin_settings_unsaved', false, '{--ADMIN_NETWORK_FORM_NOT_SENT--}'); return; diff --git a/inc/libs/order_functions.php b/inc/libs/order_functions.php index ef7549cf84..7a6fb06c42 100644 --- a/inc/libs/order_functions.php +++ b/inc/libs/order_functions.php @@ -48,7 +48,9 @@ function addOrderSelectionOptions ($default) { foreach ($LIST as $item) { // Defaul selection $selected = ''; - if ($item == $default) $selected = ' selected="selected"'; + if ($item == $default) { + $selected = ' selected="selected"'; + } // END - if // 'ref_clicks' needs to be rewritten to 'referal_clicks' if ($item == 'ref_clicks') { @@ -63,5 +65,33 @@ function addOrderSelectionOptions ($default) { return $OUT; } +// ---------------------------------------------------------------------------- +// Wrapper functions for configuration entries +// ---------------------------------------------------------------------------- + +// Getter for 'order_multi_page' config entry +function getOrderMultiPage () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('order_multi_page'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Determines wether 'order_multi_page' is set to 'Y' +function isOrderMultiPageEnabled () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getOrderMultiPage() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // [EOF] ?> diff --git a/inc/modules/admin/what-admins_edit.php b/inc/modules/admin/what-admins_edit.php index eb06ab2e8a..cc6320ec70 100644 --- a/inc/modules/admin/what-admins_edit.php +++ b/inc/modules/admin/what-admins_edit.php @@ -44,7 +44,9 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { addYouAreHereLink('admin', __FILE__); // Set selection data to empty array when it is empty -if (!isPostRequestParameterSet('sel')) setPostRequestParameter('sel', array()); +if (!isPostRequestParameterSet('sel')) { + setPostRequestParameter('sel', array()); +} // END - if // Check if direct admin account was selected if (isGetRequestParameterSet('admin')) { @@ -59,14 +61,14 @@ if (isGetRequestParameterSet('admin')) { if ((isFormSent('edit')) && (ifPostContainsSelections())) { // Edit account(s) adminsEditAdminAccount(postRequestArray()); -} elseif ((isFormSent('change')) && (count(postRequestParameter('login')) > 0)) { +} elseif ((isFormSent('do_edit')) && (count(postRequestParameter('login')) > 0)) { // Change admin accounts adminsChangeAdminAccount(postRequestArray()); } elseif ((isFormSent('delete')) && (ifPostContainsSelections())) { // Show admin accounts for deletetion adminsDeleteAdminAccount(postRequestArray()); } else { - if ((isFormSent('remove')) && (ifPostContainsSelections())) { + if ((isFormSent('do_delete')) && (ifPostContainsSelections())) { // Remove accounts now adminsRemoveAdminAccount(postRequestArray()); } // END - if diff --git a/inc/modules/admin/what-admins_mails.php b/inc/modules/admin/what-admins_mails.php index f697968d7d..525e3882da 100644 --- a/inc/modules/admin/what-admins_mails.php +++ b/inc/modules/admin/what-admins_mails.php @@ -118,7 +118,7 @@ ORDER BY if (!SQL_HASZERONUMS($result)) { // Shall I change entries? - if (isFormSent('change')) { + if (isFormSent('do_edit')) { // Init SQLs initSqls(); @@ -129,7 +129,7 @@ ORDER BY $content['admin_id'] = bigintval($content['admin_id']); // Update entry - addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins_mails` SET admin_id=%s WHERE `id`=%s ORDER BY `id` LIMIT 1", + addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins_mails` SET `admin_id`=%s WHERE `id`=%s ORDER BY `id` LIMIT 1", array($content['admin_id'], $id), __FILE__, __LINE__, false)); if (($content['admin_id'] < 1) && (isPostRequestParameterSet('template', $id))) { diff --git a/inc/modules/admin/what-config_mods.php b/inc/modules/admin/what-config_mods.php index 354fa37f7c..eeb980ca5a 100644 --- a/inc/modules/admin/what-config_mods.php +++ b/inc/modules/admin/what-config_mods.php @@ -80,9 +80,9 @@ if (isFormSent('edit')) { // Remove maybe confusing data unsetPostRequestParameter('edit'); - unsetPostRequestParameter('change'); + unsetPostRequestParameter('do_edit'); } -} elseif (isFormSent('change')) { +} elseif (isFormSent('do_edit')) { // Init SQLs initSqls(); diff --git a/inc/modules/admin/what-config_payouts.php b/inc/modules/admin/what-config_payouts.php index 077bcb0f44..7aaee12902 100644 --- a/inc/modules/admin/what-config_payouts.php +++ b/inc/modules/admin/what-config_payouts.php @@ -109,7 +109,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections())) { // Load main template loadTemplate('admin_edit_payouts', false, $OUT); -} elseif ((isFormSent('change')) && (ifPostContainsSelections())) { +} elseif ((isFormSent('do_edit')) && (ifPostContainsSelections())) { // Change them now // Init SQLs initSqls(); @@ -164,7 +164,7 @@ LIMIT 1", // Load main template loadTemplate('admin_delete_payouts', false, $OUT); -} elseif ((isFormSent('remove')) && (ifPostContainsSelections())) { +} elseif ((isFormSent('do_delete')) && (ifPostContainsSelections())) { // Init SQLs initSqls(); diff --git a/inc/modules/admin/what-config_rallye_prices.php b/inc/modules/admin/what-config_rallye_prices.php index fb49ad8711..9b92287488 100644 --- a/inc/modules/admin/what-config_rallye_prices.php +++ b/inc/modules/admin/what-config_rallye_prices.php @@ -73,7 +73,7 @@ if (isGetRequestParameterSet('rallye')) { displayMessage('{--RALLYE_PRICE_ALREADY_FOUND--}'); } } - } elseif (isFormSent('remove')) { + } elseif (isFormSent('do_delete')) { // Check if at last one line is selected if (ifPostContainsSelections()) { // Delete selected entries @@ -87,7 +87,7 @@ if (isGetRequestParameterSet('rallye')) { } else { displayMessage('{--RALLYE_ENTRIES_NOT_DELETED--}'); } - } elseif (isFormSent('change')) { + } elseif (isFormSent('do_edit')) { // Change entries foreach (postRequestParameter('level') as $id => $level) { // Secure id diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index e7bdea2baf..6774b62377 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -217,7 +217,7 @@ if (isGetRequestParameterSet('reg_ext')) { // Load template loadTemplate('admin_extensions_delete', false, $OUT); $do = 'delete'; -} elseif ((isFormSent('remove')) && (ifPostContainsSelections()) && (!isDemoModeActive())) { +} elseif ((isFormSent('do_delete')) && (ifPostContainsSelections()) && (!isDemoModeActive())) { // Remove extensions from DB (you have to delete all files manually!) $cache_update = '0'; foreach (postRequestParameter('sel') as $ext_id => $active) { diff --git a/inc/modules/admin/what-list_admins_acls.php b/inc/modules/admin/what-list_admins_acls.php index 8924be90af..f529023f73 100644 --- a/inc/modules/admin/what-list_admins_acls.php +++ b/inc/modules/admin/what-list_admins_acls.php @@ -78,7 +78,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections())) { // Load main template loadTemplate('admin_edit_admins_acls', false, $OUT); -} elseif ((isFormSent('change')) && (ifPostContainsSelections())) { +} elseif ((isFormSent('do_edit')) && (ifPostContainsSelections())) { // Change entries foreach (postRequestParameter('sel') as $id => $selected) { // Secure id @@ -131,7 +131,7 @@ LIMIT 1", // Load main template loadTemplate('admin_delete_admins_acls', false, $OUT); -} elseif ((isFormSent('remove')) && (ifPostContainsSelections())) { +} elseif ((isFormSent('do_delete')) && (ifPostContainsSelections())) { // Remove entries // @TODO Rewrite this to filter 'run_sqls' foreach (postRequestParameter('sel') as $id => $selected) { diff --git a/inc/modules/admin/what-list_bank_package.php b/inc/modules/admin/what-list_bank_package.php index 1097f84ce5..bb2fa1fbb1 100644 --- a/inc/modules/admin/what-list_bank_package.php +++ b/inc/modules/admin/what-list_bank_package.php @@ -143,7 +143,7 @@ if ((isPostRequestParameterSet('id')) && (is_array(postRequestParameter('id'))) ) ); $show = false; - } elseif (isFormSent('remove')) { + } elseif (isFormSent('do_delete')) { // Delete entries (with confirmation) adminDeleteEntriesConfirm( postRequestParameter('id'), diff --git a/inc/modules/admin/what-list_country.php b/inc/modules/admin/what-list_country.php index 31692ad9c5..39ed75b760 100644 --- a/inc/modules/admin/what-list_country.php +++ b/inc/modules/admin/what-list_country.php @@ -69,7 +69,7 @@ if ((isFormSent('add')) && (isPostRequestParameterSet('code')) && (isPostRequest // Display message displayMessage($message); -} elseif ((isFormSent('change')) && (isPostRequestParameterSet('id'))) { +} elseif ((isFormSent('do_edit')) && (isPostRequestParameterSet('id'))) { // Change all status adminChangeActivationStatus(postRequestParameter('id'), 'countries', 'is_active'); @@ -149,7 +149,7 @@ if ((isFormSent('add')) && (isPostRequestParameterSet('code')) && (isPostRequest // Create message $message = '{--ADMIN_COUNTRIES_MODIFIED--}'; - } elseif ((isFormSent('remove')) && (isPostRequestParameterSet('id'))) { + } elseif ((isFormSent('do_delete')) && (isPostRequestParameterSet('id'))) { // Remove $IDs = implode(',', array_keys(postRequestParameter('id'))); addSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id` IN (".$IDs.") LIMIT ".count(postRequestParameter('id')).""); diff --git a/inc/modules/admin/what-list_point_accounts.php b/inc/modules/admin/what-list_point_accounts.php new file mode 100644 index 0000000000..1dc5942e07 --- /dev/null +++ b/inc/modules/admin/what-list_point_accounts.php @@ -0,0 +1,47 @@ + diff --git a/inc/modules/admin/what-list_rallyes.php b/inc/modules/admin/what-list_rallyes.php index 8820788241..ec3c17b554 100644 --- a/inc/modules/admin/what-list_rallyes.php +++ b/inc/modules/admin/what-list_rallyes.php @@ -100,7 +100,7 @@ if (isGetRequestParameterSet('rallye')) { // Run SQL command runFilterChain('run_sqls'); -} elseif (isFormSent('remove')) { +} elseif (isFormSent('do_delete')) { // Delete rallyes if (ifPostContainsSelections()) { // Init SQLs @@ -126,7 +126,7 @@ if (isGetRequestParameterSet('rallye')) { // No rallye selected to delete! $message = '{--RALLYE_DELETE_NOTHING_SELECTED--}'; } -} elseif (isFormSent('change')) { +} elseif (isFormSent('do_edit')) { // Change rallye if (ifPostContainsSelections('title')) { // Init SQLs diff --git a/inc/modules/admin/what-list_sponsor_pay.php b/inc/modules/admin/what-list_sponsor_pay.php index 7da0139c83..4efd831b63 100644 --- a/inc/modules/admin/what-list_sponsor_pay.php +++ b/inc/modules/admin/what-list_sponsor_pay.php @@ -55,15 +55,15 @@ if (isFormSent('add')) { if ((postRequestParameter('pay_min_count') == '0') || (!isPostRequestParameterSet('pay_min_count'))) unsetPostRequestParameter('add'); if (!isPostRequestParameterSet('pay_currency')) unsetPostRequestParameter('add'); -} elseif ((isFormSent('edit')) || (isFormSent('delete')) || (isFormSent('change')) || (isFormSent('remove'))) { +} elseif ((isFormSent('edit')) || (isFormSent('delete')) || (isFormSent('do_edit')) || (isFormSent('do_delete'))) { // Check if at least one entry was selected if (!isPostRequestParameterSet('id')) { // Nothing selected for editing / deleting??? unsetPostRequestParameter('edit'); unsetPostRequestParameter('delete'); - unsetPostRequestParameter('change'); - unsetPostRequestParameter('remove'); - } elseif (isFormSent('change')) { + unsetPostRequestParameter('do_edit'); + unsetPostRequestParameter('do_delete'); + } elseif (isFormSent('do_edit')) { // Change entries here... foreach (postRequestParameter('id') as $id => $sel) { // Secure id @@ -91,7 +91,7 @@ LIMIT 1", // Generate message $message = '{--SPONSOR_PAY_ENTRIES_CHANGED--}'; - } elseif (isFormSent('remove')) { + } elseif (isFormSent('do_delete')) { // Remove entries here... foreach (postRequestParameter('id') as $id => $sel) { // Remove entry diff --git a/inc/modules/admin/what-list_yoomedia_tm.php b/inc/modules/admin/what-list_yoomedia_tm.php index d7e2c5244f..44fa06128d 100644 --- a/inc/modules/admin/what-list_yoomedia_tm.php +++ b/inc/modules/admin/what-list_yoomedia_tm.php @@ -58,7 +58,7 @@ if (isFormSent()) { } elseif (isPostRequestParameterSet('sent')) { // Sent mail YOOMEDIA_SEND_BONUS_MAIL(postRequestArray(), 'normal'); -} elseif (isFormSent('remove')) { +} elseif (isFormSent('do_delete')) { // Add mail to exclude list YOOMEDIA_EXCLUDE_MAIL(postRequestArray(), 'normal'); } elseif (isPostRequestParameterSet('unlist')) { diff --git a/inc/modules/member/what-cash_coupon.php b/inc/modules/member/what-cash_coupon.php index da4e810d4b..d45a15adf6 100644 --- a/inc/modules/member/what-cash_coupon.php +++ b/inc/modules/member/what-cash_coupon.php @@ -149,7 +149,7 @@ LIMIT 1", } } elseif (isFormSent('change')) { // Change receive status, depending on its current state - if (getUserData('receiving_coupons') == 'Y') { + if (isUserDataEnabled('receiving_coupons')) { // Unsubscribe from coupons $message = '{--MEMBER_COUPON_RECEIVE_STATUS_UNSUBSCRIBED--}'; $newStatus = 'N'; diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index bd934037f5..f6ed2dd996 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -59,7 +59,7 @@ if (getConfig('order_max_full') == 'MAX') $ALLOWED = getUserData('receive_mails' // Now check his points amount $total = getTotalPoints(getMemberId()); -if ((isExtensionInstalledAndNewer('holiday', '0.1.3')) && (getUserData('holiday_active') == 'Y')) { +if ((isExtensionInstalledAndNewer('holiday', '0.1.3')) && (isUserDataEnabled('holiday_active'))) { // Holiday is active! displayMessage('{--MEMBER_HOLIDAY_ORDER_NOT_POSSIBLE--}'); } elseif ((isPostRequestParameterSet('frametester')) && ($ALLOWED > 0) && (postRequestParameter('receiver') > 0)) { @@ -179,7 +179,7 @@ LIMIT 1", if (empty($url)) { // Check if category and number of receivers is okay $add = ''; - if ((getConfig('order_multi_page') == 'Y') && (isPostRequestParameterSet('zip')) && (postRequestParameter('zip') != '')) { + if ((isOrderMultiPageEnabled()) && (isPostRequestParameterSet('zip')) && (postRequestParameter('zip') != '')) { // Choose recipients by ZIP code $add = sprintf(" AND d.zip LIKE '%s%%'", bigintval(postRequestParameter('zip')) @@ -220,10 +220,15 @@ ORDER BY FROM `{?_MYSQL_PREFIX?}_user_holidays` WHERE - `userid`=%s AND `holiday_start` < UNIX_TIMESTAMP() AND `holiday_end` > UNIX_TIMESTAMP() + `userid`=%s AND + `holiday_start` < UNIX_TIMESTAMP() AND + `holiday_end` > UNIX_TIMESTAMP() LIMIT 1", array($holidayContent['userid']), __FILE__, __LINE__); - if (SQL_NUMROWS($result_holiday) == 1) $holidayContent['userid'] = '0'; // Exclude user who are in holiday + if (SQL_NUMROWS($result_holiday) == 1) { + // Exclude user who are in holiday + $holidayContent['userid'] = '0'; + } // END - if // Free memory SQL_FREERESULT($result_holiday); @@ -249,17 +254,21 @@ LIMIT 1", SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `receive_mails`=`receive_mails`-1 WHERE `userid` IN (%s) LIMIT %s", array( convertReceivers($receiver), - $content['target_send'] + bigintval($content['target_send']) ), __FILE__, __LINE__); // Is calculated max receivers larger than wanted receivers then reset it - if ($content['target_send'] > postRequestParameter('receiver')) $content['target_send'] = bigintval(postRequestParameter('receiver')); + if ($content['target_send'] > postRequestParameter('receiver')) { + $content['target_send'] = bigintval(postRequestParameter('receiver')); + } // END - if // Calculate used points $USED = $content['target_send'] * getPaymentPoints(bigintval(postRequestParameter('mail_type'))); // Fix empty zip code - if (!isPostRequestParameterSet('zip')) setPostRequestParameter('zip', 0); + if (!isPostRequestParameterSet('zip')) { + setPostRequestParameter('zip', 0); + } // END - if // Check if he has enougth points for this order and selected more than 0 receivers if (($USED > 0) && ($USED <= $total) && ($content['target_send'] > 0)) { @@ -269,8 +278,35 @@ LIMIT 1", $id = '0'; if (isExtensionActive('html_mail')) { // HTML extension is active - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_pool` (`sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `zip`, `html_msg`) -VALUES (%s,'%s','%s','%s','%s','TEMP',UNIX_TIMESTAMP(),'%s',%s,%s,%s,'%s')", + SQL_QUERY_ESC("INSERT INTO + `{?_MYSQL_PREFIX?}_pool` +( + `sender`, + `subject`, + `text`, + `receivers`, + `payment_id`, + `data_type`, + `timestamp`, + `url`, + `cat_id`, + `target_send`, + `zip`, + `html_msg` +) VALUES ( + %s, + '%s', + '%s', + '%s', + %s, + 'TEMP', + UNIX_TIMESTAMP(), + '%s', + %s, + %s, + %s, + '%s' +)", array( getMemberId(), postRequestParameter('subject'), @@ -279,14 +315,39 @@ VALUES (%s,'%s','%s','%s','%s','TEMP',UNIX_TIMESTAMP(),'%s',%s,%s,%s,'%s')", bigintval(postRequestParameter('mail_type')), postRequestParameter('url'), bigintval(postRequestParameter('cat')), - $content['target_send'], + bigintval($content['target_send']), bigintval(postRequestParameter('zip'), true, false), postRequestParameter('html') ), __FILE__, __LINE__); } else { // No HTML extension is active - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_pool` (`sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `zip`) -VALUES (%s,'%s','%s','%s','%s','TEMP',UNIX_TIMESTAMP(),'%s',%s,%s,%s)", + SQL_QUERY_ESC("INSERT INTO + `{?_MYSQL_PREFIX?}_pool` +( + `sender`, + `subject`, + `text`, + `receivers`, + `payment_id`, + `data_type`, + `timestamp`, + `url`, + `cat_id`, + `target_send`, + `zip` +) VALUES ( + %s, + '%s', + '%s', + '%s', + %s, + 'TEMP', + UNIX_TIMESTAMP(), + '%s', + %s, + %s, + %s +)", array( getMemberId(), postRequestParameter('subject'), @@ -295,7 +356,7 @@ VALUES (%s,'%s','%s','%s','%s','TEMP',UNIX_TIMESTAMP(),'%s',%s,%s,%s)", bigintval(postRequestParameter('mail_type')), postRequestParameter('url'), bigintval(postRequestParameter('cat')), - $content['target_send'], + bigintval($content['target_send']), bigintval(postRequestParameter('zip'), true, false), ), __FILE__, __LINE__); } @@ -426,7 +487,9 @@ ORDER BY // Enable HTML checking // @TODO Rewrite this to a filter $HTML = ''; $HOL_STRING = ''; - if ((isExtensionActive('html_mail')) && (postRequestParameter('html') == 'Y')) $HTML = " AND `html`='Y'"; + if ((isExtensionActive('html_mail')) && (postRequestParameter('html') == 'Y')) { + $HTML = " AND `html`='Y'"; + } // END - if if (isExtensionInstalledAndNewer('holiday', '0.1.3')) { // Extension's version is fine $HOL_STRING = " AND `holiday_active`='N'"; @@ -480,7 +543,7 @@ LIMIT 1", $result_ver = SQL_QUERY_ESC("SELECT `zip` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s".$HTML." AND `receive_mails` > 0 AND `status`='CONFIRMED' LIMIT 1", array(bigintval($userid)), __FILE__, __LINE__); - if ((SQL_NUMROWS($result_ver) == 1) && (isPostRequestParameterSet('zip')) && (getConfig('order_multi_page') == 'Y')) { + if ((SQL_NUMROWS($result_ver) == 1) && (isPostRequestParameterSet('zip')) && (isOrderMultiPageEnabled())) { // Get zip code list($zip) = SQL_FETCHROW($result_ver); if (substr($zip, 0, strlen(postRequestParameter('zip'))) == postRequestParameter('zip')) { @@ -588,7 +651,7 @@ LIMIT 1", // Free result SQL_FREERESULT($result); - if ((isPostRequestParameterSet('data')) || ((getConfig('order_multi_page') != 'Y') && ((!isAdmin()) && (!isExtensionActive('html_mail'))))) { + if ((isPostRequestParameterSet('data')) || ((getOrderMultiPage() != 'Y') && ((!isAdmin()) && (!isExtensionActive('html_mail'))))) { // Pre-output categories $content['category_selection'] = ''; foreach ($categories['id'] as $key => $value) { @@ -641,7 +704,7 @@ LIMIT 1", $content['zip_content'] = ''; // Do we want ZIP code or not? - if ((getConfig('order_multi_page') == 'Y') || (isAdmin())) { + if ((isOrderMultiPageEnabled()) || (isAdmin())) { // Yes if (postRequestParameter('zip') > 0) { $data = array( diff --git a/inc/modules/order.php b/inc/modules/order.php index c9c4ae5458..c12566fa87 100644 --- a/inc/modules/order.php +++ b/inc/modules/order.php @@ -83,15 +83,19 @@ if (empty($url)) { SQL_FREERESULT($result); // Fix empty subject line - if (empty($content['subject'])) $content['subject'] = '{--DEFAULT_SUBJECT_LINE--}'; + if (empty($content['subject'])) { + $content['subject'] = '{--DEFAULT_SUBJECT_LINE--}'; + } // END - if // Calculate used points - $usedPoints = $content['target_send'] * getPaymentPoints($content['payment_id']); + $content['payed_points'] = $content['target_send'] * getPaymentPoints($content['payment_id']); + subtractPoints('order', getMemberId(), $content['payed_points']); // Update used points $add = ''; - if (getConfig('order_max_full') == 'ORDER') $add = ', `mail_orders`=`mail_orders`+1'; - subtractPoints('order', getMemberId(), $usedPoints); + if ((isExtensionInstalledAndNewer('order', '0.1.1')) && (getConfig('order_max_full') == 'ORDER')) { + $add = ', `mail_orders`=`mail_orders`+1'; + } // END - if // Send an email to the user $message_mem = loadEmailTemplate('member_order_normal', $content, getMemberId()); diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 8a4387f00b..d73e687bf2 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -948,6 +948,18 @@ function getUserData ($column) { return $GLOBALS['user_data'][getCurrentUserId()][$column]; } +// Checks wether given user data is set to 'Y' +function isUserDataEnabled ($column) { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__][getCurrentUserId()][$column])) + // Determine it + $GLOBALS[__FUNCTION__][getCurrentUserId()][$column] = (getUserData($column) == 'Y') + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__][getCurrentUserId()][$column]; +} + // Geter for whole user data array function getUserDataArray () { // Get user id diff --git a/templates/de/emails/admin/admin_order_normal.tpl b/templates/de/emails/admin/admin_order_normal.tpl index 25d01afa6a..52433de67b 100644 --- a/templates/de/emails/admin/admin_order_normal.tpl +++ b/templates/de/emails/admin/admin_order_normal.tpl @@ -14,6 +14,7 @@ Gebuchte Kategorie: {%pipe,getCategory=$content[cat_id]%} Gebuchter Payment-Typ: {%pipe,getPaymentTitlePrice=$content[payment_id]%} Betreffzeile in den Mails: $content[subject] Gebuchte URL: $content[url] +Bezahlte {?POINTS?}: $content[payed_points] ------------------------------------ IP-Nummer: {%server,remote_addr%} (Real: {%server,real_ip_address%}) ------------------------------------ diff --git a/templates/de/emails/member/member_order_normal.tpl b/templates/de/emails/member/member_order_normal.tpl index 8dbf11fb6f..093733e40e 100644 --- a/templates/de/emails/member/member_order_normal.tpl +++ b/templates/de/emails/member/member_order_normal.tpl @@ -8,6 +8,7 @@ Gebuchte Kategorie: {%pipe,getCategory=$content[cat_id]%} Gebuchter Payment-Typ: {%pipe,getPaymentTitlePrice=$content[payment_id]%} Betreffzeile in den Mails: $content[subject] Gebuchte URL: $content[url] +Bezahlte {?POINTS?}: $content[payed_points] ------------------------------------------------ Werbetext: diff --git a/templates/de/html/admin/admin_admins_mails_edit.tpl b/templates/de/html/admin/admin_admins_mails_edit.tpl index ce4665c6e3..76fda6e1c7 100644 --- a/templates/de/html/admin/admin_admins_mails_edit.tpl +++ b/templates/de/html/admin/admin_admins_mails_edit.tpl @@ -18,7 +18,7 @@ - + diff --git a/templates/de/html/admin/admin_config_rallye_del.tpl b/templates/de/html/admin/admin_config_rallye_del.tpl index d2904a115f..8b1725dd0e 100644 --- a/templates/de/html/admin/admin_config_rallye_del.tpl +++ b/templates/de/html/admin/admin_config_rallye_del.tpl @@ -23,7 +23,7 @@ $content[rows] - + diff --git a/templates/de/html/admin/admin_config_rallye_edit.tpl b/templates/de/html/admin/admin_config_rallye_edit.tpl index fba50b4d83..9a048d453e 100644 --- a/templates/de/html/admin/admin_config_rallye_edit.tpl +++ b/templates/de/html/admin/admin_config_rallye_edit.tpl @@ -24,7 +24,7 @@ - + diff --git a/templates/de/html/admin/admin_del_bank_packages.tpl b/templates/de/html/admin/admin_del_bank_packages.tpl index f96d36f8c2..a682a1043b 100644 --- a/templates/de/html/admin/admin_del_bank_packages.tpl +++ b/templates/de/html/admin/admin_del_bank_packages.tpl @@ -15,7 +15,7 @@ $content - + diff --git a/templates/de/html/admin/admin_delete_admins.tpl b/templates/de/html/admin/admin_delete_admins.tpl index 1082a2123e..2d34699469 100644 --- a/templates/de/html/admin/admin_delete_admins.tpl +++ b/templates/de/html/admin/admin_delete_admins.tpl @@ -17,7 +17,7 @@ - + diff --git a/templates/de/html/admin/admin_delete_admins_acls.tpl b/templates/de/html/admin/admin_delete_admins_acls.tpl index 8cc74b2345..46a4b6b549 100644 --- a/templates/de/html/admin/admin_delete_admins_acls.tpl +++ b/templates/de/html/admin/admin_delete_admins_acls.tpl @@ -17,7 +17,7 @@ - + diff --git a/templates/de/html/admin/admin_delete_network_params.tpl b/templates/de/html/admin/admin_delete_network_params.tpl index e849f8b62b..9c413fcb30 100644 --- a/templates/de/html/admin/admin_delete_network_params.tpl +++ b/templates/de/html/admin/admin_delete_network_params.tpl @@ -15,7 +15,7 @@ - + diff --git a/templates/de/html/admin/admin_delete_network_types.tpl b/templates/de/html/admin/admin_delete_network_types.tpl index 3b38c21487..fc581314a4 100644 --- a/templates/de/html/admin/admin_delete_network_types.tpl +++ b/templates/de/html/admin/admin_delete_network_types.tpl @@ -15,7 +15,7 @@ - + diff --git a/templates/de/html/admin/admin_delete_networks.tpl b/templates/de/html/admin/admin_delete_networks.tpl index aa25e5b395..f3a67cceed 100644 --- a/templates/de/html/admin/admin_delete_networks.tpl +++ b/templates/de/html/admin/admin_delete_networks.tpl @@ -10,7 +10,7 @@ - + diff --git a/templates/de/html/admin/admin_delete_payouts.tpl b/templates/de/html/admin/admin_delete_payouts.tpl index 9e62cd537e..4b965442af 100644 --- a/templates/de/html/admin/admin_delete_payouts.tpl +++ b/templates/de/html/admin/admin_delete_payouts.tpl @@ -14,7 +14,7 @@ $content - + diff --git a/templates/de/html/admin/admin_edit_admins.tpl b/templates/de/html/admin/admin_edit_admins.tpl index 94bbbcf55f..4e8734ed91 100644 --- a/templates/de/html/admin/admin_edit_admins.tpl +++ b/templates/de/html/admin/admin_edit_admins.tpl @@ -17,7 +17,7 @@ - + diff --git a/templates/de/html/admin/admin_edit_admins_acls.tpl b/templates/de/html/admin/admin_edit_admins_acls.tpl index dce8929bdd..124a53116c 100644 --- a/templates/de/html/admin/admin_edit_admins_acls.tpl +++ b/templates/de/html/admin/admin_edit_admins_acls.tpl @@ -17,7 +17,7 @@ - + diff --git a/templates/de/html/admin/admin_edit_mods.tpl b/templates/de/html/admin/admin_edit_mods.tpl index 0f27b51e16..6ebfb0b520 100644 --- a/templates/de/html/admin/admin_edit_mods.tpl +++ b/templates/de/html/admin/admin_edit_mods.tpl @@ -18,7 +18,7 @@ $content - + diff --git a/templates/de/html/admin/admin_edit_network_params.tpl b/templates/de/html/admin/admin_edit_network_params.tpl index d78bfddd5a..5095dae520 100644 --- a/templates/de/html/admin/admin_edit_network_params.tpl +++ b/templates/de/html/admin/admin_edit_network_params.tpl @@ -15,7 +15,7 @@ - + diff --git a/templates/de/html/admin/admin_edit_network_types.tpl b/templates/de/html/admin/admin_edit_network_types.tpl index 9d65c3902a..6da26978d3 100644 --- a/templates/de/html/admin/admin_edit_network_types.tpl +++ b/templates/de/html/admin/admin_edit_network_types.tpl @@ -15,7 +15,7 @@ - + diff --git a/templates/de/html/admin/admin_edit_networks.tpl b/templates/de/html/admin/admin_edit_networks.tpl index ae27188926..ed0dc02d26 100644 --- a/templates/de/html/admin/admin_edit_networks.tpl +++ b/templates/de/html/admin/admin_edit_networks.tpl @@ -10,7 +10,7 @@ - + diff --git a/templates/de/html/admin/admin_edit_payouts.tpl b/templates/de/html/admin/admin_edit_payouts.tpl index efb883be9b..caf648970b 100644 --- a/templates/de/html/admin/admin_edit_payouts.tpl +++ b/templates/de/html/admin/admin_edit_payouts.tpl @@ -17,7 +17,7 @@ - + diff --git a/templates/de/html/admin/admin_edit_rallyes.tpl b/templates/de/html/admin/admin_edit_rallyes.tpl index ce745611ca..2d18ef7c88 100644 --- a/templates/de/html/admin/admin_edit_rallyes.tpl +++ b/templates/de/html/admin/admin_edit_rallyes.tpl @@ -8,7 +8,7 @@ - + diff --git a/templates/de/html/admin/admin_extensions.tpl b/templates/de/html/admin/admin_extensions.tpl index 62691347eb..50017ac897 100644 --- a/templates/de/html/admin/admin_extensions.tpl +++ b/templates/de/html/admin/admin_extensions.tpl @@ -17,7 +17,7 @@ - + diff --git a/templates/de/html/admin/admin_extensions_delete.tpl b/templates/de/html/admin/admin_extensions_delete.tpl index ed3bb647e1..87483eac40 100644 --- a/templates/de/html/admin/admin_extensions_delete.tpl +++ b/templates/de/html/admin/admin_extensions_delete.tpl @@ -14,7 +14,7 @@ $content - + diff --git a/templates/de/html/admin/admin_list_sponsor_pay_del.tpl b/templates/de/html/admin/admin_list_sponsor_pay_del.tpl index 9f5cdf280e..bfd7d84b19 100644 --- a/templates/de/html/admin/admin_list_sponsor_pay_del.tpl +++ b/templates/de/html/admin/admin_list_sponsor_pay_del.tpl @@ -17,7 +17,7 @@ $content - + diff --git a/templates/de/html/admin/admin_list_sponsor_pay_edit.tpl b/templates/de/html/admin/admin_list_sponsor_pay_edit.tpl index 6ba0506188..8c9c71a41d 100644 --- a/templates/de/html/admin/admin_list_sponsor_pay_edit.tpl +++ b/templates/de/html/admin/admin_list_sponsor_pay_edit.tpl @@ -17,7 +17,7 @@ $content - + diff --git a/templates/de/html/admin/admin_list_yoomedia_tm_row.tpl b/templates/de/html/admin/admin_list_yoomedia_tm_row.tpl index e52297f00b..945e30ff9b 100644 --- a/templates/de/html/admin/admin_list_yoomedia_tm_row.tpl +++ b/templates/de/html/admin/admin_list_yoomedia_tm_row.tpl @@ -15,7 +15,7 @@ - +
-- 2.39.5