]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_unconfirmed.php
Some global variables rewritten, a lot more language constants rewritten to getMessage()
[mailer.git] / inc / modules / admin / what-list_unconfirmed.php
index b9c7639d92a6fee9d361454b63966aade7a152dc..7c934c13ec817037b7bd03c72ab9b277ac5da66a 100644 (file)
@@ -51,10 +51,8 @@ ADD_DESCR("admin", __FILE__);
 // Don't load the admin_list_unconfirmed template by default
 $listed = false;
 
+// List confirmation links from normal or bonus mails
 if (REQUEST_ISSET_GET(('mid'))) {
-       // List confirmation links from your member's mail orders
-       define('__LIST_UNCON_TITLE', getMessage('LIST_UNCONFIRMED_MEMBER_LINKS'));
-
        // SQL query for mail data
        $sql = "SELECT DISTINCT s.id, p.sender, p.subject, p.text, p.url, p.timestamp, s.max_rec  FROM `{!_MYSQL_PREFIX!}_pool` AS p
 LEFT JOIN `{!_MYSQL_PREFIX!}_user_stats` AS s
@@ -67,7 +65,7 @@ WHERE p.id='".REQUEST_GET('mid')."' LIMIT 1";
        // Load admin_list_unconfirmed template
        $listed = true; $DATA = REQUEST_GET('mid'); $LINK = "mailid";
 } elseif ((REQUEST_ISSET_GET(('bid'))) && (EXT_IS_ACTIVE("bonus"))) {
-       // List confirmation links from bonus mails
+       // @TODO This constant might be unused?
        define('__LIST_UNCON_TITLE', getMessage('LIST_UNCONFIRMED_BONUS_LINKS'));
 
        // SQL query for mail data (both ids are required for compatiblity to above normal mail
@@ -79,7 +77,7 @@ WHERE p.id='".REQUEST_GET('mid')."' LIMIT 1";
        // Load admin_list_unconfirmed template
        $listed = true; $DATA = $ID; $LINK = "bonusid";
 } else {
-       // "Please do not call me directly."
+       // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_CALL_NOT_DIRECTLY'));
 }
 
@@ -97,13 +95,6 @@ if ($listed === true) {
                if (($stats_id > 0) && ($ID == "-1")) $ID = $stats_id;
                if ($col == "bonus_id") $sender = 0;
 
-               // @TODO Rewrite these constants
-               define('__LIST_UNCON_SENDER' , $sender);
-               define('__LIST_UNCON_SUBJECT', COMPILE_CODE($subj));
-               define('__LIST_UNCON_TEXT'   , COMPILE_CODE($text));
-               define('__LIST_UNCON_URL'    , encodeString($url));
-               define('__LIST_UNCON_STAMP'  , MAKE_DATETIME($stamp, "2"));
-
                // Load unconfirmed mail links. Hmmm, this select query is pretty cool
                // but it does only show unconfirmed mail links from existing user
                // accounts. So if you have delete one you did not see those links
@@ -116,13 +107,9 @@ WHERE l.%s='%s' ORDER BY l.userid LIMIT %s",
                        array($col, $ID, bigintval($max)),__FILE__, __LINE__);
                $unconfirmed = SQL_NUMROWS($result);
 
-               // @TODO Rewrite this constant
-               define('__LIST_UNCO_UNCONFIRMED', $unconfirmed);
-
                if ($unconfirmed > 0) {
                        // At least one link left to confirm
-                       $OUT = LOAD_TEMPLATE("admin_list_unconfirmed_header", true);
-                       $SW = 2;
+                       $OUT = ""; $SW = 2;
                        while ($content = SQL_FETCHARRAY($result)) {
                                // Prepare data for the row template
                                // @TODO Rewritings: uid->userid
@@ -140,20 +127,31 @@ WHERE l.%s='%s' ORDER BY l.userid LIMIT %s",
                                $OUT .= LOAD_TEMPLATE("admin_list_unconfirmed_row", true, $content);
                                $SW = 3 - $SW;
                        }
-                       $OUT .= "</table>\n";
+
+                       // Render it in our new listing
+                       $OUT = LOAD_TEMPLATE("admin_list_unconfirmed_list", true, $OUT);
 
                        // Free memory
                        SQL_FREERESULT($result);
-
-                       // Store table rows in a constant
-                       define('__LIST_UNCON_LISTING', $OUT);
                } else {
                        // All links are confirmed... strange, you shall normally not get a link to this place in this scenario... hmmm.
-                       define('__LIST_UNCON_LISTING', LOAD_TEMPLATE("admin_settings_saved", true, getMessage('ADMIN_UNCONFIRMED_NO_LINK_LEFT')));
+                       $OUT = LOAD_TEMPLATE("admin_settings_saved", true, getMessage('ADMIN_UNCONFIRMED_NO_LINK_LEFT'));
                }
 
+               // Prepare content
+               $content = array(
+                       'sender_link'   => ADMIN_CREATE_USERID_LINK($sender),
+                       'sender_userid' => $sender,
+                       'subject'       => COMPILE_CODE($subj),
+                       'text'          => COMPILE_CODE($text),
+                       'url'           => FRAMETESTER($url),
+                       'unconfirmed'   => $unconfirmed,
+                       'stamp'         => MAKE_DATETIME($stamp, "2"),
+                       'rows'          => $OUT
+               );
+
                // Load final template
-               LOAD_TEMPLATE("admin_list_unconfirmed");
+               LOAD_TEMPLATE("admin_list_unconfirmed", false, $content);
        } elseif (REQUEST_GET('mid') > 0) {
                // Data in pool or in user_stats not found, so let's find out where data is missing
                $result1 = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
@@ -162,10 +160,10 @@ WHERE l.%s='%s' ORDER BY l.userid LIMIT %s",
                        array(bigintval($ID)), __FILE__, __LINE__);
                if (SQL_NUMROWS($result1) == 1) {
                        // pool table
-                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('ADMIN_UNCONFIRMED_POOL_MISSING', $ID)));
+                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('ADMIN_UNCONFIRMED_POOL_MISSING'), $ID));
                } elseif (SQL_NUMROWS($result2) == 1) {
                        // user_stats table
-                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('ADMIN_UNCONFIRMED_STATS_MISSING', $ID)));
+                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('ADMIN_UNCONFIRMED_STATS_MISSING'), $ID));
                } else {
                        // both or link is invalid
                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_UNCONFIRMED_INVALID_LINK'));