Author
Message
kd8hho Worker Joined: Mar 30, 2009 Posts: 105
Posted:
Wed Jul 15, 2009 11:10 am
ok. this block was a port from the old Nukestyles advanced downloads and was converted by them at nukecode to work with nsn-downloads.
well im trying to get this to work on Ravennuke and not having much luck. (conversion went wrong somewhere?)
here is the code from the block
Code:
if(!defined('NUKE_FILE')) {
Header("Location: ../index.php");
die();
}
global $prefix, $db;
$blkh = 10; // Number of lines high
$blkw = 20; // Number of characters wide 0 = unused
$scron = 1; // Turn scrolling on by setting to 1
$scrdr = up; // Scroll direction (up, down, left, or right)
$scrhg = 200; // Scroller height in pixels
$scrwd = 170; // Scroller width in pixels
$speed = 2; // Speed Of Scroll
$most = "Top Downloads";
$latest = "Newest Downloads";
$totalfiles = "Total Files";
$totalcategories = "Total Categories";
$totaldownloads = "Total Downloads";
$totalserved = "Total Served";
// Total Files
$result = $db->sql_query("select * from ".$prefix."_nsngd_downloads");
$files = $db->sql_numrows($result);
// Total Categories
$result = $db->sql_query("select * from ".$prefix."_nsngd_categories");
$cats = $db->sql_numrows($result);
// Total Downloads
$result = $db->sql_query("select hits from ".$prefix."_nsngd_downloads");
$a = 1;
while(list($hits) = $db->sql_fetchrow($result)) {
$total_hits = $total_hits + $hits;
$a++;
}
$result=sql_query("select lid, hits from $prefix"._nsngd_downloads." order by lid");
$dresult=0;
while(list($lid, $hits) = $db->sql_fetchrow($result)) {
$dresult = $dresult + $hits;
}
$result = $db->sql_query("select * from $prefix"._nsngd_downloads."");
$numrows = $db->sql_numrows($result);
$result = $db->sql_query("select sum(filesize*hits) as serv from $prefix"._nsngd_downloads."");
while(list($serv) = $db->sql_fetchrow($result)) {
$served = $serv;
}
$tb = 1024*1024*1024*1024;
$gb = 1024*1024*1024;
$mb = 1024*1024;
$kb = 1024;
if ($served >= $tb){
$mysizes = sprintf ("%01.2f",$served/$tb) . " TB ";
} elseif ($served >= $gb) {
$mysizes = sprintf ("%01.2f",$served/$mb) . " GB ";
} elseif ($served >= $mb) {
$mysizes = sprintf ("%01.2f",$served/$mb) . " MB ";
} elseif ($served >= $kb) {
$mysizes = sprintf ("%01.2f",$served/$kb) . " KB ";
} else{
$mysizes = $served . " B ";
}
$content .= "$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br> $totalserved: $mysizes<br>";
if ($scron == 1) {
$content .= "<marquee behavior='scroll' direction='$scrdr' height='$scrhg' width='$scrwd' scrollamount='$speed' scrolldelay='100' onMouseOver='this.stop()' onMouseOut='this.start()'><br>";
}
//Latest Downloads
$content .= "<b>".$latest."</b><br>";
$a = 1;
$result = $db->sql_query("select lid, title, hits from $prefix"._nsngd_downloads." order by date DESC limit 0,$blkh");
while(list($lid, $title, $hits) = $db->sql_fetchrow($result)) {
$title2 = ereg_replace("_", " ", $title);
$title = strtr($title, " ()", "_[]");
if ($blkw > 0) { if (strlen($title2) > $blkw) { $title2 = substr($title2, 0, $blkw); } }
if ($a < 10) { $content .= "0$a: "; } else { $content .= "$a: "; }
$content .= "<a href='modules.php?name=Downloads&op=getit&lid=$lid'>$title2</a><br>[Hits: $hits]<br>";
$a++;
}
//Top Downloads
$content .= "<br><b>".$most."</b><br>";
$a = 1;
$result = $db->sql_query("select lid, title, hits from $prefix"._nsngd_downloads." order by hits DESC limit 0,$blkh");
while(list($lid, $title, $hits) = $db->sql_fetchrow($result)) {
$title2 = ereg_replace("_", " ", $title);
$title = strtr($title, " ()", "_[]");
if ($blkw > 0) { if (strlen($title2) > $blkw) { $title2 = substr($title2, 0, $blkw); } }
if ($a < 10) { $content .= "0$a: "; } else { $content .= "$a: "; }
$content .= "<a href='modules.php?name=Downloads&op=getit&lid=$lid'>$title2</a><br>[Hits: $hits]<br>";
$a++;
}
if ($scron == 1) {
$content .= "</marquee>";
}
?>
any ideas? when this block is active it dose not show the block or any other block after it.
nuken RavenNuke(tm) Development Team Joined: Mar 11, 2007 Posts: 1435 Location: North Carolina
Posted:
Wed Jul 15, 2009 11:19 am
Here ya go, this should work.
Code:
<?php
if(!defined('NUKE_FILE')) {
Header("Location: ../index.php");
die();
}
global $prefix, $db;
$blkh = 10; // Number of lines high
$blkw = 20; // Number of characters wide 0 = unused
$scron = 1; // Turn scrolling on by setting to 1
$scrdr = up; // Scroll direction (up, down, left, or right)
$scrhg = 200; // Scroller height in pixels
$scrwd = 170; // Scroller width in pixels
$speed = 2; // Speed Of Scroll
$most = "Top Downloads";
$latest = "Newest Downloads";
$totalfiles = "Total Files";
$totalcategories = "Total Categories";
$totaldownloads = "Total Downloads";
$totalserved = "Total Served";
// Total Files
$result = $db->sql_query("select * from ".$prefix."_nsngd_downloads");
$files = $db->sql_numrows($result);
// Total Categories
$result = $db->sql_query("select * from ".$prefix."_nsngd_categories");
$cats = $db->sql_numrows($result);
// Total Downloads
$result = $db->sql_query("select hits from ".$prefix."_nsngd_downloads");
$a = 1;
while(list($hits) = $db->sql_fetchrow($result)) {
$total_hits = $total_hits + $hits;
$a++;
}
$result=$db->sql_query("select lid, hits from $prefix"._nsngd_downloads." order by lid");
$dresult=0;
while(list($lid, $hits) = $db->sql_fetchrow($result)) {
$dresult = $dresult + $hits;
}
$result = $db->sql_query("select * from $prefix"._nsngd_downloads."");
$numrows = $db->sql_numrows($result);
$result = $db->sql_query("select sum(filesize*hits) as serv from $prefix"._nsngd_downloads."");
while(list($serv) = $db->sql_fetchrow($result)) {
$served = $serv;
}
$tb = 1024*1024*1024*1024;
$gb = 1024*1024*1024;
$mb = 1024*1024;
$kb = 1024;
if ($served >= $tb){
$mysizes = sprintf ("%01.2f",$served/$tb) . " TB ";
} elseif ($served >= $gb) {
$mysizes = sprintf ("%01.2f",$served/$mb) . " GB ";
} elseif ($served >= $mb) {
$mysizes = sprintf ("%01.2f",$served/$mb) . " MB ";
} elseif ($served >= $kb) {
$mysizes = sprintf ("%01.2f",$served/$kb) . " KB ";
} else{
$mysizes = $served . " B ";
}
$content .= "$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br> $totalserved: $mysizes<br>";
if ($scron == 1) {
$content .= "<marquee behavior='scroll' direction='$scrdr' height='$scrhg' width='$scrwd' scrollamount='$speed' scrolldelay='100' onMouseOver='this.stop()' onMouseOut='this.start()'><br>";
}
//Latest Downloads
$content .= "<b>".$latest."</b><br>";
$a = 1;
$result = $db->sql_query("select lid, title, hits from $prefix"._nsngd_downloads." order by date DESC limit 0,$blkh");
while(list($lid, $title, $hits) = $db->sql_fetchrow($result)) {
$title2 = ereg_replace("_", " ", $title);
$title = strtr($title, " ()", "_[]");
if ($blkw > 0) { if (strlen($title2) > $blkw) { $title2 = substr($title2, 0, $blkw); } }
if ($a < 10) { $content .= "0$a: "; } else { $content .= "$a: "; }
$content .= "<a href='modules.php?name=Downloads&op=getit&lid=$lid'>$title2</a><br>[Hits: $hits]<br>";
$a++;
}
//Top Downloads
$content .= "<br><b>".$most."</b><br>";
$a = 1;
$result = $db->sql_query("select lid, title, hits from $prefix"._nsngd_downloads." order by hits DESC limit 0,$blkh");
while(list($lid, $title, $hits) = $db->sql_fetchrow($result)) {
$title2 = ereg_replace("_", " ", $title);
$title = strtr($title, " ()", "_[]");
if ($blkw > 0) { if (strlen($title2) > $blkw) { $title2 = substr($title2, 0, $blkw); } }
if ($a < 10) { $content .= "0$a: "; } else { $content .= "$a: "; }
$content .= "<a href='modules.php?name=Downloads&op=getit&lid=$lid'>$title2</a><br>[Hits: $hits]<br>";
$a++;
}
if ($scron == 1) {
$content .= "</marquee>";
}
?>
kd8hho Worker Joined: Mar 30, 2009 Posts: 105
Posted:
Wed Jul 15, 2009 1:11 pm
well that worked. lol thanks
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