<?php
  ///////////////////////////////////////////////////
  //База знаний
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

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

  $title=$titlepage = $TEXT['support15'];

  require_once "../config.php";
  require_once "top.php";
  ?>
  <title><?php echo $title; ?></title>
  <link rel="StyleSheet" type="text/css" href="../utils/grid.css" />
  <link rel="shortcut icon" href="../Favicon/know-base.ico" type="image/x-icon" />
  </head>
  <body leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" bottommargin="0" topmargin="0" >
  <?php
  if(!isset($button)) $button = $TEXT['btn_gen'];
  if(!isset($action)) $action = "know_add_fileform.php";
?>
<table class="tabledata" align="center">
  <tr><td class="z1"><?php echo $titlepage; ?></td></tr>
</table>
<form enctype='multipart/form-data' name='form' action=<?php echo $action; ?> method=post>
<table class="tabledata" align="center" border="0">
<tr><td class="useraddedit"><?php echo $TEXT['support15']; ?></td><td><input type=file name=image /></td></tr>
 <tr><td class="useraddedit"><?php echo $TEXT['link-descrip']; ?></td><td class="useraddedit"><input type="text" size=30 maxlength=255 name="descrip" /></td></tr>
 <tr><td class="useraddedit"><?php echo $TEXT['izm-visible']; ?></td><td class="useraddedit"><input type="text" size=30 maxlength=255 name="otobr" /></td></tr>
<tr><td align="center" colspan="2"><input class="button" type=submit value='<?php echo $button; ?>' /></td></tr>
</table>
<?php
  if($_FILES['image']['size'] > 1024*20*1024) puterror2($TEXT['error-pic3']);
  $sm = "file";
  if(!empty($_FILES['image']['tmp_name']))
  {
    $ext = strrchr($_FILES['image']['name'], ".");
    $image = "../photo-knows/$sm".date("YmdHis",time())."$ext";
    if(copy($_FILES['image']['tmp_name'], $image))
    {
      unlink($_FILES['image']['tmp_name']);
      chmod($image, 0644);
    }
  }
  //else puterror2($TEXT['error-photo-no']);
  ?>
<input type=hidden name=image value='<?php echo $image; ?>' />
</form>
<?php
  if(!empty($_POST['otobr'])) $otobr1 = "&lt;img class='tips_file_link' alt='tips' src='../img/filesave14.png' /&gt; (".$_POST['otobr'].") ";
   else $otobr1 = "&lt;img class='tips_file_link' alt='tips' src='../img/filesave14.png' /&gt;";

  if(!empty($image)) echo "<table border=\"0\" width=\"95%\" align=\"center\"><tr><td><p class=\"statssilka\"><img class=\"tipsimg\" alt=\"tips\" src=\"../img/ftp16.png\" />&lt;a class=\"fntdecnone\" href=\"".$image."\" target=\"_blank\" title=\"".$_POST['descrip']."\"&gt;".$otobr1."&lt;/a&gt;</p></td></tr></table>";
?>
</body>
</html>