From: Roland Häder Date: Thu, 14 Jul 2011 18:40:50 +0000 (+0000) Subject: Referal id will now always be stored, if valid can be found in GLOBALS array X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f917eea82cde98fc804916f3e6640f3134e81d29;p=mailer.git Referal id will now always be stored, if valid can be found in GLOBALS array --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 3095100005..9d532c7521 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -10,7 +10,7 @@ ./inc/expression-functions.php:164:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again ./inc/expression-functions.php:46: // @TODO is escapeQuotes() enougth for strings with single/double quotes? ./inc/extensions/ext-html_mail.php:136: // @TODO Move these arrays into config -./inc/extensions/ext-menu.php:52: // @TODO Convert menu-Id to one coding-standard. admin(edit|_add) => admin_menu_(edit|add), mem(edit|_add) => mem_menu_(edit|add) +./inc/extensions/ext-menu.php:52: // @TODO Convert menu-Id to one coding-standard. admin(edit|_add) => admin_menu_(edit|add), mem(edit|_add) => (edit|add)_(admin|guest|member)_menu ./inc/extensions/ext-network.php:18: * @TODO AbisZED: Which charset? * ./inc/extensions/ext-network.php:19: * @TODO Ad-Magnet: Layer(klick?). Layerviews.Skybannerklick/-view, * ./inc/extensions/ext-network.php:20: * @TODO Ad-Magnet: Banner-View, Textlink-Klick/-View. Page-Peel * @@ -49,9 +49,9 @@ ./inc/functions.php:1310: // @TODO Are these convertions still required? ./inc/functions.php:1330:// @TODO Rewrite this function to use readFromFile() and writeToFile() ./inc/functions.php:156:// @TODO Rewrite this to an extension 'smtp' -./inc/functions.php:1921: // @TODO Find a way to cache this -./inc/functions.php:2022: // @TODO This is still very static, rewrite it somehow -./inc/functions.php:2214: // @TODO Rename column data_type to e.g. mail_status +./inc/functions.php:1939: // @TODO Find a way to cache this +./inc/functions.php:2040: // @TODO This is still very static, rewrite it somehow +./inc/functions.php:2232: // @TODO Rename column data_type to e.g. mail_status ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter ./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0); ./inc/language/de.php:1065: // @TODO Rewrite these two constants @@ -82,8 +82,8 @@ ./inc/libs/task_functions.php:51:// @TODO Move all extension-dependent queries into filters ./inc/libs/theme_functions.php:93: // @TODO Can't this be rewritten to an API function? ./inc/libs/user_functions.php:221:// @TODO Double-check configuration entry here -./inc/libs/user_functions.php:315: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content); -./inc/libs/user_functions.php:344: // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON)); +./inc/libs/user_functions.php:312: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content); +./inc/libs/user_functions.php:341: // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON)); ./inc/libs/yoomedia_functions.php:114: $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script ./inc/load_config.php:75: // @TODO Rewrite them to avoid this else block ./inc/loader/load-extension.php:13: * @TODO Rewrite this whole file * @@ -178,17 +178,17 @@ ./inc/mysql-manager.php:44:// @TODO Can we cache this? ./inc/purge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter ./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array' -./inc/template-functions.php:1081: // @TODO Deprecate this thing -./inc/template-functions.php:1092: // @TODO Deprecate this thing -./inc/template-functions.php:1182: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/template-functions.php:1215: // @TODO Add a little more infos here -./inc/template-functions.php:1529:// @TODO Lame description for this function -./inc/template-functions.php:1551: // @TODO Move this in a filter +./inc/template-functions.php:1084: // @TODO Deprecate this thing +./inc/template-functions.php:1095: // @TODO Deprecate this thing +./inc/template-functions.php:1185: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/template-functions.php:1218: // @TODO Add a little more infos here +./inc/template-functions.php:1532:// @TODO Lame description for this function +./inc/template-functions.php:1554: // @TODO Move this in a filter ./inc/template-functions.php:189: * @TODO On some pages this is buggy -./inc/template-functions.php:275: // @TODO Remove this sanity-check if all is fine -./inc/template-functions.php:438: // @TODO $DATA is deprecated and should be avoided and replaced with $content -./inc/template-functions.php:604:// @TODO $simple/$constants are deprecated -./inc/template-functions.php:630: // @TODO Do only use $content and deprecate $DATA in templates +./inc/template-functions.php:278: // @TODO Remove this sanity-check if all is fine +./inc/template-functions.php:441: // @TODO $DATA is deprecated and should be avoided and replaced with $content +./inc/template-functions.php:607:// @TODO $simple/$constants are deprecated +./inc/template-functions.php:633: // @TODO Do only use $content and deprecate $DATA in templates ./inc/wrapper-functions.php:130:// @TODO Implement $compress ./inc/wrapper-functions.php:137:// @TODO Implement $decompress ./inc/wrapper-functions.php:514:// @TODO Do some more sanity check here diff --git a/inc/extensions/ext-menu.php b/inc/extensions/ext-menu.php index 67991a4b55..6a41e4472f 100644 --- a/inc/extensions/ext-menu.php +++ b/inc/extensions/ext-menu.php @@ -49,7 +49,7 @@ setExtensionVersionHistory(array('0.0.0','0.0.1','0.0.2','0.0.3', '0.0.4')); switch (getExtensionMode()) { case 'register': // Do stuff when installation is running // SQL commands to run - // @TODO Convert menu-Id to one coding-standard. admin(edit|_add) => admin_menu_(edit|add), mem(edit|_add) => mem_menu_(edit|add) + // @TODO Convert menu-Id to one coding-standard. admin(edit|_add) => admin_menu_(edit|add), mem(edit|_add) => (edit|add)_(admin|guest|member)_menu addAdminMenuSql('menu',NULL,'Menü-System','Alle drei Menü-System bearbeiten (Admin-, Mitglied- und Gast-Menü)',1); addAdminMenuSql('menu','admin_add','Admin-Menü hinzufügen','Weiteren Menüpunkt zum Admin-Bereich hinzufügen',1); addAdminMenuSql('menu','adminedit','Admin-Menü editieren','Das Administrationsmenü mit neuen Menüs erweitern, bestehende ändern oder löschen. Vorsicht! Löschen Sie nicht das Login-Menü!',2); diff --git a/inc/functions.php b/inc/functions.php index 7c6659502f..2dddd0d30f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1654,30 +1654,39 @@ function determineReferalId () { // Check if refid is set if (isReferalIdValid()) { // This is fine... + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from GLOBALS (' . getReferalId() . ')'); } elseif (isPostRequestParameterSet('refid')) { // Get referal id from POST element refid + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from POST data (' . postRequestParameter('refid') . ')'); setReferalId(secureString(postRequestParameter('refid'))); } elseif (isGetRequestParameterSet('refid')) { // Get referal id from GET parameter refid + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from GET data (' . getRequestParameter('refid') . ')'); setReferalId(secureString(getRequestParameter('refid'))); } elseif (isGetRequestParameterSet('ref')) { // Set refid=ref (the referal link uses such variable) + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using ref from GET data (' . getRequestParameter('refid') . ')'); setReferalId(secureString(getRequestParameter('ref'))); } elseif ((isGetRequestParameterSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) { // The variable user comes from click.php + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using user from GET data (' . getRequestParameter('user') . ')'); setReferalId(bigintval(getRequestParameter('user'))); } elseif ((isSessionVariableSet('refid')) && (isValidUserId(getSession('refid')))) { - // Set session refid als global + // Set session refid as global + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from SESSION data (' . getSession('refid') . ')'); setReferalId(bigintval(getSession('refid'))); } elseif (isRandomReferalIdEnabled()) { // Select a random user which has confirmed enougth mails + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Checking random referal id'); setReferalId(determineRandomReferalId()); } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getDefRefid()))) { // Set default refid as refid in URL + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using default refid (' . getDefRefid() . ')'); setReferalId(getDefRefid()); } else { // No default id when sql_patches is not installed or none set - setReferalId(null); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using NULL as refid'); + setReferalId(NULL); } // Set cookie when default refid > 0 @@ -1693,24 +1702,33 @@ function determineReferalId () { // If we found it, use the userid as referal id if ($found === true) { // Set the userid as 'refid' + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from user account by nickname (' . getUserData('userid') . ')'); setReferalId(getUserData('userid')); } // END - if } elseif (isValidUserId(getReferalId())) { // Direct userid entered + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using direct userid (' . getReferalId() . ')'); $found = fetchUserData(getReferalId()); } // Is the record valid? if ((($found === false) || (!isUserDataValid())) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2'))) { // No, then reset referal id + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using default refid (' . getDefRefid() . ')'); setReferalId(getDefRefid()); } // END - if // Set cookie + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Saving refid to session (' . getReferalId() . ') #1'); setSession('refid', getReferalId()); } elseif (!isReferalIdValid()) { // Not valid! - setSession('refid', 0); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not valid referal id (' . getReferalId() . '), setting NULL in session'); + setSession('refid', NULL); + } elseif ((!isSessionVariableSet('refid')) && (isValidUserId(getReferalId()))) { + // Set it from GLOBALS array in session + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Saving refid to session (' . getReferalId() . ') #2'); + setSession('refid', getReferalId()); } // Return determined refid diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index 87ce569f5b..cc3e181578 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -356,6 +356,12 @@ function doRegistration () { return; } // END - if + // Shall we reset random refid? Only possible with latest ext-user + if (isExtensionInstalledAndNewer('user', '0.3.4')) { + // Reset all accounts, registration is done + SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0', __FUNCTION__, __LINE__); + } // END - if + // Update referal table updateReferalCounter($userid); diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 64a95f39ef..7ae54fa9dd 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -241,9 +241,6 @@ function determineRandomReferalId () { if (SQL_NUMROWS($result) == 1) { // Use that userid as new referal id list($refid) = SQL_FETCHROW($result); - - // Reset all users, this makes this random referal id more challenging - SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0', __FUNCTION__, __LINE__); } // END - if // Free result diff --git a/templates/de/html/admin/admin_list_user_row.tpl b/templates/de/html/admin/admin_list_user_row.tpl index cddfa98097..f9cf654386 100644 --- a/templates/de/html/admin/admin_list_user_row.tpl +++ b/templates/de/html/admin/admin_list_user_row.tpl @@ -51,7 +51,7 @@ {%user,lock_reason,fixEmptyContentToDashes=$content[userid]%} $content[lock_timestamp] {%pipe,translateComma=$content[own_points]%} - {%user,rand_confirmed,translateComma=$content[userid]%} + {%user,rand_confirmed,translateComma=$content[userid]%}/{%config,translateComma=user_min_confirmed%} --- diff --git a/templates/de/html/admin/admin_user_details.tpl b/templates/de/html/admin/admin_user_details.tpl index 4dfd3aea8c..6433f48dfd 100644 --- a/templates/de/html/admin/admin_user_details.tpl +++ b/templates/de/html/admin/admin_user_details.tpl @@ -120,7 +120,7 @@ {--RAND_CONFIRMED--}:
- {%user,rand_confirmed,translateComma=$content[userid]%} + {%user,rand_confirmed,translateComma=$content[userid]%}/{%config,translateComma=user_min_confirmed%} {--LOCK_TIMESTAMP--}: