Old lost code removed in modules.php, naming convention applied:
authorRoland Häder <roland@mxchange.org>
Fri, 30 Jul 2010 01:23:49 +0000 (01:23 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 30 Jul 2010 01:23:49 +0000 (01:23 +0000)
- 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
inc/libs/network_functions.php
inc/mails/beg_mails.php
inc/mails/bonus_mails.php
inc/modules/admin/admin-inc.php
modules.php
templates/de/html/admin/admin_add_network.tpl
templates/de/html/admin/admin_config_beg.tpl
templates/de/html/admin/admin_del_networks_row.tpl

index 8f7b2cf85499309551522b5c7cf731e117cf9d9d..80a4b123159672b85684e7c243c4f13c81d92d14 100644 (file)
@@ -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. <div class=\"admin_note\">(0 = Unverg&uuml;tete Benachrichtigung aussenden; nur in Verbindung mit der Erweiterung <strong>bonus!</strong>)</div>",
        'ADMIN_BEG_NEW_MEMBER_NOTIFY' => "Sollen neue Mitglieder mit selber Mail &uuml;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]
index 7289d551c5af87ab07d0dfd3cdcd9cfee1d093ac..b48456411f8c9a52864a54a5ddec0b6423d490af 100644 (file)
@@ -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 {
index abd0aff85e14b3a5e3ede43020cf87d293870f4b..32dfd5ac980b0cfb8963e4eb3369a5ec7cbaa1f6 100644 (file)
@@ -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&amp;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
 
index 12bba3219e6b94d963d9d782da0ebd18851266b8..6301004fdb6c663b36679801c6a8a6a455690ed5 100644 (file)
@@ -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&amp;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
 
index 5c20771c895554e61dc23c185797c2dc215105ea..f7e868bc117a138107c0ea46758314e7d7e3cf9a 100644 (file)
@@ -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));
        }
 }
 
index 446ffe9cd360f67285f0ccf7e273599ca3ade983..f89ea6c6e345a2fdc67997911f1658dd4c35bcc8 100644 (file)
@@ -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');
 
index a73d5538045546752d57b897dbca075f6b91a1b7..5a8b602501af76855dfad77a9bb9a5b0d65a8c64 100644 (file)
@@ -40,8 +40,7 @@
                <td align="right" width="200">{--ADMIN_NETWORK_REQUEST_TYPE--}:</td>
                <td>
                        <select class="admin_select" name="network_request_type" size="1">
-                               <option value="GET">{--ADMIN_NETWORK_REQUEST_TYPE_GET--}</option>
-                               <option value="POST">{--ADMIN_NETWORK_REQUEST_TYPE_POST--}</option>
+                               {%pipe,generateNetworkRequestTypeOptions%}
                        </select>
                </td>
        </tr>
index 7e67bf56dd00e4b53b7b1a95bd1801fdcc462993..53ca7aa1bc6e97cd8f4333a9e0753b528d47be98 100644 (file)
        </tr>
        <tr>
                <td align="right" height="20">
-                       {--ADMIN_BEG_RAL_ENABLE_NOTIFY--}
+                       {--ADMIN_BEG_RALLYE_ENABLE_NOTIFY--}
                </td>
                <td align="center">
                        <input type="radio" name="beg_rallye_enable_notify" class="admin_normal" value="Y"$content[rallye_enable_notify_y] /> {--YES--}<br />
        </tr>
        <tr>
                <td align="right" height="20">
-                       {--ADMIN_BEG_RAL_DISABLE_NOTIFY--}
+                       {--ADMIN_BEG_RALLYE_DISABLE_NOTIFY--}
                </td>
                <td align="center">
                        <input type="radio" name="beg_rallye_disable_notify" class="admin_normal" value="Y"$content[rallye_disable_notify_y] /> {--YES--}<br />
index 19e4478600c7a4c11169ebb2f4d6d4a58bde3445..c7926832c33566a839d7d0138a9493beb3c5c81b 100644 (file)
@@ -22,7 +22,7 @@
 <tr>
        <td class="{%template,ColorSwitch%}" style="padding-left:5px">{--ADMIN_NETWORK_REQUEST_TYPE--}:</td>
        <td class="{%template,ColorSwitch%}">
-               $content[network_request_type]
+               {%pipe,translateNetworkRequestType=$content[network_request_type]%}
        </td>
        <td class="{%template,ColorSwitch%}" style="padding-left:5px">{--ADMIN_NETWORK_ROW_SEPERATOR--}:</td>
        <td class="{%template,ColorSwitch%}">