<?php

include "../admin/adminses.php";
include "../engine/functions.php";
require_once("../admin/fckeditor/fckeditor.php");
$sBasePath = $_SERVER['PHP_SELF'] ;
$sitetitle="Редакция меню";

$template=adminmyconfig("template");
@$updateornot = $_POST["Submit"];
@$content = $_POST["article"];

if (empty($updateornot)) {
 				$myFile="../engine/menu.php";

				$fh = fopen($myFile, 'r');
				$data = fread($fh, filesize($myFile));
				fclose($fh);
				
$url=$_SERVER['PHP_SELF'];			 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
                <meta http-equiv="content-type" content="text/html;charset=windows-1251" />
		<title><?php echo $sitetitle;?></title>
		<meta name="description" content="Kan-Sdudio" />
		<style type="text/css" media="screen"><!--
body {
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #6B6B6B;
}
TD.header  {
	background-image: url("images/CMS.jpg");
	height: 78px
	}
TD.area {
font-family: Tahoma;
}
.links { color: #fff; font: 10px Tahoma, Verdana; word-spacing: 0.05em }
.links a { color: #fff }
.links a:hover { color: #fff; text-decoration: underline }
div.sub_text{
		margin-top: -10px;
		margin-left: 2px;
		color: white;
		font-family: Arial;}
h1 {
	color: white;
	border: 0px none;
	padding: 0;
	margin: 0;
	font-weight: bold;
	letter-spacing: -2px;}
h3 {
	color: #000000;
	font-size: 16px;
	font-weight: bold
	}
h2 {
	color: #000000;
	font-size: 12px;
	font-weight: bold
	}
TD.main_cell {
	height: 500px;
	}
TD {
	font-size: 12px
	}

.Nav {
	font-size: 12px
	}

A {
	color: #A70303
	}

A:hover {
	color: #000000
	}


.arrowlistmenu{
width: 180px; /*width of menu*/
}

.arrowlistmenu .headerbar{
font: bold 14px Arial;
color: white;
background: black url(images/titlebar.png) repeat-x center left;
margin-bottom: 10px; /*bottom spacing between header and rest of content*/
text-transform: uppercase;
padding: 4px 0 4px 18px; /*header text is indented 10px*/
}

.arrowlistmenu ul{
list-style-type: none;
margin: 0;
padding: 0;
margin-bottom: 8px; /*bottom spacing between each UL and rest of content*/
}

.arrowlistmenu ul li{
padding-bottom: 2px; /*bottom spacing between menu items*/
}

.arrowlistmenu ul li a{
color: #A70303;
background: url(images/arrowbullet.png) no-repeat center left; /*custom bullet list image*/
display: block;
padding: 2px 0;
padding-left: 19px; /*link text is indented 19px*/
text-decoration: none;
font-weight: bold;
border-bottom: 1px solid #dadada;
}

.arrowlistmenu ul li a:visited{
color: #A70303;
}

.arrowlistmenu ul li a:hover{ /*hover state CSS*/
color: #FF0000;
background-color: #F3F3F3;
}

.arrowlistmenu ul li a:active{ /*hover state CSS*/
color: #A70303;
background-color: #F5E5CE;
}
--></style>

	</head>

	<body bgcolor="#2E2E2E">
		<div align="center">
			<table align="center" width="940" border="0" cellspacing="0" cellpadding="0" bgcolor="white">
				<tr>
					<td bgcolor="#646464"></td>
				</tr>
				<tr>
					<td class="header" style="padding: 0px;" bgcolor="#939393">
					</td>
				</tr>
							<tr>
					<td style="border-bottom: 1px solid #dadada;"></td>
				</tr>
				<tr>
					<td class="main_cell" valign="top">
						<table style="height: 100%;" width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td style="border-right: 1px dashed #666666; padding: 5px;" valign="top" align="left" width="160">
                                <div class="arrowlistmenu">

<h3 class="headerbar">Навигация</h3>
<ul>
<li><a href="../admin/index.php">Начало</a></li>
<li><a href="../admin/add.php">Добавить страницу</a></li>
<li><a href="../admin/settings.php">Настройки</a></li>
<li><a href="../admin/menueditor.php">Редакция меню</a></li>
<li><a href="../admin/cateditor.php">Редакция категорий</a></li>
<li><a href="../admin/templateeditor.php">Редакция шаблона</a></li>
<li><a href="../" target="_blank">ПЕРЕЙТИ НА САЙТ</a></li>
</ul>
</div><center>
<form method="POST" action="../admin/login.php" > 
<input type="hidden" name="name" value="usersite">
<input type="hidden" name="pass" value="kandidat">
<input type="submit" style="margin-top:10px; display:block; border:1px solid #CCCCCC; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;" value="Выйти" name="logout"> 
</form></center></td>
								<td style="padding: 5px;" valign="top" align="left">

<?php
echo "<form action=\"$url\" method=\"post\" name=\"my_form\">
<h3>Редакция меню:</h3>Каждая строка - это ссылка на определенную страницу. Удаляя одну из строк, Вы удаляете ссылку из меню навигации на сайте. А также Вы можете поменять их расположение (вверх-вниз).<br /><br />";
$oFCKeditor = new FCKeditor('article') ;
$oFCKeditor->BasePath	= '../admin/fckeditor/' ;
$oFCKeditor->Value		= $data ;
$oFCKeditor->Height	= 400 ;
$oFCKeditor->Create() ;
echo "<br />
<input type=\"submit\" class=\"submit-button\" id=\"Submit\" name=\"Submit\" value=\"Изменить меню\" /><br />
</form>";
}else{
$myFile = "../engine/menu.php";

unlink($myFile);
	@chmod("../engine/menu.php", 0777);
	$ourFileName = "../engine/menu.php";
	$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
	fclose($ourFileHandle);
	
@$somecontent .= $content;

$filename=$ourFileName;
if (is_writable($filename)) {

	 $somecontent=stripslashes($somecontent);
   if (!$handle = fopen($filename, 'a')) {
         echo "Невозможно открыть ($filename)";
         exit;
   }

   if (fwrite($handle, $somecontent) === FALSE) {
       echo "Невозможна запись в ($filename)";
       exit;
   }
  
   fclose($handle);
    @chmod("../engine/menu.php", 0604);
    @$contentcenter .=  "<h3>Меню изменено!</h3>";
include "../admin/admintemplate.php";
exit();
}

} 

?></td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
			    <td style="padding: 5px;" valign="top">
						<hr noshade="noshade" size="1" />
 					Powered by : <a href="http://www.Kan-Studio.ru">Kandidat CMS v.1.3.6 Pro</a>, дизайн : <a href="http://www.clike.ru/">Clike.ru</a></td>
				</tr>
			</table>
			<p></p>
		</div>
	</body>

</html>
