okay, i *believe* i fixed it... sigh...
replace the donatometer block's code with the following:
<?php
/************************************************************************/
/* Donations - Paypal financial management module for XOOPS 2 */
/* Copyright (c) 2004 by Xoops2 Donations Module Dev Team */
/* http://dev.xoops.org/modules/xfmod/project/?group_id=1060 */
/* */
/************************************************************************/
/* */
/* Based on NukeTreasury for PHP-Nuke - by Dave Lawrence AKA Thrash */
/* NukeTreasury - Financial management for PHP-Nuke */
/* Copyright (c) 2004 by Dave Lawrence AKA Thrash */
/* thrash@fragnastika.com */
/* thrashn8r@hotmail.com */
/* */
/************************************************************************/
/* */
/* 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 */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
/* General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 */
/* USA */
/************************************************************************/
include_once XOOPS_ROOT_PATH.'/modules/donations/includes/functions.php';
if ( file_exists(XOOPS_ROOT_PATH."/modules/donations/language/".$xoopsConfig['language']."/main.php") ) {
include_once XOOPS_ROOT_PATH."/modules/donations/language/".$xoopsConfig['language']."/main.php";
} else {
include_once XOOPS_ROOT_PATH."/modules/donations/language/english/main.php";
}
function b_donations_donatometer_show($options){
global $xoopsDB;
$block = array();
$query_cfg = "SELECT * FROM ".$xoopsDB->prefix("donations_config")." WHERE subtype = ''";
$cfgset = $xoopsDB->query($query_cfg);
while ( $cfgset && $row = $xoopsDB->fetchArray($cfgset))
{
$tr_config[$row['name']] = $row['value'];
}
$swingd = $tr_config['swing_day'];
if(!($swingd > 0 AND $swingd < 32))
$swingd = 6;
$dmshowdate = $tr_config['dm_show_date'];
$dmshowamt = $tr_config['dm_show_amt'];
$DM_TITLE = $tr_config['dm_title'];
if(!$DM_TITLE)
$DM_TITLE = "Help keep us going!";
if(is_numeric($tr_config['dm_num_don']) && $tr_config['dm_num_don'] > 0 )
$dmlen = $tr_config['dm_num_don'];
else if (is_numeric($dmlen) && $dmlen ==0)
$dmlen = -1;
else
$dmlen = 10;
// Check the current day against the swing day to execute the proper query
if( date('d') >= $swingd )
{
$query_Recordset1 = "SELECT count(mc_gross) AS count, sum(mc_gross) AS gross, sum("
."mc_gross-mc_fee) AS net, date_format( now(),'%M') AS mon, date_format( subdate( date_format( adddate("
."now(), INTERVAL 1 MONTH),'%Y-%c-1'), INTERVAL 1 DAY), '%b %e') AS due_by, date_format(now(),'%b') AS "
."mon_short FROM ".$xoopsDB->prefix("donations_transactions")." WHERE (payment_date >= date_format("
."now(),'%Y-%m-".$swingd."'))";
$query_Recordset3 = "select custom as muser_id, option_selection1 as showname, "
."date_format( payment_date, '%b-%e') as date, concat('$',sum(mc_gross)) as amt "
."from ".$xoopsDB->prefix("donations_transactions")." where (payment_date >= date_format( "
."now(), '%Y-%m-".$swingd."')) group by txn_id order by payment_date desc";
} else
{
$query_Recordset1 = "select count(mc_gross) as count, sum(mc_gross) as gross, sum(mc_gross -"
." mc_fee) as net, date_format( subdate( now(), interval ".$swingd." day), '%M') as mon,"
." 'Now!' as due_by, date_format( subdate( now(), interval ".$swingd." day), '%b') as mon_short"
." from ".$xoopsDB->prefix("donations_transactions")." where (payment_date < date_format( now(), '%Y-%m-".$swingd."')"
.") and payment_date > date_format( subdate( now(), interval ".$swingd." day), '%Y-%m-".$swingd."')";
$query_Recordset3 = "select custom as muser_id, option_selection1 as showname, "
."date_format( payment_date, '%b-%e') as date, concat('$', sum(mc_gross)) as amt "
."from ".$xoopsDB->prefix("donations_transactions")." where (payment_date < date_format(now(),"
." '%Y-%m-".$swingd."')) and payment_date > date_format( subdate( now(),interval ".$swingd." "
."day), '%Y-%m-".$swingd."') group by txn_id order by payment_date desc";
}
// Get the donation totals
$Recordset1 = $xoopsDB->query($query_Recordset1);
$row_Recordset1 = $xoopsDB->fetchArray($Recordset1);
//If there are not records, then get "null" data
if( !$row_Recordset1 )
{
$query_Recordset1 = "select '0' as count, '0' as gross, '0' as net, date_format( now(),"
."'%M') as mon, date_format( subdate( date_format( adddate( now(), interval 1 month), '%Y-%c-1'),"
." interval 1 day), '%b %e') as due_by, date_format( now(), '%b') as mon_short from "
." ".$xoopsDB->prefix("donations_transactions")."";
$Recordset1 = $xoopsDB->query($query_Recordset1);
$row_Recordset1 = $xoopsDB->fetchArray($Recordset1);
}
// Get the goal
$query_Recordset2 = "SELECT * FROM ".$xoopsDB->prefix("donations_config")." WHERE name='goal' AND subtype='".$row_Recordset1['mon_short']."'";
$Recordset2= $xoopsDB->query($query_Recordset2);
$row_Recordset2 = $xoopsDB->fetchArray($Recordset2);
// Set our remaining template vars
if(!$row_Recordset1['mon']){
$DM_MON = date('F');
}else{
$DM_MON = $row_Recordset1['mon'];
}
$difference = $row_Recordset1['net'] - $row_Recordset2['value'];
$DM_GOAL = sprintf('$%.02f', $row_Recordset2['value']);
$DM_DUE = $row_Recordset1['due_by'];
$DM_NUM = $row_Recordset1['count'];
$DM_GROSS = sprintf('$%.02f',$row_Recordset1['gross']);
$DM_NET = sprintf('$%.02f',$row_Recordset1['net']);
$DM_LEFT = sprintf('$%.02f', $row_Recordset2['value'] - $row_Recordset1['net']);
$DM_BUTTON = $tr_config['dm_button'];
$DM_BUTT_DIMS = '';
if( is_numeric($tr_config['dm_img_width']) )
$DM_BUTT_DIMS .= 'width='.$tr_config['dm_img_width'].' ';
if( is_numeric($tr_config['dm_img_height']) )
$DM_BUTT_DIMS .= 'height='.$tr_config['dm_img_height'].' ';
// Load the template
$block['DM_TITLE'] = $DM_TITLE;
$block['DM_BUTTON'] = $DM_BUTTON;
$block['DM_BUTT_DIMS'] = $DM_BUTT_DIMS;
$block['DM_MON'] = $DM_MON;
$block['DM_GOAL'] = $DM_GOAL;
$block['DM_DUE'] =$DM_DUE;
$block['DM_GROSS'] = $DM_GROSS;
$block['DM_NET'] = $DM_NET;
$block['DON_URL'] = XOOPS_URL.'/modules/donations/index.php';
$show_don=0;
// Do we want to display the donators?
if(is_numeric($dmlen) && $dmlen >= 0 )
{
$show_don=1;
// Get the list of donators
$Recordset3= $xoopsDB->query($query_Recordset3);
// List all the donators
$i = 0;
$var = '';
while ( ($row_Recordset3 = $xoopsDB->fetchArray($Recordset3)) && ($i != $tr_config['dm_num_don']) )
{
// Refunded transactions will show up with $0 amount
if( $row_Recordset3['amt'] > "$0" )
{
$dmalign = "center";
$var .= "<tr><td width="100%" align="$dmalign" colspan="2">";
// Observe the user's wish regarding revealing their name
$muser_id = $row_Recordset3['muser_id'];
$sqlm = $xoopsDB->query("SELECT uid FROM ".$xoopsDB->prefix('users')." WHERE uname='$muser_id'");
list($uid) = $xoopsDB->fetchRow($sqlm);
if( strcmp($row_Recordset3['showname'],"Yes") == 0 && ($userfoin = mgetusrinfo($uid))){
$var .= "<a href='".XOOPS_URL."/userinfo.php?uid=".$userfoin->getVar('uid')."'>".$userfoin->getVar('uname')."</a>";
}else{
$var .= _DM_ANONYMOUS_SHORT;
}
$var .= " ";
if( $dmshowamt )
$var .= "(".$row_Recordset3['amt'].")";
if( $dmshowdate )
$var .= $row_Recordset3['date'];
$var .= "</td></tr>";
}
$i++;
}
}
if ($difference > 0) {
$DM_OVERAGE = sprintf('$%.02f', $row_Recordset1['net'] - $row_Recordset2['value']);
$block['DM_LEFT2GO'] = '<tr>
<td width="105" align="right"><font color="green"><b>'._DM_SURPLUS.':</b></font></td>
<td align="left"><font color="green"><b>'.$DM_OVERAGE.'</b></font></td>
</tr>';
} else {
$block['DM_LEFT2GO'] = '<tr>
<td width="105" align="right"><font color="red"><b>'._DM_LEFT2GO.':</b></font></td>
<td align="left"><font color="red"><b>'.$DM_LEFT.'</b></font></td>
</tr>';
}
// Define language constants
$block['DM_STAT'] = _DM_STAT;
$block['DM_MONGOAL'] = sprintf(_DM_MONGOAL,$block['DM_MON']);
$block['DM_DUEDATE'] = _DM_DUEDATE;
$block['DM_GROSSAMT'] = _DM_GROSSAMT;
$block['DM_NETBAL'] = _DM_NETBAL;
$block['DM_DONATIONS'] = _DM_DONATIONS;
$block['DM_MAKEDON'] = _DM_MAKEDON;
// Display block
$block['show_don']= $show_don;
$block['content'] = $var;
return $block;
}
?>