feedTitles for RSS feeds. private $veryTopCode; // code that will be outputted to the very top of the page (above the logo & nav options) inside the wrapper. private $columns; // an array of all of the columns main portion of the page private $useDefaultColumns;// if false, then the normal Pedlr-style columns will be used (with widths based on percentages). If true, the static-width default colset is used. private $tabs; // an array of the tabs to be displayed about the main page content private $leftTextTabs; // array of left aligned text only tabs private $rightTextTabs; // array of right aligned text only tabs private $headMessages; // html code that should appear at the top of the content below the menu/tabs. private $headCallbacks; // functions to call inside the
tag. private $toolTips; // array of tool-tip bubbles. private $cacheKey; private $cacheResults; private $minAge; // the minumum age that the user should be in order to see the main content of the page. This can be rolled into the authentication later, but for now is just used to know if we should serve AdSense. private $codePath; // for setting a path to which all styles and js sit in... primarily used for setting different domain names (ie: LyricWiki uses "http://pedlr.com"). private $logoURL; // for overloading only (used by LyricWiki). private $logoLink; private $logoTitle; private $extraHeadStart; private $extraHeadEnd; // Extra-Head info is extra text to be printed out in the header tags. 'Start goes at the very top and 'End goes at the very end of the tag contents. private $useModules; // if true, then the module css will be included & passed the color string private $colors; private $bgImage; private $bgImageSettings; public function Page($title='', $columnWidths = array( 100 ), $mainBgColor = 'ffffff'){ profiler_beginSection(__METHOD__); $this->colors = array(); $this->title = $title; $this->metaDescription = ""; $this->metaKeywords = ""; $this->styles = array(); $this->scripts = array(); $this->rssFeeds = array(); $this->veryTopCode = ""; $this->tabs = array(); $this->leftTextTabs = array(); $this->rightTextTabs = array(); $this->colors['bgcolor'] = '000000'; // background of the page, to the sides, behind the tabs, etc. $this->colors['mainbg'] = $mainBgColor; // backround of the area where the main content will go (as opposed to bg of the page). $this->minAge = -1; // by default, pages have no age restriction $this->bgImage = ""; $this->bgImageSettings = 3; $this->headMessages = ""; $this->toolTips = array(); $this->addScript("jquery/jquery.js"); $this->addScript("doItLater.js" ); //$this->addScript("feedbackTools.js" ); // TODO: Decide whether to use FeedbackTools, then either port it or delete the whole thing (there is a .css include and an include_once in this file also). $user = getUser(); if($user->isLoggedIn()){ sendQuery("UPDATE userStats SET pageViews=pageViews+1 WHERE user_id=".$user->getId()); } $this->cacheKey = ""; $this->cacheResults = false; $this->codePath = getCodePath(); $this->logoURL = ""; $this->logoLink = ""; $this->logoTitle = ""; $this->extraHeadStart = $this->extraHeadEnd = ""; $this->headCallbacks = array(); $this->addRSS("rss.php", "doItLater Recent Updates"); // Set up the default menu tabs. NON-PORTABLE: This should be moved out to some config file or something. $user = getUser(); if($user->isLoggedIn()){ $this->addTab("Home", "home.php"); } $this->addTab("Pictures", "pictures.php"); $this->addTab("Videos", "movies.php"); $this->addTab("Games", "games.php"); $this->addTab("Flash", "flash.php"); $this->addTab("Recent", "recent.php"); //$this->addTab("About", "about.php"); // TODO: IMPLEMENT THE PAGE AND UNCOMMENT THIS LINE $this->addTab("Upload", "submit.php"); // Use the default 3-column (static-width columns) layout unless overridden. $this->columns = array(new Column(25), new Column(55), new Column(20)); // the default three-column layout - NOTE: The widths aren't actually used in this special case. See note at top of file. $this->useDefaultColumns = true; if(count($columnWidths) > 1){ $this->setColumns($columnWidths); } profiler_endSection(__METHOD__); } public function getTitle(){ return $this->title; } public function setTitle($title){$this->title = $title;} public function setMetaTags($metaDescription, $metaKeywords){ $this->metaDescription = $metaDescription; $this->metaKeywords = $metaKeywords; } public function getMinAge(){return $this->minAge;} public function setMinAge($min){$this->minAge = $min;} public function getColor( $colorName ){ return getVal($this->colors, $colorName);} public function setColor( $colorName, $color ){ return $this->colors[$colorName] = $color; } public function getBgColor(){ return $this->getColor("bgColor"); } public function setBgColor($color){ $this->setColor( "bgColor", $color ); } public function setColors( $colors ){ $this->colors = $colors; } public function getBgImage(){ return $this->bgImage; } public function setBgImage( $bgImage ){ $this->bgImage = $bgImage; } public function getBgImageSettings(){ return $this->bgImageSettings; } public function setBgImageSettings( $bgImageSettings ){ $this->bgImageSettings = $bgImageSettings; } public function addMessage($msg){$this->headMessages .= "\n$msg";} public function addTopCode($code){$this->veryTopCode .= "\n$code";} public function setTopCode($code){$this->veryTopCode = $code;} public function addHeaderCallback($callbackFunc){$this->headCallbacks[] = $callbackFunc;} public function useModules($useModules=true){$this->useModules = $useModules;} public function getCodePath(){return $this->codePath;} public function useDefaultColumns($useThem){ $this->useDefaultColumns = $useThem; if(!$useThem){ $this->colors['mainbg'] = '000000'; } } public function addToolTip($id, $title, $caption){ include_once "toolTipTools.php"; $this->toolTips[] = array( TT_ID => $id, TT_TITLE => $title, TT_CAPTION => $caption ); } public function addToolTips($toolTips){ $this->toolTips = array_merge($this->toolTips, $toolTips); } public function setPath($codePath){$this->codePath = $codePath;} public function setLogo($logoURL, $logoTitle="", $logoLink=""){ $this->logoURL = $logoURL; if($logoTitle != ""){$this->logoTitle = $logoTitle;} if($logoLink != ""){$this->logoLink = $logoLink;} } public function addHeadCode($headCode, $start=true){ if($start){ $this->extraHeadStart .= $headCode; } else { $this->extraHeadEnd .= $headCode; } } //// // Sets the column widths for all columns. Does error-checking on passed parameters. // Overwrites any previous values. //// public function setColumns($columnWidths=array(100)){ profiler_beginSection(__METHOD__); include_once 'columns.php'; $this->useDefaultColumns(false); while(count($columnWidths) < 4){ $columnWidths[] = 0; } $lastColumnFound = false; $this->columns = array(); // clears out the previuos columns for( $i = 0; $i < 4; ++$i ){ if( $columnWidths[ $i ] > 0 && !$lastColumnFound ){ $this->columns[ $i ] = new Column( $columnWidths[ $i ] ); }else if( $columnWidths[ $i ] > 0 && $lastColumnFound ){ throw new Exception( "Columns cannot be specifed after a column with 0 width." ); }else{ $lastColumnFound = true; } } if( count( $this->columns ) == 0 ){ throw new Exception( "No columns specified for this page." ); }else if( count( $this->columns ) == 1 ){ $this->columns[0]->setClass( "highlander" ); }else{ for( $i = 0; $i < count( $this->columns ); ++$i ){ if( $i == 0 ){ $this->columns[ $i ]->setClass( "left" ); }else if( $i == count( $this->columns ) - 1 ){ $this->columns[ $i ]->setClass( "right" ); }else{ $this->columns[ $i ]->setClass( "center" ); } } } profiler_endSection(__METHOD__); } public function getColumns(){return $this->columns;} //// // This differs from just calling requireLogin directly because it passes this page // into the function, so that when something else is displayed, this page's current // settings (title, tabs, etc.) are used. //// public function requireLogin($failed=false){ profiler_beginSection(__METHOD__); if(!getUser()->isLoggedIn()){ ob_start(); print "
\n";
}
echo "\n";
}
if(count($this->tabs) > 0){
echo "\t
\n";
echo " \n";
print "\n"; // makes the body wrap down below the tabs
}
if($this->useDefaultColumns){
print " | ||||
\n";
if($this->columns[COLUMN_LEFT]->numModules() > 0){
$column = $this->columns[COLUMN_LEFT];
print $column->getContentOnly();
} else {
$user = getUser();
if($user->isAdmin()){
defconBox();
}
if($user->isAdmin()){
print "
\n"; } //print " \n"; // make sure pictures fit on the left as expected
// SWC 20060817 - AdSense Code.
// SWC 20090322 - Due to an automated message that complained that we were showing Google ads next to overly mature content, added this restriction.
if($this->getMinAge() < 13){
print "\n";
?>
\n";
// Main body.
print " | \n";
print "\n\n\t\n";
}
profiler_endSection(__METHOD__);
} // end displayLeftColumn()
////
// Displays the right-most column as well as the markup that goes around it.
//
// This "right column" is ONLY used if useDefaultColumns is true. Otherwise, the percentage-width Pedlr-style columns are used.
////
public function displayRightColumn(){
profiler_beginSection(__METHOD__);
if($this->useDefaultColumns){
if($this->columns[COLUMN_RIGHT]->numModules() > 0){
$column = $this->columns[COLUMN_RIGHT];
print $column->getContentOnly();
} else {
// This is the code that was formerly in the rightSideBar() function
popularTagBar();
print " \n"; // make sure pictures fit on the right as expected
print "\n"; print " \n";
print "Sites we love: \n";
}
}
profiler_endSection(__METHOD__);
} // end displayRightColumn()
protected function displayColumns(){
profiler_beginSection(__METHOD__);
foreach( $this->columns as $column ){
$column->setBgColor($this->colors['bgColor']); // used by AdModules to determine best colors for embedded Ads.
echo $column->getHTML();
}
$extraEmpties = 4 - count( $this->columns );
$hiddenColumn = new Column(0);
$hiddenColumn->setClass( "hidden" );
for( $i = 0; $i < $extraEmpties; $i++ ){
echo $hiddenColumn->getHTML();
}
profiler_endSection(__METHOD__);
}
////
// Takes care of the bottom of the page by displaying the footer and allowing
// the caching to run.
////
public function bottom(){
profiler_beginSection(__METHOD__);
$this->footer();
$this->cache();
profiler_endSection(__METHOD__);
}
////
// Displays the bottom of the page (closing any open tags).
//
// If the page is not going to be using the normal layout (menus, columns, etc.), then
// just use displayFooter(true) instead of footer().
////
public function footer(){
profiler_beginSection(__METHOD__);
print "\n\t\n\n\n";
if($this->useDefaultColumns){
print "\n"; // TODO: Consider rotating in a bunch of Motive Force sites and tweaking the ratios based on what we want to promote at any given time. // TODO: NON-PORTABLE. print ""; print " \n";
print "\n";
print " | ";
print "\n"; $this->displayRightColumn(); print " | "; print "||
| "; } else { print " | ||||