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

title

Body

[close]

/admin/ -> metatags.php (source)

   1  <?
   2  extract($HTTP_POST_VARS); 
   3  extract($HTTP_GET_VARS); 
   4  extract($HTTP_COOKIE_VARS); 
   5  $adminsect = 1;
   6  include  "protection.php";
   7  if(file_exists("languages/$language.php")) include "languages/$language.php";
   8  else {
   9  echo "<b>Critical error</b><br>Language file <i>$language</i> could not be found.<p>";
  10  exit;
  11  }
  12  if(!isset($txt_metatags)) $txt_metatags = "META tags";
  13  $idtitle = "$sitetitle $split $txt_metatags";
  14  $thispagetitle = "$txt_metatags";
  15  if(file_exists("../code/templates/$template}_h.php") && file_exists("../code/templates/$template}_f.php")) {
  16  $tempfilename = "../code/templates/$template}_h.php";
  17  $handle = fopen($tempfilename, "r");
  18  $temp = fread($handle, filesize ($tempfilename));
  19  fclose($handle);
  20  include  "../code/menucode.php";
  21  include  "../code/parsetemplate.php";
  22  parsetemplate($temp, $menucode, $thispagetitle, $idtitle);
  23  if($rights[10] == "1" && $adminuser == "1") {
  24  
  25  if(!isset($txt_tagsaved)) $txt_tagsaved = "Tag has been saved.";
  26  if(!isset($txt_tagdeleted)) $txt_tagdeleted = "Tag has been deleted.";
  27  if(!isset($txt_description)) $txt_description = "Description";
  28  if(!isset($txt_keywords)) $txt_keywords = "Keywords";
  29  if(!isset($txt_currentlynotag)) $txt_currentlynotag = "There are currently no tagged pages.";
  30  if(!isset($txt_addtag)) $txt_addtag = "Add new tagged page";
  31  if(!isset($txt_currenttagged)) $txt_currenttagged = "Currently tagged pages";
  32  
  33  if(isset($id)) {
  34  if($a == "d") {
  35  if(!mysql_query("DELETE FROM $table_prefix}metatags WHERE autono='$id'")) $err = 1;
  36  if($err == 1) echo "$txt_noaccess<p>";
  37  else echo "$txt_tagdeleted<p>$txt_home";
  38  }
  39  else  {
  40  if(isset($newdesc)) {
  41  if($id == "new") {
  42  if($newcat == "content") $newlink = $newlinkc;
  43  elseif($newcat == "blogs" || $newcat == "news") $newlink = $newlinkb;
  44  elseif($newcat == "gallery") $newlink = $newlinkg;
  45  elseif($newcat == "front") $newlink = "index";
  46  elseif($newcat == "rss" || $newcat == "external") $newlink = $newlinkt;
  47  else $newlink = "";
  48  
  49  if($newlink == "-1") $newlink = "";
  50  $id = "$newcat}_$newlink";
  51  }
  52  if(isset($msect)) $newcat = $msect;
  53  if(isset($mpage)) $newlink = $mpage;
  54  
  55  $values = "'', '$newcat', '$newlink', '$newdesc', '$newkeyw'";
  56  if(!mysql_query("REPLACE INTO $table_prefix}metatags VALUES($values)")) $err = 1;
  57  
  58  if($err == 1) echo "$txt_noaccess<p>";
  59  else echo "$txt_tagsaved<p>$txt_home";
  60  
  61  }
  62  else {
  63  
  64  if($id == "new") {
  65  echo "<head>
  66  <script language=\"javascript\">
  67  function checkselection(radioButton) {
  68  for (x = 0; x <= radioButton.length; x++) {
  69  if (radioButton[x].checked == true) return radioButton[x].value; 
  70  } 
  71  }
  72  
  73  function boxes(chosen) {
  74  if(chosen == 'notapp') {
  75  document.getElementById('notapp').style.display = 'inline';
  76  document.getElementById('cont').style.display = 'none';
  77  document.getElementById('blog').style.display = 'none';
  78  document.getElementById('gall').style.display = 'none';
  79  document.getElementById('text').style.display = 'none';
  80  }
  81  if(chosen == 'cont') {
  82  document.getElementById('notapp').style.display = 'none';
  83  document.getElementById('cont').style.display = 'inline';
  84  document.getElementById('blog').style.display = 'none';
  85  document.getElementById('gall').style.display = 'none';
  86  document.getElementById('text').style.display = 'none';
  87  }
  88  if(chosen == 'blog') {
  89  document.getElementById('notapp').style.display = 'none';
  90  document.getElementById('cont').style.display = 'none';
  91  document.getElementById('blog').style.display = 'inline';
  92  document.getElementById('gall').style.display = 'none';
  93  document.getElementById('text').style.display = 'none';
  94  }
  95  if(chosen == 'gall') {
  96  document.getElementById('notapp').style.display = 'none';
  97  document.getElementById('cont').style.display = 'none';
  98  document.getElementById('blog').style.display = 'none';
  99  document.getElementById('gall').style.display = 'inline';
 100  document.getElementById('text').style.display = 'none';
 101  }
 102  if(chosen == 'text') {
 103  document.getElementById('notapp').style.display = 'none';
 104  document.getElementById('cont').style.display = 'none';
 105  document.getElementById('blog').style.display = 'none';
 106  document.getElementById('gall').style.display = 'none';
 107  document.getElementById('text').style.display = 'inline';
 108  }
 109  }
 110  
 111  function checkselect(rad) {
 112  cat = checkselection(rad);
 113  if (cat == 'content') boxes('cont');
 114  if (cat == 'blogs' || cat == 'news') boxes('blog');
 115  if (cat == 'gallery') boxes('gall');
 116  if (cat == 'rss' || cat == 'external') boxes('text');
 117  if (cat == 'front' || cat == 'separator' || cat == 'guestbook') boxes('notapp');
 118  }
 119  
 120  </script>
 121  </head>
 122  <body onload=checkselect(document.menu.newcat)>";
 123  
 124  $varname = $id;
 125  $under = strpos($varname, "_");
 126  $sect = substr($varname, 0, $under);
 127  $thepage = substr($varname, $under + 1);
 128  
 129  $contq = mysql_query("SELECT filename FROM $table_prefix}content ORDER BY filename ASC");
 130  $contdrop = "<select name=newlinkc>";
 131  for($i = 0; $i < mysql_num_rows($contq); $i++) {
 132  $dispfile = mysql_result($contq, $i, 0);
 133  $contdrop .= "<option value=$dispfile>$dispfile</option>";
 134  }
 135  $contdrop .= "</select>";
 136  
 137  $blogq = mysql_query("SELECT name FROM $table_prefix}blogdetails ORDER BY name ASC");
 138  $blogdrop = "<select name=newlinkb>";
 139  for($i = 0; $i < mysql_num_rows($blogq); $i++) {
 140  $dispfile = mysql_result($blogq, $i, 0);
 141  $blogdrop .= "<option value=$dispfile>$dispfile</option>";
 142  }
 143  $blogdrop .= "</select>";
 144  
 145  $gallq = mysql_query("SELECT * FROM $table_prefix}gall ORDER BY gallname ASC");
 146  $galldrop = "<select name=newlinkg>";
 147  $galldrop .= "<option value=-1";
 148  if($link[$m] == "") $galldrop .= " SELECTED";
 149  $galldrop .= ">(None)</option>";
 150  for($i = 0; $i < mysql_num_rows($gallq); $i++) {
 151  $name = mysql_result($gallq, $i, "gallname");
 152  $dispfile = mysql_result($gallq, $i, "gallid");
 153  $galldrop .= "<option value=$dispfile>$dispfile ($name)</option>";
 154  }
 155  $galldrop .= "</select>";
 156  
 157  echo "<b>$txt_addtag</b><br><img src=\"../gfx/blank.gif\" width=1 height=6><br>
 158  <table border=0 cellspacing=1 cellpadding=2><form method=post name=menu action=metatags.php?id=$id>
 159  <tr><td colspan=2><input type=radio name=newcat value=\"front\" CHECKED onclick=\"boxes('notapp')\"> $txt_front} <input type=radio name=newcat value=\"content\" onclick=\"boxes('cont')\"> $txt_content <input type=radio name=newcat value=\"blogs\" onclick=\"boxes('blog')\"> $txt_blog <input type=radio name=newcat value=\"news\" onclick=\"boxes('blog')\"> $txt_news<br><input type=radio name=newcat value=\"guestbook\" onclick=\"boxes('notapp')\"> $txt_guestbook <input type=radio name=newcat value=\"gallery\" onclick=\"boxes('gall')\"> $txt_gallery <input type=radio name=newcat value=\"rss\" onclick=\"boxes('text')\"> RSS <input type=radio name=newcat value=\"separator\" onclick=\"boxes('notapp')\"> $txt_separator</td></tr>
 160  <tr><td align=right width=20%>$txt_page:</td><td><div id=\"notapp\">(N/A)</div><div id=\"cont\" style=\"display:none;\">$contdrop</div><div id=\"blog\" style=\"display:none;\">$blogdrop</div><div id=\"gall\" style=\"display:none;\">$galldrop</div><div id=\"text\" style=\"display:none;\"><input type=text name=newlinkt></div></td></tr>
 161  <tr><td align=right>$txt_description:</td><td><input type=text name=newdesc></td></tr>
 162  <tr><td align=right>$txt_keywords:</td><td><input type=text name=newkeyw></td></tr>
 163  <tr><td>&nbsp;</td><td><input type=submit value=\"$txt_save\"></td></tr>
 164  </form></table>";
 165  }
 166  else {
 167  $metaq = mysql_query("SELECT * FROM $table_prefix}metatags WHERE autono='$id'");
 168  $msect = mysql_result($metaq, 0, "msection");
 169  $mpage = mysql_result($metaq, 0, "mpage");
 170  $mdesc = mysql_result($metaq, 0, "mdescription");
 171  $mkeyw = mysql_result($metaq, 0, "mkeywords");
 172  echo "<b>$txt_password</b><br><img src=\"../gfx/blank.gif\" width=1 height=6><br>
 173  <table border=0 cellspacing=1 cellpadding=2><form method=post name=menu id=menu action=metatags.php?id=$id>
 174  <tr><td align=right>$txt_description:</td><td><input type=text name=newdesc value=\"$mdesc\"></td></tr>
 175  <tr><td align=right>$txt_keywords:</td><td><input type=text name=newkeyw value=\"$mkeyw\"></td></tr>
 176  <input type=hidden name=\"msect\" value=\"$msect\">
 177  <input type=hidden name=\"mpage\" value=\"$mpage\">
 178  <tr><td>&nbsp;</td><td><input type=submit value=\"$txt_save\"></td></tr>
 179  </form></table>";
 180  }
 181  }
 182  }
 183  }
 184  else {
 185  
 186  $metaq = mysql_query("SELECT * FROM $table_prefix}metatags ORDER BY msection, mpage ASC");
 187  
 188  if(mysql_num_rows($metaq) > 0) {
 189  
 190  echo "$txt_currenttagged:<br>
 191  <table border=0 cellspacing=0 cellpadding=2 width=30%>
 192  <tr><td><b>$txt_section</b></td><td><b>$txt_page</b></td><td><b>$txt_description</b></td><td><b>$txt_keywords</b></td><td>&nbsp;</td></tr>";
 193  for($i = 0; $i < mysql_num_rows($metaq); $i++) {
 194  $mid[$i] = mysql_result($metaq, $i, "autono");
 195  $msect[$i] = mysql_result($metaq, $i, "msection");
 196  $mpage[$i] = mysql_result($metaq, $i, "mpage");
 197  $mdesc[$i] = mysql_result($metaq, $i, "mdescription");
 198  $mkeyw[$i] = mysql_result($metaq, $i, "mkeywords");
 199  next($pass);
 200  echo "<tr><td>$msect[$i]</td><td>$mpage[$i]</td><td>$mdesc[$i]</td><td>$mkeyw[$i]</td><td><a href=\"metatags.php?id=$mid[$i]\">$txt_edit</a> $split <a href=\"metatags.php?id=$mid[$i]&a=d\">$txt_delete</a></td></tr>";
 201  }
 202  echo "</table><p>";
 203  }
 204  else echo "$txt_currentlynotag<p>";
 205  
 206  echo "<a href=\"metatags.php?id=new\">$txt_addtag</a><p>";
 207  }
 208  }
 209  else echo "<b>$txt_error</b><br>$txt_norights<br><img src=\"../gfx/blank.gif\" width=1 height=6><br>$txt_home<p>";
 210  $tempfilename = "../code/templates/$template}_f.php";
 211  $handle = fopen($tempfilename, "r");
 212  $temp = fread($handle, filesize ($tempfilename));
 213  fclose($handle);
 214  parsetemplate($temp, $menucode, $thispagetitle, $pagetitle);
 215  }
 216  else echo "<b>$txt_error</b><br>$txt_tempnofound<p>";
 217  ?>


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