PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
eldorado
Involved
Involved


Joined: Sep 10, 2008
Posts: 366
Location: France

PostPosted: Sun Mar 08, 2009 5:03 am Reply with quote Back to top

Just got my hands on the top10 downloads block and just for the fun I used some ideas from the collapsible forum block.
Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* 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.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/
/************************************************************************/
/* Additional code clean-up, performance enhancements, and W3C and      */
/* XHTML compliance fixes by Raven and Montego.                         */
/************************************************************************/
/* Some HTML addons in this script can cause the block not to be W3C      */
/* compliant                                                                                  */

if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');
   die();
}

global $prefix, $db;

function random_color(){
    mt_srand((double)microtime()*1000000);
    $c = '';
    while(strlen($c)<6){
        $c .= sprintf("%02X", mt_rand(0, 255));
    }
    return $c;
}

//Additionals Configs
$SkipSubmitter = "'eldorado','montego','gazzasan','loki'"; //these are the fools who's downloads won't be shown.Rofl I'm kidding guys :P
$MaxDownloads = 10; //Input Max Downloads to show up in the block
$Font_Size_Max = 6; //Fancy Styling the thing.
$Font_Size_Min = 1; //Set minimum font for maximum visibility

$content = '';
$n = 1;
$result = $db->sql_query("SELECT lid, title FROM ".$prefix."_downloads_downloads WHERE submitter NOT IN ($SkipSubmitter) ORDER BY hits DESC LIMIT 0,$MaxDownloads");
   if($result==''){$content = "Error in MYSQL script.Either you don't have downloads or the config of the block is flawed.";
      }
while (list($lid, $title) = $db->sql_fetchrow($result)) {
   
   $size = $Font_Size_Max-$n+1;
      if($size < $Font_Size_Min){$size = $Font_Size_Min;
         }
   $lid = intval($lid);
   $title2 = htmlspecialchars(str_replace('_', ' ', $title), ENT_QUOTES, _CHARSET);
   $content .= '<strong><big>&middot;</big></strong>&nbsp;<a href="modules.php?name=Downloads&amp;d_op=viewdownloaddetails&amp;lid='.$lid.'"><font color="'.random_color().'" "size="'.$size.'"><u>'.$title2.'</u></font></a>&nbsp;';
   ++$n;
}
error_reporting($currentReporting);
?>


The idea behind this was to create a sort of height hierarchy between the top downloads.
edit:This script is unfinished .I want to add the RSS tag from nukefeed but would be cool if I had some newer Ideas.
The height hierarchy can easily be shutdown if the $font_size_max and $font_size_min are set to the same value.
View user's profile Send private message Visit poster's website MSN Messenger
montego
Former Admin in Good Standing


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

PostPosted: Mon Apr 13, 2009 6:24 am Reply with quote Back to top

How is the script coming along? You mentioned that it was "unfinished".
View user's profile Send private message Visit poster's website
eldorado
Involved
Involved


Joined: Sep 10, 2008
Posts: 366
Location: France

PostPosted: Mon Apr 13, 2009 8:02 am Reply with quote Back to top

Well I do have some problems with the colors not displaying in firefox. And I still need to add some additionnal config layers to make it pro Very Happy
Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* 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.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/
/************************************************************************/
/* Additional code clean-up, performance enhancements, and W3C and      */
/* XHTML compliance fixes by Raven and Montego.                         */
/************************************************************************/
/* Modded for me and perhaps for RN                                     */

if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');
   die();
}

global $prefix, $db;
//Additionals Configs
$SkipSubmitter = "'eldorado','montego','gazzasan','loki'"; //these are the fools who's downloads won't be shown.Rofl I'm kidding guys :P
$MaxDownloads = 10; //Input Max Downloads to show up in the block
$Font_Size_Max = 6; //Fancy Styling the thing.
$Font_Size_Min = 1; //Set minimum font for maximum visibility
$Font_Color = 1; // Allow Random Colours.Not Working in Gecko Engine for some reason.
$backend_DL_XML = 'feeds-3-rss20.xml'; //URL of your Downloads Feed.Assumed in root directory. If it's empty then it won't show up.Remember to create it with nukefeed.

function random_color(){
    mt_srand((double)microtime()*1000000);
    $c = '';   //Init.
    while(strlen($c)<6){  //Colours = 6 numbers or letters
        $c .= sprintf("%02X", mt_rand(0, 255));
    }
   if($Font_Color==1){
               return $c;
                  }
}
$ContentXML= ''; // XML button.
if (strlen($backend_DL_XML)>0) $ContentXML = '<center><a href="'.$backend_DL_XML.'" title="Downloads Backend"><img src="images/blocks/xmlicon.gif" alt="" border="0" /></a></center>';


$content = '';
$result = $db->sql_query("SELECT lid, title FROM ".$prefix."_downloads_downloads WHERE submitter NOT IN ($SkipSubmitter) ORDER BY hits DESC LIMIT 0,$MaxDownloads");
if($result==''){$content = "Error in MYSQL script.Either you don't have downloads or the config of the block is flawed.";}

$n = 1;
$content .= $ContentXML;
while (list($lid, $title) = $db->sql_fetchrow($result)) {
   
   $size = $Font_Size_Max-$n+1;
      if($size < $Font_Size_Min){$size = $Font_Size_Min;
         }
   $lid = intval($lid);
   $title2 = htmlspecialchars(str_replace('_', ' ', $title), ENT_QUOTES, _CHARSET);

   $content .= '<strong><big>&middot;</big></strong>&nbsp;<a href="modules.php?name=Downloads&amp;d_op=viewdownloaddetails&amp;lid='.$lid.'"><font color="'.random_color().'" "size="'.$size.'">'.$title2.'</font></a>&nbsp;';
   ++$n;
}
error_reporting($currentReporting);
?>


here it is. enjoy , that's the best I could achieve under 70 lines of code
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum