Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Other
Author Message
blastwood
New Member
New Member



Joined: Sep 11, 2010
Posts: 12
Location: Bucharest

PostPosted: Thu Oct 06, 2011 4:47 pm Reply with quote

I want to convert a block of code in php nuke block is attached to the RN in May. I tried myself but I could not.

I have not posted in the "Blocks" because I could not create a new topic .is saw error

Code:
<?php


/************************************************************************/
/* Advanced Downloads Block                                             */
/* ===========================                                          */
/*                                                                      */
/* This is basically just an edit of the original block by Francisco.   */
/* Even though this is heavly edited, I think he deserves credit, so:   */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* 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.       */
/************************************************************************/
/*                                                                      */
/* Copyright © 2002 by Michael Bacoz                                    */
/* http://www.fatal-instinct.com                                        */
/*                                                                      */
/************************************************************************/

/************************/
/*      Variables       */
/************************/

$downloadstoshow = 10;
$usemarquee = 1;
$scrolldirection = "Up";

/********************************************/
/* Edit the following to suit your language */
/********************************************/

$newest = "Newest Files";
$most = "Most Downloaded";
$latest = "Latest Downloads";
$lastupdated = "Last Updated";
$totalfiles = "Total Files";
$totalcategories = "Total Categories";
$totaldownloads = "Total Downloads";
$hitstext = "Downloaded";
$addedon = "Added on";

/************************/
/*     End Variables    */
/************************/

// Make sure people don't try and access it directly
if (eregi("block-Advanced_Downloads.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

global $prefix, $db, $sitename;

// Total Files
$result = $db->sql_query("select * from ".$prefix."_downloads_downloads");
$files = $db->sql_numrows($result);

// Total Categories
$result2 = $db->sql_query("select * from ".$prefix."_downloads_categories");
$cats = $db->sql_numrows($result2);

// Total Downloads
$result3 = $db->sql_query("select hits from ".$prefix."_downloads_downloads");

$a = 1;
while(list($hits) = $db->sql_fetchrow($result3)) {
          $total_hits = $total_hits + $hits;
                $a++;
}

$content .= "<b>$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br></b>";

if ($usemarquee == 1) {
        $content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" Height=\"200\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}

// Latest added
$content .= "<center><br><img src=\"images/red_dot.gif\">&nbsp;<b><u>$newest</u></b>&nbsp;<img src=\"images/red_dot.gif\"><br></center>";
$a = 1;
$result4 = $db->sql_query("select lid, title, date, hits from ".$prefix."_downloads_downloads order by date DESC limit 0,$downloadstoshow");

while(list($lid, $title, $date, $hits) = $db->sql_fetchrow($result4)) {
   setlocale (LC_TIME, $locale);
   ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $date, $datetime);
   $datetime = strftime("%d-%b-%Y", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
   $datetime = ucfirst($datetime);
   $transfertitle = str_replace (" ", "_", $title);
   $title2 = ereg_replace("_", " ", $title);
          $content .= "<img src=\"images/icon_ultima.gif\">&nbsp;$a: <a href=\"modules.php?name=Downloads&amp;d_op=viewdownloaddetails&amp;lid=$lid&amp;ttitle=$transfertitle\"><b>$title2</b></a>&nbsp;($hits)<br>[$addedon: <b>$datetime</b>]<br><hr>";
                $a++;
}

// Last updated
    $sql_t = "SELECT * FROM ".$prefix."_bbconfig";
    $result_t = $db->sql_query($sql_t);
    while ( $row_t = $db->sql_fetchrow($result_t) )
    {
    $board_config[$row_t['config_name']] = $row_t['config_value'];
    }
$content .= "<center><br><img src=\"images/green_dot.gif\">&nbsp;<b><u>$lastupdated</u></b>&nbsp;<img src=\"images/green_dot.gif\"><br></center>";
$a = 1;
$result5 = $db->sql_query("select lid, title, hits, uddate from ".$prefix."_downloads_downloads WHERE uddate!='0' order by uddate DESC limit 0,$downloadstoshow");
while(list($lid, $title, $hits, $uddate) = $db->sql_fetchrow($result5)) {
   $udtime =  gmdate("M d, Y", $uddate + (3600 * $board_config['board_timezone']));
        $transfertitle = str_replace (" ", "_", $title);
        $title2 = ereg_replace("_", " ", $title);
          $content .= "<img src=\"images/icon_ultima.gif\">&nbsp;$a: <a href=\"modules.php?name=Downloads&amp;d_op=viewdownloaddetails&amp;lid=$lid&amp;ttitle=$transfertitle\"><b>$title2</b></a>&nbsp;($hits)<br>[$lastupdated: <b>$udtime</b>]<br><hr>";
                $a++;
}

// Most downloaded
$content .= "<center><br><img src=\"images/popular.gif\">&nbsp;<b><u>$most</u></b>&nbsp;<img src=\"images/popular.gif\"><br></center>";
$a = 1;
$result6 = $db->sql_query("select lid, title, hits from ".$prefix."_downloads_downloads order by hits DESC limit 0,$downloadstoshow");

while(list($lid, $title, $hits) = sql_fetch_row($result6)) {
    if ($hits == 1) {
    $hitstimes = "Time";
    } else {
    $hitstimes = "Times";
    }
    $transfertitle = str_replace (" ", "_", $title);
    $title2 = ereg_replace("_", " ", $title);
    $content .= "<img src=\"images/icon_ultima.gif\">&nbsp;$a: <a href=\"modules.php?name=Downloads&amp;d_op=viewdownloaddetails&amp;lid=$lid&amp;ttitle=$transfertitle\"><b>$title2</b></a><br>[$hitstext: <b>$hits</b> $hitstimes]<br><hr>";
    $a++;
}

$content .= "</Marquee><br><center><a href=\"downloads.html\"><b>$sitename<br>"._UDOWNLOADS."</b></a><br><br></center>";

?>
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Fri Oct 07, 2011 7:17 am Reply with quote

Technically, this should work just fine although depending upon the PHP version you are using and your error logging settings, you may get some PHP warnings in your logs. What is not working for you? Please be specific on the issue.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
blastwood







PostPosted: Fri Oct 07, 2011 11:38 am Reply with quote

When the block is active not appear block sites and does not charge foter page
javascript is to blame?

PS : How to change the keyword in the RN? I searched but I found from what I read on wiki it is generated automatically?
 
montego







PostPosted: Sat Oct 08, 2011 8:48 am Reply with quote

blastwood, regarding the block. There is no javascript in this block. We need to know what error is being generated, so please do this:

1. In config.php, set $display_errors to true, so it looks like this:

$display_errors = true;

2. Make sure you save the file and then try the site again. Write down any errors displayed on the page.

3. Change it back to false so the errors will not show anymore.

Report any errors here. If no errors, then you'll need to try this:

1. Make sure the following file has write permissions as 666:

rnlogs/dblog

2. Open rnconfig.php and set the $loglevel variable to 1.

$loglevel = 1;

3. Try your site again and note any errors reported in the dblog.

Regarding your other question, please post your question in a separate thread. Only one topic per thread please. Thanks.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Other

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 ©