<?

  include '../FCKeditor/fckeditor.php';
  include_once '../../config.inc.php';
  if (!include '../autorization.php')
  {
    echo 'Access denied!';
    exit ();
  }

  if (!($result_proper = mysql_query ('select * from properties')))
  {
    exit ('<b>Error:</b>' . mysql_error ());
    ;
  }

  $proper = mysql_fetch_array ($result_proper);
  include '../lang/' . $proper['admin_language'];
  echo '
<HTML><BODY STYLE="color: Navy;"><LINK HREF="../style.css" REL="stylesheet" TYPE="text/css">

<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=5 BGCOLOR="#EFEFF8"><TR><TD VALIGN=top BGCOLOR="#BFBFDF" STYLE="border: 1px solid #505090;">
';
  if ($_POST['save'])
  {
    $handle = fopen ($documentroot . ('' . '/upload/topmenu/' . $_POST['old_tpl_name']), 'w+');
    $buffer = fputs ($handle, stripslashes ($_POST['FCKeditor1']));
    fclose ($handle);
  }

  echo '
<FORM ACTION="topmenu.php" METHOD=post>

<input type="hidden" name="old_tpl_name" value="';
  echo $_POST['page'];
  echo '">

';
  echo $admin_Current_page;
  echo '
	';
  echo '<s';
  echo 'elect name="page" onChange="submit()">
	<OPTION VALUE="----">---------------</OPTION>
	';
  if ($dir = @opendir ($documentroot . '/upload/topmenu'))
  {
    while ($file = readdir ($dir) !== false)
    {
      if ((($file != '.' AND $file != '..') AND strstr ($file, 'html')))
      {
        echo '					<OPTION VALUE="';
        echo $file;
        echo '" ';
        if ($_POST['page'] == $file)
        {
          echo 'selected';
        }

        echo '>';
        echo $file;
        echo '</OPTION>
			';
        continue;
      }
    }
  }

  closedir ($dir);
  echo '	</SELECT>
<input type="submit" name="save" value="';
  echo $admin_save;
  echo '"><hr>




';
  $oFCKeditor = new FCKeditor ('FCKeditor1');
  $oFCKeditor->BasePath = $sBasePath;
  if (file_exists ($documentroot . '/upload/topmenu/' . $_POST['page']))
  {
    $SRC = join ('', file ($documentroot . '/upload/topmenu/' . $_POST['page']));
  }

  if ($SRC != '')
  {
    $oFCKeditor->Value = str_replace ('
', '', $SRC);
  }
  else
  {
    $oFCKeditor->Value = '' . 'Page <b>' . $row['page'] . '</b> not found!';
  }

  $oFCKeditor->Width = '720';
  $oFCKeditor->Height = '600';
  $oFCKeditor->Config['DefaultLanguage'] = 'en';
  $oFCKeditor->Create ();
  echo '</FORM>
</TD></TR></TABLE></BODY></HTML>';
?>
