<?php

	// include files
	require_once('php/config.php');
	require_once('php/db.php');
	require_once('php/login.php');
	require_once('php/info.php');
	require_once('php/status.php');
	require_once('fckeditor.php') ;
	//

	// query
	$msg = "";
	$page_name = "epage";
	$level_name = $page_name;
	// update change
	if(@$MM_update == "form1" && @$event == "change" && @$level1 != "" && @$level2 != "" && @$level3 != "" && $c13 != "")
	{
		mysql_query("UPDATE $page_name SET level1 = '$level1', level2 = '$level2', level3 = '$level3', title_global = '$a1', title1 = '$t1', title2 = '$t2', title3 = '$t3', title4 = '$t4', title5 = '$t5', text1 = '$b1', text2 = '$b2', text3 = '$b3', text4 = '$b4', text5 = '$b5', img1 = '$a5', img2 = '$a6', width = '$a9', height = '$a10', border = '$a11', style = '$a12', class = '$a13', page_type = '$c1', hidden_status = '$a3', list_number = '$a4', up_date = '$cur_date', ip_address = '$hostname', info2 = '$c13' WHERE level1 = '$level1' AND level2 = '$level2' AND level3 = '$level3' AND info2 = '$c13'");
		$msg = "Updated<br>";
		//header("Location: page.php");
	}
	// add info
	if(@$MM_update == "form1" && @$event == "add" && @$level1 != "" && @$level2 != "" && @$level3 != "" && $c13 != "")
	{
		mysql_query("INSERT INTO $page_name values('','$level1','$level2','$level3','$a1','$t1','$t2','$t3','$t4','$t5','$b1','$b2','$b3','$b4','$b5','$a5','$a6','$a9','$a10','$a11','$a12','$a13','$c1','$a3','$a4','$cur_date','$cur_date','$hostname','','$c13')");
		$msg = "Added<br>";
		header("Location: page.php");
	}
	// view change
	if(@$event == "change" && @$id != "")
	{
		$result = mysql_query("SELECT * FROM $page_name WHERE level1 = '$level1' AND level2 = '$level2' AND level3 = '$level3' AND info2 = '$c13'", $db);
		if(@$myrow = mysql_fetch_array($result))
		{
			$level1 = $myrow['level1'];
			$level2 = $myrow['level2'];
			$level3 = $myrow['level3'];
			$ln = $myrow['list_number'];
		}
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo($admin_title);?></title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<script src="script.js" language="javascript"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="18%" valign="top" style="padding:10px;"><?php include('menu.php'); ?></td>
    <td width="82%" valign="top" style="padding: 10px;">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top" class="adm_ct"><p>&nbsp;</p>
          <form action="<?php echo($_SERVER['REQUEST_URI']); ?>" method="post" name="form1" id="form1">
			<table width="100%" border="0" cellpadding="0" cellspacing="10">
				<tr>
					<td width="15%" valign="top" align="right"><strong>Page <?php if(@$id != ""){echo('(ID - '.@$id.')');}?></strong></td>
					<td width="2%" valign="top"><strong>&nbsp;</strong></td>
					<td width="83%" valign="top"><strong><?php echo(@$msg.' '.$cur_full_date);?></strong></td>
				</tr>
			  <?php
				//
				if($event == "add")
				{
					@$myrow['title_global'] = @$c11.' > '.@$c12;
				}
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Title (Global)</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="text" name="a1" value="'.@$myrow['title_global'].'" size="70" maxlength="30" style="font-family:'.$info["langfont"]["2"].'"></td>'."\n");
				echo('</tr>'."\n");
				//
				for($i=1;$i<=count($info["lang"]);$i++)
				{
					if($info["lang"][$i] == 1)
					{
						echo('<tr>'."\n");
							echo('<td width="15%" valign="top" align="right">Title ('.$info["langname"][$i].')</td>'."\n");
							echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
							echo('<td width="83%" valign="top">');
							//<input type="text" name="t'.$i.'" value="'.@$myrow['title'.$i].'" size="70" maxlength="150" style="font-family:'.$info["langfont"][$i].'">');
							//if($i == 1)
							//{
							//	echo('&nbsp<a href="javascript:gadaikvane(document.form1.t1, document.form1.t1, met[0], met[2], 0);" class="t2">Georgian</a>');
							//}
							//echo('<br><br>
							// fckedito
							$sBasePath = $_SERVER['PHP_SELF'] ;
							$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
							$oFCKeditor = new FCKeditor('b'.$i) ;
							$oFCKeditor->BasePath	= $sBasePath ;
							$oFCKeditor->Width = '650';
							$oFCKeditor->Height = '500';
							$oFCKeditor->Value	= @$myrow['text'.$i];
							$oFCKeditor->Create() ;
							//
							echo('</td>'."\n");
						echo('</tr>'."\n");
					}
				}
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Page type</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top">');
					echo('<select name="c1">');
					$cinfo = @$myrow['page_type'];
					include('php/sel_ptype.php');
					echo('</select>');
					echo('</td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Level 1</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top">');
					echo('<input type="text" name="level1" value="'.@$level1.'" size="4" maxlength="4" style="font-family:'.$info["langfont"]["2"].'" readonly>');
					echo('</td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Level 2</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top">');
					echo('<input type="text" name="level2" value="'.@$level2.'" size="4" maxlength="4" style="font-family:'.$info["langfont"]["2"].'" readonly>');
					echo('</td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Level 3</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top">');
					echo('<input type="text" name="level3" value="'.@$level3.'" size="4" maxlength="4" style="font-family:'.$info["langfont"]["2"].'" readonly>');
					echo('</td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">City</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top">');
					echo('<input type="text" name="c13" value="'.@$c13.'" size="4" maxlength="4" style="font-family:'.$info["langfont"]["2"].'" readonly>');
					echo('</td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Unlock / Lock</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top">');
					echo('<select name="a3">');
					@$cinfo = @$myrow['hidden_status']; 
					include('php/sel_status.php');
					echo('</select>');
					echo('</td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">List Number</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top">');
					echo('<select name="a4">');
					$cinfo = @$ln;
					include('php/sel_list.php');
					echo('</select>');
					echo('</td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Image (title)</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="text" name="a5" value="'.@$myrow['img1'].'" size="70" maxlength="150" style="font-family:'.$info["langfont"]["2"].'"></td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Image Width</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="text" name="a9" value="'.@$myrow['width'].'" size="5" maxlength="3" style="font-family:'.$info["langfont"]["2"].'"></td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Image Height</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="text" name="a10" value="'.@$myrow['height'].'" size="5" maxlength="3" style="font-family:'.$info["langfont"]["2"].'"></td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Image Border</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="text" name="a11" value="'.@$myrow['border'].'" size="5" maxlength="1" style="font-family:'.$info["langfont"]["2"].'"></td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">CSS Style</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="text" name="a12" value="'.@$myrow['style'].'" size="70" maxlength="150" style="font-family:'.$info["langfont"]["2"].'"></td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Class Name</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="text" name="a13" value="'.@$myrow['class'].'" size="10" maxlength="15" style="font-family:'.$info["langfont"]["2"].'"></td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">Image (bullet)</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="text" name="a6" value="'.@$myrow['img2'].'" size="70" maxlength="150" style="font-family:'.$info["langfont"]["2"].'"></td>'."\n");
				echo('</tr>'."\n");
				//
				echo('<tr>'."\n");
					echo('<td width="15%" valign="top" align="right">&nbsp;</td>'."\n");
					echo('<td width="2%" valign="top">&nbsp;</td>'."\n");
					echo('<td width="83%" valign="top"><input type="button" value="Add / Update" class="but1" onclick="txt_page();" /></td>'."\n");
				echo('</tr>'."\n");
				// 
			  ?>
            </table>
            <input type="hidden" name="MM_update" value="form1" />         
            <input type="hidden" name="id" value="<?php echo(@$id); ?>" />
			<input type="hidden" name="event" value="<?php echo(@$event); ?>" />
			<input type="hidden" name="c11" value="<?php echo(@$c11); ?>" />
			<input type="hidden" name="c12" value="<?php echo(@$c12); ?>" />
			<input type="hidden" name="c13" value="<?php echo(@$c13); ?>" />
          </form>
          <p>&nbsp;</p>
		  </td>
      </tr>
    </table>
	</td>
  </tr>
</table>
</body>
</html>
