Hi everyone. I installed NukeTreasury2006 and i still cant get my admin page to work. "Donat_o_Meter" block and the "Donations" module works fine.
When I open Admin / Treasury I receive an error:
Code:
Parse error: syntax error, unexpected '"' in admin/modules/treasury.php on line 26
Line 26 is:
Code:
$result = sql_query("select radminsuper from ".$prefix."_authors where aid='$aid'", $dbi);
My treasury.php is:
Code:
<?php
/************************************************************************/
/* 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 */
/* Upgraded and cleaned up by Telli http://codezwiz.com */
/* Updated config file references by Guardian
Only registered users can see links on this board! Get registered or login to the forums!
function Treasury()
{
global $admin, $bgcolor2, $prefix, $dbi, $currentlang, $multilingual;
include ("header.php");
include("modules/Donations/config.php");
if( !$ipnppd )
{
echo "<br><br>NukeTreasury FATAL ERROR: Unable to connect to SQL database. Please check your settings in modules/Donations/config.php<br><br>";
return;
}
// Collect IPN reconcile data
// First, get the date of the last time we reconciled
$query_Recordset2 = 'SELECT `date` as recdate'
. ' FROM financial'
. ' WHERE name = \'PayPal IPN\''
. ' ORDER BY date DESC '
. ' LIMIT 1 ';
$Recordset2 = mysql_query($query_Recordset2, $ipnppd) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$recdate = $row_Recordset2[recdate];
// Get the date of the last donation
$query_Recordset2 = 'SELECT `payment_date` as curdate'
. ' FROM transactions'
. ' WHERE payment_status = \'Completed\' AND ( transactions.txn_type = \'send_money\' OR transactions.txn_type = \'web_accept\' )'
. ' ORDER BY payment_date DESC '
. ' LIMIT 1 ';
$Recordset2 = mysql_query($query_Recordset2, $ipnppd) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$curdate = $row_Recordset2[curdate];
// Collect the IPN transactions between recdate and curdate
$query_Recordset2 = 'SELECT custom, SUM( mc_gross ) AS gross, SUM( mc_gross - mc_fee ) AS net'
. ' FROM transactions '
. ' WHERE ( payment_Date > \'' . $recdate . '\' AND payment_date <= \'' . $curdate . '\' ) '
. ' GROUP BY txn_id ';
$Recordset2 = mysql_query($query_Recordset2, $ipnppd) or die(mysql_error());
// Iterate over the records skipping the ones that total out to zero(refunds)
$ipn_tot = 0;
$num_ipn = 0;
while( $row_Recordset2 = mysql_fetch_assoc($Recordset2) )
{
if( $row_Recordset2[gross] > 0 )
{
$ipn_tot += $row_Recordset2[net];
$num_ipn++;
}
}
// Get the register balance
$query_Recordset4 = "SELECT SUM(amount) as total FROM financial";
$Recordset4 = mysql_query($query_Recordset4, $ipnppd) or die(mysql_error());
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
$total = $row_Recordset4[total];
echo "<tr><td width=\"100%\">";
echo "Number of new IPN records: $num_ipn - Totaling \$$ipn_tot";
echo "</td></tr>";
echo "<tr><td width=\"100%\">";
echo "<form action=\"admin.php?op=IpnRec#AdminTop\" method=\"post\">";
echo "<input type=\"hidden\" name=\"op\" value=\"IpnRec\">"
."<input type=\"submit\" value=\"PayPal IPN reconcile\" onClick=\"return confirm('This action will total up all recent PayPal IPN" . '\n' . "transactions and post them here in the register." . '\n\n' . "Are you sure you want to do this now?')\">"
."</form>";
echo "</td></tr></table>";
."return false;\">"
."<img border=\"0\" width=\"12\" height=\"13\" src=\"images/admin/treasury_edit.png\"></a> "
."<a href=\"admin.php?op=FinRegDel&id=$row_Recordset1[id]\">"
."<img border=\"0\" width=\"12\" height=\"13\" src=\"images/admin/treasury_drop.png\" onClick=\"return confirm('Are you sure you want to delete this record?" . '\n\n' . "Are you sure you want to do this now?')\""
."></a></td>"
function FinancialRegAdd()
{
global $admin, $bgcolor2, $prefix, $dbi, $currentlang, $multilingual;
include ("header.php");
include("modules/Donations/config.php");
$ipnppd = mysql_pconnect($hostname_ipnppd, $username_ipnppd, $password_ipnppd) or die(mysql_error());
function FinancialRegDel()
{
global $admin, $bgcolor2, $prefix, $dbi, $currentlang, $multilingual;
include ("header.php");
include("modules/Donations/config.php");
$ipnppd = mysql_pconnect($hostname_ipnppd, $username_ipnppd, $password_ipnppd) or die(mysql_error());
function FinancialRegEdit()
{
global $admin, $bgcolor2, $prefix, $dbi, $currentlang, $multilingual;
include ("header.php");
include("modules/Donations/config.php");
$ipnppd = mysql_pconnect($hostname_ipnppd, $username_ipnppd, $password_ipnppd) or die(mysql_error());
// echo "$_POST[Date] $_POST[Num] $_POST[Name] $_POST[Descr] $_POST[Amount]<br><br>";
$nTime = strtotime($_POST[Date]);
if($nTime == -1)
echo "Invalid Date format<br>";
else
if( strlen($_POST[Name]) == 0)
echo "The Name field cannot be blank<br>";
else
if( !is_numeric($_POST[Amount]))
echo "Invalid Amount field, do not use any characters other than -.0123456789<br>";
else
{
echo "Field passed validation!<br>";
function Config()
{
global $admin, $bgcolor2, $prefix, $dbi, $currentlang, $multilingual;
include ("header.php");
include("modules/Donations/config.php");
?>
<script Language="JavaScript">
function isEmailAddr(email)
{
var result = false;
var theStr = new String(email);
var index = theStr.indexOf("@");
if (index > 0)
{
var pindex = theStr.indexOf(".",index);
if ((pindex > index+1) && (theStr.length > pindex+1))
result = true;
}
return result;
}
function validRequired(formField,fieldLabel)
{
var result = true;
if (formField.value == "")
{
alert('Please enter a value for the "' + fieldLabel +'" field.');
formField.focus();
result = false;
}
return result;
}
function allDigits(str)
{
return inValidCharSet(str,"0123456789");
}
function inValidCharSet(str,charset)
{
var result = true;
// Note: doesn't use regular expressions to avoid early Mac browser bugs
for (var i=0;i<str.length;i++)
if (charset.indexOf(str.substr(i,1))<0)
{
result = false;
break;
}
return result;
}
function validInt(formField,fieldLabel,required)
{
var result = true;
if (required && !validRequired(formField,fieldLabel))
result = false;
if (result)
{
// var num = parseInt(formField.value,10);
if (!allDigits(formField.value))
{
if(required)
{
alert('Please enter a number for the "' + fieldLabel +'" field.');
formField.focus();
result = false;
}
else if ( formField.value == "" )
{
return true;
}
else
{
alert('Please enter a number or a blank for the "' + fieldLabel +'" field.');
formField.focus();
result = false;
}
}
}
return result;
}
function validdateURL(formField, value, secure)
{
var match = /https/i.test(value);
if( value != "" && !/^http/i.test(value) )
{
alert('The URL must start with http://');
formField.focus();
return false;
}
if( secure && value != "" && !/^https/i.test(value) )
{
// alert('This should reside on a HTTPS server. Users will be warned about viewing secure and non-secure data on the same page');
return confirm('This URL does not begin with https://\nThis image should reside on an HTTPS server.\nIf you use this URL, users will receive a warning\nabout viewing secure and non-secure data on the same page.\n\n Are you sure you want to continue?');
}
return true;
}
function checkCancelledURL()
{
if( document.tr_configs.var_pp_image_url.value == "")
alert('There is no URL for a Cancelled payment. If you do not enter\na URL for cancelled payments PayPal will also use\nthis URL for cancelled payments.');
return true;
}
</script>
<?php
$desc = "This is where you can appeal to your
users and your community for donations.
Suggestion: Explain why you need donations,
what you do with the money and how you
manage it. Make them comfortable that
they are not throwing their money away.";
$sql = $sql = "SELECT * FROM config WHERE name = 'don_text'";
$Recordset = mysql_query($sql, $ipnppd) or die(mysql_error());
$row = mysql_fetch_assoc($Recordset);
$DON_TEXT = $row[text];
echo "<tr>"
."<td title=\"$desc\" bgcolor=\"$bgcolor2\" align=\"right\"><b>Donations page text</b></td>"
."<td title=\"$desc\" align=\"left\">"
."<textarea name=\"var_don_text-rawtext-txt\" cols=\"100\" rows=\"20\">$DON_TEXT</textarea></td></tr>";
ShowTextBox("ipn_log_entries", "<b>Keep this many log entries</b>", "", "4", "");
global $nukeurl;
$desc = 'This box shows the link to the IPN recorder.
This link must be pasted EXACTLY as it is
into your PayPal IPN profile. You can click
on the "test" link to the right to verify
that the IPN recorder is functioning correctly.';
$desc = htmlentities($desc);
echo "<tr>"
."<td title =\"$desc\" bgcolor=\"$bgcolor2\" align=\"right\"><b>IPN link for PayPal</b></td>"
."<td title =\"$desc\" align=\"left\"> $nukeurl/modules/Donations/ipn/ipnppd.php <a href=\"$nukeurl/modules/Donations/ipn/ipnppd.php?dbg=1\" target=\"_blank\"><b><i>Click here to test IPN</i></b></a></td>"
. "</td></tr>";
echo "</table><br>";
function UpdateDb($db,$nm, $sub, $val, $txt)
{
global $ilog;
$insert_Recordset = "UPDATE `config` SET `value`='$val', `text`='$txt' WHERE `name`='$nm' AND `subtype`='$sub'";
$ilog .= "$insert_Recordset<br><br>";
echo "$insert_Recordset<br><br><font color=\"#FF0000\"><b>";
$rvalue = mysql_query($insert_Recordset, $db) or die(mysql_error());
echo "</b></font>";
}
function UpdateDbShort($db,$nm, $sub, $val, $txt)
{
global $ilog;
$insert_Recordset = "UPDATE `config` SET `value`='$val' WHERE `name`='$nm' AND `subtype`='$sub'";
function ConfigUpdate()
{
global $admin, $bgcolor2, $prefix, $dbi, $currentlang, $multilingual;
include ("header.php");
include("modules/Donations/config.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>Treasury Configuration Error</b></font></center>";
echo "<br><font color=\"#0000FF\"><b>If you see this screen then an SQL error was encountered</b></br>"
. "You shoud see a message in <font color=\"#FF0000\">RED</font> below indicating what the error is</font><br><br>";
CloseTable();
// echo "<br>";
OpenTable();
$ERR = 1;
$ilog="";
$ilog .= "<br>";
foreach( $_POST as $option => $value )
{
/// Look for form variables
if( preg_match("/var_/",$option))
{
$varnm = preg_replace("/var_/","",$option);
// Check for subtype field
if( preg_match("/-(.*)/",$varnm,$subtype) )
{
echo "<br>subtype = $subtype[1] <br>";
$temp = $varnm;
$varnm = preg_replace("/-.*/","",$temp);
// Is this is a text field?
if( preg_match("/([^-]*)-txt/",$subtype[1], $subtype2) )
{
if (!get_magic_quotes_gpc()) {
$textarea = addslashes($value);
} else {
$textarea = $value;
}
if( $row_Recordset1['numrecs'] == 0 )
echo "There are no new IPN records to import! ";
else
{
$insert_set = "INSERT INTO `financial` (`date`,`num`,`name`,`descr`,`amount`) VALUES ('$curdate','','PayPal IPN','Auto-Reconcile','$row_Recordset1[ipn_total]')";
$rval = mysql_query($insert_set, $ipnppd) or die(mysql_error());
if($rval)
echo "<b>$row_Recordset1[numrecs]</b> IPN records have been imported for a total of $" . sprintf("%0.2f", $row_Recordset1[ipn_total]);
else
echo "<b> ERROR : There are $row_Recordset1[numrecs] to import, but there was an<br>"
."error encoutered during db record insertion into Financial table. Insertion<br>"
."FAILED";
}
Joined: Aug 27, 2002 Posts: 16650 Location: Kansas
Posted:
Wed Nov 19, 2008 11:19 pm
I have never heard of NT2006 but I'll assume it's basically the standard NT. The line of code looks correct except RN v2.30.00 no longer uses the $dbi variable - see
Only registered users can see links on this board! Get registered or login to the forums!
. A quick test to see if that's the issue would be to change
From
$result = sql_query("select radminsuper from ".$prefix."_authors where aid='$aid'", $dbi);
TO
$result = sql_query("select radminsuper from ".$prefix."_authors where aid='$aid'");
Only registered users can see links on this board! Get registered or login to the forums!
I have made as you have said, but nothing. I receive an error like before: Parse error: syntax error, unexpected '"' in admin/modules/treasury.php on line 26
That version (V1.1.1) and all the others previous to it use $dbi in a lot of places and that is what is causing your problem.
You can install the tables to your *nuke database but just remember that Treasury does not use the nuke prefix, so don't add the prefix to the database config file in modules/Donations/x
I am writing a new module to handle donations, subscriptions and one-off type payments via PayPal (and possibly 2Ccheckout) but the way things are going I do not think it will be ready until late December.
To confirm your problem see this in mainfile.php
Code:
/*
* The following two lines of code were moved and commented out in RN 2.30.00 to "test the waters" on
* finding out what old modules/blocks/hacks/etc. are still using this SQL layer that is so
* old it should be obsoleted. If you really need these back, uncomment them back. We will keep this
* code this way for one more major release as well as keep the includes/sql_layer.php script.
*/
//@require_once(INCLUDE_PATH.'includes/sql_layer.php');
//$dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);
Joined: Aug 27, 2002 Posts: 16650 Location: Kansas
Posted:
Fri Nov 21, 2008 5:39 pm
redmanu wrote:
I have instaled the NT from
Only registered users can see links on this board! Get registered or login to the forums!
I have made as you have said, but nothing. I receive an error like before: Parse error: syntax error, unexpected '"' in admin/modules/treasury.php on line 26
thanks for your answer!
That's one of the many files I need to update. Thanks!
I got my treasury admin page working on my new RN2.3.0 install by uncommenting the $dbi part in the mainfile, works fine.. (havent tested it by actually doing a donation yet) I also read that this is very old code and you recommend $db logic instead..
do you have a link for tutorial on $db logic and how it works with treasury?
That looks fine to me, the path seems correct and the treasury test is clear so if not payment is shown within the treasury module the only thing it can be is the sql statement that deals with the transaction.
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum