Template renamed, some minor improvements
authorRoland Häder <roland@mxchange.org>
Wed, 3 Oct 2012 16:30:34 +0000 (16:30 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 3 Oct 2012 16:30:34 +0000 (16:30 +0000)
.gitattributes
inc/language/de.php
inc/mysql-manager.php
inc/template-functions.php
mailid.php
mailid_top.php
templates/de/html/app_die_message.tpl
templates/de/html/app_exit_message.tpl [new file with mode: 0644]

index ebe31109b091687b13b20d7df2bffd24e888795b..3caecbf54c89715c5a79b0257c62f742b349f06e 100644 (file)
@@ -1657,6 +1657,7 @@ templates/de/html/admin/admin_yoomedia_error.tpl svneol=native#text/plain
 templates/de/html/agb.tpl svneol=native#text/plain
 templates/de/html/ajax_test_passed.tpl svneol=native#text/plain
 templates/de/html/app_die_message.tpl svneol=native#text/plain
+templates/de/html/app_exit_message.tpl svneol=native#text/plain
 templates/de/html/beg/.htaccess svneol=native#text/plain
 templates/de/html/beg/beg_banner.tpl svneol=native#text/plain
 templates/de/html/beg/beg_done.tpl svneol=native#text/plain
index 47198036b3a42d15233f1b1e5da4505150a7711f..ac2b3118acfe852cbeb9c68d18d567fd3a25fc46 100644 (file)
@@ -947,7 +947,7 @@ addMessages(array(
        'EMAIL_DELETE_COUNT' => "Buchungseintr&auml;ge gel&ouml;scht",
        'MAILER_HAS_DIED' => "{?TITLE?} ist in Script/Funktion <span class=\"data\">%s</span>, Zeile <span class=\"data\">%s</span> mit folgender Meldung abgebrochen: <span class=\"data\">%s</span>",
        'ADMIN_CONFIG_POINTS_TITLE' => "Einstellungen f&uuml;r {?POINTS?}",
-       'APP_DIE_TITLE' => "Bug im Script erkannt.",
+       'APPLICATION_DIED_TITLE' => "Bug im Script erkannt.",
        'ADMIN_CONTACT_LINK_TITLE' => "Kontakt zum Administrator",
        'ADMIN_MAIL_NOTHING_DELETED' => "Die Mail mit der Id <span class=\"data\">%s</span> weisst keine Mitglieder auf.",
 
index d97d33d37fd9899ef59c376b858fcc3c557cdc8c..129b7c6ae1822d25b510b8ef5be4951af0bce075 100644 (file)
@@ -423,7 +423,7 @@ function isMember () {
        // Init user data array
        initUserData();
 
-       // Fix "deleted" cookies first
+       // Fix "deleted" cookies
        fixDeletedCookies(array('userid', 'u_hash'));
 
        // Are cookies set and can the member data be loaded?
@@ -1312,18 +1312,18 @@ function getAdminMenuMode ($adminId) {
 }
 
 // Generates an option list from various parameters
-function generateOptions ($table, $id, $name, $default = '', $special = '', $whereStatement = '', $disabled = array(), $callback = '') {
+function generateOptions ($table, $key, $value, $default = '', $extra = '', $whereStatement = '', $disabled = array(), $callback = '') {
        $ret = '';
        if ($table == '/ARRAY/') {
                // Selection from array
-               if ((is_array($id)) && (is_array($name)) && ((count($id)) == (count($name)) || (!empty($callback)))) {
+               if ((is_array($key)) && (is_array($value)) && ((count($key)) == (count($value)) || (!empty($callback)))) {
                        // Both are arrays
-                       foreach ($id as $idx => $value) {
-                               $ret .= '<option value="' . $value . '"';
-                               if ($default == $value) {
+                       foreach ($key as $idx => $optionValue) {
+                               $ret .= '<option value="' . $optionValue . '"';
+                               if ($default == $optionValue) {
                                        // Selected by default
                                        $ret .= ' selected="selected"';
-                               } elseif (isset($disabled[$value])) {
+                               } elseif (isset($disabled[$optionValue])) {
                                        // Disabled!
                                        $ret .= ' disabled="disabled"';
                                }
@@ -1331,65 +1331,69 @@ function generateOptions ($table, $id, $name, $default = '', $special = '', $whe
                                // Is the call-back function set?
                                if (!empty($callback)) {
                                        // Call it
-                                       $name[$idx] = call_user_func_array($callback, array($id[$idx]));
+                                       $value[$idx] = call_user_func_array($callback, array($key[$idx]));
                                } // END - if
 
                                // Finish option tag
-                               $ret .= '>' . $name[$idx] . '</option>';
+                               $ret .= '>' . $value[$idx] . '</option>';
                        } // END - foreach
                } else {
                        // Problem in request
-                       reportBug(__FUNCTION__, __LINE__, 'Not all are arrays: id[' . count($id) . ']=' . gettype($id) . ',name[' . count($name) . ']=' . gettype($name) . ',callback=' . $callback);
+                       reportBug(__FUNCTION__, __LINE__, 'Not all are arrays: key[' . count($key) . ']=' . gettype($key) . ',value[' . count($value) . ']=' . gettype($value) . ',callback=' . $callback);
                }
        } else {
-               // Data from database
-               $SPEC = ',`' . $id . '`';
-               if (!empty($special)) {
-                       $SPEC = ',`' . $special . '` AS `special`';
+           ///////////////////////
+               // Data from database /
+               ///////////////////////
+
+               // Init extra column (if requested)
+               $extraColumn = '';
+               if (!empty($extra)) {
+                       $extraColumn = ',`' . $extra . '` AS `extra`';
                } // END - if
 
-               // Query the database
-               $result = SQL_QUERY_ESC("SELECT `%s` AS `id`,`%s` AS `name`".$SPEC." FROM `{?_MYSQL_PREFIX?}_%s` ".$whereStatement." ORDER BY `%s` ASC",
+               // Run SQL query
+               $result = SQL_QUERY_ESC("SELECT `%s` AS `key`,`%s` AS `value`" . $extraColumn . " FROM `{?_MYSQL_PREFIX?}_%s` " . $whereStatement . " ORDER BY `%s` ASC",
                        array(
-                               $id,
-                               $name,
+                               $key,
+                               $value,
                                $table,
-                               $name
+                               $value
                        ), __FUNCTION__, __LINE__);
 
                // Do we have rows?
                if (!SQL_HASZERONUMS($result)) {
                        // Found data so add them as OPTION lines
                        while ($content = SQL_FETCHARRAY($result)) {
-                               // Is special set?
-                               if (!isset($content['special'])) {
+                               // Is extra set?
+                               if (!isset($content['extra'])) {
                                        // Set it to empty
-                                       $content['special'] = '';
+                                       $content['extra'] = '';
                                } // END - if
 
-                               $ret .= '<option value="' . $content['id'] . '"';
+                               $ret .= '<option value="' . $content['key'] . '"';
 
-                               if ($default == $content['id']) {
+                               if ($default == $content['key']) {
                                        // Selected by default
                                        $ret .= ' selected="selected"';
-                               } elseif (isset($disabled[$content['id']])) {
+                               } elseif (isset($disabled[$content['key']])) {
                                        // Disabled!
                                        $ret .= ' disabled="disabled"';
                                }
 
                                // Add it, if set
-                               if (!empty($content['special'])) {
-                                       $content['special'] = ' (' . $content['special'] . ')';
+                               if (!empty($content['extra'])) {
+                                       $content['extra'] = ' (' . $content['extra'] . ')';
                                } // END - if
 
                                // Is the call-back function set?
                                if (!empty($callback)) {
                                        // Call it
-                                       $content['name'] = call_user_func_array($callback, array($content['name']));
+                                       $content['value'] = call_user_func_array($callback, array($content['value']));
                                } // END - if
 
                                // Finish option list
-                               $ret .= '>' . $content['name'] . $content['special'] . '</option>';
+                               $ret .= '>' . $content['value'] . $content['extra'] . '</option>';
                        } // END - while
                } else {
                        // No data found
index 93eacf3606332f1237b817e8d3120eabe35a8e43..495cccb3458ba81f441ad5339b6ac68f6c20d8fd 100644 (file)
@@ -1197,7 +1197,7 @@ function app_exit ($F, $L, $message) {
        );
 
        // Load the message template
-       loadTemplate('app_die_message', false, $message);
+       loadTemplate('app_exit_message', false, $message);
 
        // Load footer
        loadIncludeOnce('inc/footer.php');
index 5413d03bc0db94d89b766c230375520e8916bc23..fc7e64ae70bf211417d9ffdfeb39de8d02d4036c 100644 (file)
@@ -208,7 +208,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
                                                $errorCode = getCode('POSSIBLE_INVALID');
                                        }
                                } else {
-                                       $errorCode = getCode('ACCOUNT_' . getUserData('status'));
+                                       $errorCode = getCode('ACCOUNT_' . strtoupper(getUserData('status')));
                                }
                        } else {
                                $errorCode = getCode('USER_404');
index 1d125754178a75a4dd0b32c55c6112cb4a227d51..ca8c3a57410b1e6f8d3039c303d6ee0d7b890861 100644 (file)
@@ -87,54 +87,58 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
 
        // Maybe he wants to confirm an email?
        if ($mailId > 0) {
-               $result_main = SQL_QUERY_ESC("SELECT `id`,`link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
+               $result_main = SQL_QUERY_ESC("SELECT `id` AS `link_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
                        array($mailId, $userId), __FILE__, __LINE__);
                $type = 'mailid';
                $urlId = $mailId;
        } elseif ($bonusId > 0) {
-               $result_main = SQL_QUERY_ESC("SELECT `id`,`link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
+               $result_main = SQL_QUERY_ESC("SELECT `id` AS `link_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
                        array($bonusId, $userId), __FILE__, __LINE__);
                $type = 'bonusid';
                $urlId = $bonusId;
+       } else {
+               // Not detected
+               reportBug(__FILE__, __LINE__, 'Whether bonusid or mailid was set. This is a strange bug.');
        }
 
+       // Is an entry found?
        if (SQL_NUMROWS($result_main) == 1) {
                // Is the stats id valid?
-               list($lid, $ltype) = SQL_FETCHROW($result_main);
+               $data = SQL_FETCHARRAY($result_main);
 
                // Init result here with invalid to avoid possible missing variable
                $result_mailid = false;
 
-               // @TODO Rewrite this to a filter
-               switch ($ltype) {
+               // @TODO Rewrite this to a filter/function
+               switch ($data['link_type']) {
                        case 'NORMAL':
-                               $result_mailid = SQL_QUERY_ESC("SELECT `pool_id`,`userid`,`id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `id`=%s LIMIT 1",
-                                       array($mailId), __FILE__, __LINE__);
+                               $result_mailid = SQL_QUERY_ESC("SELECT `pool_id`, `userid` AS `sender` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `id`=%s LIMIT 1",
+                                       array($urlId), __FILE__, __LINE__);
                                break;
 
                        case 'BONUS':
-                               $result_mailid = SQL_QUERY_ESC("SELECT `id`,`id`,`is_notify` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
-                                       array($bonusId), __FILE__, __LINE__);
+                               $result_mailid = SQL_QUERY_ESC("SELECT `is_notify` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+                                       array($urlId), __FILE__, __LINE__);
                                break;
 
                        default: // Unknown type
-                               reportBug(__FILE__, __LINE__, 'Unknown mail type ' . $ltype . ' detected.');
+                               reportBug(__FILE__, __LINE__, 'Unknown mail type ' . $data['link_type'] . ' detected.');
                                break;
-               }
+               } // END - switch
 
                // Entry found?
                if (SQL_NUMROWS($result_mailid) == 1) {
                        // Load data
-                       list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid);
+                       $data = merge_array($data, SQL_FETCHARRAY($result_mailid));
 
                        // Correct notification switch in non-bonus mails
-                       if (!in_array($notify, array('Y', 'N'))) {
-                               $notify = 'N';
+                       if ((!isset($data['is_notify'])) || (!in_array($data['is_notify'], array('Y', 'N')))) {
+                               $data['is_notify'] = 'N';
                        } // END - if
 
                        // Set sender to 0 when we have a bonus mail
-                       if ($ltype == 'BONUS') {
-                               $sender = '0';
+                       if ($data['link_type'] == 'BONUS') {
+                               $data['sender'] = '0';
                        } // END - if
 
                        // Is the user id valid?
@@ -143,10 +147,10 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
                                if (getUserData('status') == 'CONFIRMED') {
                                        // User has confirmed his account so we can procede...
                                        // @TODO Rewrite this to a filter
-                                       switch ($ltype) {
+                                       switch ($data['link_type']) {
                                                case 'NORMAL':
                                                        $result = SQL_QUERY_ESC("SELECT `payment_id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
-                                                               array(bigintval($pool)), __FILE__, __LINE__);
+                                                               array(bigintval($data['pool_id'])), __FILE__, __LINE__);
 
                                                        // Entry found?
                                                        if (SQL_NUMROWS($result) == 1) {
@@ -162,7 +166,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
 
                                                case 'BONUS':
                                                        $result = SQL_QUERY_ESC("SELECT `time`,`points` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
-                                                               array(bigintval($pool)), __FILE__, __LINE__);
+                                                               array(bigintval($data['pool_id'])), __FILE__, __LINE__);
 
                                                        // Entry found?
                                                        if (SQL_NUMROWS($result) == 1) {
@@ -175,7 +179,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
                                                        break;
 
                                                default: // Unknown type
-                                                       reportBug(__FILE__, __LINE__, 'Unknown mail type ' . $ltype . ' detected.');
+                                                       reportBug(__FILE__, __LINE__, 'Unknown mail type ' . $data['link_type'] . ' detected.');
                                                        break;
                                        } // END - switch
 
@@ -197,7 +201,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
 
                                                                        // Count clicks
                                                                        // @TODO Rewrite this to a filter
-                                                                       switch ($ltype) {
+                                                                       switch ($data['link_type']) {
                                                                                case 'NORMAL':
                                                                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1",
                                                                                                array($mailId), __FILE__, __LINE__);
@@ -223,7 +227,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
                                                                                        break;
 
                                                                                default: // Unknown type
-                                                                                       reportBug(__FILE__, __LINE__, 'Unknown mail type ' . $ltype . ' detected.');
+                                                                                       reportBug(__FILE__, __LINE__, 'Unknown mail type ' . $data['link_type'] . ' detected.');
                                                                                        break;
                                                                        } // END - switch
 
@@ -273,7 +277,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
                                                                                // Shall I add bonus points for "turbo clickers" ?
                                                                                if (isExtensionInstalledAndNewer('bonus', '0.2.2')) {
                                                                                        // Is an active-rallye running and this is not a notification mail?
-                                                                                       if ((isBonusRallyeActive()) && ($notify != 'Y')) {
+                                                                                       if ((isBonusRallyeActive()) && ($data['is_notify'] != 'Y')) {
                                                                                                // Shall I exclude the webmaster's own userid from the active-rallye?
                                                                                                if ((((getBonusUserid() == $userId) && (getConfig('bonus_include_own') == 'Y')) || (getBonusUserid() != $userId)) && (getDefRefid() != $userId)) {
                                                                                                        // Add points and remember ranking are done in this function....
@@ -303,10 +307,10 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
 
                                                                                // Load template
                                                                                loadTemplate($template, false, $content);
-                                                                       } elseif (isValidUserId($sender)) {
+                                                                       } elseif (isValidUserId($data['sender'])) {
                                                                                // Wrong image code! So add points to sender's account
                                                                                initReferralSystem();
-                                                                               addPointsThroughReferralSystem('mailid_payback', $sender, $payment);
+                                                                               addPointsThroughReferralSystem('mailid_payback', $data['sender'], $payment);
 
                                                                                // Add payment points
                                                                                $content['points'] = $payment;
@@ -323,7 +327,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
 
                                                                        // Remove link from table
                                                                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `id`=%s LIMIT 1",
-                                                                               array(bigintval($lid)), __FILE__, __LINE__);
+                                                                               array(bigintval($data['link_id'])), __FILE__, __LINE__);
                                                                        break;
 
                                                                case 'img':
index 4c277c75d9360f2e4977b66ec74ab76a6c0a4e1b..11f5d85d80b1ca4d16cf4c19e14af24e5ec2a60f 100644 (file)
@@ -1,8 +1 @@
-<div class="bug_table dashed">
-       <div class="bug_table_header bottom">
-               <strong>{--APP_DIE_TITLE--}</strong>
-       </div>
-       <div align="left" style="margin:5px">
-               $content
-       </div>
-</div>
+<!-- @DEPRECATED //-->
diff --git a/templates/de/html/app_exit_message.tpl b/templates/de/html/app_exit_message.tpl
new file mode 100644 (file)
index 0000000..3617496
--- /dev/null
@@ -0,0 +1,8 @@
+<div class="bug_table dashed">
+       <div class="bug_table_header bottom">
+               <strong>{--APPLICATION_DIED_TITLE--}</strong>
+       </div>
+       <div align="left" style="margin:5px">
+               $content
+       </div>
+</div>