To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Code Critique

Code Critique Having someone critique your code is always a great way to hone the skills. Stop in and post your code to see what your peers may have done differently.

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-16-2003, 11:02 PM   #1
Tristan Wells
Member
 
Join Date: Oct 2003
Location: Louisiana
Posts: 38
Board wrapper [v3.0]

I got sick of the last version of my board wrapper so I recoded it...again. Here it is. This version isnt done but it does what it needs to do for now. It features a bug fix regarding gzip compression and removal of all previous raw globals.
PHP Code:
<?php
//+----------------------------------+\\
//+Vital stuff
//+----------------------------------+\\
error_reporting(E_ALL);
set_magic_quotes_runtime(0);
define('IN_NUKEBOARD',true);
define('ROOT','./');
//+----------------------------------+\\
//+Load configuration
//+----------------------------------+\\
require(ROOT.'config/config.php');
//+----------------------------------+\\
//+Build the core
//+----------------------------------+\\
class nukeboard
{
   var
$version = '1.0 Beta1';
   var
$member;
   var
$lang;
   var
$conf;
   var
$skin;
   function
nukeboard()
    {
      global
$conf;
      
$this->conf = &$conf;
    }
}
$nukeboard = new nukeboard();
//+----------------------------------+\\
//+Start output buffering
//+----------------------------------+\\
if($nukeboard->conf['cpusaving_usegzip'] == true)
{
   if(
extension_loaded('zlib'))
    {
      
$encodings = explode(',',$_SERVER['HTTP_ACCEPT_ENCODING']);
      if(
in_array('gzip',$encodings) || in_array('deflate',$encodings))
       {
         
define('BUFFER_STARTED',true);
         
ob_start('ob_gzhandler');
       }
    }
}
//+----------------------------------+\\
//+Load modules
//+----------------------------------+\\
$modules = array(
                
'idx' => 'boards.php',
                );
if(!isset(
$_GET['act']))
{
   
$_GET['act'] = 'idx';
}
if(
in_array($_GET['act'],array_keys($modules)))
{
   require(
ROOT.'sources/'.$modules[$_GET['act']]);
} else {
   require(
ROOT.'sources/'.$modules['idx']);
}
//+----------------------------------+\\
//+Stop output buffering
//+----------------------------------+\\
if($nukeboard->conf['cpusaving_usegzip'] == true)
{
   if(
defined('BUFFER_STARTED'))
    {
      
ob_end_flush();
    }
}
?>
__________________
The girls at school call me nerdalicious.
Tristan Wells is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 12:49 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.