<?php
/************************************************************************
NukeLayout Class (PHP)
Copyright (C) 2001  Chauncey Thorn
 
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, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  , USA.
**************************************************************************/
/** 
*********** What is NukeLayout Class ******************
NukeLayout Class is a PHP class that allow you to develop web pages 
that look and feel like PHPNuke. 
With out the need for a database and alot of programming... 
This class allows you to focus on content! 

********** Changelog for NukeLayout Class (PHP) *********
 
-- got the idea from some code I was working on for my site.
   PCCS-Linux.COM. This layout is a layout taken from HLUG.org
   and hacked to fit how I wanted my site to look. As I was coding
   I noticed that I was creating a template of the layout.
-- cleaned up code, removing all custom pccs-linux.com code
   and decided to release it as NukeLayout Class
   

 
-- NOTICE: very little modification is required.
   this is the initial release.

-- version 0.1


-- Fix bug in layout
   space between left middle column and right column 
   render badly.. thanks IE explorer for finding this
   bug

-- renamed most of the functions to nukelayoutXxxx

-- renamed the leftbar and right bar render functions
   to renderleftBar, renderrightBar

-- create var for site logo

-- begin working on color themes (still limited)

-- Added support for language (very basic) 

-- expand ability to over ride default values

-- add support to turn off features
   turn off the rightBar, topBanner, bottomBanner, and leftBar 

-- verion 0.2
   

-- Fixed - failed HTML validation issue
   I would like to thank Mathew Solnik for making me aware of this
   NOTE A page with ONLY Text it will format HTML without errors..
   If invalid HTML is used by the page developer it will produce
   invalid HTML errors when validated

-- Fixed - major bug in navBarLinks() -- upgrade required to fix
   in the narBarLinks() I had hardcoded /$val which 
   caused links to become broken if outside the ./ directory
   e.g. http://freshmeat.net would be http://sitename/http://freshmeat.net  

-- Fixed - renamed some vars
   $userightcol --->  $rightbarStatus        
   $leftbarOff --->  $leftbarStatus 
   $topbannerOff --->  $topbannerStatus
   $bottombannerOff --->  $bottombannerStatus

-- Fixed - removed the Default link array for site from inside class
   removing it gives more control and makes the class easier to use.
   $this->nukelayoutmenuLink_array = array("HOME"=>"./"); REMOVED

-- Added support - set bottom banner text by using
   $mypage->nukelayoutfooterText 

-- Added support - define what appeared before link_array 
   in main menu box e.g.
   $this->nukelayoutmenuLinkstarter  = <IMG SRC=dot.gif> 
   default <strong><big> * </big></strong> 

-- Added support - turn off Greeting

-- Added support - change the postion of the site logo
   e.g. left, middle, right

-- Added support - make site banner a link to ./ or no link
   no link default

-- Added support - ability point to a remote site and have it 
   nbsp;in a new windows via the main menu links
   rhttp://www.linux.com would nbsp;http://www.linux.com in a new
   browser window 
   
-- version 0.3



-- Fixed - bug where layout would fail if php was configured
   using the --disable-short-tags which doesn't  allow <?
-- As a result I removed the mixture of HTML and now using 
   only php calls   
-- cleaned up code... more readable



-- Fixed - renamed a number of variables
-- added support - $this->

   -- Fixed - failed HTML validation issue
   I would like to thank Mathew Solnik for making me aware of this
   NOTE A page with ONLY Text it will format HTML without errors..
   If invalid HTML is used by the page developer it will produce
   invalid HTML errors when validated

   -- Fixed - major bug in navBarLinks() -- upgrade required to fix
   in the narBarLinks() I had hardcoded /$val which 
   caused links to become broken if outside the ./ directory
   e.g. http://freshmeat.net would be http://sitename/http://freshmeat.net 

   -- Fixed - renamed some vars
   $userightcol ---> $rightbarStatus 
   $leftbarOff ---> $leftbarStatus 
   $topbannerOff ---> $topbannerStatus
   $bottombannerOff ---> $bottombannerStatus

   -- Fixed - removed the Default link array for site from inside class
   removing it gives more control and makes the class easier to use.
   $this->nukelayoutmenuLink_array = array("HOME"=>"./"); REMOVED

   -- Added support - set bottom banner text by using
   $mypage->nukelayoutfooterText 

   -- Added support - define what appeared before link_array 
   in main menu box e.g.
   $this->nukelayoutmenuLinkstarter = < IMG SRC=dot.gif >
   default  *  

   -- Added support - turn off Greeting

   -- Added support - change the postion of the site logo
   e.g. left, middle, right

   -- Added support - make site banner a link to ./ or no link
   no link default

   -- Added support - ability point to a remote site and have itin a new windows via the main menu links
   rhttp://www.linux.com wouldhttp://www.linux.com in a new
   browser window 

   -- version 0.3 


s Web Site");
-- added comments email link to pageowner
-- extended class to support articles with links to more...
-- added examples for themes

      
********** End of Changelog for NukeLayout Class (PHP) *********
**/


                /******  BEGIN NukeLayout Class *********/

/******* nukeLayout Class defined as nukeLayout  *******
**
** NukeLayout Class is PHP class that allows you to 
** develop web pages that look and feel
** like PHPNuke. With out the need for a database 
** and alot of programming
** It was designed to make static portals easy
**
*/

class nukeLayout
{

// No need to really modify these values

var $PCCSLinuxappname         "NukeLayout PHP Class"// Name of Class
var $PCCSLinuxappVersion     "1.1";        // I will maintain this 

// Feature values

var $nukelayoutpageOwner;
var 
$nukelayoutpageOwneremail;            // your e-mail     
var $nukelayoutpageTitle;            // <title>TITLE</title>
var $nukelayoutpageArticles;            // Articles
var $nukelayoutmenuLink_array;            // Link array
var $nukelayoutSitename;            // Your site name
var $nukelayoutmenuLinkstarter     "<strong><big> * </big></strong>";
var 
$nukelayouttopbannerGreeting "ON";

var 
$nukelayoutnavBarLinks_array;

// Turn off sections of the layout

var $nukelayoutcacheStatus;            // allow/disallow caching of page ON/OFF
var $topbannerStatus         "ON";        // Display RightBar
var $bottombannerStatus        "ON";
var 
$leftbarStatus         "ON";
var 
$rightbarStatus        "ON";


// Theme values 
// need to get some themes together...

var $nukelayoutthemeBgcolor;     // Page Background Color
var $nukelayoutthemeSectionheader;    // Section Header Color 
var $nukelayoutthemeSectionbody;     // Section body color
var $nukelayoutthemeText;        // Page Text Color
var $nukelayoutthemeTrimcolor;    // Header Footer Trim Color
var $nukelayoutthemesectionheaderTextcolor;
var 
$nukelayoutthemelink;        // Default Link Colors
var $nukelayoutthemealink;        // active Link Colors
var $nukelayoutthemevlink;        // Visited Link Colors
var $nukelayoutLogo;                // Site logo Image
var $nukelayoutlogoPosition    "left";
var 
$nukelayoutlogolinkStatus   "OFF";        // Active Link to ./  
var $nukelayoutfooterText;

// Meta Tags values
// You are encourged to change these values
// I'm using the META GENERATOR for the class

var $nukelayoutmetaAuthor;
var 
$nukelayoutmetaCopyright;
var 
$nukelayoutmetaDesc;

// english lang values
// translate to your language 

var $lang_yourlastvistwas "Your last visit was";
var 
$lang_yourbrowseris "Your Browser is running on";
var 
$lang_mainmenu "Main Menu";

/******  FUNCTIONS BEING DEFINED *********/

/*
** These functions set needed vars    
** 
**
**
*/

// Set NukeLayout: get sitename, banner image, and theme
// 
function set_nukeLayout($sitename$image$theme "")
{
    
$this->set_siteName($sitename);
    
$this->set_layoutLogo($image);
    
$this->set_layoutTheme($theme);

}

// Set site Name
function set_siteName($sitename)
{
    
$this->nukelayoutSitename $sitename;

}

// Set page Title
function set_pageTitle($pagetitle)
{
    
$this->nukelayoutpageTitle $pagetitle;

}

// Set page Owner
function set_pageOwner($_email$pageowner"Page Owner")
{
    
$this->nukelayoutpageOwner $pageowner;
    
$this->nukelayoutpageOwneremail $_email;

}

// Set the logo image value
function set_layoutLogo($image)
{
    
$this->nukelayoutLogo $image;

}


// Set Bottom Banner Footer Text
function set_layoutfooterText($footertext "Using NukeLayout Class by PCCS-Linux.COM<br> http://www.pccs-linux.com/")
{
    
$this->nukelayoutfooterText $footertext;
}

// Set layout theme
function set_layoutTheme($theme "")
{
 
     if (
$theme)
    {
      include(
"themes/$theme.theme.php");
    } else {
      include(
"themes/default.theme.php");
    }
 
    
$this->set_themeBgcolor($bgcolor);
    
$this->set_themeSectionheader($sectionheader);
    
$this->set_themeSectionbody($sectionbody);
    
$this->set_headertextColor($headertextColor);
    
$this->set_trimColor($trimcolor);
    
$this->set_textColor($textcolor);
    
$this->set_linkColor($linkcolor);
    
$this->set_vlinkColor($vlinkcolor);
    
$this->set_alinkColor($alinkcolor);

}


function 
set_Metadata($desctext  "Site is using NukeLayout PHP Class from http://www.pccs-linux.com"
{
    
$this->set_metaAuthor();
    
$this->set_metaCopyright();
    
$this->set_metaDescription($desctext);

}


// Set meta Author
function set_metaAuthor()
{
    
$this->nukelayoutmetaAuthor $this->nukelayoutpageOwner;

}

// Set meta Copyright
function set_metaCopyright()
{
    
$year date("Y");
    
$this->nukelayoutmetaCopyright "Copyright (c) $year by $this->nukelayoutSitename";

}

// Set meta Description
function set_metaDescription($desctext)
{
    
$this->nukelayoutmetaDesc $desctext;
}    


// Set theme background color
function set_themeBgcolor($bgcolor)
{
    
$this->nukelayoutthemeBgcolor $bgcolor;

}

// Set section header backgroud color
function set_themeSectionheader($sectionheader)
{
    
$this->nukelayoutthemeSectionheader $sectionheader;

}

// Set section body color
function set_themeSectionbody($sectionbody)
{
    
$this->nukelayoutthemeSectionbody $sectionbody;

}

// Set section table trim color
function set_trimColor($trimcolor)
{
    
$this->nukelayoutthemeTrimcolor $trimcolor;

}


// Set text color
function set_textColor($textcolor)
{
    
$this->nukelayoutthemeText $textcolor;

}

// Set link color
function set_linkColor($linkcolor)
{
    
$this->nukelayoutthemelink $linkcolor;

}

// Set vlink color
function set_vlinkColor($vlinkcolor)
{
    
$this->nukelayoutthemevlink $vlinkcolor;

}

// Set alink color
function set_alinkColor($alinkcolor)
{
    
$this->nukelayoutthemealink $alinkcolor;

}

// Set Section Header text color
function set_headertextColor($headertextColor)
{
    
$this->nukelayoutthemesectionheaderTextcolor $headertextColor;
}

/******  FUNCTION BEING DEFINED *********/

/*
** render()    
** this is called at the end of every page
** puts the page together
**
*/

function render ()
{

     
$this->nukelayoutsiteHeader();
    
$this->nukelayoutsiteBody();
    
$this->nukelayoutsiteFooter();

// end of render function

/******  FUNCTION BEING DEFINED *********/

/*
** addAtricle()    
** used to add articles to a page
** example
** $mypage->addArticle("Ease of Use","The class is very easy to use....")
*/

function addArticle ($nukelayoutpageTitle$pagetext)
{

    
$article = array("nukelayoutpageTitle" => $nukelayoutpageTitle,
                 
"pagetext" => $pagetext);
    
$this->nukelayoutpageArticles[] = $article;

// end of addArticle function

/******  FUNCTION BEING DEFINED *********/

/*  
** renderArticles($nukelayoutArticlesarray) 
** this function generates std HTML syntax 
** process page articles
** addArticle function passes array[$i]["value"]
** Generates std HTML
** Creates 2 tables. the inclosed table has 2 rows
** $this->nukelayoutthemeTrimcolor var is used
** Color schema is use
**  
*/

function renderArticles($nukelayoutArticlesarray)
{

    if (empty(
$nukelayoutArticlesarray[0]["nukelayoutpageTitle"]))
      return;
          for (
$i 0$i count($nukelayoutArticlesarray); $i++)
          {    
        print
"
        <table cellspacing=
\"0\" cellpadding=\"0\" border=\"0\" bgcolor=\"$this->nukelayoutthemeTrimcolor\"
        align=
\"center\" width=\"100%\">
         <tr>
         <td>
          <table cellspacing=
\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"$this->nukelayoutthemeTrimcolor\"
          width=
\"100%\">
           <tr>
            <td bgcolor=
\"$this->nukelayoutthemeSectionheader\" width=\"100%\">
            <font size=
\"2\">
        "
;    
            print 
"<b><font color=".$this->nukelayoutthemesectionheaderTextcolor.">"$nukelayoutArticlesarray[$i]["nukelayoutpageTitle"]
            .
"</font></b>";
        print 
"
            </font>
            </td>
           </tr>
           <tr>
            <td bgcolor=
\"$this->nukelayoutthemeSectionbody\">
            <font size=
\"2\">
        "
;    
            
        print  
$nukelayoutArticlesarray[$i]["pagetext"];
        
        print 
"    
             </font>
             </td>
            </tr>
           </table>
         </td>
         </tr>
        </table><br>

        "
;
        }

}  
// end renderArticles

/******  FUNCTION BEING DEFINED *********/

/*  
** nukelayoutsiteBody() 
** this function generates std HTML syntax 
** This function has the most control 
** it brings everything together for the render function
** 
** the $this->nukelayoutsiteBanner() is used
** $this->navigationMenu() is used
** $this->renderleftBar($this->addleftbarContent) is used
** $this->renderArticles($this->nukelayoutpageArticles) is used
** $this->renderrightBar($this->addrightbarText) is used
**
*/

function nukelayoutsiteBody()
{
                    
/** BEGIN TOP AND LEFT SIDE OF PAGE **/

    
if($this->topbannerStatus == "OFF") {
        
// do nothing
    
} else {
    
        
// Display sitebanner and main site links
        
$this->nukelayoutsiteBanner();
    
    }
    

    
// check the status of the left side of page
    
if($this->leftbarStatus == "OFF"
    {
        
$this->navigationMenuOFF();
    } else {
    
        
// Display Links for navigation
        
$this->navigationMenu();
        
        
// Display Items on the left side
        
$this->renderleftBar($this->addleftbarContent);
        
    }

                      
/****** End of Left side ******/

    /**DO NOT DELETE START***/

    
print "
        <td>
        <td bgcolor="
$this->nukelayoutthemeBgcolor .">&nbsp;&nbsp;</td>
        <td width=\"100%\" valign=top bgcolor="
$this->nukelayoutthemeBgcolor .">
    "
;

    
/**DO NOT DELETE END ***/

                    /****** Begin Middle Section ******/

    
if ($op == '') {

          
// Get main articles from include file...
        
$this->renderArticles($this->nukelayoutpageArticles);
   
     } else {

        
// this section can be used to include external features
        // eg. a feedback form
    
}

                    
/*** DO NOT EDIT it will break !!! ***/

    
print "</td>";
    print 
"<td bgcolor="$this->nukelayoutthemeBgcolor .">&nbsp;&nbsp;</td>";

                    
/*** DO NOT EDIT END it will break !!! ***/


                    /******** Begin right side of page ********/

    // if the rightbarStatus is off don't display the third column

    
if($this->rightbarStatus == "OFF") {

        
// do nothing because the right column was turned off

        
} else { 

    
                    
/*** DO NOT EDIT it will break !!! ***/
    
            
print "<td></td><td valign=\"top\" width=\"150\" bgcolor="$this->nukelayoutthemeBgcolor .">";

                    
/*** DO NOT EDIT END it will break !!! ***/
    

            // render rightbar text
            
$this->renderrightBar($this->addrightbarText); 


           }
    
// end of siteBody function

/******  FUNCTION BEING DEFINED *********/

/*  
** nukelayoutsiteHeader() 
** this function generates std HTML syntax 
** the $this->nukelayoutpageTitle var is used
** the $this->nukelayoutcacheStatus var is used
** 
** Color schema is use
** Controls HTML META 
*/

function nukelayoutsiteHeader() 
{

    
$getkeywords ltrim(ereg_replace("The","",$this->nukelayoutpageTitle));
    
$genkeywords ereg_replace(" ",",",$getkeywords);

        
// this code allows the page to be cache
        //  
       
            
        
if($this->nukelayoutcacheStatus == "ON") {
              
$LastModified filemtime(__FILE__) + date("Z");
             
header("Last-Modified: " 
             
gmdate("D, d M Y H:i:s"$LastModified) . " GMT");
         
             
//set expiration time 24 hours (86400 seconds) from now
             
$Expires time() + 86400;
             
header("Expires: " 
             
gmdate("D, d M Y H:i:s"$Expires) . " GMT");
    
             
//tell cache to let page age for 24 hours (86400 seconds)
             
header("Cache-Control: max-age=86400");
         } elseif (
$this->nukelayoutcacheStatus == "OFF") {
             
// Don't allow page to be cached
             
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
             
header("Expires: " gmdate("D, d M Y H:i:s") . " GMT");
             
header("Cache-Control: no-cache, must-revalidate");
             
header("Pragma: no-cache");
         } else {
             
// Do nothing
         
}



    print 
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
    print 
"<!--This site is using NukeLayout PHP Class -->\n";
    print 
"<!--Developed by Chauncey Thorn at http://www.pccs-linux.com -->\n";
    print 
"<HTML lang=en-us>\n";
    print 
"<HEAD>\n";
    print 
"<TITLE>"$this->nukelayoutpageTitle ."</TITLE>\n";
    print 
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=ISO-8859-1\">\n";
    print 
"<META NAME=\"AUTHOR\" CONTENT=\"".$this->nukelayoutmetaAuthor."\">\n";
    print 
"<META NAME=\"GENERATOR\" CONTENT=\""$this->PCCSLinuxappname " - Version "  $this->PCCSLinuxappVersion ."\">\n";
    print 
"<META NAME=\"COPYRIGHT\" CONTENT=\"".$this->nukelayoutmetaCopyright ."\">\n";
    print 
"<META NAME=\"DESCRIPTION\" CONTENT=\""$this->nukelayoutmetaDesc ."\">\n";
    print 
"<META NAME=\"KEYWORDS\" CONTENT=\"$genkeywords\">\n";

    print 
"</HEAD>";

    print 
"<BODY bgcolor="$this->nukelayoutthemeBgcolor .
                  text="
$this->nukelayoutthemeText .
                  link="
$this->nukelayoutthemelink .
                  vlink="
$this->nukelayoutthemevlink .
                  alink="
$this->nukelayoutthemealink .">\n";

// end the siteHeader function

/******  FUNCTION BEING DEFINED *********/

/*  
** nukelayoutsiteFooter() 
** this function generates std HTML syntax 
** the $this->bottombannerStatus var is used
** the $this->nukelayoutfooterText var is used
** 
*/

function nukelayoutsiteFooter() 
{

    print 
"</td></tr></table>\n";
    print 
"<br>\n";
     if(
$this->bottombannerStatus == "OFF") { 
        print 
"</body>\n";
        print 
"</html>\n";

    } else { 

 
        print 
"<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\" bgcolor="$this->nukelayoutthemeTrimcolor ."><tr><td>\n";
        print 
"<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\" bgcolor=\"$this->nukelayoutthemeSectionbody\"><tr><td>\n";
        print 
"<table bgcolor=\"$this->nukelayoutthemeSectionbody\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">\n";
        print 
"<tr><td>\n";
        print 
"    <center><font size=\"1\">\n";
        print 
"    <br><br>\n";

        print  
$this->nukelayoutfooterText;
        print 
"<br>";
        print 
"Comments to <a href=\"mailto:".$this->nukelayoutpageOwneremail."\">".$this->nukelayoutpageOwner."</a>\n";
        print 
"<br>";
        print 
"    <br>";
        print 
"    </font></center>\n";
        print 
"    </td></tr></table>\n";
        print 
"</td></tr></table></td></tr></table>\n";
        print 
"</body>\n";
        print 
"</html>\n";
    }


// end of function


/******  FUNCTION BEING DEFINED *********/

/*  
** addleftBar($addleftbarTitle, $addleftbarBody) 
** Creates the array for adding a left column 
** The array create by this function will be
** used by renderleftBar($addleftbararray)
*/

function addleftBar($addleftbarTitle$addleftbarBody)
{
    
$leftbarContent = array("addleftbarTitle"=> $addleftbarTitle,
              
"addleftbarBody" => $addleftbarBody);
    
$this->addleftbarContent[] = $leftbarContent;

// end of addleftBar function


/******  FUNCTION BEING DEFINED *********/

/*  
** renderleftBar($addleftbararray) 
** process the array passed by the addleftBar function
** Generates std HTML
** Creates 2 tables. the inclosed table has 2 rows
** $this->nukelayoutthemeTrimcolor is used
*/

function renderleftBar($addleftbararray)
{
    if(empty(
$addleftbararray[0]["addleftbarTitle"]))
    return;
    
        for(
$i 0$i count($addleftbararray); $i++)
        {
            print 
"
            <table border=
\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"150\"    bgcolor=\"$this->nukelayoutthemeTrimcolor\">
              <tr>
                <td >
                <table width=
\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"$this->nukelayoutthemeTrimcolor\">
                <tr>
             <td colspan=1 bgcolor="
$this->nukelayoutthemeSectionheader ." align=\"left\">
               <b><font size=\"2\" color="
.$this->nukelayoutthemesectionheaderTextcolor.">".  $addleftbararray[$i]["addleftbarTitle"] ." </b></font>
             </td>
            </tr>
            <tr>

             <td bgcolor=
\"$this->nukelayoutthemeSectionbody\" >
              " 
.  $addleftbararray[$i]["addleftbarBody"] . "
             </td>
            </tr>
            </table>
            </td>
          </tr>
        </table>
        <br>
        "
;
        }  


// end of function

/******  FUNCTION BEING DEFINED *********/

/*  
** addrightBar($addrightbarTitle, $addrightbarBody) 
** Creates the array for adding a right column 
** The array create by this function will be
** used by renderrightBar($addrightbararray)
*/

function addrightBar($addrightbarTitle$addrightbarBody)
{
    
$rightbarContent = array("addrightbarTitle"=> $addrightbarTitle,
              
"addrightbarBody" => $addrightbarBody);
    
$this->addrightbarText[] = $rightbarContent;

// end of function

/******  FUNCTION BEING DEFINED *********/

/*  
** renderrightBar($addrightbararray)
** process the array passed by the addrightBar function
** Generates std HTML
** Creates 2 tables. the inclosed table has 2 rows
** $this->nukelayoutthemeTrimcolor is used
*/

function renderrightBar($addrightbararray)
{
    if(empty(
$addrightbararray[0]["addrightbarTitle"]))
    return;
    
        for(
$i 0$i count($addrightbararray); $i++)
        {
            print 
"
            <table border=
\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"150\" bgcolor=\"$this->nukelayoutthemeTrimcolor\">
              <tr>
                <td>
                <table width=
\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"$this->nukelayoutthemeTrimcolor\">
                <tr>
             <td colspan=
\"1\" bgcolor="$this->nukelayoutthemeSectionheader ." align=\"left\">
               <b><font size=\"2\" color="
.$this->nukelayoutthemesectionheaderTextcolor.">".  $addrightbararray[$i]["addrightbarTitle"] ." </b></font>
             </td>
            </tr>
            <tr>

             <td bgcolor=
\"$this->nukelayoutthemeSectionbody\">
              " 
.  $addrightbararray[$i]["addrightbarBody"] . "
             </td>
            </tr>
            </table>
            </td>
          </tr>
        </table>
        <br>
        "
;
        }  


// end of function


/******  FUNCTION BEING DEFINED *********/



/*
** nukelayoutsiteBanner()    
** site banner function 
** sets cookie, detects browser and setup header image...
** 
** no need to really modify... unless you like hacking
**
*/


function nukelayoutsiteBanner() 
{
  global 
$remoteaddr;
  global 
$HTTP_COOKIE_VARS$HTTP_USER_AGENT;
  
       if(!isset(
$HTTP_COOKIE_VARS["ThisSiteLastVisit"])) {
           
$udata["ThisSiteLastVisit"] =
        
$HTTP_COOKIE_VARS["ThisSiteLastVisit"];
       } else {
           
$thisday date("Y-m-d H:i");
        
$time = (time() + 3600 24 52);
        
setcookie("ThisSiteLastVisit"$thisday$time);
       }
   
       list(
$day$time) = split(" "$udata["ThisSiteLastVisit"]);
       list(
$hour$min) = split(":"$time);
       
$this_min date("i");
       
$this_hr date("H");
       
$this_day date("Y-m-d");
   
       if((
$this_day $day) || ($this_hr $hour) || ($this_min $min) ) 
       {
           
$thisday date("Y-m-d H:i");
        
$time = (time() + 3600 24 52);
        
setcookie("ThisSiteLastVisit"$thisday$time);
       }
       
       
   
       if(
strstr($HTTP_USER_AGENT,'Win')) {
               
$BROWSER_PLATFORM="Windows BOX";
       } else if(
strstr($HTTP_USER_AGENT,'Mac')) {
               
$BROWSER_PLATFORM="Mac";
       } else if(
strstr($HTTP_USER_AGENT,'Linux')) {
               
$BROWSER_PLATFORM="Linux BOX";
       } else if(
strstr($HTTP_USER_AGENT,'Unix')) {
               
$BROWSER_PLATFORM="UNIX BOX";
       } else {
               
$BROWSER_PLATFORM="Other";
       }    
            

        print 
"<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\" bgcolor="$this->nukelayoutthemeBgcolor ."><tr><td>";
        print 
" <table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\" bgcolor="$this->nukelayoutthemeTrimcolor ."><tr><td>";
        print 
"  <table bgcolor=\"$this->nukelayoutthemeSectionbody\" border=\"0\" cellspacing=\"0\" cellpadding=\"6\" width=\"100%\">";
        print 
"    <tr>";

     if(
$this->nukelayouttopbannerGreeting == "OFF") { 

        print 
"<td colspan=\"3\" align=\"$this->nukelayoutlogoPosition\">";

      } else {

        print 
"<td colspan=\"2\">";
      }
     
    if(
$this->nukelayoutlogolinkStatus == "OFF") { 
       
               print 
"<img src="$this->nukelayoutLogo ." border=\"0\" alt=".$this->nukelayoutSitename ." align=\"middle\">";

    } else { 

               print 
"<a href=\"./\">";
               print 
"<img src="$this->nukelayoutLogo ." border=\"0\" alt="$this->nukelayoutSitename ." align=\"middle\"></a>";

        } 

        print 
"</td>";

    if(
$this->nukelayouttopbannerGreeting == "OFF") { 
        
// do nothing 

    
} else {
  

             print 
"<td>";
             print 
"Hello,".  $remoteaddr ." and welcome to the "$this->nukelayoutSitename " Home Page.";
             print 
"<br>"$this->lang_yourlastvistwas "&nbsp; "$HTTP_COOKIE_VARS["ThisSiteLastVisit"] ;
             print 
"<br> "$this->lang_yourbrowseris "&nbsp; ".  $BROWSER_PLATFORM ;
              print 
"</td>";
    
        }

             print 
"</tr>";
             print 
"</table>";
             print 
"   </td></tr>";
             print 
"</table>";
             print 
"  </td></tr>";
             print 
"</table>";

             print 
"<table width=\"100%\"><tr><td height=\"5\"></td></tr></table>";


// end of function

/******  FUNCTION BEING DEFINED *********/

/*
**
** navigationMenu()
** Provide the menu system for page. Top left table box
** $this->navBarLinks($this->nukelayoutmenuLink_array) used
**
*/

function navigationMenu()
{

    print 
"<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\" align=\"center\" bgcolor=\"$this->nukelayoutthemeTrimcolor\"\">";
    print 
"<tr><td valign=\"top\" bgcolor="$this->nukelayoutthemeBgcolor">";
    print 
"<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"150\" bgcolor=\"$this->nukelayoutthemeTrimcolor\"\"><tr><td>";
    print 
"<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\"><tr>";
    print 
"<td colspan=\"1\" bgcolor=".  $this->nukelayoutthemeSectionheader ." align=\"left\">";
    print 
"<b><font size=\"2\" color=".$this->nukelayoutthemesectionheaderTextcolor.">"$this->lang_mainmenu ."</b></font>";
    print 
"</td></tr><tr>";
    print 
"<td bgcolor=".  $this->nukelayoutthemeSectionbody ." >";

    
$this->navBarLinks($this->nukelayoutmenuLink_array); 

    print 
"<font size=\"2\">";
    print 
"<br>";
    print 
"</font>";
    print 
"</td></tr></table></td></tr></table><br>";

// end of function


/******  FUNCTION BEING DEFINED *********/

/*
**
** navBarLinks()
** Provide the menu system links for page.
** called from navigationMenu()
** nbsp;url in new window 
**
*/


function navBarLinks()
{
    
reset($this->nukelayoutmenuLink_array);
    
    while (list(
$key$val) = each($this->nukelayoutmenuLink_array)) {
       
$label ucfirst($key);
       
      echo 
"$this->nukelayoutmenuLinkstarter";
          echo 
"<FONT SIZE='1' FACE='Arial'>";
      
// see if we want to nbsp;in a new window
      // code added 
       
if(ereg("rhttp://"$val)) {
              
$val ereg_replace("rhttp""http"$val);
                 echo 
"<A HREF=\"$val\" TARGET=\"_blank\">$label</A></FONT><br>\n";
          } else {  
            echo 
"<A HREF=\"$val\">$label</A></FONT><br>\n";
      }
      
    }
    
// end of function


/******  FUNCTION BEING DEFINED *********/

/*
**
** Function keeps table structure if left menu is turned of
** just a spacer
**
*/

function navigationMenuOFF()
{


    print 
"<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\" align=\"center\" bgcolor=\"#CCCCCC\">";
    print 
"<tr><td valign=\"top\" bgcolor="$this->nukelayoutthemeBgcolor .">";

// end of function


// end nukeLayout class


                /******  END OF NukeLayout Class *********/


class nukelayout_Link extends nukelayout
{
/******  FUNCTION BEING DEFINED *********/

/*
** addAtricle()    
** used to add articles to a page
** example
** $mypage->addArticle("Ease of Use","The class is very easy to use....")
*/

function addArticle ($nukelayoutpageTitle$pagetext$link="")
{

    
$article = array("nukelayoutpageTitle" => $nukelayoutpageTitle,
                 
"pagetext" => $pagetext"link"=> $link);
    
$this->nukelayoutpageArticles[] = $article;
    
    
// end of addArticle function

/******  FUNCTION BEING DEFINED *********/

/*  
** renderArticles($nukelayoutArticlesarray) 
** this function generates std HTML syntax 
** process page articles
** addArticle function passes array[$i]["value"]
** Generates std HTML
** Creates 2 tables. the inclosed table has 2 rows
** $this->nukelayoutthemeTrimcolor var is used
** Color schema is use
**  
*/

function renderArticles($nukelayoutArticlesarray)
{
    

    if (empty(
$nukelayoutArticlesarray[0]["nukelayoutpageTitle"]))
      return;
          for (
$i 0$i count($nukelayoutArticlesarray); $i++)
          {    
        print
"
        <table cellspacing=
\"0\" cellpadding=\"0\" border=\"0\" bgcolor=\"$this->nukelayoutthemeTrimcolor\"
        align=
\"center\" width=\"100%\">
         <tr>
         <td>
          <table cellspacing=
\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"$this->nukelayoutthemeTrimcolor\"
          width=
\"100%\">
           <tr>
            <td bgcolor=
\"$this->nukelayoutthemeSectionheader\" width=\"100%\">
            <font size=
\"2\">
        "
;    
            print 
"<b>"$nukelayoutArticlesarray[$i]["nukelayoutpageTitle"] ."</b>";
        print 
"
            </font>
            </td>
           </tr>
           <tr>
            <td bgcolor=
\"$this->nukelayoutthemeSectionbody\">
            <font size=
\"2\">
        "
;    
            
        print  
$nukelayoutArticlesarray[$i]["pagetext"];
        
        print 
"    
             </font>
             </td>
            </tr>
            "
;
        if(
$nukelayoutArticlesarray[$i]["link"] == "") {
        
            
// do nothing
        
} else {    
            print 
"    
            
                  <tr>
                <td bgcolor=\"#CCCCCC\" align=\"right\">
                <font size=2>(  <a href="
.$nukelayoutArticlesarray[$i]["link"]."> More Info ... </a>)
    
                </font>
                </td>
                  </tr>
                  "
;
        }
              
        print 
"      
           </table>
         </td>
         </tr>
        </table><br>

        "
;
        }

}  
// end renderArticles
    




//end of class


?>
PCCS-Linux.COM ::ource Advocate Articles catalogue
2000 2002