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
NeapolitanWorld
Involved
Involved


Joined: Nov 06, 2005
Posts: 337
Location: Los Angeles, USA

PostPosted: Fri Jul 24, 2009 12:50 am Reply with quote

Hello everyone,
I have a nice coppermine block "gallery stats" that works but for some reason it duplicates the results/content on the block Confused

Gallery
Albums: 400
Pictures: 11771
· Views: 1519568
· Votes: 45546
· Comments: 50408
Upload approval: 0
Batch add pictures
Review Comments
Groups
Users
Albums
Categories
Config
Gallery
Albums: 400
Pictures: 11771
· Views: 1519568
· Votes: 45546
· Comments: 50408
Upload approval: 0
Batch add pictures
Review Comments
Groups
Users
Albums
Categories
Config

I'm hoping one of you experts in this can take a quick glance and see if you see anything obvious in the block that is duplicating Very Happy

Code:
if (eregi("block-CPG", $_SERVER['PHP_SELF'])) {

    Header("Location: index.php");
    die();
}
define('NO_HEADER', true);
global $prefix, $db, $CONFIG, $Version_Num, $cat, $cpg_dir;

$cpg_dir = "coppermine";
$cat = is_numeric($cat) ? $cat : 0;

$cpg_block = true;
require("modules/" . $cpg_dir . "/include/load.inc");
$cpg_block = false;

$content = "";

$result = $db->sql_query("SELECT dirname, prefix FROM ".$prefix."_cpg_installs");
while ($row = $db->sql_fetchrow($result)) {
    if ($content != "") $content .= "<hr />";
    $cpgdir = $row[0];
    $cpgprefix = $row[1];
    $cpgtitle = $db->sql_fetchrow($db->sql_query("SELECT custom_title FROM " . $prefix . "_modules WHERE title='$cpgdir'"));
    if ($cpgtitle[0] == '') $cpgtitle[0] = $cpgdir;
    $content .= "<center><b>" . $cpgtitle[0] . "</b></center>";
    $content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;" . ALBUMS . ": " . cpg_tablecount($cpgprefix . "albums", "count(*)") . "<br />";
    $content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;" . PICTURES . ": " . cpg_tablecount($cpgprefix . "pictures", "count(*)") . "<br />";
    $num = cpg_tablecount($cpgprefix . "pictures", "sum(hits)");
    if (!is_numeric($num)) $num = 0;
    $content .= "<strong><big>&nbsp;&nbsp;&middot;</big></strong>&nbsp;" . PIC_VIEWS . ": $num<br />";
    $num = cpg_tablecount($cpgprefix . "pictures", "sum(votes)");
    if (!is_numeric($num)) $num = 0;
    $content .= "<strong><big>&nbsp;&nbsp;&middot;</big></strong>&nbsp;" . PIC_VOTES . ": $num<br />";
    $content .= "<strong><big>&nbsp;&nbsp;&middot;</big></strong>&nbsp;" . PIC_COMMENTS . ": " . cpg_tablecount($cpgprefix . "comments", "count(*)") . "<br />";
    if (GALLERY_ADMIN_MODE) {
        $num = $db->sql_fetchrow($db->sql_query("SELECT count(*) FROM " . $cpgprefix . "pictures WHERE approved='NO'"));
        if ($name != $cpgdir) $cat = 0;
        $content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=editpics&amp;mode=upload_approval").'">' . UPL_APP_LNK . "</a>: " . $num[0] . "<br />" .
                    "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=searchnew").'">' . SEARCHNEW_LNK . "</a><br />" .
                    "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=reviewcom").'">' . COMMENTS_LNK . "</a><br />" .
                    "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=groupmgr").'">' . GROUPS_LNK . "</a><br />" .
                    "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=usermgr").'">' . USERS_LNK . "</a><br />" .
                    "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=albmgr&amp;cat=$cat").'">' . ALBUMS_LNK . "</a><br />" .
                    "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=catmgr").'">' . CATEGORIES_LNK . "</a><br />";
        if (is_admin($admin)) $content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=config").'">' . CONFIG_LNK . "</a>";
    } else if (USER_ADMIN_MODE) {
        $content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=albmgr").'">' . ALBMGR_LNK . "</a><br />" .
                    "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=modifyalb").'">' . MODIFYALB_LNK . "</a><br />" .
                    "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"".getlink("$cpgdir&amp;file=profile&amp;op=edit_profile").'">' . MY_PROF_LNK . "</a>";
    }
}
// $ob = ob_get_contents();
// ob_end_clean();
?>


Thanks Very Happy

jc
 
View user's profile Send private message
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Fri Jul 24, 2009 1:12 am Reply with quote

Probably you have more than one row in the PREFIX_cpg_installs table, which is causing it to loop. I don't know why it's coded that way

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
NeapolitanWorld
PostPosted: Fri Jul 24, 2009 11:37 am Reply with quote

Hi evaders that was exactly it on my coppermine table nuke_cpg_installs I had a duplicate:
1 coppermine nuke_cpg_ 1.3.0
2 coppermine nuke_cpg_ 1.3.0

Removed the 2nd and it's working perfect Very Happy
You da man worship

Thanks!
jc
 
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 ©