<?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 priview the site.*/  
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'];
$currentpage=$_GET['currentpage'];
/* for published site 
*       SaveSitePreview() will be called  with the requested siteid as one parameter.
*  for  unpublished site        
*       SaveSitePreview() will be called  with the requested tempsiteid as one parameter.
* 
*/ 
if($_SESSION['session_published']=="yes"){
   SaveSitePreview($userid,$templateid,"","$siteid","Yes","..","Editpages");
   if($currentpage=="")
        $location="../workarea/sites/$siteid/home.htm";
   else
        $location="../workarea/sites/$siteid/".$currentpage;
}else{
    SaveSitePreview($userid,$templateid,$tmpsiteid,"","no","..","Editpages");
	if($currentpage=="")
       $location="../workarea/tempsites/$tmpsiteid/home.htm";
	else
	   $location="../workarea/tempsites/$tmpsiteid/".$currentpage;   
}

header("location:$location");
exit;
?>