- $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
- define('__DOUBLER_ALREADY_DIRECT_LINK', '0');
- }
- else
- {
- // Something was payed out
- $SUM_ALREADY += $cnt;
- define('__DOUBLER_ALREADY_DIRECT_LINK', "<a href=\"{!URL!}/modules.php?module=admin&what=list_doubler&mode=already&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&what=list_doubler&mode=already&select=ref\">".$cnt."</a>");
- }
- define('__DOUBLER_ALREADY_ALL_LINK', "<a href=\"{!URL!}/modules.php?module=admin&what=list_doubler&mode=already&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&what=list_doubler&mode=waiting&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&what=list_doubler&mode=waiting&select=ref\">".$cnt."</a>");
- }
- define('__DOUBLER_WAITING_ALL_LINK', "<a href=\"{!URL!}/modules.php?module=admin&what=list_doubler&mode=waiting&select=all\">".$SUM_WAITING."</a>");
-
- // All data is loaded here...
- break;
-}
+ $count = countSumTotalData('Y','doubler','id','completed',true, " AND `is_ref`='N'");
+
+ if ($count > 0) {
+ // Something was payed out
+ $sumAlready += $count;
+ $content['already_direct_link'] = '<a href="{%url=modules.php?module=admin&what=list_doubler&mode=already&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&what=list_doubler&mode=already&select=ref%}">' . $count . '</a>';
+ } // END - if
+
+ // And the same for waiting pouts (direct and referal)
+ $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&what=list_doubler&mode=waiting&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&what=list_doubler&mode=waiting&select=ref%}">' . $count . '</a>';
+ } // END - if
+
+ // Links for all
+ $content['already_all_link'] = '<a href="{%url=modules.php?module=admin&what=list_doubler&mode=already&select=all%}">' . $sumAlready . '</a>';
+ $content['waiting_all_link'] = '<a href="{%url=modules.php?module=admin&what=list_doubler&mode=waiting&select=all%}">' . $sumWaiting . '</a>';
+
+ // All data is loaded here...
+ break;
+} // END - switch