<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005-2006 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts EasyCreate 1.1                 |
// +----------------------------------------------------------------------+
// | Authors: sudheesh<sudheesh@armia.com>        		              	  |
// |          									                          |
// +----------------------------------------------------------------------+
/* This page used to edit the editable content of a page that are created by the user for a site
*  first block contains the list of pages that are fethced from the table.
*  user can edit the page by clicking on each page.
*  for published site copy the selected page file from sites/siteid/pagename to workarea/sites/$siteid/pagename.extn
*        set source file to iframe workarea/sites/$siteid/pagename.extn
*        when user click on save the following steps are exicuted
*         1)update the resource file(deleted entry for deleted images,add entry for added images) for the site in which user is working
*         2)search http://sitelocation and replace it with './',
*           search <head>,</head>,<body>,<html>,</html> and replace them with ''
*         3)save the editable area into site/siteid/pagename.extn
*         4)build the html file using smarty and save the file in  workarea/sites/$siteid/pagename.extn
*  for site un published site copy the selected page file from sitepages/tempsites/$tmpsiteid/pagename to workarea/tempsites/$tmpsiteid/pagename.extn
*        set source file to iframe workarea/tempsites/$tmpsiteid/pagename.extn
*        when user click on save the following steps are exicuted
*         1)update the resource file(deleted entry for deleted images,add entry for added images) for the site in which user is working
*         2)search http://sitelocation and replace it with './',
*           search <head>,</head>,<body>,<html>,</html> and replace them with ''
*         3)save the editable area into site/siteid/pagename.extn
*         4)build the html file using smarty and save the file in  workarea/sites/$siteid/pagename.extn
*/
include "../includes/session.php";
include "../includes/config.php";
include "../includes/function.php";
$tmpsiteid=$_SESSION['session_currenttempsiteid'];
$templateid=$_SESSION['session_currenttemplateid'];
$userid=$_SESSION["session_userid"];
$siteid=$_SESSION['session_siteid'];
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}

 
?>
<?php include "./userheader.php"; ?>
<!--
<script type="text/javascript" src="../code/jscripts/tiny_mce/tiny_mce.js"></script>
<SCRIPT language=JavaScript src="js/formatbar.js"></script>
-->
<SCRIPT>
function savefile(){

document.getElementById('htmltext').value=foo.document.body.innerHTML;
document.frmbtnedit.submit();

}
function savePage(a) {
/*
		if(foo.document.readyState != "complete") {
			alert('The page you are trying to save has not yet loaded completely. Please wait for the page to load completely.');
			return;
		}
		try{
			if (SelMode == 2) {
				ShowHtml()
			}
		}catch(e){}
		*/
 		//document.getElementById("EditorHTM").value = foo.document.body.innerHTML
		//document.getElementById("EditorHTM").value = foo.document.documentElement.innerHTML
//		var content = tinyMCE.get('ajaxfilemanager').getContent();
                var content = CKEDITOR.instances.editor1.getData();
		document.getElementById("EditorHTM").value = content;
		//re = /&amp;/g
		//document.getElementById("EditorHTM").value = document.getElementById("EditorHTM").value.replace(re,'&')
		htmlLength = document.getElementById("EditorHTM").value.length
		myHTML = document.getElementById("EditorHTM").value
		mcLength = myHTML.length / 5;
		document.getElementById("EditorHTM").value = content;
		//document.getElementById("EditorHTM2").value = myHTML.substr(mcLength, mcLength*2 + 1);
		//document.getElementById("EditorHTM3").value = myHTML.substr(mcLength*2+1, mcLength*3 + 1);
		//document.getElementById("EditorHTM4").value = myHTML.substr(mcLength*3+1, mcLength*4 + 1);
		//document.getElementById("EditorHTM5").value = myHTML.substr(mcLength*4+1, myHTML.length);
		document.getElementById("deletedimages").value = checkForDeleted();
		document.getElementById("newimages").value = checkForNew();
		switch(a) {
			case 1:
					document.getElementById("actiontype").value = "save";
					break;
			case 2:
				document.getElementById("actiontype").value = "saveandcreate";
				break;
			default:
					alert("Invalid function call.");
					return;
		}
		if(isNaN(document.getElementById("checkid").value) || document.getElementById("checkid").value.length <= 0 || (parseInt(document.getElementById("checkid").value) <= 0)) {
			document.getElementById("checkid").value=1;
		}
		else {
			document.getElementById("checkid").value = parseInt(document.getElementById("checkid").value) + 1;
		}
		document.getElementById("PageDetails").submit();
}
function viewpreview(){
/*
          if(foo.document.readyState != "complete") {
			alert('The page you are trying to priview has not yet loaded completely. Please wait for the page to load completely.');
			return;
		  }
		  
*/
            var leftPos = (screen.availWidth-500) / 2;
		   var topPos = (screen.availHeight-400) / 2 ;
		   var currentpage=document.getElementById("currentpage").value;
		   winurl="showsitepreview.php?currentpage="+currentpage+"&";
		   insertFormWin = window.open(winurl,'','width=' + screen.availWidth + ',height=' + screen.availHeight + ',scrollbars=yes,resizable=yes,titlebar=0,top=' + topPos + ',left=' + leftPos);
}
processFlag=false;
function process() {
	if(processFlag == false) {
		processFlag=true;
			var finalImages;
//			finalImages = tinyMCE.get('ajaxfilemanager').getContent().images;
                        finalImages = CKEDITOR.instances.editor1.getData().images;
			i=0;
			var sourceCount=source.length;

			if (typeof(finalImages) != "undefined")
                        var finalCount=finalImages.length;
                        else
                        var finalCount=0;
			while(i < sourceCount) {
				if(source[i] != "") {
					var strTemp=source[i];
					strTemp=strTemp.substr((strTemp.lastIndexOf("/") + 1),(strTemp.length));
					if(strTemp.substr(0,2) == "ug" || strTemp.substr(0,2) == "sg" || strTemp.substr(0,2) == "sl") {
						j=0;
						while(j < finalCount) {
							if(finalImages[j].src != "") {
								var strTemp2 = finalImages[j].src;
								if(strTemp == strTemp2.substr((strTemp2.lastIndexOf("/") + 1),(strTemp2.length))) {
									source[i]="";
									finalImages[j].src="";
									break;
								}
							}
							j++;
						}
					}
					else {
						source[i] == "";
					}
				}
				i++;
			}
	}
}
function checkForDeleted() {
	var strDeleted = "";
	process();
	var sourceCount=source.length;
	//alert(sourceCount);
	for(i=0;i<sourceCount;i++) {
		if(source[i] != "") {
			var strTemp=source[i];
			strTemp=strTemp.substr((strTemp.lastIndexOf("/") + 1),(strTemp.length));
			if(strTemp.substr(0,2) == "ug" || strTemp.substr(0,2) == "sg" || strTemp.substr(0,2) == "sl") {
				strDeleted = strDeleted + strTemp + "|";
			}
		}
	}
	if(strDeleted.length > 0) {
		strDeleted = strDeleted.substr(0,strDeleted.length-1);
	}
	return strDeleted;
}
function checkForNew() {
	var strNew = "";
	process();
	if (typeof(finalImages) != "undefined") 
		var finalCount=finalImages.length;
	else
		var finalCount=0;
	//alert(finalCount);
	for(i=0;i<finalCount;i++) {
		if(finalImages[i].src != "") {
			var strTemp=finalImages[i].src;
			strTemp=strTemp.substr((strTemp.lastIndexOf("/") + 1),(strTemp.length));
			if(strTemp.substr(0,2) == "ug" || strTemp.substr(0,2) == "sg" || strTemp.substr(0,2) == "sl") {
				strNew = strNew + strTemp + "|";
			}
		}
	}
	if(strNew.length > 0) {
		strNew = strNew.substr(0,strNew.length-1);
	}
	return strNew;
}
function SaveCompelsory(pag,pagtype){
	if(confirm("Do you want to save your current page ?")){
	  document.getElementById("pageforsave").value =pag;
	   document.getElementById("pagetypeforsave").value =pagtype;
	  document.getElementById("pageforsave_type").value ="saveandgo";
	  savePage(1);
	}else{
	  document.getElementById("pageforsave").value =pag;
	  document.getElementById("pagetypeforsave").value =pagtype;
	  document.getElementById("pageforsave_type").value ="go";
	  document.getElementById("PageDetails").submit();
	}

}
</SCRIPT>

 <!-- ckeditor integration start here -->
 <script type="text/javascript" src="<?php echo fetchBasicLocation(1); ?>/ckeditor/ckeditor/ckeditor.js"></script>
        <script type="text/javascript" src="<?php echo fetchBasicLocation(1); ?>/ckeditor/js/jquery.js"></script>
        <script language=JavaScript src="js/formatbar.js"></script>
        <script type="text/javascript">
	 $(document).ready(function(){

		CKEDITOR.replace( 'editor1',
        {

			height : 300,
			width : '100%',
			toolbar : [
			['Source','-','Bold','Italic','Underline','-','BulletedList','-','Link','Unlink'],
			['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
			'/',
			['Font','FontSize','-','TextColor','-','About']
			],


            filebrowserBrowseUrl : '<?php echo fetchBasicLocation(1); ?>/ckeditor/ckeditor/filemanager/index.php',
            filebrowserImageBrowseUrl : '<?php echo fetchBasicLocation(1); ?>/ckeditor/ckeditor/filemanager/index.php?Type=Images',
            filebrowserUploadUrl : '<?php echo fetchBasicLocation(1); ?>/ckeditor/ckeditor/filemanager/core/connector/php/filemanager.php?command=QuickUpload&type=Files',
            filebrowserImageUploadUrl : '<?php echo fetchBasicLocation(1); ?>/ckeditor/ckeditor/filemanager/core/connector/php/filemanager.php?command=QuickUpload&type=Images',
            filebrowserImageManagerUrl : '<?php echo fetchBasicLocation(1); ?>/ckeditor/ckeditor/filemanager/index.php?Type=Images&CKEditor=editor1&CKEditorFuncNum=4&langCode=en&filemode=server'
            });

     CKEDITOR.config.width = 900;
     CKEDITOR.config.height = 500;
     CKEDITOR.config.fullPage = true;
     CKEDITOR.config.removePlugins = 'smiley,link,save';
     CKEDITOR.on( 'dialogDefinition', function( ev ){

                // Take the dialog name and its definition from the event data.
		var dialogName = ev.data.name;
		var dialogDefinition = ev.data.definition;
		// Check if the definition is from the dialog we're
		// interested on (the Link dialog).
		if ( dialogName == 'link' ){
			// FCKConfig.LinkDlgHideAdvanced = true
                        dialogDefinition.removeContents('advanced');
                        dialogDefinition.removeContents('upload');
                        /*
                        var definition = ev.data.definition;
                        var content = definition.getContents( 'target' );
                        content.remove( 'linkTargetType' );
                        */
                        var info = dialogDefinition.getContents( 'info' );
                        info.remove('protocol');


                        info.add( {
					type : 'text',
					label : 'Protocol',
					id : 'protocol',
					'default' : 'http://',
					validate : function()
					{
						if ( /\d/.test( this.getValue() ) )
							return 'Protocol is must';
					}
				});

			// FCKConfig.LinkDlgHideTarget = true
			//dialogDefinition.removeContents( 'default' );
                         /*Enable this part only if you don't remove the 'target' tab in the previous block.*/
			// FCKConfig.DefaultLinkTarget = '_blank'
			// Get a reference to the "Target" tab.
			var targetTab = dialogDefinition.getContents( 'target' );

                        /*
                        var cdrt  =   targetTab.get('linkTargetType');
                        cdrt.remove('_blank');
                        */

                        //targetTab.remove('PopupWindowFeatures');
                        //targetTab.remove('linkTargetType');

                        //$("#cke_81_select option[value='_blank']").remove();



                        /*
                        targetTab.add( {
					type : 'select',
                                        id : 'cke_81_select',
                                        label : 'Target',
                                        items : [ [ 'New Window', '_blank' ], [ 'Same Window', '_self' ] ],
                                        'default' : 'Football',
                                        onChange : function( api ) {
                                        //this = CKEDITOR.ui.dialog.select
                                        alert( 'Current value: ' + this.getValue() );
                                        }
                                       });
                      /*
                        targetTab.add( {
					type : 'radio',
					label : 'Link Type',
					id : 'cke_81_select',
					items   :   [ [ 'New Window', '_blank' ], [ 'Same Window', '_self' ] ]
				});
                       */
                      /*
                            targetTab.add( {
					type : 'file',
                                        id : 'upload',
                                        label : 'Select file from your computer',
                                        size : 38

				});
                        targetTab.add( {
					type : 'text',
					label : 'My Custom Field',
					id : 'customField',
					'default' : 'added new!',
					validate : function()
					{
						if ( /\d/.test( this.getValue() ) )
							return 'My Custom Field must not contain digits';
					}
				});

                        */
			// Set the default value for the URL field.
			//var targetField = targetTab.get( 'linkTargetType' );

			//targetField[ 'default' ] = '_blank';
		}
		if ( dialogName == 'image' ){

			dialogDefinition.removeContents( 'advanced' );
                        var info        =   dialogDefinition.getContents( 'info' );

                        var brwse       =   info.get('browse');
                        brwse.label     =   'Browse';

                        var alttxt      =   info.get('txtAlt');
                        alttxt.label    =   'Image Title';

                        var wdth        =   info.get('txtWidth');
                        wdth.label      =   'Image Width';
                        wdth.width      =   60;

                        var hght = info.get('txtHeight');
                        hght.label  =   'Image Height';
                        hght.width  =   60;

                        var valg = info.get('cmbAlign');
                        valg.items = [['left','left'],['right','right']];
                        valg['default'] =   'left';

                        var Link        =   dialogDefinition.getContents( 'Link' );
                        var Url         =   Link.get('txtUrl');
                        Url.label       =   'Make Image Clickable Link';
                        Url['default']  =   'http://';
                        Link.remove('browse');

                        var target       =   Link.get( 'cmbTarget' );
                        target.label     =   '<br />Target Page';
                        target.items     =   [['New Window','_blank'],['Same Window','_self']];

                        var Upload       =   dialogDefinition.getContents( 'Upload' );
                        var upload       =   Upload.get('uploadButton');
                        upload.label     =   'Upload Image';
                        dialogDefinition.removeContents( 'Upload' );


		}
		if ( dialogName == 'flash' )
		{
			dialogDefinition.removeContents( 'advanced' );
                        dialogDefinition.removeContents( 'Upload' );
                        dialogDefinition.removeContents( 'properties' );
		}
	});


	});

        </script>

<table width="100%"  border="0" cellspacing="0" cellpadding="0" class=background>
<tr>
<td  valign="top" align=center>
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                <td >
				<!-- Main section starts here-->
                                 <?php
                                if(isset($_POST['actiontype'])) { ?>
                                <div class="comm_div" align="center" style="font-size: 13px;font-weight: bold;color: green;">Page Saved...</div>
                                <?php } ?>


						                 <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
																		  <TBODY>
																		  <?php
																		    $pagenamewithouthtm=addslashes(trim($_GET['page']));
																			  if($pagenamewithouthtm=="")
																			       $pagenamewithouthtm="home";
																		    if($_SESSION['session_published']=="yes"){
																			    $qry="select * from tbl_site_pages where nsite_id='".$siteid."' order by nsp_id";

																			}else{
																			    $qry="select * from tbl_tempsite_pages where ntempsite_id='".$_SESSION['session_currenttempsiteid']."' order by ntempsp_id";

																			}
																			  $res=mysql_query($qry);
																			?>
																		    <tr>
																			    <td COLSPAN="2">
																				   <table align=left>
																				       <tr>
																					   <?php
																				        $totalcharctercountinpagename=0;
																					    while($row=mysql_fetch_array($res)){

																						$pagenamewithspace=$row['vpage_name'];
																						$row['vpage_name']=str_replace(" ","" , $row['vpage_name']);
																						/* block guest by editing using pageeditor*/
																						if(strcasecmp($row['vpage_name'],"Guestbook" )==0){
																					      continue;
																						}
																						$totalcharctercountinpagename=$totalcharctercountinpagename+strlen($row['vpage_name']);
																						if($totalcharctercountinpagename >70){
																						  echo "</tr><tr>";
																						  $totalcharctercountinpagename=0;
																						}
																						if( strcasecmp($pagenamewithouthtm,$row['vpage_name'])==0){
																				?>
																									    <td  class=maintext valign="top">

																										   <table width="70px" height="45"  border="1" cellpadding="0" cellspacing="0" bordercolor="#1E63AE">
																		                                        <tr>
																		                                          <td align="center" valign="middle" bgcolor="#47B1E4" style="width:70px; word-wrap: break-word;">
                                                                                                                                                                                              <a class=anchor href="./pageeditor.php?page=<?php echo strtolower($row['vpage_name'])?>&pagetype=<?php echo strtolower($row['vpage_type'])?>&"  style="color:black;">  <img border=0 src="images/pageclear.gif" width="30" height="35"></a><br>
																												   <a class=anchor href="./pageeditor.php?page=<?php echo strtolower($row['vpage_name'])?>&pagetype=<?php echo strtolower($row['vpage_type'])?>&"   style="color:black;"> <?php echo strtolower($row['vpage_name']); ?></a>
																												  </td>
																		                                        </tr>
																		                                      </table>



																										</td>
																										<td>&nbsp;</td>

																						<?php
																								}else{
																						 ?>

																										       <td class=maintext valign="top">

																												             <table width="70px" height="45"  border="1" cellpadding="0" cellspacing="0" bordercolor="#A2BFCC">

																								                                        <tr>
																																		  <?php
																																		    $pagenameforjs="";
																																		    $pagenameforjs=strtolower($row['vpage_name']);
																																			$pagetypeforjs="";
																																			$pagetypeforjs=strtolower($row['vpage_type']);
																																		  ?>
																								                                          <td align="center" valign="middle" bgcolor="#D0DFE6" style="width:70px; word-wrap: break-word;">
																																		  <a class=anchor href="#" onclick="SaveCompelsory('<?php echo $pagenameforjs?>','<?php echo $pagetypeforjs?>');"><img border=0 src="images/pagefade.gif" width="30" height="35"> </a>
																																		   <br>
																																         <a class=anchor href="#" onclick="SaveCompelsory('<?php echo $pagenameforjs?>','<?php echo $pagetypeforjs?>');">     <?php echo strtolower($row['vpage_name']); ?> </a>
																																		  </td>
																								                                        </tr>

																								                               </table>



																											   </td>
																											   <td>&nbsp;</td>

																								 <?php
																									}

																							     ?>

																					   <?php }

																					    ?>



																					   </tr>

																				   </table>
																				</td>

																			</tr>
																			 <tr><td class=borderbg colspan=5><img src="./image/spacer.gif" width=0 height=1></td></tr>
																		  <TR>
																		  <TD  class=bodyband height=22 COLSPAN="2">
																		       <?php
																			  // print_r($_SESSION);
																			   if(isset($_SESSION['session_siteid']) && $_SESSION['session_siteid']!="")
																			   	 $siteid=$_SESSION['session_siteid'];
																				else
																				   $siteid=$_SESSION['session_currenttempsiteid'];

$imgPath='';
$fileSavePath='';
//print_r($_SESSION);
//$siteid=$_SESSION['session_siteid'];
if($_SESSION['session_edittype'] == "new" || !isset($_SESSION['session_edittype']))
{
        $substr=str_replace("../workarea/tempsites/","",$currenteditableurllocation);
        $sid=substr($substr,0,strpos($substr,"/"));
        $replacepath=fetchBasicLocation(1)."/workarea/tempsites/$siteid/";
        $repString="../workarea/tempsites/".$siteid."/";
//        $imgPath="/davidpaul/workarea/tempsites/$tmpsiteid/images";
//        $fileSavePath="/davidpaul/workarea/tempsites/$tmpsiteid/flash";

        //------------------

        $replacepath=fetchBasicLocation(1)."/workarea/tempsites/$siteid/";
                $imgPath="workarea/tempsites/$siteid/images";
                $fileSavePath="workarea/tempsites/$siteid/flash";
    }
else
    {
        $repString="../workarea/sites/".$siteid."/";
        $replacepath=fetchBasicLocation(1)."/workarea/sites/$siteid/";
//        $imgPath="/davidpaul/workarea/sites/$tmpsiteid/images";
//        $fileSavePath="/davidpaul/workarea/sites/$tmpsiteid/flash";
        //------------
        $tmpsiteid=$_SESSION['session_siteid'];
        $repString="../workarea/sites/".$tmpsiteid."/";
   	$replacepath=fetchBasicLocation(1)."/workarea/sites/$tmpsiteid/";
        $imgPath="workarea/sites/$tmpsiteid/images";
        $fileSavePath="workarea/sites/$tmpsiteid/flash";
    }

   $roorLoc=$_SESSION['ROOT_PATH'];
   $rootLoc=str_replace($_SERVER['DOCUMENT_ROOT'], "", $roorLoc);
   $_SESSION['imagesavepath']=$_SESSION['ROOT_PATH'].$imgPath;
   $_SESSION['mediasavepath']=$_SESSION['ROOT_PATH'].$fileSavePath;
   $_SESSION['replacepath']=$replacepath.'images/';
   $_SESSION['FILE_PATH'] = '/'.$rootLoc.$imgPath;
   $_SESSION['FILE_PATH']=str_replace("//","/",$_SESSION['FILE_PATH']);
   $_SERVER['DOCUMENT_ROOT'].fetchBasicLocation(1);
//$_SESSION['imagesavepath']=$_SERVER['DOCUMENT_ROOT'].$imgPath;
//   $_SESSION['mediasavepath']=$_SERVER['DOCUMENT_ROOT'].$fileSavePath;

 if(isset($_SESSION['session_siteid']))
 $repString="../workarea/sites/".$siteid."/";
//echo "$replacepath...$pagename...$siteid...$currenteditableurllocation";
 $FileName=$currenteditableurllocation;
																	   
  $handle      =fopen($FileName, 'rb');
  $f_contents  =fread($handle, filesize($FileName));
 fclose($handle);
   //$f_contents=str_replace("src=\"","src=\"".$replacepath,$f_contents);
 $f_contents=str_replace($repString,"",$f_contents);
 $f_contents=str_replace("src=\"./","src=\"",$f_contents);
 $f_contents=str_replace("src=\"","src=\"".$replacepath,$f_contents);
 $f_contents=str_replace("/images/images/","/images/",$f_contents);
 //echo $f_contents;
																		       ?>
																		        
																		   </TD></TR>
																		   <tr>
																		     <td COLSPAN="2">

																			 </td>
																		   </tr>
																		   <!-- iframe window -->

																			<tr>
																			   <td COLSPAN="2">
<textarea id="editor1" name="ajaxfilemanager"><?php echo $f_contents; ?></textarea>
																			     <IFRAME id="foo" style="display:none;" contentEditable=true
																		style="BORDER-RIGHT: #000000 0px solid; PADDING-RIGHT: 0px; BORDER-TOP: #000000 0px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; OVERFLOW: auto; BORDER-LEFT: #000000 0px solid; WIDTH: 100%; PADDING-TOP: 0px; BORDER-BOTTOM: #000000 0px solid; SCROLLBAR-BASE-COLOR: #dddddd; ; HEIGHT:400px; BACKGROUND-COLOR: white"
																		src="<?php echo $currenteditableurllocation?>"</IFRAME>
																			   </td>
																			</tr>
																			<tr>
																			   <td>dddddddddddddddddddddd
																			   
																			     <IFRAME id=fooStyles
																		contentEditable=true style="DISPLAY: none"
																		src="images/00af970f4b9590626dcfdb96a5f4b4d4.htm"></IFRAME>
																			   </td>
																			</tr>
                                                                                                                                                  <form name=PageDetails id="PageDetails" method=post >
																			  <tr><td align=right width="50%">
																			    <input type="hidden" name="checkid" id="checkid" value="<?php echo($_SESSION["session_checkid"]); ?>">
																			    <input type=hidden id=htmltext name=htmltext value="" >
																				<input type="hidden" name="pageurl" id="pageurl" value="<?php echo($currenteditableurllocation); ?>">
																				<input type=hidden id=currentpage name=currentpage value="<?php echo $pagename?>" >
																				<INPUT type=hidden name="EditorHTM" id="EditorHTM" value="">
																				<INPUT type=hidden name="EditorHTM2" id="EditorHTM2"  value="">
																				<INPUT type=hidden name="EditorHTM3" id="EditorHTM3"  value="">
																				<INPUT type=hidden name="EditorHTM4" id="EditorHTM4"  value="">
																				<INPUT type=hidden name="EditorHTM5"  id="EditorHTM5" value="">
																				<INPUT type=hidden name="pageforsave" id="pageforsave"  value="">
                                                                                                                                                                <INPUT type=hidden name="pagetypeforsave" id="pagetypeforsave"  value="">
                                                                                                                                                                <INPUT type=hidden name="pageforsave_type" id="pageforsave_type" value="">
																				<input type="hidden" name="deletedimages" id="deletedimages" value="">
																				<input type="hidden" name="newimages" id="newimages" value="">
																				<input type="hidden" name="actiontype" id="actiontype" value="">
																				<input type="hidden" name="pagetype" id="pagetype" value="<?php echo $pagetype?>">

																			    <input class=button type=button id=savedata name=savedata value="Save this page ( <?php echo $pagenamewithouthtm?>)" onclick="savePage(1);">
																				<input class=button type=button id=sitepreview name=sitepreview value="Preview" onclick="viewpreview();">
																			  </td>
																			  </form>
																			  <form name=frmbackbuttons method=post>
																			  <td align=left>
																			    &nbsp;<input class=button name="btnpayment" type=submit value="Publish" >
																				<input class=button name=btnback type=submit value="Back" >
																			  </td>
																			  </tr>
																			  </form>
																			<tr>
																			   <td>&nbsp;</td>
																			</tr>

																			<!--<tr>
																			    <td>
																				   <table width="40%" align=right border=0>
																				      <tr>
																					       <td width="10%"><input class=button name="btnpayment" type=submit value="Publish" ></td>
																					       <td><input class=button name=btnback type=submit value="Back" ></td>
																					  </tr>
																				   </table>
																				</td>

																			</tr>-->

																		</TBODY>
																		</TABLE>



				<!-- Main section ends here-->
                </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
				<tr><td>&nbsp;</td></tr>
                </table>
				<?php
				  $reloadpage=basename($_SERVER['REQUEST_URI']);

				?>
				<form name=reloadpage action="<?php echo $reloadpage?>" method=post>

				</form>
</td>
</tr>
</table>

<?php
include "./userfooter.php";
?>
