<?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 *
* mod_media - By Robert Niedziela *
* (c)2003 www.megacomputing.net *
* -------------------------------------------------------------------- *
- * Rewritten by Roland Haeder, 2003 - 2008 *
+ * Rewritten by Roland Haeder, 2003 - 2009 *
* -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * Needs to be in all Files and every File needs "svn propset *
+ * 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 *
// Some security stuff...
if (!defined('__SECURITY')) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
- require($INC);
-} elseif ((!EXT_IS_ACTIVE('mediadata')) && (!IS_ADMIN())) {
- addFatalMessage(__FILE__, __LINE__, generateExtensionInactiveNotInstalledMessage('mediadata'));
- return;
-}
+ die();
+} // END - if
// Add description as navigation point
-ADD_DESCR('guest', __FILE__);
+addMenuDescription('guest', __FILE__);
-// @TODO Rewrite all constants
-define('value', 'value');
-define('lang', 'lang');
-define('rows', 'rows');
+if ((!isExtensionActive('mediadata')) && (!isAdmin())) {
+ loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('mediadata'));
+ return;
+} // END - if
-// Get total confirmed user IDs...
-define('user_confirmed' , round(GET_TOTAL_DATA('CONFIRMED' , 'user_data', 'userid', 'status', true)));
-define('user_unconfirmed', round(GET_TOTAL_DATA('UNCONFIRMED', 'user_data', 'userid', 'status', true)));
-define('user_locked' , round(GET_TOTAL_DATA('LOCKED' , 'user_data', 'userid', 'status', true)));
-define('user_count' , (constant('user_confirmed') + constant('user_unconfirmed') + constant('user_locked')));
+// Get total confirmed user ids...
+$content['user_confirmed'] = getTotalConfirmedUser();
+$content['user_unconfirmed'] = getTotalUnconfirmedUser();
+$content['user_locked'] = getTotalLockedUser();
+$content['user_count'] = ($content['user_confirmed'] + $content['user_unconfirmed'] + $content['user_locked']);
// Start of this exchange
-define('__MT_START', generateDateTime(getConfig('mt_start'), '3'));
-
-// Projected number of members
-define('__MT_STAGE', getConfig('mt_stage'));
+$content['mt_start'] = generateDateTime(getConfig('mt_start'), 3);
// Project timestamp when number of members are reached
-$PROJECTED = 0;
-if (constant('user_count')> 0) {
+$PROJECTED = '0';
+if ($content['user_count'] > 0) {
// @TODO Find a better formular than this one
- $PROJECTED = round((time() - getConfig('mt_start')) / constant('user_count') * getConfig('mt_stage') + getConfig('mt_start'));
-}
+ $PROJECTED = round((time() - getConfig('mt_start')) / $content['user_count'] * getConfig('mt_stage') + getConfig('mt_start'));
+} // END - if
// Generate timestamp
$TEST = makeTime(0, 0, 0, $PROJECTED);
if ($TEST > time()) {
- define('__MT_PROJECTED', generateDateTime($PROJECTED, '3'));
+ $content['projected'] = getMaskedMessage('USER_MT_PROJECTED', generateDateTime($PROJECTED, 3));
} else {
- define('__MT_PROJECTED', getMessage('USER_PROJECTION_UNKNOWN'));
+ $content['projected'] = getMaskedMessage('USER_MT_PROJECTED', '{--USER_PROJECTION_UNKNOWN--}');
}
// User who can receive mails
-define('user_max_mails', GET_TOTAL_DATA('CONFIRMED', 'user_data' 'max_mails', 'status', true, " AND `max_mails` > 0"));
+$content['user_max_mails'] = countSumTotalData('CONFIRMED', 'user_data', 'max_mails', 'status', true, " AND `max_mails` > 0");
// Users who can receive mails today
-define('user_max_rec', GET_TOTAL_DATA('CONFIRMED', 'user_data', 'receive_mails', 'status', true, " AND `receive_mails` > 0"));
+$content['user_max_rec'] = countSumTotalData('CONFIRMED', 'user_data', 'receive_mails', 'status', true, " AND `receive_mails` > 0");
// Max mails per day
-define('max', GET_TOTAL_DATA('CONFIRMED', 'user_data', 'max_mails', 'status', false, " AND `max_mails` > 0"));
+$content['max'] = countSumTotalData('CONFIRMED', 'user_data', 'max_mails', 'status', false, " AND `max_mails` > 0");
// Max mails for this day
-define('rec', GET_TOTAL_DATA('CONFIRMED', 'user_data', 'receive_mails', 'status', false, " AND `receive_mails` > 0"));
+$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 = MEDIA_GET_ENTRY('normal_orders');
-if (empty($nmails)) $nmails = 0;
+$nmails = getMediadataEntry('normal_orders');
+if (empty($nmails)) $nmails = '0';
// Mails sent so far
-$clicks = MEDIA_GET_ENTRY('normal_clicks');
-$sent = MEDIA_GET_ENTRY('normal_send');
-if (empty($sent)) $sent = 0;
-if (empty($clicks)) $clicks = 0;
+$clicks = getMediadataEntry('normal_clicks');
+$sent = getMediadataEntry('normal_send');
+if (empty($sent)) $sent = '0';
+if (empty($clicks)) $clicks = '0';
// Bonus mails
-if (EXT_IS_ACTIVE('bonus')) {
- $bmails = MEDIA_GET_ENTRY('bonus_orders');
- if (empty($bmails)) $bmails = 0;
+if (isExtensionActive('bonus')) {
+ $bmails = getMediadataEntry('bonus_orders');
+ if (empty($bmails)) $bmails = '0';
// Count bonus mails clicks / sent mails
- $dmy = MEDIA_GET_ENTRY('bonus_clicks');
- $dmy2 = MEDIA_GET_ENTRY('bonus_send');
- if (empty($dmy)) $dmy = 0;
- if (empty($dmy2)) $dmy2 = 0;
+ $dmy = getMediadataEntry('bonus_clicks');
+ $dmy2 = getMediadataEntry('bonus_send');
+ if (empty($dmy)) $dmy = '0';
+ if (empty($dmy2)) $dmy2 = '0';
$sent += $dmy2; $clicks += $dmy;
} // END - if
-define('user_stats', ($nmails + $bmails));
-define('sent' , $sent);
+$content['user_stats'] = ($nmails + $bmails);
+$content['sent'] = $sent;
// All clicks
-define('user_links', abs($sent - $clicks));
+$content['user_links'] = abs($sent - $clicks);
$clr = '0.00000';
if ($sent > 0) $clr = $clicks / $sent * 100;
-define('_clr', translateComma($clr).'%');
+$content['_clr'] = $clr;
// Load jackpot
-$jackpot = GET_JACKPOT_POINTS();
+$jackpot = '0';
+if (isExtensionActive('jackpot')) $jackpot = getJackpotPoints();
-if (empty($jackpot)) $jackpot = 0;
-define('jackpot', translateComma($jackpot));
+if (empty($jackpot)) $jackpot = '0';
+$content['jackpot'] = translateComma($jackpot);
// Total referal link clicks, total logins
-$result = SQL_QUERY("SELECT DISTINCT
+$result = SQL_QUERY('SELECT
SUM(d.ref_clicks), SUM(d.total_logins)
FROM
- `{!_MYSQL_PREFIX!}_user_data` AS d", __FILE__, __LINE__);
+ `{?_MYSQL_PREFIX?}_user_data` AS d', __FILE__, __LINE__);
list($ref, $logins) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Get total points
-$points = MEDIA_GET_ENTRY('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';
-define('__TOTAL_POINTS' , translateComma($points));
-define('__TOTAL_REFCLICKS', $ref);
-define('__TOTAL_LOGINS' , $logins);
+$content['total_points'] = $points;
+$content['total_refclicks'] = $ref;
+$content['total_logins'] = $logins;
// Referal banner
-$total = GET_TOTAL_DATA('Y', 'refbanner', 'id', 'visible', true);
+$total = countSumTotalData('Y', 'refbanner', 'id', 'visible', true);
// Total views and clicks
-$result = SQL_QUERY("SELECT SUM(`counter`) AS cnt, SUM(`clicks`) AS clx FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `visible`='Y'", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT SUM(`counter`) AS cnt, SUM(`clicks`) AS clx FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `visible`='Y'", __FILE__, __LINE__);
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';
-define('__REF_TOTAL' , $total);
-define('__REF_VIEWS' , $views);
-define('__REF_CLICKS', $clicks);
+$content['ref_total'] = $total;
+$content['ref_views'] = $views;
+$content['ref_clicks'] = $clicks;
//
// Extra mediadata depending on installed extensions
//
// 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 these all if-blocks to filters
-if (EXT_IS_ACTIVE('beg')) {
+// @TODO Rewrite all these if-blocks to filters
+if (isExtensionActive('beg')) {
// Clicks on beg links
- $result = SQL_QUERY("SELECT SUM(beg_clicks) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE beg_clicks>0", __FILE__, __LINE__);
- list($extra) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- if (empty($extra)) $extra = 0;
- $content = array(
- 'lang' => MEDIA_BEG_CLICKS,
- 'value' => $extra
+ $data = array(
+ 'lang' => '{--MEDIA_BEG_CLICKS--}',
+ 'value' => countSumTotalData('0', 'user_data', 'beg_clicks', 'userid', false, ' AND `beg_clicks` > 0')
);
- $OUT_EXTRA .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
- $ROWS_EXTRA++;
-}
-
-if (EXT_IS_ACTIVE('doubler')) {
- // Total payed points
- $result = SQL_QUERY("SELECT COUNT(id), SUM(points) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='Y' AND points > 0", __FILE__, __LINE__);
- list($count1, $points1) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $result = SQL_QUERY("SELECT COUNT(id), SUM(points) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' AND points > 0", __FILE__, __LINE__);
- list($count2, $points2) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- if (empty($count1)) $count1 = 0;
- if (empty($count2)) $count2 = 0;
- if (empty($points1)) $points1 = 0;
- if (empty($points2)) $points2 = 0;
+ $OUT_EXTRA .= loadTemplate('mediadata_extra_row', true, $data);
+} // END - if
+if (isExtensionActive('doubler')) {
// Add header
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_hrow', true, getMessage('MEDIA_DOUBLER_HEADER'));
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_hrow', true, '{--MEDIA_DOUBLER_HEADER--}');
// Add first line (count)
- $content = array(
- 'lang' => getMessage('MEDIA_DOUBLER_COUNT'),
- 'value' => $count1,
- 'rows' => '4'
+ $data = array(
+ 'lang' => '{--MEDIA_DOUBLER_COUNT--}',
+ 'value' => countSumTotalData('Y','doubler','id','completed', true, ' AND `points` > 0'),
);
// Add points
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row2', true, $content);
- $content = array(
- 'lang' => getMessage('MEDIA_DOUBLER_CPOINTS'),
- 'value' => translateComma($points1)
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_row2', true, $data);
+ $data = array(
+ 'lang' => '{--MEDIA_DOUBLER_CPOINTS--}',
+ 'value' => countSumTotalData('Y','doubler','id','completed', false, ' AND `points` > 0')
);
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
- $content = array(
- 'lang' => getMessage('MEDIA_DOUBLER_WAITING'),
- 'value' => translateComma($count2)
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_row', true, $data);
+ $data = array(
+ 'lang' => '{--MEDIA_DOUBLER_WAITING--}',
+ 'value' => countSumTotalData('N','doubler','id','completed', true, ' AND `points` > 0')
);
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
- $content = array(
- 'lang' => getMessage('MEDIA_DOUBLER_WPOINTS'),
- 'value' => translateComma($points2)
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_row', true, $data);
+ $data = array(
+ 'lang' => '{--MEDIA_DOUBLER_WPOINTS--}',
+ 'value' => countSumTotalData('N','doubler','id','completed', false, ' AND `points` > 0')
);
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
-}
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_row', true, $data);
+} // END - if
-if (EXT_IS_ACTIVE('holiday')) {
+if (isExtensionActive('holiday')) {
// Total holiday requests
- $result = SQL_QUERY("SELECT DISTINCT COUNT(h.userid)
-FROM `{!_MYSQL_PREFIX!}_user_holidays` AS h
-LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
-ON h.userid=d.userid
-WHERE d.`holiday_active`='Y'",
+ $result = SQL_QUERY("SELECT
+ COUNT(h.userid) AS count_holidays
+FROM
+ `{?_MYSQL_PREFIX?}_user_holidays` AS h
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_user_data` AS d
+ON
+ h.userid=d.userid
+WHERE
+ d.`holiday_active`='Y'",
__FILE__, __LINE__);
list($holiday) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if (empty($holiday)) $holiday = 0;
- $content = array(
- 'lang' => getMessage('MEDIA_HOLIDAY_COUNT'),
+ if (empty($holiday)) $holiday = '0';
+ $data = array(
+ 'lang' => '{--MEDIA_HOLIDAY_COUNT--}',
'value' => $holiday
);
- $OUT_USER .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
- $ROWS_USER++;
-}
+ $OUT_USER .= loadTemplate('mediadata_extra_row', true, $data);
+} // END - if
-if (EXT_IS_ACTIVE('transfer')) {
+if (isExtensionActive('transfer')) {
// Statistics for points transfers
- $result = SQL_QUERY("SELECT DISTINCT COUNT(t.id), SUM(t.points)
-FROM `{!_MYSQL_PREFIX!}_user_transfers_in` AS t
-LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
-ON t.userid=d.userid",
- __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT
+ COUNT(t.id) AS cnt, SUM(t.points) AS points
+FROM
+ `{?_MYSQL_PREFIX?}_user_transfers_in` AS t
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_user_data` AS d
+ON
+ t.userid=d.userid",
+ __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 DISTINCT COUNT(t.id), SUM(t.points)
-FROM `{!_MYSQL_PREFIX!}_user_transfers_out` AS t
-LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
-ON t.userid=d.userid",
+ $result = SQL_QUERY("SELECT
+ COUNT(t.id), SUM(t.points)
+FROM
+ `{?_MYSQL_PREFIX?}_user_transfers_out` AS t
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_user_data` AS d
+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 .= LOAD_TEMPLATE('mediadata_extra_hrow', true, getMessage('MEDIA_TRANSFER_HEADER'));
- $content = array(
- 'lang' => getMessage('MEDIA_TRANSFER_IN_COUNT'),
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_hrow', true, '{--MEDIA_TRANSFER_HEADER--}');
+ $data = array(
+ 'lang' => '{--MEDIA_TRANSFER_IN_COUNT--}',
'value' => $count_in,
- 'rows' => '4'
);
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row2', true, $content);
- $content = array(
- 'lang' => getMessage('MEDIA_TRANSFER_IN_POINTS'),
- 'value' => translateComma($points_in)
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_row2', true, $data);
+ $data = array(
+ 'lang' => '{--MEDIA_TRANSFER_IN_POINTS--}',
+ 'value' => $points_in
);
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
- $content = array(
- 'lang' => getMessage('MEDIA_TRANSFER_OUT_COUNT'),
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_row', true, $data);
+ $data = array(
+ 'lang' => '{--MEDIA_TRANSFER_OUT_COUNT--}',
'value' => $count_out
);
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
- $content = array(
- 'lang' => getMessage('MEDIA_TRANSFER_OUT_POINTS'),
- 'value' => translateComma($points_out)
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_row', true, $data);
+ $data = array(
+ 'lang' => '{--MEDIA_TRANSFER_OUT_POINTS--}',
+ 'value' => $points_out
);
- $OUT_SPECIAL .= LOAD_TEMPLATE('mediadata_extra_row', true, $content);
+ $OUT_SPECIAL .= loadTemplate('mediadata_extra_row', true, $data);
} // END - if
-define('__EXTRA_MEDIADATA' , $OUT_EXTRA);
-define('__POINTS_MEDIADATA' , $OUT_POINTS);
-define('__USER_MEDIADATA' , $OUT_USER);
-define('__SPECIAL_MEDIADATA', $OUT_SPECIAL);
-define('__ROWSPAN_EXTRA' , $ROWS_EXTRA);
-define('__ROWSPAN_POINTS' , $ROWS_POINTS);
-define('__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 level and it's timespamp
-define('__PATCH_LEVEL', getConfig('patch_level'));
-define('__PATCH_CTIME', generateDateTime(getConfig('patch_ctime'), '2'));
+// Patch timespamp
+$content['patch_ctime'] = generateDateTime(getConfig('patch_ctime'), 2);
// Load template
-LOAD_TEMPLATE('mediadata');
+loadTemplate('mediadata', false, $content);
-//
+// [EOF]
?>