<?php
ob_start();
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";

if(isset( $_SESSION["sess_adminname"]) and $_SESSION["sess_adminname"]!= ""){
	$adminname = $_SESSION["sess_adminname"];
}else{
	header("Location:login.php");
	exit;
}
$type = $_GET['q']?$_GET['q']:'';
if(isset($_POST['btnUpdate']))
{
	if($_POST['htitle'] =="")
	{
		$update_message = TITLE_EMPTY;
		header("Location:".$_SERVER['HTTP_REFERER']."&msg=".$update_message);		
		exit;
	}
        else if(strlen(strip_tags($_POST['FCKeditor1']))==0) {
                $update_message = DESC_EMPTY;
		header("Location:".$_SERVER['HTTP_REFERER']."&msg=".$update_message);
		exit;
        }
        else
	{
	$update_help_content = "UPDATE ".$tableprefix."help
							SET
                                                        htitle = ".GetSQLValueString($_POST['htitle'],"text").",
                                                        hdescription = " .GetSQLValueString($_POST['FCKeditor1'],"text").
                                                       " WHERE hid = ".GetSQLValueString($_POST['help_id'],"text");
	mysql_query($update_help_content) or die(mysql_error());
	
	$update_message = CONTENTS_UPDATED_SUCCESSFULLY." !!";

       
        if($type == 'seller'){
             header("Location:seller_list_help.php?msg=".$update_message);
        }
        else{
            header("Location:list_help.php?msg=".$update_message);
        }
	
	exit;
	}
	
	   

}

if($_GET['edit_id'] != "")
{

	$select_help_details = "SELECT htitle,hdescription FROM ".$tableprefix."help
							WHERE hid = ".GetSQLValueString($_GET['edit_id'],"text");
	$result_help_details = mysql_query($select_help_details);
	
	$help_row = mysql_fetch_assoc($result_help_details);

}

if($_GET["msg"])
$message = $_GET["msg"];

include "../includes/htmltop.php";
?>
<script type="text/javascript" src="<?php echo SITE_URL?>/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
	window.onload = function()
	{
		CKEDITOR.replace( 'editor1' );
		
	};
</script>

<body>
		<center>
		<div align="left" id="layout">
				<!--header area start -->
<?php
	include_once("../includes/topheader_admin.php")
?>
				<!--header area end -->
				<div align="left" class="main_body">
				<!--main body start -->
<?php
	include_once("../includes/admintopmenu.php");
	$contentHeading = stripslashes($help_row['htitle']);
?>		
			<form name="frmProfile" action="" method="POST" onSubmit="return formcheck();">
			<div align="left" class="content_area">
			<!--content area start -->
			<div align="left" class="page_title"><?php echo HELP_MGT;?> - <?php echo $contentHeading; ?></div>
			<div align="center" class="text_information grey_tr"><?php echo $message?></div>
            <br>
			<div align="left">
			<table cellpadding="2" cellspacing="2" width="70%" align="center">
				<tr><td colspan="3"></tr>
				<tr>
					<td colspan="3">
						<fieldset>
							<legend class=''><?php echo HEADING_EDIT_SEC;?></legend>
								<table width="100%" cellspacing="2" cellpadding="2">
									<tr>
										<td align="left">
									<?php 	
									
										$htitle = stripslashes($help_row['htitle']);
										//ContentManagementHeading(700,100,$cms_text_heading);
									?>
                                                                                    <input type="text" name="htitle" value="<?php echo $htitle;?>" size="100">
										</td>
									</tr>
								</table>
						</fieldset>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<fieldset>
							<legend class=''><?php echo CONTENT_EDIT_SEC;?></legend>
								<table width="100%" cellspacing="2" cellpadding="2">
									<tr>
										<td align="left">
									<?php 	
										
										$hdescription = stripslashes($help_row['hdescription']);
										
									?>
							 <textarea id="editor1" name="FCKeditor1"><?php echo $hdescription;?></textarea>

										</td>
									</tr>
									<tr>
										<td align="center">
											<input type="submit" class="button" value="<?php echo UPDATE;?>" name="btnUpdate">
											<input type="hidden" name="help_id" value="<?php echo $_GET['edit_id']?>">
										</td>
									</tr>
								</table>
						</fieldset>
					</td>
				</tr>																								
			</table>
			</div>
				<!--content area end-->
				</div>
				</form>
					<div align="left" class="clear_float"><img src="../images/clear.gif" alt="" width="1" height="1" /></div>
				<!--main body end -->
				</div>
<?php
	include "../includes/footer.php";
	ob_end_flush();
?>
