From 8ad295d1b883eed6cc50ec9e37b6639503ac6aa9 Mon Sep 17 00:00:00 2001 From: quix0r Date: Thu, 18 Aug 2011 23:04:06 +0000 Subject: [PATCH] Extension ext-network continued, functions renamed: - Loading of network types handler configuration implemented (with missing templates which will follow next commit) - Functions makeFooToBar() renamed to convertFooToBar(), functions with this (convert) prefix will be used in PHP scripts and some templates, compared to translateFooBar() which will be used only in templates as "translation helper" - DOCS/debug-lines.log ignored which will be used to identify commented-in debug lines - TODOs.txt updated --- .gitattributes | 1 + .gitignore | 1 + DOCS/TODOs.txt | 1 - doubler.php | 4 +- inc/filter/online_filter.php | 8 +- inc/functions.php | 4 +- inc/language/network_de.php | 5 + inc/libs/admins_functions.php | 2 +- inc/libs/refback_functions.php | 16 +- inc/libs/register_functions.php | 2 +- inc/modules/admin/admin-inc.php | 4 +- .../admin/what-config_network_types.php | 147 +++++++++++++++++- inc/modules/member/what-points.php | 2 +- inc/mysql-manager.php | 4 +- inc/referral-functions.php | 42 ++--- ref.php | 2 +- .../admin/admin_add_config_network_type.tpl | 18 +++ .../admin/admin_delete_surfbar_urls_row.tpl | 2 +- .../admin/admin_edit_surfbar_urls_row.tpl | 2 +- .../admin/admin_lock_surfbar_urls_row.tpl | 2 +- .../admin/admin_undelete_surfbar_urls_row.tpl | 2 +- .../html/guest/guest_register_refid_hide.tpl | 2 +- .../de/html/member/member_points_row.tpl | 2 +- templates/de/html/member/member_reflink.tpl | 2 +- 24 files changed, 223 insertions(+), 54 deletions(-) create mode 100644 templates/de/html/admin/admin_add_config_network_type.tpl diff --git a/.gitattributes b/.gitattributes index 42fa14819e..9c5298714a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1040,6 +1040,7 @@ templates/de/html/admin/admin_add_admins.tpl svneol=native#text/plain templates/de/html/admin/admin_add_admins_acl.tpl svneol=native#text/plain templates/de/html/admin/admin_add_bank_package.tpl svneol=native#text/plain templates/de/html/admin/admin_add_cat.tpl svneol=native#text/plain +templates/de/html/admin/admin_add_config_network_type.tpl svneol=native#text/plain templates/de/html/admin/admin_add_country.tpl svneol=native#text/plain templates/de/html/admin/admin_add_forced_ad.tpl svneol=native#text/plain templates/de/html/admin/admin_add_guest_menu.tpl svneol=native#text/plain diff --git a/.gitignore b/.gitignore index e9cccc4e9f..4485b80e82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /.cache /.project /.settings +DOCS/debug-lines.log DOCS/doxygen/*.tmp DOCS/doxygen/html DOCS/template-warnings.log diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 1ff32ba788..fdc9a5ddfd 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -108,7 +108,6 @@ ./inc/modules/admin/what-admins_mails.php:58: // @TODO Can this be rewritten to an API function? ./inc/modules/admin/what-bonus.php:46:// @TODO Unused at the moment ./inc/modules/admin/what-config_mods.php:55: // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function -./inc/modules/admin/what-config_network_types.php:60: // @TODO Do something here ./inc/modules/admin/what-config_points.php:110: // @TODO Rewrite this to a filter ./inc/modules/admin/what-config_rallye_prices.php:195: // @TODO Rewrite these two constants ./inc/modules/admin/what-config_rallye_prices.php:227: // @TODO rename: start->start_time, end->end_time diff --git a/doubler.php b/doubler.php index 80b913e61e..9d4e63cbd7 100644 --- a/doubler.php +++ b/doubler.php @@ -102,7 +102,7 @@ if (isFormSent()) { SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`,`refid`,`points`,`remote_ip`,`timemark`,`completed`,`is_ref`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(), 'N','N')", array( getUserData('userid'), - makeZeroToNull(determineReferralId()), + convertZeroToNull(determineReferralId()), bigintval(postRequestElement('points') * 2), detectRemoteAddr() ), __FILE__, __LINE__); @@ -120,7 +120,7 @@ if (isFormSent()) { // Okay add a refid line and apply refid percents SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`,`refid`,`points`,`remote_ip`,`timemark`,`completed`,`is_ref`) VALUES (%s,0,%s,'%s',UNIX_TIMESTAMP(),'N','Y')", array( - makeZeroToNull(determineReferralId()), + convertZeroToNull(determineReferralId()), (postRequestElement('points') * 2 * getConfig('doubler_ref') / 100), detectRemoteAddr() ), __FILE__, __LINE__); diff --git a/inc/filter/online_filter.php b/inc/filter/online_filter.php index c1459c6b09..e24b674fd3 100644 --- a/inc/filter/online_filter.php +++ b/inc/filter/online_filter.php @@ -93,8 +93,8 @@ LIMIT 1", getModule(), $action, getWhat(), - makeZeroToNull($userid), - makeZeroToNull(determineReferralId()), + convertZeroToNull($userid), + convertZeroToNull(determineReferralId()), $isMember, $isAdmin, detectRemoteAddr(), @@ -107,8 +107,8 @@ LIMIT 1", getModule(), $action, getWhat(), - makeZeroToNull($userid), - makeZeroToNull(determineReferralId()), + convertZeroToNull($userid), + convertZeroToNull(determineReferralId()), $isMember, $isAdmin, session_id(), diff --git a/inc/functions.php b/inc/functions.php index 25035b54e0..d0494e19e1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2134,7 +2134,7 @@ function handleFieldWithBraces ($field) { } // Converts a zero or NULL to word 'NULL' -function makeZeroToNull ($number) { +function convertZeroToNull ($number) { // Is it a valid username? if ((!is_null($number)) && (!empty($number)) && ($number > 0)) { // Always secure it @@ -2149,7 +2149,7 @@ function makeZeroToNull ($number) { } // Converts a NULL to zero -function makeNullToZero ($number) { +function convertNullToZero ($number) { // Is it a valid username? if ((!is_null($number)) && (!empty($number)) && ($number > 0)) { // Always secure it diff --git a/inc/language/network_de.php b/inc/language/network_de.php index f40871a47a..38adb643ab 100644 --- a/inc/language/network_de.php +++ b/inc/language/network_de.php @@ -82,6 +82,7 @@ addMessages(array( 'ADMIN_NETWORK_REQUEST_PARAMETER_DELETE_TITLE' => "API-Parameter löschen", 'ADMIN_ADD_NETWORK_API_TRANSLATION_TITLE' => "Werbenetzwerk verwalten - Neues API-Arrayelement hinzufügen", 'ADMIN_LIST_NETWORK_API_TRANSLATION_TITLE' => "API-Arrayelemente auflisten und verwalten", + 'ADMIN_ADD_CONFIG_NETWORK_TYPE_TITLE' => "Werbeart-Handler einrichten - {%%pipe,translateNetworkTypeHandler=%s%%}", // - Link titles 'ADMIN_NETWORK_CONFIG_LINK_TITLE' => "Weiter zur API-Konfiguration", 'ADMIN_LIST_NETWORK_TYPES_LINK_TITLE' => "Weiter zu den Werbearten", @@ -101,6 +102,7 @@ addMessages(array( 'ADMIN_CHANGE_NETWORK_REQUEST_PARAMETER_SUBMIT' => "API-Parameter ändern", 'ADMIN_REMOVE_NETWORK_REQUEST_PARAMETER_SUBMIT' => "API-Parameter entfernen", 'ADMIN_ADD_NETWORK_API_TRANSLATION_SUBMIT' => "API-Arrayelement hinzufügen", + 'ADMIN_ADD_CONFIG_NETWORK_TYPE_SUBMIT' => "Jetzt den Werbeart-Handler einrichten", // - Success titles 'ADMIN_NETWORK_ADDED_TITLE' => "Allgemeine Werbenetzwerkdaten hinzugefügt", 'ADMIN_NETWORK_TYPES_ADDED_TITLE' => "Werbeart-Handler hinzugefügt", @@ -217,6 +219,9 @@ addMessages(array( 'ADMIN_CONFIG_NETWORK_API_NOT_SAVED' => "API-Konfiguration NICHT gespeichert (keine Änderungen).", 'ADMIN_NETWORK_API_NOT_CONFIGURED' => "Konfiguration fehlt", 'ADMIN_NETWORK_API_CONFIGURED' => "Konfiguration vorhanden", + // Network types configuration + 'ADMIN_CONFIG_NETWORK_TYPES_404' => "Es wurden keine Daten zur Werbenetzwerk-Id %s gefunden. Bitte benachrichtigen Sie das Entwickler-Team.", + 'ADMIN_ADD_CONFIG_NETWORK_TYPE_404_NOTE' => "Damit das Script auch das Interface des Werbenetzwerks ansprechen kann, muss ein Werbeart-Handler eingerichtet werden.", // Error codes 'ADMIN_NETWORK_AFF_ID_PASS_WRONG_ERROR_CODE' => "Affiliate-Id oder -Passwort falsch", 'ADMIN_NETWORK_SITE_ID_NOT_ASSIGNED_ERROR_CODE' => "Seiten-Id nicht zugewiesen/ungültig", diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 3ac7769a27..15f781889d 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -366,7 +366,7 @@ function generateAdminAccessModeSelectionBox ($adminId = NULL) { // Generate menu mode selection box for given admin it function generateAdminMenuModeSelectionBox ($adminId = NULL) { // Start the selection box - $OUT = ''; // Add option list $OUT .= generateOptionList('/ARRAY/', array('global', 'OLD', 'NEW'), array('{--ADMIN_ADMINS_LA_MODE_GLOBAL--}', '{--ADMIN_ADMINS_LA_MODE_OLD--}', '{--ADMIN_ADMINS_LA_MODE_NEW--}'), getAdminMenuMode($adminId)); diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index dbab02152d..300ee3aacd 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -70,9 +70,9 @@ function addRefbackPoints ($userid, $ref, $points, $ref_points) { * call. If you do so, you will check the wrong direction, $userid * is always bigger than $refid. */ - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . makeNullToZero($refid) . ' - CALLING getRefbackPercents()'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . convertNullToZero($refid) . ' - CALLING getRefbackPercents()'); $content['refback_percents'] = getRefbackPercents($refid, $userid); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . makeNullToZero($refid) . ',refback_percents=' . $content['refback_percents']); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . convertNullToZero($refid) . ',refback_percents=' . $content['refback_percents']); // Some percents given? if ($content['refback_percents'] > 0) { @@ -98,11 +98,11 @@ LIMIT 1', // Something must have been updated if (SQL_HASZEROAFFECTED()) { // Please report this bug - debug_report_bug(__FUNCTION__, __LINE__, 'Nothing has been updated in user_refs,userid=' . $userid . ',refid=' . makeNullToZero($refid) . ',refbackPoints=' . $refbackPoints); + debug_report_bug(__FUNCTION__, __LINE__, 'Nothing has been updated in user_refs,userid=' . $userid . ',refid=' . convertNullToZero($refid) . ',refbackPoints=' . $refbackPoints); } // END - if // Add points again, but only directly - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refbackPoints=' . $refbackPoints . ',userid=' . $userid . ',ref=' . $ref . ',refid=' . makeNullToZero($refid) . ' - REFBACK-UPDATE! (' . SQL_AFFECTEDROWS() . ')'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refbackPoints=' . $refbackPoints . ',userid=' . $userid . ',ref=' . $ref . ',refid=' . convertNullToZero($refid) . ' - REFBACK-UPDATE! (' . SQL_AFFECTEDROWS() . ')'); addPointsThroughReferralSystem(sprintf("refback:%s", $refid), $userid, $refbackPoints); // Reduce points if refid is found @@ -138,7 +138,7 @@ function getRefbackPercents ($userid, $refid) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . $refid . ' - ENTERED!'); if ((!isValidUserId($userid)) || (!isValidUserId($refid))) { // userid and/or refid is invalid - debug_report_bug(__FUNCTION__, __LINE__, 'userid=' . makeNullToZero($userid) . ', refid=' . makeNullToZero($refid) . ' - Both must be > 0'); + debug_report_bug(__FUNCTION__, __LINE__, 'userid=' . convertNullToZero($userid) . ', refid=' . convertNullToZero($refid) . ' - Both must be > 0'); } elseif ($userid == $refid) { // Skip identical ids return 0; @@ -174,7 +174,7 @@ function getRefbackPercents ($userid, $refid) { // "Getter" for userid array which will return only one entry function getArrayFromRefbackLevel ($refid, $level) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . makeNullToZero($refid) . ',level=' . $level . ' - ENTERED!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . convertNullToZero($refid) . ',level=' . $level . ' - ENTERED!'); // Init userids $userIds = array(); @@ -195,7 +195,7 @@ ORDER BY if (!SQL_HASZERONUMS($result)) { // Add all while ($content = SQL_FETCHARRAY($result)) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . makeNullToZero($refid) . ',level=' . $level . ',userid=' . $content['userid']); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . convertNullToZero($refid) . ',level=' . $level . ',userid=' . $content['userid']); $userIds[] = $content['userid']; } // END - while } // END - if @@ -204,7 +204,7 @@ ORDER BY SQL_FREERESULT($result); // Return array - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . makeNullToZero($refid) . ',userIds()=' . count($userIds) . ' - EXIT!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . convertNullToZero($refid) . ',userIds()=' . count($userIds) . ' - EXIT!'); return $userIds; } diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index 2f7b9ad64e..35a790ae7f 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -378,7 +378,7 @@ function doRegistration () { generateHash(postRequestElement('pass1')), bigintval(postRequestElement('max_mails')), bigintval(postRequestElement('max_mails')), - makeZeroToNull(postRequestElement('refid')), + convertZeroToNull(postRequestElement('refid')), $hash ), __FUNCTION__, __LINE__); diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 29083fce0f..ae6191a043 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -696,7 +696,7 @@ function generateUserProfileLink ($userid, $title = '', $what = 'list_user') { $title = $userid; } elseif (!isValidUserId($userid)) { // User id zero is invalid - return '' . makeNullToZero($userid) . ''; + return '' . convertNullToZero($userid) . ''; } if (($title == '0') && ($what == 'list_refs')) { @@ -910,7 +910,7 @@ function adminListBuilder ($listType, $tableName, $columns, $filterFunctions, $e if ($key == $userIdColumn[0]) { // Add it again as raw id //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'key=' . $key . ',userIdColumn=' . $userIdColumn[0]); - $content[$userIdColumn[0]] = makeZeroToNull($value); + $content[$userIdColumn[0]] = convertZeroToNull($value); $content[$userIdColumn[0] . '_raw'] = $content[$userIdColumn[0]]; } // END - if diff --git a/inc/modules/admin/what-config_network_types.php b/inc/modules/admin/what-config_network_types.php index 0871c70c18..15d85b9f35 100644 --- a/inc/modules/admin/what-config_network_types.php +++ b/inc/modules/admin/what-config_network_types.php @@ -57,7 +57,152 @@ if ($GLOBALS['network_display'] === false) { // Do we have a network selected? if (isGetRequestElementSet('network_id')) { - // @TODO Do something here + // Is a network type handler selected? + if (isGetRequestElementSet('network_type_id')) { + // Load data for given network + $result = SQL_QUERY_ESC('SELECT + `network_id`, + `network_type_id`, + `network_type_handle`, + `network_type_api_url`, + `network_type_click_url`, + `network_type_banner_url`, + NULL AS `network_data_id`, + NULL AS `network_max_reload_time`, + NULL AS `network_min_waiting_time`, + NULL AS `network_min_remain_clicks`, + NULL AS `network_min_payment`, + NULL AS `network_allow_erotic` +FROM + `{?_MYSQL_PREFIX?}_network_types` +WHERE + `network_id`=%s AND + `network_type_id`=%s +LIMIT 1', + array( + bigintval(getRequestElement('network_id')), + bigintval(getRequestElement('network_type_id')) + ), __FUNCTION__, __LINE__); + + // Do we have a record? + if (SQL_NUMROWS($result) == 1) { + // Load it + $content = SQL_FETCHARRAY($result); + + // Check for network type configuration + $result_config = SQL_QUERY_ESC('SELECT + `network_data_id`, + `network_max_reload_time`, + `network_min_waiting_time` + `network_min_remain_clicks`, + `network_min_payment`, + `network_allow_erotic` +FROM + `{?_MYSQL_PREFIX?}_network_types_config` +WHERE + `network_id`=%s AND + `network_type_id`=%s +LIMIT 1', + array( + bigintval(getRequestElement('network_id')), + bigintval($content['network_type_id']) + ), __FUNCTION__, __LINE__); + + // Do we also have configuration? + if (SQL_NUMROWS($result_config) == 1) { + // Load as well and merge it + $content = merge_array($content, SQL_FETCHARRAY($result_config)); + } // END - if + + // Free result + SQL_FREERESULT($result_config); + + // Load template + loadTemplate('admin_add_config_network_type_form', false, $content); + + // Abort here + return; + } else { + // No entry found + displayMessage('{%message,ADMIN_ADD_CONFIG_NETWORK_TYPE_404', bigintval(getRequestElement('network_id')) . '/' . bigintval(getRequestElement('network_type_id'))); + } // END - if + + // Free result + SQL_FREERESULT($result); + } // END - if + + // Get all type handlers + $result = SQL_QUERY_ESC('SELECT + `network_id`, + `network_type_id`, + `network_type_handle`, + `network_type_api_url`, + `network_type_click_url`, + `network_type_banner_url` +FROM + `{?_MYSQL_PREFIX?}_network_types` +WHERE + `network_id`=%s +ORDER BY + `network_type_handle` ASC', + array( + bigintval(getRequestElement('network_id')) + ), __FUNCTION__, __LINE__); + + // Do we have entries left? + if (!SQL_HASZERONUMS($result)) { + // Init row output + $OUT = ''; + + // List all entries + while ($content = SQL_FETCHARRAY($result)) { + // Check if config entry is there + $result_config = SQL_QUERY_ESC('SELECT + `network_data_id`, + `network_max_reload_time`, + `network_min_waiting_time`, + `network_min_remain_clicks`, + `network_min_payment`, + `network_allow_erotic` +FROM + `{?_MYSQL_PREFIX?}_network_types_config` +WHERE + `network_id`=%s AND + `network_type_id`=%s +LIMIT 1', + array( + bigintval(getRequestElement('network_id')), + bigintval($content['network_type_id']) + ), __FUNCTION__, __LINE__); + + // Do we have an entry? + if (SQL_NUMROWS($result_config) == 1) { + // Load this data as well + $contentConfig = SQL_FETCHARRAY($result_config); + + // Add it with extra template + $content['network_types_config_content'] = loadTemplate('admin_show_config_network_type', true, $contentConfig); + } else { + // No configuration found, so display form + $content['network_types_config_content'] = loadTemplate('admin_add_config_network_type', true, $content); + } + + // Free result + SQL_FREERESULT($result_config); + + // Load row template + $OUT .= loadTemplate('admin_config_network_types_row', true, $content); + } // END - while + + // Load main template + loadTemplate('admin_config_network_types', false, $OUT); + } else { + // No entries found + displayMessage('{%message,ADMIN_CONFIG_NETWORK_TYPES_404=' . bigintval(getRequestElement('network_id')) . '%}'); + } + + // Free result + SQL_FREERESULT($result); } else { // Generate network list for this script outputHtml(generateAdminNetworkList()); diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index b476f08b1c..563eab9f39 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -108,7 +108,7 @@ WHERE LIMIT 1", array( getMemberId(), - makeZeroToNull($content['level']) + convertZeroToNull($content['level']) ), __FILE__, __LINE__); // Do we have an entry? diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index e8e897fed4..ebb1aeb436 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1724,8 +1724,8 @@ function createNewTask ($subject, $notes, $taskType, $userid = NULL, $adminId = // Insert the task data into the database SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_task_system` (`assigned_admin`,`userid`,`status`,`task_type`,`subject`,`text`,`task_created`) VALUES (%s,%s,'NEW','%s','%s','%s', UNIX_TIMESTAMP())", array( - makeZeroToNull($adminId), - makeZeroToNull($userid), + convertZeroToNull($adminId), + convertZeroToNull($userid), $taskType, $subject, $notes diff --git a/inc/referral-functions.php b/inc/referral-functions.php index 7cc8b6468d..02a4fea202 100644 --- a/inc/referral-functions.php +++ b/inc/referral-functions.php @@ -91,7 +91,7 @@ function getReferralLevelPercents ($level) { * refid = inc/modules/guest/what-confirm.php need this */ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NULL) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'subject=' . $subject . ',userid=' . $userid . ',points=' . $points . ',refid=' . makeNullToZero($refid) . ' - ENTERED!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'subject=' . $subject . ',userid=' . $userid . ',points=' . $points . ',refid=' . convertNullToZero($refid) . ' - ENTERED!'); // By default nothing has been added $added = false; @@ -119,7 +119,7 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU // Get percents $per = getReferralLevelPercents($GLOBALS['ref_level']); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',points=' . $points . ',depth=' . makeNullToZero($GLOBALS['ref_level']) . ',per=' . $per . ',mode=' . $paymentMethod . ',pointsColumn=' . $pointsColumn . ',locked=' . intval($locked) . ',refid=' . getUserData('refid')); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',points=' . $points . ',depth=' . convertNullToZero($GLOBALS['ref_level']) . ',per=' . $per . ',mode=' . $paymentMethod . ',pointsColumn=' . $pointsColumn . ',locked=' . intval($locked) . ',refid=' . getUserData('refid')); // Some percents found? if ($per > 0) { @@ -127,11 +127,11 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU $ref_points = $points * $per / 100; // Pay refback here if level > 0 and in ref-mode - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . makeNullToZero(getUserData('refid')) . ',points=' . $points . ',paymentMethod=' . $paymentMethod); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . convertNullToZero(getUserData('refid')) . ',points=' . $points . ',paymentMethod=' . $paymentMethod); if (($userid != $refid) && ($paymentMethod == 'REFERRAL') && (isValidUserId(getUserData('refid'))) && (isExtensionActive('refback'))) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . makeNullToZero(getUserData('refid')) . ',ref_points=' . $ref_points . ',depth=' . makeNullToZero($GLOBALS['ref_level']) . ' - BEFORE!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . convertNullToZero(getUserData('refid')) . ',ref_points=' . $ref_points . ',depth=' . convertNullToZero($GLOBALS['ref_level']) . ' - BEFORE!'); $ref_points = addRefbackPoints($userid, getUserData('refid'), $points, $ref_points); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . makeNullToZero(getUserData('refid')) . ',ref_points=' . $ref_points . ',depth=' . makeNullToZero($GLOBALS['ref_level']) . ' - AFTER!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . convertNullToZero(getUserData('refid')) . ',ref_points=' . $ref_points . ',depth=' . convertNullToZero($GLOBALS['ref_level']) . ' - AFTER!'); } // END - if // Update points... @@ -155,7 +155,7 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU bigintval($GLOBALS['ref_level']) ), __FUNCTION__, __LINE__); } - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'pointsColumn='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.makeNullToZero($GLOBALS['ref_level']).',mode='.$paymentMethod.' - UPDATE! ('.SQL_AFFECTEDROWS().')'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'pointsColumn='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.convertNullToZero($GLOBALS['ref_level']).',mode='.$paymentMethod.' - UPDATE! ('.SQL_AFFECTEDROWS().')'); // No entry updated? if (SQL_HASZEROAFFECTED()) { @@ -164,10 +164,10 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU array( $pointsColumn, bigintval($userid), - makeZeroToNull($GLOBALS['ref_level']), + convertZeroToNull($GLOBALS['ref_level']), $ref_points ), __FUNCTION__, __LINE__); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'data='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.makeNullToZero($GLOBALS['ref_level']).',mode='.$paymentMethod.' - INSERTED! ('.SQL_AFFECTEDROWS().')'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'data='.$pointsColumn.',ref_points='.$ref_points.',userid='.$userid.',depth='.convertNullToZero($GLOBALS['ref_level']).',mode='.$paymentMethod.' - INSERTED! ('.SQL_AFFECTEDROWS().')'); } // END - if // Check affected rows @@ -233,23 +233,23 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU if ($paymentMethod == 'REFERRAL') { // Increase it $GLOBALS['ref_level']++; - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Referral level increased, ref_level=' . makeNullToZero($GLOBALS['ref_level']) . ',points=' . $points . ',refid=' . makeNullToZero(getUserData('refid')) . ',userid=' . $userid . ',paymentMethod=' . $paymentMethod); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Referral level increased, ref_level=' . convertNullToZero($GLOBALS['ref_level']) . ',points=' . $points . ',refid=' . convertNullToZero(getUserData('refid')) . ',userid=' . $userid . ',paymentMethod=' . $paymentMethod); } elseif (isDebugModeEnabled()) { // Not increasing referral level, DIRECT payment method - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Referral level *NOT* increased, ref_level=' . makeNullToZero($GLOBALS['ref_level']) . ',points=' . $points . ',refid=' . makeNullToZero(getUserData('refid')) . ',userid=' . $userid . ',paymentMethod=' . $paymentMethod); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Referral level *NOT* increased, ref_level=' . convertNullToZero($GLOBALS['ref_level']) . ',points=' . $points . ',refid=' . convertNullToZero(getUserData('refid')) . ',userid=' . $userid . ',paymentMethod=' . $paymentMethod); } // Maybe there's another ref? - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'points=' . $points . ',refid(var|data)=' . makeNullToZero($refid) . '|' . makeNullToZero(getUserData('refid')) . ',userid=' . $userid . ',paymentMethod=' . $paymentMethod); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'points=' . $points . ',refid(var|data)=' . convertNullToZero($refid) . '|' . convertNullToZero(getUserData('refid')) . ',userid=' . $userid . ',paymentMethod=' . $paymentMethod); if ((isValidUserId(getUserData('refid'))) && ($points > 0) && (getUserData('refid') != $userid) && ($paymentMethod == 'REFERRAL')) { // Then let's credit him here... - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . makeNullToZero(getUserData('refid')) . ',points=' . $points . ',ref_points=' . $ref_points . ',added[' . gettype($added) . ']=' . intval($added) . ' - ADVANCE!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . convertNullToZero(getUserData('refid')) . ',points=' . $points . ',ref_points=' . $ref_points . ',added[' . gettype($added) . ']=' . intval($added) . ' - ADVANCE!'); $added = ($added && addPointsThroughReferralSystem(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), getUserData('refid'), $points, getFetchedUserData('userid', getUserData('refid'), 'refid'))); } // END - if } // END - if } // END - if - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'subject=' . $subject . ',userid=' . $userid . ',points=' . $points . ',sendNotify=' . intval($sendNotify) . ',refid=' . makeNullToZero($refid) . ',paymentMethod=' . $paymentMethod . ' - EXIT!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'subject=' . $subject . ',userid=' . $userid . ',points=' . $points . ',sendNotify=' . intval($sendNotify) . ',refid=' . convertNullToZero($refid) . ',paymentMethod=' . $paymentMethod . ' - EXIT!'); return $added; } @@ -263,7 +263,7 @@ function updateReferralCounter ($userid) { if (fetchUserData($userid)) { // Get it $ref = getUserData('refid'); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . makeZeroToNull($ref) . ' - FETCHED!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . convertZeroToNull($ref) . ' - FETCHED!'); } // END - if // Init entries @@ -274,7 +274,7 @@ function updateReferralCounter ($userid) { $GLOBALS['cache_array']['ref_level'][$ref] = NULL; } // END - if - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . makeZeroToNull($ref)); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . convertZeroToNull($ref)); // When he has a referral... if (($ref > 0) && ($ref != $userid)) { @@ -296,7 +296,7 @@ function updateReferralCounter ($userid) { SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_refsystem` (`userid`,`level`,`counter`) VALUES (%s,%s,1)", array( bigintval($ref), - makeZeroToNull($GLOBALS['cache_array']['ref_level'][$ref]) + convertZeroToNull($GLOBALS['cache_array']['ref_level'][$ref]) ), __FUNCTION__, __LINE__); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ref=' . $ref . ',level=' . $GLOBALS['cache_array']['ref_level'][$ref] . ',SQL_AFFECTEDROWS()=' . SQL_AFFECTEDROWS()); } // END - if @@ -305,14 +305,14 @@ function updateReferralCounter ($userid) { updateReferralCounter($ref); } elseif ((($ref == $userid) || ($ref == '0')) && (isExtensionInstalledAndNewer('cache', '0.1.2'))) { // Remove cache here - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ref=' . makeZeroToNull($ref) . ' - CACHE!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ref=' . convertZeroToNull($ref) . ' - CACHE!'); rebuildCache('refsystem', 'refsystem'); } // Update the referral table updateReferralTable($userid); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . makeZeroToNull($ref) . ',level=' . makeZeroToNull($GLOBALS['cache_array']['ref_level'][$ref]) . ' - EXIT!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . convertZeroToNull($ref) . ',level=' . convertZeroToNull($GLOBALS['cache_array']['ref_level'][$ref]) . ' - EXIT!'); } // Subtract points from database and mediadata cache @@ -584,15 +584,15 @@ function addMissingReferralLevels ($userid) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . $refid); // Does the refid have an array? if (isset($GLOBALS['referral_refid'][$refid])) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . makeNullToZero($refid) . ',count()=' . count($GLOBALS['referral_refid'][$refid])); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . convertNullToZero($refid) . ',count()=' . count($GLOBALS['referral_refid'][$refid])); // Okay, then walk through here, too foreach ($GLOBALS['referral_refid'][$refid] as $refLevel => $refArray) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . makeNullToZero($refid) . ',refLevel=' . $refLevel . ',count()=' . count($refArray)); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . convertNullToZero($refid) . ',refLevel=' . $refLevel . ',count()=' . count($refArray)); // Also walk through this one foreach ($refArray as $refRefid) { // Calculate new level $newLevel = $level + $refLevel; - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . makeNullToZero($refid) . ',refLevel=' . $refLevel . ',refRefid=' . $refRefid . ',newLevel=' . $newLevel); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . convertNullToZero($refid) . ',refLevel=' . $refLevel . ',refRefid=' . $refRefid . ',newLevel=' . $newLevel); // Is the refRefid not in? if ((!isset($GLOBALS['referral_refid'][$userid][$newLevel])) || (!in_array($refRefid, $GLOBALS['referral_refid'][$userid][$newLevel]))) { // Then we must add this ref's refid to the userid's next level diff --git a/ref.php b/ref.php index e2a7c62a30..f3308e2ee0 100644 --- a/ref.php +++ b/ref.php @@ -58,7 +58,7 @@ $url = 'modules.php?module=index'; if ((isExtensionActive('user')) && (isReferralIdValid()) && (isValidUserId(determineReferralId()))) { // Update ref counter SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`=%s LIMIT 1", - array(makeZeroToNull(determineReferralId())), __FILE__, __LINE__); + array(convertZeroToNull(determineReferralId())), __FILE__, __LINE__); // Base URL for redirection switch (getConfig('refid_target')) { diff --git a/templates/de/html/admin/admin_add_config_network_type.tpl b/templates/de/html/admin/admin_add_config_network_type.tpl new file mode 100644 index 0000000000..7d37fd0bf2 --- /dev/null +++ b/templates/de/html/admin/admin_add_config_network_type.tpl @@ -0,0 +1,18 @@ +
+
+
+
+ {%message,ADMIN_ADD_CONFIG_NETWORK_TYPE_TITLE=$content[network_type_handle]%} +
+
+ {--ADMIN_ADD_CONFIG_NETWORK_TYPE_404_NOTE--} +
+ + +
diff --git a/templates/de/html/admin/admin_delete_surfbar_urls_row.tpl b/templates/de/html/admin/admin_delete_surfbar_urls_row.tpl index c9d7a77bec..0870d60415 100644 --- a/templates/de/html/admin/admin_delete_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_delete_surfbar_urls_row.tpl @@ -1,7 +1,7 @@ - + $content[url_userid] diff --git a/templates/de/html/admin/admin_edit_surfbar_urls_row.tpl b/templates/de/html/admin/admin_edit_surfbar_urls_row.tpl index 5d1aa450fd..4baff476c7 100644 --- a/templates/de/html/admin/admin_edit_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_edit_surfbar_urls_row.tpl @@ -1,7 +1,7 @@ - + $content[url_userid] diff --git a/templates/de/html/admin/admin_lock_surfbar_urls_row.tpl b/templates/de/html/admin/admin_lock_surfbar_urls_row.tpl index 969e5f5a15..ae2715360f 100644 --- a/templates/de/html/admin/admin_lock_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_lock_surfbar_urls_row.tpl @@ -1,7 +1,7 @@ - + $content[url_userid] diff --git a/templates/de/html/admin/admin_undelete_surfbar_urls_row.tpl b/templates/de/html/admin/admin_undelete_surfbar_urls_row.tpl index 53c040eea1..ac100f028d 100644 --- a/templates/de/html/admin/admin_undelete_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_undelete_surfbar_urls_row.tpl @@ -1,7 +1,7 @@ - + $content[url_userid] diff --git a/templates/de/html/guest/guest_register_refid_hide.tpl b/templates/de/html/guest/guest_register_refid_hide.tpl index f1ab9d6c5d..f3d267cb5a 100644 --- a/templates/de/html/guest/guest_register_refid_hide.tpl +++ b/templates/de/html/guest/guest_register_refid_hide.tpl @@ -4,6 +4,6 @@ {%pipe,determineReferralId%} - + diff --git a/templates/de/html/member/member_points_row.tpl b/templates/de/html/member/member_points_row.tpl index a433e7b5ee..85850d7f01 100644 --- a/templates/de/html/member/member_points_row.tpl +++ b/templates/de/html/member/member_points_row.tpl @@ -1,5 +1,5 @@ - {%pipe,makeNullToZero=$content[level]%}. {--REFERRAL_LEVEL--} ({%pipe,translateComma=$content[percents]%}%) + {%pipe,convertNullToZero=$content[level]%}. {--REFERRAL_LEVEL--} ({%pipe,translateComma=$content[percents]%}%) {%pipe,translateComma=$content[points]%} {?POINTS?} {%pipe,translateComma=$content[order_points]%} {?POINTS?} {%pipe,translateComma=$content[counter]%} diff --git a/templates/de/html/member/member_reflink.tpl b/templates/de/html/member/member_reflink.tpl index 2749ca7a6e..cf9926c9a7 100644 --- a/templates/de/html/member/member_reflink.tpl +++ b/templates/de/html/member/member_reflink.tpl @@ -23,7 +23,7 @@ $content[nickname_content]
  • {--MEMBER_YOUR_REFID_IS--}:
    - {%user,refid,makeNullToZero%} ({%user,nickname,fixEmptyContentToDashes=refid%}) + {%user,refid,convertNullToZero%} ({%user,nickname,fixEmptyContentToDashes=refid%})
  • -- 2.39.5