<?

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

  if (($_POST['function_set'] AND $_GET['func_prev_id'] != $_POST['function_set']))
  {
    $_GET['func_prev_id'] = $_POST['function_set'];
  }

  if ($_POST['main()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'main()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }
  }

  if ($_POST['main()_article'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'main()_article')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    if ($_POST['function_set'] == 'main()')
    {
      $_GET['func_prev_id'] = $_POST['main()_article'];
    }
  }

  if ($_POST['main()_typical'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'main()_typical')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    if ($_POST['function_set'] == 'main()')
    {
      $_GET['func_prev_id'] = $_POST['main()_typical'];
    }
  }

  if ($_POST['interview()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'interview()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }
  }

  if ($_POST['vscroll()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'vscroll()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }
  }

  if ($_POST['calendar()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'calendar()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }
  }

  if ($_POST['last2post()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'last2post()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }
  }

  if ($_POST['poll(poll_id)'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'poll(poll_id)')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }
  }

  if ($_POST['rss()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'rss()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }
  }

  if ($_POST['search()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'search()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }
  }

  if ($_POST['catlist()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'catlist()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    if ($_FILES['bullet']['name'])
    {
      if (file_exists ($documentroot . '/upload/Image/bullet.gif'))
      {
        unlink ($documentroot . '/upload/Image/bullet.gif');
      }

      if (copy ($_FILES['bullet']['tmp_name'], $documentroot . '/upload/Image/bullet.gif'))
      {
        unlink ($_FILES['bullet']['tmp_name']);
      }
    }
  }

  if ($_POST['categories()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'categories()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    if ($_FILES['cat_bullet']['name'])
    {
      if (file_exists ($documentroot . '/upload/Image/cat_bullet.gif'))
      {
        unlink ($documentroot . '/upload/Image/cat_bullet.gif');
      }

      if (copy ($_FILES['cat_bullet']['tmp_name'], $documentroot . '/upload/Image/cat_bullet.gif'))
      {
        unlink ($_FILES['cat_bullet']['tmp_name']);
      }
    }

    if ($_FILES['cat_sub_bullet']['name'])
    {
      if (file_exists ($documentroot . '/upload/Image/cat_sub_bullet.gif'))
      {
        unlink ($documentroot . '/upload/Image/cat_sub_bullet.gif');
      }

      if (copy ($_FILES['cat_sub_bullet']['tmp_name'], $documentroot . '/upload/Image/cat_sub_bullet.gif'))
      {
        unlink ($_FILES['cat_sub_bullet']['tmp_name']);
      }
    }
  }

  if ($_GET['bg_image'] == 'remove')
  {
    if (file_exists ($documentroot . '/upload/Image/topmenu_bg.gif'))
    {
      unlink ($documentroot . '/upload/Image/topmenu_bg.gif');
    }
  }

  if ($_POST['topmenu()'])
  {
    $SQL_start = 'UPDATE styles SET ';
    while (key ($_POST) != 'topmenu()')
    {
      $SQL = $SQL . key ($_POST) . '=\'' . $_POST[key ($_POST)] . '\',';
      next ($_POST);
    }

    $SQL = $SQL_start . substr ($SQL, 0, -1) . ('' . ' WHERE skin=\'' . $_POST['skin'] . '\'');
    if (!(mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    if ($_FILES['topmenu_image']['name'])
    {
      if (file_exists ($documentroot . '/upload/Image/topmenu_bg.gif'))
      {
        unlink ($documentroot . '/upload/Image/topmenu_bg.gif');
      }

      if (copy ($_FILES['topmenu_image']['tmp_name'], $documentroot . '/upload/Image/topmenu_bg.gif'))
      {
        unlink ($_FILES['topmenu_image']['tmp_name']);
      }
    }

    echo $_GET['bg_image'];
  }

  if (!($result = mysql_query ('select * from styles WHERE active=\'yes\'')))
  {
    exit ('<b>Error:</b>' . mysql_error ());
    ;
  }

  $row = mysql_fetch_row ($result);
  for ($i = 0; $i < sizeof ($row); ++$i)
  {
    define (mysql_field_name ($result, $i), $row[$i]);
  }

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

  $row1 = mysql_fetch_row ($result1);
  for ($i = 0; $i < sizeof ($row1); ++$i)
  {
    define (mysql_field_name ($result1, $i), $row1[$i]);
  }

  include '../lang/' . admin_language;
  echo '
<HTML><BODY STYLE="color: Navy;"><LINK HREF="../../newsadmin/style.css" REL="stylesheet" TYPE="text/css">

';
  echo '<s';
  echo 'cript language="javascript">
var win= null;

function NewWindow(fieldName)
{
	document.form1.fieldName.value=fieldName
	win2=window.open(\'../colorchart.html\',\'colorPop\',\'height=130,width=274,top=150,left=100,scrollbars=no,resizable=no\');
}

function doIt(color)
{
	eval(\'document.form1.\' + document.form1.fieldName.value + \'.value=\\\'\' + color + \'\\\'\');
	//eval(\'document.form1.\' + document';
  echo '.form1.fieldName.value + \'.style.background=\\\'\' + color + \'\\\'\');
}
</script>

<FORM name="form1" ACTION="func_prev.php" METHOD=post ENCTYPE="multipart/form-data">

<TABLE WIDTH="800" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#505090;"><TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=5 BGCOLOR="#EFEFF8"><TR><TD VALIGN=top BGCOLOR="#BFBFDF" STYLE="border-bottom: 1px so';
  echo 'lid #505090;">

<table width="100%" border="0" CELLSPACING="0" CELLPADDING="0">
<tr><td>
	<FONT COLOR="navy">';
  echo $admin_Build_functions;
  echo ' - <B>';
  echo $_GET['func_prev_id'];
  echo '</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT>
</td><td>
	';
  if ((($_GET['func_prev_id'] == 'main()' OR $_GET['func_prev_id'] == 'main()_typical') OR $_GET['func_prev_id'] == 'main()_article'))
  {
    echo '		<A href="func_prev.php?func_prev_id=main()" class="admin_link">Start page</A> |
		<A href="func_prev.php?func_prev_id=main()_typical" class="admin_link">Typical Articles List</A> |
		<A href="func_prev.php?func_prev_id=main()_article" class="admin_link">Display Article</A>
	';
  }

  echo '</td><td align="right">
	';
  echo '<S';
  echo 'ELECT NAME="function_set" onChange="javascript:submit()">
	';
  for ($i = 0; $i < sizeof ($admin_function_array); ++$i)
  {
    echo '<option value="';
    echo key ($admin_function_array);
    echo '" ';
    if (key ($admin_function_array) == $_GET['func_prev_id'])
    {
      echo 'SELECTED';
    }

    echo '>';
    echo key ($admin_function_array);
    echo '</option>';
    next ($admin_function_array);
  }

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

</TD></TR><TR><TD VALIGN=top>


';
  switch ($_GET['func_prev_id'])
  {
    case 'main()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'main()_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'main().php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'main()_article':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'main()_article_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'main()_article.php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'main()_typical':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'main()_typical_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'main()_typical.php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'interview()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'interview()_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'interview().php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'vscroll()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'vscroll()_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'vscroll().php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'calendar()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'calendar()_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'calendar().php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'last2post()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'last2post()_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'last2post().php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'catlist()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'catlist()_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'catlist().php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'poll(poll_id)':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'poll(poll_id)_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'poll(poll_id).php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'categories()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'categories()_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'categories().php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'rss()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'rss()_set.php';
      echo '</td><td valign="top" width="550">';
      include_once 'rss().php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'topmenu()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'topmenu().php';
      echo '</td></tr><tr><td valign="top" width="100%">';
      include_once 'topmenu()_set.php';
      echo '</TD></TR></TABLE>';
      break;
    }

    case 'search()':
    {
      echo '<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=1><TR><TD style="background-color:#EFEFF8;"><TR><TD valign="top">';
      include_once 'search()_set.php';
      echo '</td><td valign="top" width="468">';
      include_once 'search().php';
      echo '</TD></TR></TABLE>';
    }
  }

  echo '

</TD></TR></TABLE></TD></TR></TABLE>
<input type="hidden" name="fieldName" value="">
<input type="hidden" name="skin" value="';
  echo skin;
  echo '">

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