]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_doubler.php
Code style changed, ext-user continued:
[mailer.git] / inc / modules / admin / what-list_doubler.php
index 6ba8c6ddc84d817b3718950d240d640a005f6048..190be0268fb1c9786c0527a9a3769f7600160a94 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 02/12/2004 *
- * ================                             Last change: 02/12/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 02/12/2004 *
+ * ===================                          Last change: 02/12/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-list_doubler.php                            *
  * $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 - 2008 by Roland Haeder                           *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
  ************************************************************************/
 
 // Some security stuff...
-if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
-       require($INC);
-}
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
+} // END - if
 
 // Add description as navigation point
-ADD_DESCR('admin', __FILE__);
+addYouAreHereLink('admin', __FILE__);
 
-if (!REQUEST_ISSET_GET('mode')) {
+if (!isGetRequestElementSet('do')) {
        // Chosse the overview page as default
-       REQUEST_GET('mode', 'overview');
+       setGetRequestElement('do', 'overview');
 } else {
        // Set table title automatically
-       if (!REQUEST_ISSET_GET(('select'))) REQUEST_GET('select', "all");
-       $eval = "define('__ADMIN_DOUBLER_LIST_".strtoupper(REQUEST_GET('mode'))."', getMessage('ADMIN_DOUBLER_LIST_".strtoupper(REQUEST_GET('mode'))."_".strtoupper(REQUEST_GET('select'))."'));";
-       eval($eval);
+       if (!isGetRequestElementSet('select')) {
+               setGetRequestElement('select', 'all');
+       } // END - if
+
+       // Prepare header
+       $content['list_' . strtolower(getRequestElement('do'))] = strtoupper('{--ADMIN_DOUBLER_LIST_' . getRequestElement('do') . '_' . getRequestElement('select') . '--}');
 }
 
 // Load data for the template
-// @TODO Try to rewrite this into include files
-switch (REQUEST_GET('mode')) {
+switch (getRequestElement('do')) {
        case 'already':  // Already payed out points
                break;
 
        case 'overview': // General overview page
-               $SUM_ALREADY = 0; $SUM_WAITING = 0;
-               // Number of direct already payouts and referal
-               $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='Y' AND is_ref='N'", __FILE__, __LINE__);
-               list($cnt) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
-
-               if ((empty($cnt)) || ($cnt == '0')) {
-                       // Nothing payed out so far
-                       // @TODO Rewrite all these constants
-                       define('__DOUBLER_ALREADY_DIRECT_LINK', '0');
-               } else {
+               // Prepare links
+               foreach (array('already_direct','already_ref','waiting_direct','waiting_ref') as $entry) {
+                       $content[$entry . '_link'] = '0';
+               } // END - switch
+
+               // Init sums
+               $sumAlready = '0'; $sumWaiting = '0';
+
+               // Number of direct already payouts and referral
+               $count = countSumTotalData('Y', 'doubler', 'id', 'completed', TRUE, " AND `is_ref`='N'");
+
+               if ($count > 0) {
                        // Something was payed out
-                       $SUM_ALREADY += $cnt;
-                       define('__DOUBLER_ALREADY_DIRECT_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=direct\">".$cnt."</a>");
-               }
-
-               $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='Y' AND is_ref='Y'", __FILE__, __LINE__);
-               list($cnt) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
-
-       if ((empty($cnt)) || ($cnt == '0')) {
-               // Nothing payed out so far
-               define('__DOUBLER_ALREADY_REF_LINK', '0');
-       } else {
-               // Something was payed out
-               $SUM_ALREADY += $cnt;
-               define('__DOUBLER_ALREADY_REF_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=ref\">".$cnt."</a>");
-       }
-       define('__DOUBLER_ALREADY_ALL_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=all\">".$SUM_ALREADY."</a>");
-
-       // And the same for waiting pouts (direct and referal)
-       $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' AND is_ref='N'", __FILE__, __LINE__);
-       list($cnt) = SQL_FETCHROW($result);
-       SQL_FREERESULT($result);
-
-       if ((empty($cnt)) || ($cnt == '0')) {
-               // Nothing payed out so far
-               define('__DOUBLER_WAITING_DIRECT_LINK', '0');
-       } else {
-               // Something was payed out
-               $SUM_WAITING += $cnt;
-               define('__DOUBLER_WAITING_DIRECT_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=direct\">".$cnt."</a>");
-       }
-
-       $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' AND is_ref='Y'", __FILE__, __LINE__);
-       list($cnt) = SQL_FETCHROW($result);
-       SQL_FREERESULT($result);
-
-       if ((empty($cnt)) || ($cnt == '0')) {
-               // Nothing payed out so far
-               define('__DOUBLER_WAITING_REF_LINK', '0');
-       } else {
-               // Something was payed out
-               $SUM_WAITING += $cnt;
-               define('__DOUBLER_WAITING_REF_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=ref\">".$cnt."</a>");
-       }
-       define('__DOUBLER_WAITING_ALL_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=all\">".$SUM_WAITING."</a>");
-
-       // All data is loaded here...
-       break;
-}
+                       $sumAlready += $count;
+                       $content['already_direct_link'] = '<a href="{%url=modules.php?module=admin&amp;what=list_doubler&amp;do=already&amp;select=direct%}">' . $count . '</a>';
+               } // END - if
+
+               $count = countSumTotalData('Y', 'doubler', 'id', 'completed', TRUE, " AND `is_ref`='Y'");
+
+               if ($count > 0) {
+                       // Something was payed out
+                       $sumAlready += $count;
+                       $content['already_ref_link'] = '<a href="{%url=modules.php?module=admin&amp;what=list_doubler&amp;do=already&amp;select=ref%}">' . $count . '</a>';
+               } // END - if
+
+               // And the same for waiting pouts (direct and referral)
+               $count = countSumTotalData('N', 'doubler', 'id', 'completed', TRUE, " AND `is_ref`='N'");
+
+               if ($count > 0) {
+                       // Something was payed out
+                       $sumWaiting += $count;
+                       $content['waiting_direct_link'] = '<a href="{%url=modules.php?module=admin&amp;what=list_doubler&amp;do=waiting&amp;select=direct%}">' . $count . '</a>';
+               } // END - if
+
+               $count = countSumTotalData('N', 'doubler', 'id', 'completed', TRUE, " AND `is_ref`='Y'");
+
+               if ($count > 0) {
+                       // Something was payed out
+                       $sumWaiting += $count;
+                       $content['waiting_ref_link'] = '<a href="{%url=modules.php?module=admin&amp;what=list_doubler&amp;do=waiting&amp;select=ref%}">' . $count . '</a>';
+               } // END - if
+
+               // Links for all
+               $content['already_all_link'] = '<a href="{%url=modules.php?module=admin&amp;what=list_doubler&amp;do=already&amp;select=all%}">' . $sumAlready . '</a>';
+               $content['waiting_all_link'] = '<a href="{%url=modules.php?module=admin&amp;what=list_doubler&amp;do=waiting&amp;select=all%}">' . $sumWaiting . '</a>';
+
+               // All data is loaded here...
+               break;
+} // END - switch
 
 // Load mode template
-LOAD_TEMPLATE('admin_list_doubler_' . REQUEST_GET('mode'));
+loadTemplate('admin_list_doubler_' . getRequestElement('do'), FALSE, $content);
 
-//
+// [EOF]
 ?>