From 0f8b6618aeb5d92a372be12066c611c60ff86917 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 30 Jul 2010 01:23:49 +0000 Subject: [PATCH] Old lost code removed in modules.php, naming convention applied: - Old lost code to check if 'module' is set removed, it is done now in a filter - Naming convention applied: subject line identifier should end with _SUBJECT - Some code simplified --- inc/language/beg_de.php | 8 ++-- inc/libs/network_functions.php | 46 ++++++++++++------- inc/mails/beg_mails.php | 7 +-- inc/mails/bonus_mails.php | 7 +-- inc/modules/admin/admin-inc.php | 9 ++-- modules.php | 9 ---- templates/de/html/admin/admin_add_network.tpl | 3 +- templates/de/html/admin/admin_config_beg.tpl | 4 +- .../de/html/admin/admin_del_networks_row.tpl | 2 +- 9 files changed, 44 insertions(+), 51 deletions(-) diff --git a/inc/language/beg_de.php b/inc/language/beg_de.php index 8f7b2cf854..80a4b12315 100644 --- a/inc/language/beg_de.php +++ b/inc/language/beg_de.php @@ -125,8 +125,8 @@ addMessages(array( 'BEG_RALLYE_NO_ONE_JOINED' => "Niemand nimmt an der Bettel-Rallye dran teil, oder sie ist administrativ deaktiviert worden.", 'ADMIN_BEG_RALLYE_DEACTIVATED' => "Bettel-Rallye nicht aktiviert.", 'ADMIN_EDIT_BEG_RALLYE_NOTIFICATIONS' => "Benachrichtungen per Mail zur Bettel-Rallye", - 'ADMIN_BEG_RAL_ENABLE_NOTIFY' => "Benachtigen, wenn Bettel-Rallye aktiviert wurde?", - 'ADMIN_BEG_RAL_DISABLE_NOTIFY' => "Benachtigen, wenn Bettel-Rallye deaktiviert wurde?", + 'ADMIN_BEG_RALLYE_ENABLE_NOTIFY' => "Benachtigen, wenn Bettel-Rallye aktiviert wurde?", + 'ADMIN_BEG_RALLYE_DISABLE_NOTIFY' => "Benachtigen, wenn Bettel-Rallye deaktiviert wurde?", 'ADMIN_BEG_NOTIFY_BONUS' => "Bonus-Mail mit Anzahl {?POINTS?} aussenden, wenn Bettel-Rallye aktiviert wurde.
(0 = Unvergütete Benachrichtigung aussenden; nur in Verbindung mit der Erweiterung bonus!)
", 'ADMIN_BEG_NEW_MEMBER_NOTIFY' => "Sollen neue Mitglieder mit selber Mail über eine laufende Bettel-Rallye benachrichtigt werden?", 'ADMIN_BEG_NOTIFY_WAIT' => "Wie lange soll die Wartezeit der Bonus-Mail sein?", @@ -138,8 +138,8 @@ addMessages(array( 'ADMIN_TASK_LIST_BEG_TITLE' => "Es nehmen Mitglieder an der Bettel-Rallye dran teil.", // Subject lines - 'BEG_RALLYE_ENABLE_NOTIFY' => "HINWEIS: Eine Bettel-Rallye ist am Laufen.", - 'BEG_RALLYE_DISABLE_NOTIFY' => "HINWEIS: Eine Bettel-Rallye wurde gestoppt.", + 'BEG_RALLYE_ENABLE_SUBJECT' => "HINWEIS: Eine Bettel-Rallye ist am Laufen.", + 'BEG_RALLYE_DISABLE_SUBJECT' => "HINWEIS: Eine Bettel-Rallye wurde gestoppt.", )); // [EOF] diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index 7289d551c5..b48456411f 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -577,6 +577,29 @@ function generateNetworkTranslationOptions ($default = '') { return $GLOBALS['network_translation'][$default]; } +// Generates an option list of request types +function generateNetworkRequestTypeOptions ($default = '') { + // Do we have cache? + if (!isset($GLOBALS['network_request_type'][$default])) { + // Generate the list + $GLOBALS['network_request_type'][$default] = generateOptionList( + '/ARRAY/', + array( + 'GET', + 'POST' + ), + array( + '{--ADMIN_NETWORK_REQUEST_TYPE_GET--}', + '{--ADMIN_NETWORK_REQUEST_TYPE_POST--}' + ), + $default + ); + } // END - if + + // Return cache + return $GLOBALS['network_request_type'][$default]; +} + // Translates 'translate_name' for e.g. templates function translateNetworkTranslationName ($name) { // Get the message id @@ -589,6 +612,12 @@ function translateNetworkTypeHandler ($type) { return getMessage('ADMIN_NETWORK_TYPES_' . strtoupper($type) . ''); } +// Translates request type +function translateNetworkRequestType ($name) { + // Get the message id + return getMessage('ADMIN_NETWORK_REQUEST_TYPE_' . strtoupper($name) . ''); +} + //------------------------------------------------------------------------------ // Call-back functions //------------------------------------------------------------------------------ @@ -642,26 +671,9 @@ function doAdminNetworkProcessHandlenetworkForm () { // Do we have found the network? if (count($networkData) > 0) { if (isFormSent('edit')) { - // Make selection box for network_request_type - $networkData['network_request_type'] = generateOptionList( - '/ARRAY/', - array( - 'GET', - 'POST' - ), - array( - '{--ADMIN_NETWORK_REQUEST_TYPE_GET--}', - '{--ADMIN_NETWORK_REQUEST_TYPE_POST--}' - ), - $networkData['network_request_type'] - ); - // Add row template for editing $OUT .= loadTemplate('admin_edit_networks_row', true, $networkData); } elseif (isFormSent('del')) { - // Translate the request type - $networkData['network_request_type'] = '{--ADMIN_NETWORK_REQUEST_TYPE_' . $networkData['network_request_type'] . '--}'; - // Add row template for deleting $OUT .= loadTemplate('admin_del_networks_row', true, $networkData); } else { diff --git a/inc/mails/beg_mails.php b/inc/mails/beg_mails.php index abd0aff85e..32dfd5ac98 100644 --- a/inc/mails/beg_mails.php +++ b/inc/mails/beg_mails.php @@ -95,9 +95,6 @@ if (!empty($sql)) { // Normal notification mails or bonus mails? $sentBonusMails = ((getConfig('beg_notify_bonus') > 0) && ($mode == 'enable') && (isExtensionActive('bonus'))); - // Generate subject line - $subject = '{--BEG_RALLYE_' . strtoupper($mode) . '_NOTIFY--}'; - // Load message body for bonus mails $message = loadEmailTemplate('beg_enable_notify_body', '', '{PER}userid{PER}'); $receiver = ''; $userids = array(); @@ -127,7 +124,7 @@ LIMIT 1", } else { // Send normal notification mail to the members $message = loadEmailTemplate('beg_' . $mode . '_notify', $content, $content['userid']); - sendEmail($content['email'], $subject, $message); + sendEmail($content['email'], '{--BEG_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message); } } // END - while @@ -140,7 +137,7 @@ LIMIT 1", $url = 'modules.php?module=index&what=login'; // Insert mail - addBonusMailToQueue($subject, $message, $receiver, getConfig('beg_notify_bonus'), getConfig('beg_notify_wait'), $url, 0, 'normal', SQL_NUMROWS($result_main)); + addBonusMailToQueue('{--BEG_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getConfig('beg_notify_bonus'), getConfig('beg_notify_wait'), $url, 0, 'normal', SQL_NUMROWS($result_main)); } // END - if } // END - if diff --git a/inc/mails/bonus_mails.php b/inc/mails/bonus_mails.php index 12bba3219e..6301004fdb 100644 --- a/inc/mails/bonus_mails.php +++ b/inc/mails/bonus_mails.php @@ -84,9 +84,6 @@ if (!empty($sql)) { // Normal notification mails or bonus mails? $sentBonusMails = ((getConfig('bonus_notify_points') > 0) && ($mode == 'enable') && (isExtensionActive('bonus'))); - // Generate subject line - $subject = '{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}'; - // Load message body for bonus mails $message = loadEmailTemplate('bonus_enable_notify_body', '', '{PER}userid{PER}'); $receiver = ''; $userids = array(); @@ -116,7 +113,7 @@ LIMIT 1", } else { // Send normal notification mail to the members $message = loadEmailTemplate('bonus_' . $mode . '_notify', $content, $content['userid']); - sendEmail($content['email'], $subject, $message); + sendEmail($content['email'], '{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message); } } // END - while @@ -129,7 +126,7 @@ LIMIT 1", $url = 'modules.php?module=index&what=login'; // Insert mail - addBonusMailToQueue($subject, $message, $receiver, getConfig('bonus_notify_points'), getConfig('bonus_notify_wait'), $url, 0, 'normal', SQL_NUMROWS($result_main)); + addBonusMailToQueue('{--MEMBER_BONUS_RALLYE_' . strtoupper($mode) . '_SUBJECT--}', $message, $receiver, getConfig('bonus_notify_points'), getConfig('bonus_notify_wait'), $url, 0, 'normal', SQL_NUMROWS($result_main)); } // END - if } // END - if diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 5c20771c89..f7e868bc11 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -739,9 +739,6 @@ function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '', $ // Is the raw userid set? if (postRequestParameter($userid, $id) > 0) { - // Generate subject - $subject = '{--MEMBER_' . strtoupper($subject) . '_' . strtoupper($table) . '_SUBJECT--}'; - // Load email template if (!empty($subjectPart)) { $mail = loadEmailTemplate('member_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content); @@ -750,7 +747,7 @@ function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '', $ } // Send email out - sendEmail(postRequestParameter($userid, $id), $subject, $mail); + sendEmail(postRequestParameter($userid, $id), '{--MEMBER_' . strtoupper($subject) . '_' . strtoupper($table) . '_SUBJECT--}', $mail); } // END - if // Generate subject @@ -758,9 +755,9 @@ function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '', $ // Send admin notification out if (!empty($subjectPart)) { - sendAdminNotification($subject, 'admin_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content, postRequestParameter($userid, $id)); + sendAdminNotification('{--ADMIN_' . strtoupper($subject) . '_' . strtoupper($table) . '_SUBJECT--}', 'admin_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content, postRequestParameter($userid, $id)); } else { - sendAdminNotification($subject, 'admin_' . $mode . '_' . $table, $content, postRequestParameter($userid, $id)); + sendAdminNotification('{--ADMIN_' . strtoupper($subject) . '_' . strtoupper($table) . '_SUBJECT--}', 'admin_' . $mode . '_' . $table, $content, postRequestParameter($userid, $id)); } } diff --git a/modules.php b/modules.php index 446ffe9cd3..f89ea6c6e3 100644 --- a/modules.php +++ b/modules.php @@ -56,15 +56,6 @@ require('inc/config-global.php'); // Set content type setContentType('text/html'); -// Fix missing module to 'index' -if (!isGetRequestParameterSet('module')) { - // Set element - setGetRequestParameter('module', 'index'); - - // ... and module - setModule('index'); -} // END - if - // The header file loadIncludeOnce('inc/header.php'); diff --git a/templates/de/html/admin/admin_add_network.tpl b/templates/de/html/admin/admin_add_network.tpl index a73d553804..5a8b602501 100644 --- a/templates/de/html/admin/admin_add_network.tpl +++ b/templates/de/html/admin/admin_add_network.tpl @@ -40,8 +40,7 @@ {--ADMIN_NETWORK_REQUEST_TYPE--}: diff --git a/templates/de/html/admin/admin_config_beg.tpl b/templates/de/html/admin/admin_config_beg.tpl index 7e67bf56dd..53ca7aa1bc 100644 --- a/templates/de/html/admin/admin_config_beg.tpl +++ b/templates/de/html/admin/admin_config_beg.tpl @@ -125,7 +125,7 @@ - {--ADMIN_BEG_RAL_ENABLE_NOTIFY--} + {--ADMIN_BEG_RALLYE_ENABLE_NOTIFY--} {--YES--}
@@ -134,7 +134,7 @@ - {--ADMIN_BEG_RAL_DISABLE_NOTIFY--} + {--ADMIN_BEG_RALLYE_DISABLE_NOTIFY--} {--YES--}
diff --git a/templates/de/html/admin/admin_del_networks_row.tpl b/templates/de/html/admin/admin_del_networks_row.tpl index 19e4478600..c7926832c3 100644 --- a/templates/de/html/admin/admin_del_networks_row.tpl +++ b/templates/de/html/admin/admin_del_networks_row.tpl @@ -22,7 +22,7 @@ {--ADMIN_NETWORK_REQUEST_TYPE--}: - $content[network_request_type] + {%pipe,translateNetworkRequestType=$content[network_request_type]%} {--ADMIN_NETWORK_ROW_SEPERATOR--}: -- 2.39.5