Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
ghostgeek
Regular
Regular


Joined: Jan 14, 2005
Posts: 93

PostPosted: Mon Dec 05, 2005 9:23 am Reply with quote

Whew!

Took me a while to isolate this, but I've found the culprit.

I use the 4nalbum module for my site. Its an interactive media gallery that I've been using for some time. I've posted to the forums at the homesite for this module, but getting any sort of a response there seems to be the exception, not the norm.

I recently started using Nuke Treasury as well. It seems that the block-Donat_o_Meter.php has a conflict with 4nalbum.

Here is the code from my donat-o-meter block
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                                                                  */
/************************************************************************/

if (eregi("block-Donat_o_Meter.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

global $user, $cookie, $prefix, $db, $user_prefix;

include("modules/Donations/config.php");

if( !$ipnppd )
{
        $content = "There is an error in your SQL configuration. Check modules/Donations/config.php for the correct SQL settings";
}
else
{
        global $content;
       
        $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 business, 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 transactions'
                        . ' WHERE ( transactions.payment_date >= DATE_FORMAT( NOW( ) , \'%Y-%m-' . $swingd . '\' ) ) '
                        . ' GROUP BY business';
       
                $query_Recordset3 = 'SELECT custom AS name, option_selection1 as showname, ';
                $query_Recordset3 .= 'DATE_FORMAT( payment_date, \'%b-%e\' ) AS date, ';
                $query_Recordset3 .= 'CONCAT(\'$\',SUM(mc_gross)) AS amt ';
                $query_Recordset3 .= ' FROM transactions'
                        . ' WHERE ( transactions.payment_date >= DATE_FORMAT( NOW( ) , \'%Y-%m-' . $swingd . '\' ) ) '
                        . ' GROUP BY txn_id ORDER BY payment_date DESC';
        } else
        {
                $query_Recordset1 = ' SELECT business, 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 transactions'
                        . ' WHERE ( transactions.payment_date < DATE_FORMAT( NOW( ) , \'%Y-%m-' . $swingd . '\' ) ) AND transactions.payment_date > DATE_FORMAT( SUBDATE( NOW( ) , INTERVAL ' . $swingd . ' '
                        . ' DAY ) , \'%Y-%m-' . $swingd . '\' )'
                        . ' GROUP BY business ';
       
                $query_Recordset3 = 'SELECT custom AS name, option_selection1 as showname, ';
                $query_Recordset3 .= 'DATE_FORMAT( payment_date, \'%b-%e\' ) AS date, ';
                $query_Recordset3 .= 'CONCAT(\'$\',SUM(mc_gross)) AS amt ';
                $query_Recordset3 .= ' FROM transactions'
                        . ' WHERE ( transactions.payment_date < DATE_FORMAT( NOW( ) , \'%Y-%m-' . $swingd . '\' ) ) AND transactions.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 = mysql_query($query_Recordset1, $ipnppd) or die(mysql_error());
        $row_Recordset1 = mysql_fetch_assoc($Recordset1);
        //If there are not records, then get "null" data
        if( !$row_Recordset1 )
        {
                $query_Recordset1 = ' SELECT \'\' AS business, \'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'; 
                $Recordset1 = mysql_query($query_Recordset1, $ipnppd) or die(mysql_error());
                $row_Recordset1 = mysql_fetch_assoc($Recordset1);
        }
         
        // Get the goal
        $query_Recordset2 = $sql = 'SELECT * FROM config WHERE name=\'goal\' AND subtype=\'' . $row_Recordset1['mon_short'] . '\'';
        $Recordset2= mysql_query($query_Recordset2, $ipnppd) or die(mysql_error());
        $row_Recordset2 = mysql_fetch_assoc($Recordset2);
       
        // Set our remaining template vars
        $DM_MON = $row_Recordset1[mon];
        $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
        $tmpl_file = "modules/Donations/Donatometer.html";
        $thefile = implode("", file($tmpl_file));
        $thefile = addslashes($thefile);
        $thefile = "\$r_file=\"".$thefile."\";";
        eval($thefile);
        $content = $r_file;
       
        // Do we want to display the donators?
        if(is_numeric($dmlen) && $dmlen >= 0 )
        {
                // Get the list of donators
                $Recordset3= mysql_query($query_Recordset3, $ipnppd) or die(mysql_error());
       
                $content .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">"
                                  . "<tr><td width=\"100%\"><hr></td><td  width=\"11\"><a href=\"javascript:openwindow()\">&copy;</a></td></tr>"
                                  . "<tr><td align=\"center\" colspan=\"2\"><b><u>Donations</u></b></td></tr>";
       
                // List all the donators
                $i = 0;
                while ( ($row_Recordset3 = mysql_fetch_assoc($Recordset3)) && ($i != $tr_config[dm_num_don]) )
                {
                        // Refunded transactions will show up with $0 amount
                        if( $row_Recordset3['amt'] > "$0" )
                        {
                                // Observe the user's wish regarding revealing their name
                                if( strcmp($row_Recordset3['showname'],"Yes") == 0)
                                        $name = $row_Recordset3['name'];
                                else
                                        $name = "Anonymous";
                               
                                if( !$dmshowamt && !$dmshowdate )
                                        $dmalign = "center";
                                else
                                        $dmalign = "right";
                                $content .= "<tr><td width=\"100%\" align=\"$dmalign\" colspan=\"2\">";
                                $content .=  $name;
                                if( $dmshowamt )
                                        $content .= " $row_Recordset3[amt]";
                                if( $dmshowdate )
                                        $content .= " $row_Recordset3[date]";
                                $content .= "</td></tr>";
                        }
                        $i++;
                } ;
                $content .= "</table>";
        }
}

?>



And here is the code from one of the pages in the 4nalbum module that appears to be conflicting...


Code:


<?

/************************************************************************/
/* 4nAlbum Version 0.92 (German & English)                              */
/* for phpNUKE Version 6.5 - 7.0 (http://phpnuke.org)                   */
/* ==================================================================== */
/* By WarpSpeed (Marco Wiesler) (warpspeed@4thDimension.de) @ Nov/2oo3  */
/* http://www.warp-speed.de @ 4thDimension.de Networking                */
/* ==================================================================== */
/* Based on:                                                            */
/* MyGallery v2.79                                                      */
/* ===============                                                      */
/* Author: MarsIsHere                                                   */
/* Web: http://www.MarsIsHere.net                                       */
/* ==================================================================== */
/* 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.       */
/************************************************************************/

/*----------- ENDE DER EINSTELLUNGEN - END OF SETTINGS -----------*/

function top() {
        global $font, $galleryvar, $baseurl, $bgcolor1, $bgcolor2, $user, $prefix, $name, $adminpath;

        galleryHeader();
        $result = mysql_query("select pid, name, counter, rate, votes, visible from $prefix"._4nalbum_pictures." p, $prefix"._4nalbum_categories." c WHERE p.gid=c.gallid AND c.visible>0 order by counter DESC, rate DESC");
        $result1 = mysql_query("select pid, name, counter, rate, votes, visible from $prefix"._4nalbum_pictures." p, $prefix"._4nalbum_categories." c WHERE p.gid=c.gallid AND c.visible>0 order by rate DESC, votes ASC, counter DESC");

        $nav = navigationGall();
         if ($galleryvar['allowrate'])
                 $col = 4;
         else
                $col = 3;
        OpenTable();
         echo "
        <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
          <tr>
                  <td colspan=3 align=\"center\">
                    $nav<br>
                  </td>
          </tr>
          <tr>
             <td>&nbsp;</td>
             <td width=\"70%\" align=\"center\">";
        echo '<b>'._GALTOP10H.'</b><br><br>
        <table width="400" align="center" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
        <tr><td>
        <table width="100%" align="center" border="0" cellspacing="0" cellpadding="3" bgcolor="'.$bgcolor1.'">
        <tr>
          <td colspan="'.$col.'" width="100%" align="center"  bgcolor="'.$bgcolor2.'"><font class="'.$font['title'].'">'._GALTOP10.'</font><br><font class="'.$font['normal'].'">'._GALTOP10HITS.'</font></td>
        </tr>
        <tr>
          <td align="center" colspan="'.$col.'"></td>
        </tr>
        <tr>
          <td align="center"><font class="'.$font['normal'].'">'._GALTOPPOS.'</font></td>
          <td align="center"><font class="'.$font['normal'].'">'._GALTOPHITS.'</font></td>';
        if ($allowrate) echo '<td align="center"><font class="'.$font['title'].'">'._GALTOPRATING.'</font></td>';
          echo '<td align="left"><font class="'.$font['normal'].'">'._GALTOPMEDIA.'</font></td>
        </tr>';
        $pos = 1;
        while((list($pid, $name, $counter, $rate, $votes, $visible) = mysql_fetch_array($result)) && $pos<=10) {

                echo '
                <tr>
                <td align="center"><font class="'.$font['normal'].'">'.$pos.'</font></td>
                <td align="center"><font class="'.$font['normal'].'">'.$counter.'</font></td>';
                if ($allowrate) echo '<td align="center"><font class="'.$font['normal'].'">'.$rate.'</font></td>';
                if ($visible==1) {
                        if (is_user($user))
                                echo "<td align=\"left\"><a class=\"".$font['normal']."\" href=\"".$baseurl."&amp;do=showpic&amp;pid=$pid\">$name</a></td>";
                        else
                                echo "<td align=\"left\"><font class=\"".$font['normal']."\"> $name (*)</font></td";
                }
                else
                        echo "<td align=\"left\"><a class=\"".$font['normal']."\" href=\"".$baseurl."&amp;do=showpic&amp;pid=$pid\">$name</a></td>";
                echo "</tr>";
                $pos += 1;
        } // While
        echo "</table></td></tr></table>";
        echo "<br><br>";
        if ($galleryvar['allowrate']) {
// pk
                       echo '
                <table width="400" align="center" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
                <tr><td>
                <table width="100%" align="center" border="0" cellspacing="0" cellpadding="3" bgcolor="'.$bgcolor1.'">
                <tr>
                  <td colspan="4" width="100%" align="center" bgcolor="'.$bgcolor2.'"><font class="'.$font['title'].'">'._GALTOP10.'</font><br><font class="'.$font['normal'].'">'._GALTOP10RATING.'</font></td>
                </tr>
                <tr>
                  <td colspan="4"></td>
                </tr>
                <tr>
                  <td align="center"><font class="'.$font['normal'].'">'._GALTOPPOS.'</font></td>
                  <td align="center"><font class="'.$font['normal'].'">'._GALTOPRATING.'</font></td>
                  <td align="center"><font class="'.$font['normal'].'">'._GALTOPVOTES.'</font></td>
                  <td align="left"><font class="'.$font['normal'].'">'._GALTOPMEDIA.'</font></td>
                </tr>';
                $pos = 1;
                while((list($pid, $name, $counter, $rate, $votes, $visible) = mysql_fetch_array($result1)) && $pos<=10) {
                        if ($visible==1) {
                                if (is_user($user))
                                        echo '
                                        <tr>
                                        <td align="center"><font class="'.$font['normal'].'">'.$pos.'</font></td>
                                        <td align="center"><font class="'.$font['normal'].'">'.$rate.'</font></td>
                                        <td align="center"><font class="'.$font['normal'].'">'.$votes.'</font></td>
                                        <td align="left"><a class="'.$font['normal'].'" href="'.$baseurl.'&amp;do=showpic&amp;pid='.$pid.'">'.$name.'</a></font></td>
                                        </tr>';
                                else
                                        echo '
                                        <tr>
                                        <td align="center"><font class="'.$font['normal'].'">'.$pos.'</font></td>
                                        <td align="center"><font class="'.$font['normal'].'">'.$rate.'</font></td>
                                        <td align="center"><font class="'.$font['normal'].'">'.$votes.'</font></td>
                                        <td align="left"><font class="'.$font['normal'].'">'.$name.' (*)</font></td>
                                        </tr>';
                        }
                        else
                                echo '
                                <tr>
                                <td align="center"><font class="'.$font['normal'].'">'.$pos.'</font></td>
                                <td align="center"><font class="'.$font['normal'].'">'.$rate.'</font></td>
                                <td align="center"><font class="'.$font['normal'].'">'.$votes.'</font></td>
                                <td align="left"><a class="'.$font['normal'].'" href="'.$baseurl.'&amp;do=showpic&amp;pid='.$pid.'">'.$name.'</a></td>
                                </tr>';

                        $pos += 1;
                } // While
                echo "</table>
                 </td>
                </tr></table>";
                if (!is_user($user))
                        print '<br><center><font class="'.$font['tiny'].'"><i>'._GALCATMEMBERS.'</i></font></center>';

        }
        echo "<br></td><td>&nbsp;</td>
        </tr></table>";
        CloseTable();
        galleryFooter();

}

?>


Any ideas where the problem is and how I might fix it?

Thanks again as always!
 
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6383

PostPosted: Mon Dec 05, 2005 11:31 am Reply with quote

What kind of conflict? There is a widely reported issue with the Nuke Treasury block not properly initializing the $content variable.

_________________
I google, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
ghostgeek
PostPosted: Mon Dec 05, 2005 11:42 am Reply with quote

with the block disabled, I can browse images and see the top level categories. With it enabled, no image thumbnails display.
 
ghostgeek
PostPosted: Wed Dec 07, 2005 4:35 am Reply with quote

Any ideas on this anyone? If indeed this is related to the $content variable problem as discribed above, is there a work around for it?
 
ghostgeek
PostPosted: Thu Dec 15, 2005 10:45 am Reply with quote

As a wise person once said, "there's more than one way to skin a cat"...

Since no one had given me a possible solution, I came up with one on my own Razz

I figured that I might be able to shield the conflicting code by placing the block within an Iframe, and then calling that Iframe into a block on its own. I was right! Smile

Here is how I did this.

I called the block on a blank page all by itself, with no header or footer info - just the blocks output. To do this, I created a new file called "donate_iframe.php"...

Code:


<?php

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
        echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n\n\n";
        echo "<body bgcolor=\"#000000\" topmargin=\"0\" leftmargin=\"0\">";
$index = 0;
        OpenTable();
        include("blocks/block-Donat_o_Meter.php");
        echo $content;
        CloseTable();

?>


the bgcolor=\"#000000\" is set to black - my sites background color, so that may need to be changed accordingly.

Next, I created block that calls this page as an Iframe within the block...


Code:


<?php
if (eregi("block-Block_Creator.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
$content .= "<iframe src=\"http://mysite.com/donate_iframe.php\" marginwidth=\"0\" marginheight=\"0\" width=\"146\" height=\"452\" border=\"0\" frameborder=\"0\" style=\"border:none;\" scrolling=\"no\"></iframe>";
?>


The one caviet - clicking on the Donat-o-meter link within the iframe obviously tries to open the donations page WITHIN the iframe, so I simply altered the Javascript link within the modules "Donatometer.html" file to open in a new window changing the code on the 3'rd line to this...

Code:


function openwindow(){
  {popupWin = window.open ("modules/Donations/info.html","NukeTreasury","toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=440,height=330")};
}


and line 15 to this...

Code:


        <a href="donations.html" target="_blank">



to open the page in a new browser window when its clicked on.

Perhaps not the most elegant solution, but it works.

I'm sure there is an easier way to do this, but I'm not a programmer (nor do I play one on TV). Razz Again, not the most elegant solution, but I can take donations once again on my site, AND my media galleries are working at the same time - thats what counts!

To the resident Nuke gurus - please feel free to streamline this proceedure, should anyone else ever run into this problem with this or another block. MAYbe someone could even be so nice as to write a new block called "block-within-a-block.php" to address this. HINT HINT!! Wink
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©