<?php
if(!strlen($pathtoroot))
{
  $path=dirname(realpath(__FILE__));
  if(strlen($path))
  {
    /* determine the OS type for path parsing */
    $pos = strpos($path,":");
    if ($pos === false)
    {
      $gOS_TYPE="unix";
      $pathchar = "/";
    }
    else
    {
      $gOS_TYPE="win";
      $pathchar="\\";
    }
    $p = $path.$pathchar;
    /*Start looking for the root flag file */
    while(!strlen($pathtoroot) && strlen($p))
    {
      $sub = substr($p,strlen($pathchar)*-1);
      if($sub==$pathchar)
      {
        $filename = $p."root.flg";
      }
      else
        $filename = $p.$pathchar."root.flg";
      if(file_exists($filename))
      {
        $pathtoroot = $p;
      }
      else
      {
        $parent = realpath($p.$pathchar."..".$pathchar);
	if($parent!=$p)
	{
	  $p = $parent;
	}
	else
	  $p = "";
      }
    }
    if(!strlen($pathtoroot))
      $pathtoroot = ".".$pathchar;
  }
  else
  {
    $pathtoroot = ".".$pathchar;
  }
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
  $pathtoroot = $pathtoroot.$pathchar;
}

require_once($pathtoroot."kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
    $admin = "admin";    
$adminURL = $rootURL.$admin;
$localURL=$rootURL."kernel/";
$imagesURL = $rootURL."admin/images";
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot."admin/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot."admin/toolbar.php");


$error = $objSession->GetVariable("restore_error");
$objSession->SetVariable("restore_error","");
$success=0;
$success=$objSession->GetVariable("restore_success");
$objSession->SetVariable("restore_success",0);

$section = "in-portal:restore";
//Set Environment Variable
$envar = "env=" . BuildEnv();
$sec = $objSections->GetSection($section);
$objCatToolBar = new clsToolBar();

if (true)
{     
  if(true)
  {

    $var="?env=".BuildEnv()."&en=$en_prev";
    $link=$adminURL."/backup/restore1.php".$var;
    
    $objCatToolBar->Add("moveleft",admin_language("la_ToolTip_Previous")." ".admin_language("la_Text_Step"),$link,$MouseOver,$MouseOut,"","tool_prev.gif");
  }
  
  if(true)
  {
      $MouseOver="";
      $MouseOut="";
      $onClick="";
      $link="#";
      $objCatToolBar->Add("moveright",admin_language("la_ToolTip_Next")." ".admin_language("la_Text_Step"),"#","","","","tool_next_f3.gif");
  }
  int_header($objCatToolBar,NULL,$title);
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<form name="restore4" METHOD="POST" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>">	
<?php int_subsection_title(admin_language("la_Prompt_Restore_Status"));  ?>

    <?php if ($success==0) { ?>
    <TR <?php echo int_table_color(); ?>> 
       <TD COLSPAN="2"><span class=\"text\"><?php echo admin_language("la_Prompt_Restore_Success");?> 
            </span> 
       </TD>
    </TR>

    <?php }  else { ?>
     <tr <?php echo int_table_color(); ?>>
    <TD>
     <img src="../images/smicon7.gif"  border="0">
    </TD>
  <td >
   	<span class=\"small\"><?php echo admin_language("la_Prompt_Restore_Failed"); echo " ".$error; ?> 
   	</span>  
  </td>
  </tr>
    <?php } ?>
   
</FORM>
</TABLE>
<?php
int_footer();
?>