rendered paste body<?phpclass Page2{ public $title; public $content; public $flipTitle = false; public $h1; public $style = 'liquidblue'; public $information; public $metatags; public $headers = array(); public $breadcrumbs = array(); public $onload; public $description; private $replacements = array(); function Page2(){ $filename = '/tmp/cache/pages/'.base64_encode($_SERVER['REQUEST_URI']); if(file_exists($filename)){ include($filename); foreach($cache as $key=>$val ){ $this->$key = $val; } $this->Generate(); exit; } if(!(ob_get_level()-1)){ ob_start(); } foreach(get_object_vars($this) as $key => $value){ $this->replacements[$key] = &$this->$key; } $this->replacements['pageContent'] = &$this->content; unset($this->replacements['breadcrumbs']); } function UpdateCache(){ $cache = var_export(get_object_vars($this),true); $filename = '/tmp/cache/pages/'.base64_encode($_SERVER['REQUEST_URI']); file_put_contents($filename,'<?php $cache = '.$cache.'; ?>'); } function BuildMetaTags(){ if($this->gameName){ $sql = DB::Query("SELECT * FROM games.sections WHERE alias = '$this->section'"); $r = DB::FetchArray($sql); } $sql2 = DB::Query("SELECT * FROM mp3sections WHERE game = '$this->section'"); if (pg_num_rows($sql2) > 0){ while($r2 = pg_fetch_array($sql2)){ $mwords .= " $r2[name],"; } $cwords .= " $this->gameName mp3s, $this->gameName music"; } $sql2 = DB::Query("SELECT * FROM videos.fmvs WHERE section = '$this->section'"); if (pg_num_rows($sql2) > 0){ $cwords .= " $this->gameName fmvs, $this->gameName cutscenes, $this->gameName movies,"; } $sql2 = DB::Query("SELECT * FROM wcount WHERE section = '$this->section' AND count > 0"); if (pg_num_rows($sql2) > 0){ $cwords .= " $this->gameName wallpapers,"; } $sql2 = DB::Query("SELECT * FROM imgcount WHERE section = '$this->section' AND count > 0"); if (pg_num_rows($sql2) > 0){ $cwords .= " $this->gameName images,"; } $sql2 = DB::Query("SELECT * FROM trailers WHERE game = '$this->section'"); if (pg_num_rows($sql2) > 0){ $cwords .= " $this->gameName trailers,"; } $this->metatags = "<meta name=\"Description\" content=\"$this->description BlueLaguna.net provides users with $r[name] media including$cwords and media from other games in the RPG genre\">\n <meta name=\"Keywords\" content=\"$r[name] media,$mwords $cwords\">\n"; } public function Generate(){ //Fetch list of games $sql = DB::Query("SELECT alias, name FROM games.series WHERE type = 'n' UNION ALL SELECT alias, name FROM games.sections WHERE category='other' OR category='se'ORDER BY name"); while ($r=pg_fetch_array($sql)){ $this->replacements['gameList'] .= "<li>><a href='http://bluelaguna.net/splash/$r[alias].php'>$r[name]</a></li>\n"; unset($r); } //Generate Title if($this->flipTitle){ $this->replacements['titledisplay'] = "Blue Laguna's Media Archive - $this->title"; } else{ $this->replacements['titledisplay']= "$this->title - Blue Laguna's Media Archive"; } //Generate Bread Crumbs if($this->breadcrumbs){ $this->replacements['breadcrumbs'] = '<a href="http://bluelaguna.net/">Blue Laguna</a>'; foreach ($this->breadcrumbs as $bread){ $item = explode("|&|",$bread); $this->replacements['breadcrumbs'] .= " / <a href='$item[1]'>$item[0]</a>"; } } else{ $this->replacements['breadcrumbs'] = false; } //Insert all headers $tmp = ""; foreach($this->headers as $header){ $tmp .= $header."\n"; } $this->replacements['headers'] = $tmp; //Generate login bar if($userinfo['username']){ $this->replacements['topBar'] = "<div id=\"topnav\" >\n $userinfo[username]: <a href=\"/members/submissions.php\">My Submissions</a>\n <a href=\"/members/logout.php\">Log Out</a>\n </div>\n"; } else{ $this->replacements['topBar'] = " <div id='toplogin'> <form method=\"post\">\n <input type='text' size='16' maxlength='64' value='Username' name='username' onClick='javascript: this.focus();this.select();'>\n <input type='password' size='16' value='password' maxlength='64' name='password' onClick='javascript: this.focus();this.select();'>\n <input type='submit' name='Submit' value='Login' class='button'>\n </form>\n</div> \n"; } if(!$this->metatags && $this->section){ $this->BuildMetaTags(); } //Determine Current user's playlist if($_SESSION['userinfo']['alist']){ $this->replacements['alist'] = $_SESSION['userinfo']['alist']; } else{ $this->replacements['alist'] = 0; } if($this->information){ $this->replacements['information'] = "<p>$this->information</p>"; } $temp = file_get_contents("/home/vhosts/bluelaguna.net/templates/$this->style/index.html"); foreach($this->replacements as $key=>$replacement){ $temp = str_replace('$'."$key",$replacement,$temp); } echo $temp; } function __get($var){ if($var == 'linkbox'){ $title = $_GLOBALS['title']; $pageurl = "http://bluelaguna.net/$_SERVER[REQUEST_URI]"; $link = "<form name='linkform' id='linkform'><strong>Link to this page: </strong><input name=\"pagelink\" type=\"text\" value=\"<a href='$pageurl'>$title</a>\" onClick=\"javascript: document.linkform.pagelink.focus();document.linkform.pagelink.select();\" readonly='true'></form>"; return $link; } else{ return $this->$var; } } private function __set($var, $val){ switch ($var) { case 'section': $this->$var = $val; //$this->SectionLinks(); break; case 'title': $this->$var = $val; if(!$this->h1){ $this->h1 = '<h1>'.$val.'</h1>'; } break; case 'h1': $this->h1 = '<h1>'.$val.'</h1>'; break; case 'default': $this->$var = $val; break; } } } ?>