<?php
  ///////////////////////////////////////////////////
  //2007 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if (is_file ("../lang/".$lang."/".$lang.".php")) include "../lang/".$lang."/".$lang.".php";
     else include "../lang/ru/ru.php";

  $title=$titlepage = $TEXT['supp-tema-title3'];
  $helppage = $TEXT['supp-tema-help3'];

  require_once "../config.php";
  require_once "../util/top_layer1.php";

  if($result2['user'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);

  if(!isset($title)) $title = $TEXT['supp-tema-title3'];
  if(!isset($button)) $button = $TEXT['btn_edit'];
  if(!isset($action)) $action = "edit-tema.php";

  if(strlen($_GET['tema_id'])>11) puterror2($TEXT['error-tema4']);
  $_GET['tema_id'] = rep($_GET['tema_id']);

  $old_tema_id = $_GET['tema_id'];

  $query = "SELECT * FROM `tbl_supp_tema` WHERE `tema_id`='".$_GET['tema_id']."' ";
  $result = mysql_query($query);
  if(!$result) puterror2($TEXT['error-tbl22']);
   $result2 = mysql_fetch_array($result);
         $tema = $result2['tema'];
         $position = $result2['position'];
         $old_shablon = $result2['shablon'];
         $visible = $result2['visible'];

?>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table>
<tr><td class="useraddedit"><?php echo $TEXT['supp-tema-title']; ?></td><td><input size=30 maxlength=200 class="inputmandatory" type=text name=tema value='<?php echo $tema; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['nd-field10']; ?></td><td><input size=5 maxlength=11 class="inputmandatory" type=text name=position value='<?php echo $position; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-shablon']; ?></td><td><textarea class="input" name="shablon" cols="50" rows="5" ><?= $old_shablon ?></textarea></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-show']; ?></td><td class="useraddedit">
<select name=visible>
  <option value='show' <?php if ($visible =='show') echo "selected"?>><?php echo $TEXT['tbl-for-all']; ?>
  <option value='hide' <?php if ($visible =='hide') echo "selected"?>><?php echo $TEXT['tbl-for-otv']; ?>
  <option value='it' <?php if ($visible =='it') echo "selected"?>><?php echo $TEXT['tbl-for-it']; ?>
</select>
</td></tr>
<tr><td></td><td>
<input class=button type=submit value='<?php echo $button; ?>' />
<input type=hidden name=tema_id value='<?php echo $old_tema_id; ?>' />
</td></tr>
</table>
</form>
<?php
  require_once "../util/bottom.php";
?>