[ PHPXref.com ] [ Generated: Sun Jul 20 19:57:11 2008 ] [ PHP-Update 2.7 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/code/ -> template.php (source)

   1  <?
   2  extract($HTTP_POST_VARS); 
   3  extract($HTTP_GET_VARS); 
   4  extract($HTTP_COOKIE_VARS); 
   5  if(isset($enteredpass)) Setcookie("cookie[$currentpage]",$enteredpass);
   6  if(empty($adminfolder)) $adminfolder = "admin";
   7  
   8  if(file_exists("code/settings.php")) {
   9  include  "code/settings.php";
  10  if($connected != 1) {
  11  include "$adminfolder/common_db.inc";
  12  error_reporting(0);
  13  $link_id = db_connect();
  14  if(!$link_id) die(sql_error());
  15  if(!mysql_select_db($dbname)) die(sql_error());
  16  $connected = 1;
  17  }
  18  include "$adminfolder/sqlset.php";
  19  if(!isset($s) || $s == "") $s = "front";
  20  if((!isset($p) || $p == "") && $s != "gallery") $p = "index";
  21  
  22  if(isset($tn)) {
  23  if($tn != "") {
  24  if(file_exists("code/templates/$tn}_h.php") && file_exists("code/templates/$tn}_f.php")) {
  25  $texists = 1;
  26  Setcookie("cookie[template]",$tn);
  27  }
  28  }
  29  else {
  30  Setcookie("cookie[template]",$template);
  31  }
  32  }
  33  if(isset($tn)) {
  34  if($texists == 1) $template = $tn;
  35  }
  36  elseif(isset($cookie[template])) $template = $cookie[template];
  37  
  38  if(file_exists("$adminfolder/languages/$language.php")) include "$adminfolder/languages/$language.php";
  39  else {
  40  echo "<b>Critical error</b><br>Language file <i>$language</i> could not be found.<p>";
  41  exit;
  42  }
  43  
  44  $p = str_replace("../", "", $p);
  45  $s1 = substr($s, 0, 1);
  46  
  47  if($s == "guestbook") $countcat = "v";
  48  else $countcat = $s1;
  49  if($s1 == "r") {
  50  $pc = str_replace("/", "-", $p);
  51  $pc = str_replace("?", "-", $pc);
  52  $pc = str_replace(":", "-", $pc);
  53  $countfile = "counter/$countcat}_$pc.txt";
  54  }
  55  $countq = mysql_query("SELECT count FROM $table_prefix}counter WHERE section='$s1' AND name='$p'");
  56  $totcount = mysql_result($countq, 0, 0) + 1;
  57  $table_def = "'', '$countcat', '$p', '$totcount'";
  58  if(!mysql_query("REPLACE INTO $table_prefix}counter VALUES($table_def)")) $err = 1;
  59  
  60  $variable = "$s1}_$p";
  61  if($s1 == "b" || $s1 == "n") {
  62  $blogq = mysql_query("SELECT title FROM $table_prefix}blogdetails WHERE name='$p'");
  63  if(mysql_num_rows($blogq) > 0) {
  64  $blogtitle = mysql_result($blogq, 0, 0);
  65  $pagetitle = "$sitetitle $split $blogtitle";
  66  $thispagetitle = "$blogtitle";
  67  }
  68  else {
  69  $pagetitle = $sitetitle;
  70  $thispagetitle = $sitetitle;
  71  }
  72  }
  73  elseif($s == "gallery") {
  74  if(empty($p)) {
  75  $pagetitle = $sitetitle;
  76  $thispagetitle = $sitetitle;
  77  }
  78  else {
  79  $gallq = mysql_query("SELECT gallname FROM $table_prefix}gall WHERE gallid='$p'");
  80  if(mysql_num_rows($gallq) > 0) {
  81  $name = mysql_result($gallq, 0, 0);
  82  $pagetitle = "$sitetitle $split $name";
  83  $thispagetitle = "$name";
  84  }
  85  }
  86  }
  87  elseif($s == "rss") {
  88  include  "code/rss.php";
  89  $pagetitle = "$sitetitle $split $rsstitle";
  90  $thispagetitle = $rsstitle;
  91  }
  92  elseif($s == "guestbook") {
  93  $pagetitle = "$sitetitle $split $title_guestbook";
  94  $thispagetitle = "$title_guestbook";
  95  }
  96  elseif($s == "files") {
  97  $pagetitle = "$sitetitle $split $txt_files";
  98  $thispagetitle = "$txt_files";
  99  }
 100  else {
 101  if($s == "content") {
 102  $pagetitleq = mysql_query("SELECT title FROM $table_prefix}content WHERE filename='$p'");
 103  $contenttitle = mysql_result($pagetitleq, 0, 0);
 104  $pagetitle = "$sitetitle $split $contenttitle";
 105  $thispagetitle = "$contenttitle";
 106  }
 107  else {
 108  if(!empty($fronttitle)) {
 109  $pagetitle = "$sitetitle $split $fronttitle";
 110  $thispagetitle = "$fronttitle";
 111  }
 112  else {
 113  $pagetitle = $sitetitle;
 114  $thispagetitle = $sitetitle;
 115  }
 116  }
 117  }
 118  
 119  if(!isset($txt_wrongpass)) $txt_wrongpass = "Sorry, you have entered the wrong password. Please try again below.";
 120  if(!isset($txt_enterpass)) $txt_enterpass = "This page is password protected - please enter the password below.";
 121  if(!isset($txt_enter)) $txt_enter = "Enter";
 122  $currentpage = "$s}_$p";
 123  $passq = mysql_query("SELECT password FROM $table_prefix}passwords WHERE page='$currentpage'");
 124  $pass[$currentpage] = mysql_result($passq, 0, 0);
 125  
 126  if($print == 1) {
 127  echo "<html>
 128  <head>
 129  <title>$pagetitle</title>
 130  <body>
 131  <table width=100%><tr><td align=right width=100%><font size=-2><a href=\"javascript:window.print()\">$txt_printpg</a> | <a href=\"javascript:window.close()\">$txt_close</a></font></td></tr></table>
 132  <hr>";
 133  if($s == "front") $p = "index";
 134  if(!empty($pass[$currentpage]) && ($pass[$currentpage] != $enteredpass && $pass[$currentpage] != $cookie[$currentpage])) {
 135  if(isset($enteredpass)) echo "$txt_wrongpass<br/>";
 136  else echo "$txt_enterpass<br/>";
 137  
 138  echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\"><table cellpadding=\"2\">
 139  <tr><td>$txt_password:</td><td><input type=\"password\" name=\"enteredpass\"/></td></tr>
 140  <tr><td>&nbsp;</td><td><input type=\"hidden\" name=\"currentpage\" value=\"$currentpage\"/><input type=\"submit\" value=\"$txt_enter\"/></td></tr>
 141  </table></form>";
 142  }
 143  else include  "code/content.php";
 144  echo "</body>
 145  </html>";
 146  }
 147  else {
 148  if(file_exists("code/templates/$template}_h.php") && file_exists("code/templates/$template}_f.php")) {
 149  $metaq = mysql_query("SELECT * FROM $table_prefix}metatags WHERE msection='$s' AND mpage='$p'");
 150  $meta_description = mysql_result($metaq, 0, "mdescription");
 151  $meta_keyword = mysql_result($metaq, 0, "mkeywords");
 152  include "code/templates/$template}_h.php";
 153  $usetemplate = $template;
 154  
 155  if(!empty($pass[$currentpage]) && ($pass[$currentpage] != $enteredpass && $pass[$currentpage] != $cookie[$currentpage])) {
 156  if(isset($enteredpass)) echo "$txt_wrongpass<br/>";
 157  else echo "$txt_enterpass<br/>";
 158  
 159  echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\"><table cellpadding=\"2\">
 160  <tr><td>$txt_password:</td><td><input type=\"password\" name=\"enteredpass\"/></td></tr>
 161  <tr><td>&nbsp;</td><td><input type=\"hidden\" name=\"currentpage\" value=\"$currentpage\"/><input type=\"submit\" value=\"$txt_enter\"/></td></tr>
 162  </table></form>";
 163  }
 164  else include  "code/content.php";
 165  if($rss == 1 && ($s == "blogs" || $s == "news" || ($s == "front" && ($front == "both" || $front == "blogs")))) {
 166  if($s == "front") $p = "$frontblog";
 167  $rssin = 1;
 168  if($stat == "1") echo "<table width=\"90%\" align=\"center\"><tr><td align=\"right\"><a title=\"RSS 2.0\" href=\"st/feed/$p\" class=\"st_rss\">RSS</a>";
 169  else echo "<table width=\"90%\" align=\"center\"><tr><td align=\"right\"><a title=\"RSS 2.0\" href=\"rss.php?p=$p\" class=\"st_rss\">RSS</a>";
 170  if($printable == 0) echo "</td></tr></table>";
 171  }
 172  if($printable == 1) {
 173  if($rssin != 1) echo "<table width=\"90%\" align=\"center\"><tr><td align=\"right\">";
 174  else echo "&nbsp;&nbsp;";
 175  if($stat == "1") {
 176  if(empty($p) || $s == "front") $p = "index";
 177  echo "<a href=\"javascript:window.open('$rooturl}st/$s/$p";
 178  if(isset($c)) echo "/c/$c";
 179  if(isset($m)) echo "/m/$m";
 180  echo "/print','','status=no,width=600,height=400,left=20,top=20,scrollbars=yes');void('w');\" class=\"st_printable\">$txt_printable</a></td></tr></table>";
 181  }
 182  else {
 183  echo "<a href=\"javascript:window.open('index.php?s=$s&amp;p=$p";
 184  if(isset($c)) echo "&amp;c=$c";
 185  if(isset($m)) echo "&amp;m=$m";
 186  echo "&amp;print=1','','status=no,width=600,height=400,left=20,top=20,scrollbars=yes');void('w');\" class=\"st_printable\">$txt_printable</a></td></tr></table>";
 187  }
 188  }
 189  include "code/templates/$usetemplate}_f.php";
 190  }
 191  else {
 192  echo "<b>$txt_error</b><br>$txt_tempnofound<p>";
 193  include  "code/content.php";
 194  }
 195  }
 196  }
 197  else {
 198  echo "Welcome to PHP-Update. You must first install the script. To do this, run the installer by clicking <a href=\"code/install.php\">here</a>.";
 199  }
 200  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]