<?

  require_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>
<LINK HREF="../style.css" REL="stylesheet" TYPE="text/css">
<FONT COLOR="maroon">';
  echo $admin_Site_Properties;
  echo '</FONT>

';
  if ($_POST['Save_changes'])
  {
    if (!(mysql_query ('delete from properties')))
    {
      exit ('Invalid query1');
      ;
    }

    $SQL = '' . 'INSERT INTO properties VALUES(
	\'' . $HTTP_POST_VARS['title'] . '\',
	\'' . $HTTP_POST_VARS['keywords'] . '\',
	\'' . $HTTP_POST_VARS['description'] . '\',
	\'' . $HTTP_POST_VARS['bodytagset'] . '\',
	\'' . $HTTP_POST_VARS['email'] . '\',
	\'' . $HTTP_POST_VARS['language'] . '\',
	\'' . $HTTP_POST_VARS['encoding'] . '\',
	\'' . $HTTP_POST_VARS['date_format'] . '\',	
	\'' . $HTTP_POST_VARS['counter'] . '\',
	\'' . $HTTP_POST_VARS['admin_language'] . '\',
	\'' . $HTTP_POST_VARS['txt_direction'] . '\'
	)';
    if (!(mysql_query ($SQL)))
    {
      exit ('Invalid query2');
      ;
    }

    echo '<B><FONT COLOR="white" STYLE="background-color:red;">&nbsp;';
    echo $admin_Last_Changes_Saved;
    echo '&nbsp;</FONT></B>';
  }

  echo '

';
  if (!($result = mysql_query ('SELECT * FROM properties')))
  {
    exit ('Invalid query3');
    ;
  }

  $row = mysql_fetch_array ($result);
  echo '
<FORM ACTION="';
  echo $php_self;
  echo '" METHOD=post>
<table border="1" cellspacing="0" cellpadding="5" class="border">
<tr>
	<td align="right" width="150">';
  echo $admin_Title;
  echo '</td>
	<td><textarea cols="50" rows="3" name="title">';
  echo $row['title'];
  echo '</textarea></td>
</tr>
<tr>
	<td align="right">';
  echo $admin_Keywords;
  echo '</td>
	<td><textarea cols="50" rows="3" name="keywords">';
  echo $row['keywords'];
  echo '</textarea></td>
</tr>
<tr>
	<td align="right">';
  echo $admin_Description;
  echo '</td>
	<td><textarea cols="50" rows="3" name="description">';
  echo $row['description'];
  echo '</textarea></td>
</tr>
<tr>
	<td align="right">';
  echo $admin_Body_set;
  echo '</td>
	<td><textarea cols="50" rows="3" name="bodytagset">';
  echo $row['bodytagset'];
  echo '</textarea></td>
</tr>
<tr>
	<td align="right">';
  echo $admin_Email;
  echo '</td>
	<td><input type="text" name="email" size=50 maxsize=50 value="';
  echo $row['email'];
  echo '"></td>
</tr>
<tr>
	<td align="right">';
  echo $admin_Site_Language;
  echo '</td>
	<td>
	';
  echo '<S';
  echo 'ELECT NAME="language">
	';
  if ($dir = @opendir ('../../lang'))
  {
    while ($file = readdir ($dir) !== false)
    {
      if (($file != '.' AND $file != '..'))
      {
        echo '					<OPTION VALUE="';
        echo $file;
        echo '" ';
        if ($row['language'] == $file)
        {
          echo 'selected';
        }

        echo '>';
        echo substr ($file, 0, -4);
        echo '</OPTION>
			';
        continue;
      }
    }
  }

  closedir ($dir);
  echo '	</SELECT>
	</td>
</tr>
<tr>
<tr>
	<td align="right">';
  echo $admin_Admin_Panel_Language;
  echo '</td>
	<td>
	';
  echo '<S';
  echo 'ELECT NAME="admin_language">
	';
  if ($dir = @opendir ('../lang'))
  {
    while ($file = readdir ($dir) !== false)
    {
      if (($file != '.' AND $file != '..'))
      {
        echo '					<OPTION VALUE="';
        echo $file;
        echo '" ';
        if ($row['admin_language'] == $file)
        {
          echo 'selected';
        }

        echo '>';
        echo substr ($file, 0, -4);
        echo '</OPTION>
			';
        continue;
      }
    }
  }

  closedir ($dir);
  echo '	</SELECT>
	</td>
</tr>
<tr>
	<td align="right" valign="top">';
  echo $admin_Encoding;
  echo '</td>
	<td>
	';
  $lang_name = array ('Arabic (ISO)', 'Arabic (Windows)', 'Baltic (ISO)', 'Baltic (Windows)', 'Central European (ISO)', 'Central European (Windows)', 'Chinese Simplified (GB2312)', 'Chinese Simplified (HZ)', 'Chinese Traditional (Big5)', 'Cyrillic (ISO)', 'Cyrillic (KOI8-R)', 'Cyrillic (KOI8-U)', 'Cyrillic (Windows)', 'Greek (ISO)', 'Greek (Windows)', 'Hebrew (ISO-Logical)', 'Hebrew (Windows)', 'Japanese (EUC)', 'Japanese (JIS)', 'Japanese (JIS-Allow 1 byte Kana)', 'Japanese (Shift-JIS)', 'Korean', 'Korean (EUC)', 'Latin 3 (ISO)', 'Latin 9 (ISO)', 'Thai (Windows)', 'Turkish (ISO)', 'Turkish (Windows)', 'Unicode (UTF-7)', 'Unicode (UTF-8)', 'US-ASCII', 'Vietnamese (Windows)', 'Western European (ISO)', 'Western European (Windows)');
  $lang_charset = array ('ISO-8859-6', 'Windows-1256', 'ISO-8859-4', 'Windows-1257', 'ISO-8859-2', 'Windows-1250', 'GB2312', 'HZ-GB-2312', 'Big5', 'ISO-8859-5', 'KOI8-R', 'KOI8-U', 'Windows-1251', 'ISO-8859-7', 'Windows-1253', 'ISO-8859-8-I', 'indows-1255', 'EUC-JP', 'ISO-2022-JP', 'ISO-2022-JP', 'Shift-JIS', 'KS_C_5601-1987', 'EUC-KR', 'ISO-8859-3', 'ISO-8859-15', 'Windows-874', 'ISO-8859-9', 'Windows-1254', 'UTF-7', 'UTF-8', 'US-ASCII', 'Windows-1258', 'ISO-8859-1', 'Windows-1252');
  echo '	';
  echo '<s';
  echo 'elect name="encoding">
	';
  for ($i = 0; $i < sizeof ($lang_name); ++$i)
  {
    echo '		<option value="';
    echo $lang_charset[$i];
    echo '" ';
    if ($row['encoding'] == $lang_charset[$i])
    {
      echo 'selected';
    }

    echo '>';
    echo $lang_name[$i];
    echo '</option>
';
  }

  echo '	</select>
	</td>
</tr>

<tr>
<td align="right">';
  echo $admin_date_format;
  echo '</td>
	<td>
		<input type="text" name="date_format" size=20 value="';
  echo $row['date_format'];
  echo '"><BR>
		<b>#d</b> - day(digits)<BR>
		<b>#m</b> - month(digits)<BR>
		<b>#M</b> - month(textual)<BR>
		<b>#y</b> - year(2 digit)<BR>
		<b>#Y</b> - year(4 digit)<BR>
		<b>#h</b> - hour(AM/PM)<BR>
		<b>#H</b> - hour(24)<BR>
		<b>#i</b> - minutes
	</td>
</tr>

<tr>
<td align="right">';
  echo $admin_Activate_session_tracking;
  echo '</td>
<TD><input type="radio" name="counter" value="yes" ';
  if ($row['counter'] == 'yes')
  {
    echo 'CHECKED';
  }

  echo '>';
  echo $admin_yes;
  echo '<input type="radio" name="counter" value="no" ';
  if ($row['counter'] == 'no')
  {
    echo 'CHECKED';
  }

  echo '>';
  echo $admin_no;
  echo '</TD>
</tr>

<tr>
<td align="right">';
  echo $admin_display8;
  echo '</td>
<TD>
<input type="radio" name="txt_direction" value="LTR" ';
  if ($row['txt_direction'] == 'LTR')
  {
    echo 'CHECKED';
  }

  echo '>';
  echo $admin_LTR;
  echo '<input type="radio" name="txt_direction" value="RTL" ';
  if ($row['txt_direction'] == 'RTL')
  {
    echo 'CHECKED';
  }

  echo '>';
  echo $admin_RTL;
  echo '</TD>
</tr>

</table>
<br><INPUT TYPE=submit NAME="Save changes" VALUE="';
  echo $admin_Save_changes;
  echo '">

</FORM>
</BODY></HTML>';
?>
