Even more rewrites/fixes from EL branch (please report any broken part after you...
[mailer.git] / inc / modules / guest / what-mediadata.php
index 258509fb8a60587a83d27d5070735dc729979fe4..50078e5ade00e38f53b5e1f732222b8ea181f9dd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 12/09/2003 *
- * ===============                              Last change: 02/12/2006 *
+ * Mailer v0.2.1-FINAL                                Start: 12/09/2003 *
+ * ===================                          Last change: 02/12/2006 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-mediadata.php                               *
@@ -23,6 +23,7 @@
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -54,17 +55,17 @@ if ((!isExtensionActive('mediadata')) && (!isAdmin())) {
        return;
 } // END - if
 
-// Get total confirmed user IDs...
+// Get total confirmed user ids...
 $content['user_confirmed']   = round(countSumTotalData('CONFIRMED'  , 'user_data', 'userid', 'status', true));
 $content['user_unconfirmed'] = round(countSumTotalData('UNCONFIRMED', 'user_data', 'userid', 'status', true));
 $content['user_locked']      = round(countSumTotalData('LOCKED'     , 'user_data', 'userid', 'status', true));
 $content['user_count']       = ($content['user_confirmed'] + $content['user_unconfirmed'] + $content['user_locked']);
 
 // Start of this exchange
-$content['mt_start'] = generateDateTime(getConfig('mt_start'), '3');
+$content['mt_start'] = generateDateTime(getConfig('mt_start'), 3);
 
 // Project timestamp when number of members are reached
-$PROJECTED = 0;
+$PROJECTED = '0';
 if ($content['user_count'] > 0) {
        // @TODO Find a better formular than this one
        $PROJECTED = round((time() - getConfig('mt_start')) / $content['user_count'] * getConfig('mt_stage') + getConfig('mt_start'));
@@ -74,9 +75,9 @@ if ($content['user_count'] > 0) {
 $TEST = makeTime(0, 0, 0, $PROJECTED);
 
 if ($TEST > time()) {
-       $content['projected'] = generateDateTime($PROJECTED, '3');
+       $content['projected'] = getMaskedMessage('USER_MT_PROJECTED', generateDateTime($PROJECTED, 3));
 } else {
-       $content['projected'] = getMessage('USER_PROJECTION_UNKNOWN');
+       $content['projected'] = getMaskedMessage('USER_MT_PROJECTED', getMessage('USER_PROJECTION_UNKNOWN'));
 }
 
 // User who can receive mails
@@ -92,28 +93,28 @@ $content['max'] = countSumTotalData('CONFIRMED', 'user_data', 'max_mails', 'stat
 $content['rec'] = countSumTotalData('CONFIRMED', 'user_data', 'receive_mails', 'status', false, " AND `receive_mails` > 0");
 
 // Initial lots of variables
-$bmails = 0; $sent = 0; $max = 0; $rec = 0; $clicks = 0;
+$bmails = '0'; $sent = '0'; $max = '0'; $rec = '0'; $clicks = '0';
 
 // Mail orders (only current)
 $nmails = getMediadataEntry('normal_orders');
-if (empty($nmails)) $nmails = 0;
+if (empty($nmails)) $nmails = '0';
 
 // Mails sent so far
 $clicks = getMediadataEntry('normal_clicks');
 $sent   = getMediadataEntry('normal_send');
-if (empty($sent))   $sent   = 0;
-if (empty($clicks)) $clicks = 0;
+if (empty($sent))   $sent   = '0';
+if (empty($clicks)) $clicks = '0';
 
 // Bonus mails
 if (isExtensionActive('bonus')) {
        $bmails = getMediadataEntry('bonus_orders');
-       if (empty($bmails)) $bmails = 0;
+       if (empty($bmails)) $bmails = '0';
 
        // Count bonus mails clicks / sent mails
        $dmy  = getMediadataEntry('bonus_clicks');
        $dmy2 = getMediadataEntry('bonus_send');
-       if (empty($dmy))  $dmy  = 0;
-       if (empty($dmy2)) $dmy2 = 0;
+       if (empty($dmy))  $dmy  = '0';
+       if (empty($dmy2)) $dmy2 = '0';
        $sent += $dmy2; $clicks += $dmy;
 } // END - if
 
@@ -128,10 +129,10 @@ if ($sent > 0) $clr = $clicks / $sent * 100;
 $content['_clr'] = translateComma($clr) . '%';
 
 // Load jackpot
-$jackpot = 0;
+$jackpot = '0';
 if (isExtensionActive('jackpot')) $jackpot = getJackpotPoints();
 
-if (empty($jackpot)) $jackpot = 0;
+if (empty($jackpot)) $jackpot = '0';
 $content['jackpot'] = translateComma($jackpot);
 
 // Total referal link clicks, total logins
@@ -145,9 +146,9 @@ SQL_FREERESULT($result);
 // Get total points
 $points = getMediadataEntry('total_points');
 
-if (empty($points)) $points = 0;
-if (empty($ref))    $ref    = 0;
-if (empty($logins)) $logins = 0;
+if (empty($points)) $points = '0';
+if (empty($ref))    $ref    = '0';
+if (empty($logins)) $logins = '0';
 
 $content['total_points']    = translateComma($points);
 $content['total_refclicks'] = $ref;
@@ -161,9 +162,9 @@ $result = SQL_QUERY("SELECT SUM(`counter`) AS cnt, SUM(`clicks`) AS clx FROM `{?
 list($views, $clicks) = SQL_FETCHROW($result);
 SQL_FREERESULT($result);
 
-if (empty($total))  $total  = 0;
-if (empty($views))  $views  = 0;
-if (empty($clicks)) $clicks = 0;
+if (empty($total))  $total  = '0';
+if (empty($views))  $views  = '0';
+if (empty($clicks)) $clicks = '0';
 
 $content['ref_total']  = $total;
 $content['ref_views']  = $views;
@@ -174,9 +175,9 @@ $content['ref_clicks'] = $clicks;
 //
 
 // Initialize Variables
-$OUT_EXTRA   = ''; $ROWS_EXTRA   = 2;
-$OUT_POINTS  = ''; $ROWS_POINTS  = 2;
-$OUT_USER    = ''; $ROWS_USER    = 6;
+$OUT_EXTRA   = '';
+$OUT_POINTS  = '';
+$OUT_USER    = '';
 $OUT_SPECIAL = ''; // We don't need row count here
 
 // @TODO Rewrite all these if-blocks to filters
@@ -184,10 +185,9 @@ if (isExtensionActive('beg')) {
        // Clicks on beg links
        $data = array(
                'lang'  => getMessage('MEDIA_BEG_CLICKS'),
-               'value' => countSumTotalData(1, 'user_data', 'beg_clicks', 1, false, " AND `beg_clicks` > 0")
+               'value' => countSumTotalData('0', 'user_data', 'beg_clicks', 'userid', false, " AND `beg_clicks` > 0")
        );
        $OUT_EXTRA .= loadTemplate('mediadata_extra_row', true, $data);
-       $ROWS_EXTRA++;
 }
 
 if (isExtensionActive('doubler')) {
@@ -198,7 +198,6 @@ if (isExtensionActive('doubler')) {
        $data = array(
                'lang'  => getMessage('MEDIA_DOUBLER_COUNT'),
                'value' => countSumTotalData('Y','doubler','id','completed', true, " AND `points` > 0"),
-               'rows'  => '4'
        );
 
        // Add points
@@ -235,13 +234,12 @@ WHERE
        __FILE__, __LINE__);
        list($holiday) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
-       if (empty($holiday)) $holiday = 0;
+       if (empty($holiday)) $holiday = '0';
        $data = array(
                'lang'  => getMessage('MEDIA_HOLIDAY_COUNT'),
                'value' => $holiday
        );
        $OUT_USER .= loadTemplate('mediadata_extra_row', true, $data);
-       $ROWS_USER++;
 }
 
 if (isExtensionActive('transfer')) {
@@ -257,8 +255,8 @@ ON
                __FILE__, __LINE__);
        list($count_in, $points_in) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
-       if (empty($count_in))  $count_in  = 0;
-       if (empty($points_in)) $points_in = 0;
+       if (empty($count_in))  $count_in  = '0';
+       if (empty($points_in)) $points_in = '0';
 
        $result = SQL_QUERY("SELECT COUNT(t.id), SUM(t.points)
 FROM `{?_MYSQL_PREFIX?}_user_transfers_out` AS t
@@ -267,15 +265,14 @@ ON t.userid=d.userid",
        __FILE__, __LINE__);
        list($count_out, $points_out) = SQL_FETCHROW($result);
        SQL_FREERESULT($result);
-       if (empty($count_out))  $count_out  = 0;
-       if (empty($points_out)) $points_out = 0;
+       if (empty($count_out))  $count_out  = '0';
+       if (empty($points_out)) $points_out = '0';
 
        // Add header
        $OUT_SPECIAL .= loadTemplate('mediadata_extra_hrow', true, getMessage('MEDIA_TRANSFER_HEADER'));
        $data = array(
                'lang'  => getMessage('MEDIA_TRANSFER_IN_COUNT'),
                'value' => $count_in,
-               'rows'  => '4'
        );
        $OUT_SPECIAL .= loadTemplate('mediadata_extra_row2', true, $data);
        $data = array(
@@ -295,16 +292,13 @@ ON t.userid=d.userid",
        $OUT_SPECIAL .= loadTemplate('mediadata_extra_row', true, $data);
 } // END - if
 
-$content['out_extra']      = $OUT_EXTRA;
-$content['out_points']     = $OUT_POINTS;
-$content['out_user']       = $OUT_USER;
-$content['out_special']    = $OUT_SPECIAL;
-$content['rowspan_extra']  = $ROWS_EXTRA;
-$content['rowspan_points'] = $ROWS_POINTS;
-$content['rowspan_user']   = $ROWS_USER;
+$content['out_extra']   = $OUT_EXTRA;
+$content['out_points']  = $OUT_POINTS;
+$content['out_user']    = $OUT_USER;
+$content['out_special'] = $OUT_SPECIAL;
 
 // Patch timespamp
-$contentp['patch_ctime'] = generateDateTime(getConfig('patch_ctime'), '2');
+$content['patch_ctime'] = generateDateTime(getConfig('patch_ctime'), 2);
 
 // Load template
 loadTemplate('mediadata', false, $content);