From ad85ea5a3690e65e3509d4e4e8c63083b2b71b0c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Jul 2010 22:48:37 +0000 Subject: [PATCH] Naming convention, more usage of EL, new wrapper function introduced: - Naming convention applied on further more language strings - New wrapper function isDirectPaymentAllowed() added - More usage of EL to shorten PHP scripts - Parameter $locked in function addPointsToRefSystem() optimized out - TODOs.txt updated --- DOCS/TODOs.txt | 18 ++++----- birthday_confirm.php | 10 ++--- inc/autopurge/purge-inact.php | 2 +- inc/language/autopurge_de.php | 9 ++--- inc/language/birthday_de.php | 12 +++--- inc/libs/autopurge_functions.php | 2 +- inc/libs/beg_functions.php | 6 +-- inc/modules/admin/what-config_points.php | 6 +-- inc/modules/admin/what-del_email.php | 2 +- inc/modules/guest/what-confirm.php | 11 +----- inc/mysql-manager.php | 38 ++++++++++--------- inc/reset/reset_birthday.php | 2 +- inc/wrapper-functions.php | 14 ++++++- mailid_top.php | 6 +-- .../de/html/admin/admin_config_birthday.tpl | 6 +-- .../de/html/admin/admin_list_autopurge.tpl | 2 +- 16 files changed, 71 insertions(+), 75 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index e2b1105de8..8a69638369 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -2,7 +2,7 @@ ### DO NOT EDIT THIS FILE. ### ./autoreg.php:60:// @TODO Add processing of request here ./beg.php:165: // @TODO Opps, what is missing here??? -./birthday_confirm.php:99: // @TODO Try to rewrite the following unset() +./birthday_confirm.php:95: // @TODO Try to rewrite the following unset() ./inc/autopurge/purge-inact.php:57: // @TODO Rewrite these if() blocks to a filter ./inc/cache/config-local.php:126:// @TODO Rewrite the following three constants, somehow... ./inc/classes/cachesystem.class.php:474: // @TODO Add support for more types which break in last else-block @@ -59,7 +59,7 @@ ./inc/language/refback_de.php:46:// @TODO Rewrite these constants to one ./inc/language/sponsor_de.php:119:// @TODO Rewrite these four constants to one and use sprintf() ./inc/libs/admins_functions.php:432: // @TODO This can be, somehow, rewritten -./inc/libs/beg_functions.php:58: // @TODO Try to rewrite the following unset() +./inc/libs/beg_functions.php:54: // @TODO Try to rewrite the following unset() ./inc/libs/bonus_functions.php:204: // @TODO Move this HTML to a template ./inc/libs/bonus_functions.php:288: // @TODO This query isn't right, it will only update if the user was for a longer time away! ./inc/libs/doubler_functions.php:46:// @TODO Lame description @@ -145,7 +145,7 @@ ./inc/modules/admin/what-usage.php:88: // @TODO This code is double, see loadTemplate() and loadEmailTemplate() in functions.php ./inc/modules/admin/what-usr_online.php:51: // @TODO Add a filter for sponsor ./inc/modules/guest/what-beg.php:53:// @TODO No more needed? define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_userid_timeout'))); -./inc/modules/guest/what-confirm.php:120: // @TODO Try to rewrite the following unset() +./inc/modules/guest/what-confirm.php:111: // @TODO Try to rewrite the following unset() ./inc/modules/guest/what-login.php:114: // @TODO Move this HTML code into a template ./inc/modules/guest/what-mediadata.php:183:// @TODO Rewrite all these if-blocks to filters ./inc/modules/guest/what-mediadata.php:70: // @TODO Find a better formular than this one @@ -172,11 +172,11 @@ ./inc/modules/member/what-unconfirmed.php:143: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() ./inc/modules/order.php:76: // @TODO Unused: 2,4 ./inc/monthly/monthly_bonus.php:69: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1164: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1411: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() -./inc/mysql-manager.php:1509: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1876: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1920:// @TODO Fix inconsistency between last_module and getWhat() +./inc/mysql-manager.php:1168: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1415: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() +./inc/mysql-manager.php:1513: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1880: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1924:// @TODO Fix inconsistency between last_module and getWhat() ./inc/mysql-manager.php:370: // @TODO Try to rewrite this to one or more functions ./inc/mysql-manager.php:46:// @TODO Can we cache this? ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye @@ -198,7 +198,7 @@ ./mailid_top.php:179: // @TODO Rewrite this to a filter ./mailid_top.php:186: // @TODO Rewrite this to a filter ./mailid_top.php:221: // @TODO Rewrite these blocks to filter -./mailid_top.php:256: // @TODO Try to rewrite the following unset() +./mailid_top.php:254: // @TODO Try to rewrite the following unset() ./mailid_top.php:99: // @TODO Rewrite this to a filter ./show_bonus.php:107: // @TODO No more needed? $content['points'] = translateComma($content['points']); ./view.php:70: // @TODO No banner found, output some default banner diff --git a/birthday_confirm.php b/birthday_confirm.php index 91d5f911c3..818001a631 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -91,14 +91,10 @@ if (SQL_NUMROWS($result) == 1) { // Is the account confirmed? if ($data['status'] == 'CONFIRMED') { - // Set mode depending on how many mails the member has to confirm - $locked = false; - if (($data['ref_payout'] > 0) && (getConfig('allow_direct_pay') != 'Y')) $locked = true; - // Add points to account // @TODO Try to rewrite the following unset() unset($GLOBALS['ref_level']); - addPointsThroughReferalSystem('birthday_confirm', $userid, $data['points'], false, 0, $locked, strtolower(getConfig('birthday_mode'))); + addPointsThroughReferalSystem('birthday_confirm', $userid, $data['points'], false, 0, strtolower(getConfig('birthday_mode'))); // Remove entry from table SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_birthday` WHERE `userid`=%s AND `chk_value`='%s' LIMIT 1", @@ -108,11 +104,11 @@ if (SQL_NUMROWS($result) == 1) { $content['message'] = loadTemplate('birthday_msg', true, $data); } else { // Unconfirmed / locked accounts cannot get points - $content['message'] = getMaskedMessage('BIRTHDAY_CANNOT_STATUS', translateUserStatus($data['status'])); + $content['message'] = getMaskedMessage('MEMBER_BIRTHDAY_CANNOT_STATUS', translateUserStatus($data['status'])); } } else { // Cannot load data! - $content['message'] = '{--BIRTHDAY_CANNOT_LOAD_DATA--}'; + $content['message'] = '{--MEMBER_BIRTHDAY_CANNOT_LOAD_DATA--}'; } // Free memory diff --git a/inc/autopurge/purge-inact.php b/inc/autopurge/purge-inact.php index 70eae0be2d..bca267d2e4 100644 --- a/inc/autopurge/purge-inact.php +++ b/inc/autopurge/purge-inact.php @@ -101,7 +101,7 @@ ORDER BY // Load mail template $message = loadEmailTemplate('member_autopurge_inactive', $content, bigintval($content['userid'])); - sendEmail($content['email'], '{--AUTOPURGE_MEMBER_INACTIVE_SUBJECT--}', $message); + sendEmail($content['email'], '{--MEMBER_AUTOPURGE_INACTIVE_SUBJECT--}', $message); // Update this account addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ap_notified`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1", diff --git a/inc/language/autopurge_de.php b/inc/language/autopurge_de.php index 2d27da65ac..5294aea965 100644 --- a/inc/language/autopurge_de.php +++ b/inc/language/autopurge_de.php @@ -44,9 +44,9 @@ if (!defined('__SECURITY')) { // Language definitions addMessages(array( - 'AUTOPURGE_MEMBER_SUBJECT' => "{?POINTS?}-Gutschrift bei Auto-Loeschung", - 'AUTOPURGE_MEMBER_INACTIVE_SUBJECT' => "Inaktivitaet --> Account wird bald gelöscht.", - 'AUTOPURGE_MEMBER_UNCONFIRMED_SUBJECT' => "Löschung --> EMail-Adresse nicht bestätigt.", + 'MEMBER_AUTOPURGE_SUBJECT' => "{?POINTS?}-Gutschrift bei Auto-Loeschung", + 'MEMBER_AUTOPURGE_INACTIVE_SUBJECT' => "Inaktivitaet --> Account wird bald gelöscht.", + 'MEMBER_AUTOPURGE_UNCONFIRMED_SUBJECT' => "Löschung --> EMail-Adresse nicht bestätigt.", 'ADMIN_AUTOPURGE_SUBJECT' => "[Auto-Purge:] Bestätigungslinks", 'ADMIN_AUTOPURGE_INACTIVE_SUBJECT' => "Inaktive Mitglieder benachrichtigt", 'ADMIN_AUTOPURGE_DELETE_SUBJECT' => "[Auto-Purge:] Inaktiven Mitgliedern", @@ -54,7 +54,6 @@ addMessages(array( 'ADMIN_AUTOPURGE_TASKS_SUBJECT' => "[Auto-Purge:] Zu löschen marktierte Aufgaben", 'ADMIN_AUTOPURGE_TURBO_SUBJECT' => "[Auto-Purge:] Veraltete Bonus-Eintraege", 'ADMIN_AUTOPURGE_DELETE_MAILS_SUBJECT' => "[Auto-Purge:] Mailbuchungen bereits gel. Mitglieder", - 'ADMIN_AUTOPURGE_CONFIGURATION' => "Konfiguration der automatischen Löschungen", 'ADMIN_AUTOPURGE_INACTIVE' => "Sollten inaktive Accounts erkannt und gelöscht werden?", 'ADMIN_AUTOPURGE_INACTIVE_SINCE' => "Dauer bis bestätigtes Account als inaktiv markiert wird", @@ -72,7 +71,7 @@ addMessages(array( 'ADMIN_AUTOPURGE_NOTIFY_UNCONFIRMED' => "Benachrichtigung bei unbestätigte Accounts löschen", 'ADMIN_AUTOPURGE_NOTIFY_TASKS' => "Benachrichtigung bei veraltete Aufgaben löschen", 'ADMIN_LIST_AUTOPURGE_FOOTER' => "Hier sollte ein Hinweis kommen.", - 'AUTOPURGE_NOTIFIED' => "Benachrichtigt", + 'ADMIN_AUTOPURGE_NOTIFIED' => "Benachrichtigt", 'ADMIN_AUTOPURGE_DELETE_MAILS_TITLE' => "Mails von gelöschten Mitgliedern löschen", 'ADMIN_AUTOPURGE_DELETE_MAILS' => "Sollen die Mailbuchungen von bereits gelöschten Mitgliedern gelöscht werden?", diff --git a/inc/language/birthday_de.php b/inc/language/birthday_de.php index 62f46fee6f..2652dc6dab 100644 --- a/inc/language/birthday_de.php +++ b/inc/language/birthday_de.php @@ -44,15 +44,15 @@ if (!defined('__SECURITY')) { // Language definitions addMessages(array( - 'HAPPY_BIRTHDAY_SUBJECT' => "Herzlichen Glückwunsch zum Geburtstag.", - 'ADMIN_CONFIG_BIRTHDAY_HEADER' => "Einstellungen zu Geburtstagsmails", + 'MEMBER_HAPPY_BIRTHDAY_SUBJECT' => "Herzlichen Glückwunsch zum Geburtstag.", + 'ADMIN_CONFIG_BIRTHDAY_TITLE' => "Einstellungen zu Geburtstagsmails", 'ADMIN_BIRTHDAY_POINTS' => "{?POINTS?} als "Geburtstagsgeschenk"", 'ADMIN_BIRTHDAY_POINTS_NOTE' => "Wert 0 deaktiviert die Extragutschrift.", - 'BIRTHDAY_CANNOT_STATUS' => "Kann keine {?POINTS?} gutschreiben! Status Ihres Accounts: %s", - 'BIRTHDAY_CANNOT_LOAD_DATA' => "Entweder haben Sie bereits Ihr Geburtsgeschenk erhalten oder Sie haben heute keinen Geburtstag.", + 'MEMBER_BIRTHDAY_CANNOT_STATUS' => "Kann keine {?POINTS?} gutschreiben! Status Ihres Accounts: %s", + 'MEMBER_BIRTHDAY_CANNOT_LOAD_DATA' => "Entweder haben Sie bereits Ihr Geburtsgeschenk erhalten oder Sie haben heute keinen Geburtstag.", 'ADMIN_SELECT_BIRTHDAY_MODE' => "Vergütungsmodus der {?POINTS?}", - 'BIRTHDAY_MODE_DIRECT' => "Nur direktem Mitglied gutschreiben.", - 'BIRTHDAY_MODE_REF' => "Auch dem Werber des Mitgliedes gutschreiben.", + 'ADMIN_BIRTHDAY_MODE_DIRECT' => "Nur direktem Mitglied gutschreiben.", + 'ADMIN_BIRTHDAY_MODE_REF' => "Auch dem Werber des Mitgliedes gutschreiben.", 'ADMIN_BIRTHDAY_ONLY_ACTIVE' => "Nur aktive Mitglieder erhalten die Geburtstagsgutschrift?
(Nur in Verbindung mit der Erweiterung autopurge!)
", )); diff --git a/inc/libs/autopurge_functions.php b/inc/libs/autopurge_functions.php index fe3cdd4b58..3d90fba927 100644 --- a/inc/libs/autopurge_functions.php +++ b/inc/libs/autopurge_functions.php @@ -49,7 +49,7 @@ function addPointsAutoPurge ($userid, $points) { // Send out mail to user $message = loadEmailTemplate('member_autopurge_points', array('points' => $points), $userid); - sendEmail($userid, '{--AUTOPURGE_MEMBER_SUBJECT--}', $message); + sendEmail($userid, '{--MEMBER_AUTOPURGE_SUBJECT--}', $message); } // Checks wether auto-purging is active diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index 4a22933c8f..cc648742f0 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -50,14 +50,10 @@ function addPointsBeg ($userid, $points) { SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1", array($points, $userid), __FUNCTION__, __LINE__); } else { - // Set mode depending on how many mails the member has to confirm - $locked = false; - if ((getConfig('ref_payout') > 0) && (getConfig('allow_direct_pay') != 'Y')) $locked = true; - // Add points to account // @TODO Try to rewrite the following unset() unset($GLOBALS['ref_level']); - addPointsThroughReferalSystem('beg', $userid, $points, false, 0, $locked, strtolower(getConfig('beg_mode'))); + addPointsThroughReferalSystem('beg', $userid, $points, false, 0, strtolower(getConfig('beg_mode'))); } // Subtract begged points from member account if the admin has selected one diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index 8f6056b541..365be6cc8f 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -165,7 +165,7 @@ WHERE if (!empty($message)) { // When do so... loadTemplate('admin_settings_saved', false, $message); - } + } // END - if } elseif (getRequestParameter('sub') == 'settings') { // Setup some settings like direct pay and so on // Including new add-mode for one-time referal bonus @@ -178,13 +178,13 @@ WHERE // One-time referal bonus add-mode foreach (array('reg_points_mode_ref','reg_points_mode_direct') as $entry) { $content[$entry] = ''; - } // END - if + } // END - foreach $content['reg_points_mode_' . strtolower(getConfig('reg_points_mode'))] = ' checked="checked"'; // Load template loadTemplate('admin_config_point_settings', false, $content); } elseif (getRequestParameter('sub') == 'ref') { - // 12 3 32 2 3 32 2 3 4 43 21 + // 12 3 32 2 3 32 2 3321 if ((isFormSent('del')) && (isPostRequestParameterSet('sel')) && (ifPostContainsSelections())) { // Delete entries $OUT = ''; diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php index 0e98689ede..819770ab74 100644 --- a/inc/modules/admin/what-del_email.php +++ b/inc/modules/admin/what-del_email.php @@ -110,7 +110,7 @@ LIMIT 1", // Pay back points //* DEBUG: */ debugOutput('PAYBACK:'.$sender); - addPointsThroughReferalSystem('mail_deleted', $sender, $totalPoints, true, 0, false,'direct'); + addPointsDirectly('mail_deleted', $sender, $totalPoints); // Output message if (getConfig('repay_deleted_mails') == 'REPAY') { diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php index 569f4d4e0a..ad16f5ea30 100644 --- a/inc/modules/guest/what-confirm.php +++ b/inc/modules/guest/what-confirm.php @@ -97,15 +97,6 @@ LIMIT 1", // Update ref counter... updateReferalCounter($refid); - // Shall I 'pay' the referal points imidiately? - if (getConfig('ref_payout') == '0') { - // Yes, 'pay' it now - $locked = false; - } else { - // No, 'pay' it later - $locked = true; - } - // If version matches add ref bonus to refid's account if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) { // Add points (directly only!) @@ -119,7 +110,7 @@ LIMIT 1", // Add one-time referal bonus over referal system or directly // @TODO Try to rewrite the following unset() unset($GLOBALS['ref_level']); - addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), true, bigintval($userid), $locked, getConfig('reg_points_mode')); + addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), true, bigintval($userid), getConfig('reg_points_mode')); } // END - if } // END - if diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 51e24c8ede..43de04889b 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -994,7 +994,7 @@ function getReferalLevelPercents ($level) { * add_mode = Add points only to $userid or also refs? (WARNING! Changing 'ref' to 'direct' * for default value will cause no referal will get points ever!!!) */ -function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $refid = '0', $locked = false, $add_mode = 'ref') { +function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $refid = '0', $add_mode = 'ref') { //* DEBUG: */ debugOutput('----------------------- ' . __FUNCTION__ . ' - ENTRY ------------------------