<?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;
}
//echo $pathtoroot;
//echo $pathtoroot;
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");
//Set Section
$section = "in-portal:addmodule";
//Set Environment Variable
$envar = "env=" . BuildEnv();
global $tables;
unset($tables);


if($_POST["Action"]=="update")
{
    $newpath= $_POST["backup_path"];
    $newpath = str_replace('\\\\','\\',$newpath);
    $objConfig->Set("Backup_Path",$newpath);
    $objConfig->Save();

}
$filepath=$objConfig->Get("Backup_Path");
         
$limit = 100;
$success =0;

$objSession->SetVariable("restore_filepath",$filepath);
$objSession->SetVariable("restore_success",0);
$objSession->SetVariable("restore_todo","");
      
$sec = $objSections->GetSection($section);
$objCatToolBar = new clsToolBar();

$ro_perm = $objSession->HasSystemPermission("SYSTEM_ACCESS.READONLY");

if (true)
{
	
  $MouseOver="";
  $MouseOut="";
  $onClick="";
  $link="#";
  $objCatToolBar->Add("moveleft",admin_language("la_ToolTip_Previous")." ".admin_language("la_Text_Step"),"#","","","","tool_prev_f3.gif");
 
  if(true)
  {
    $MouseOver="swap('moveright','toolbar/tool_next_f2.gif');";
    $MouseOut="swap('moveright', 'toolbar/tool_next.gif');";


    $var="?env=".BuildEnv()."&en=$en_next";
    $link2=$rootURL."admin/install.php".$var;
    $onClick="document.location= '$link2';";
    $onClick="document.restore1.submit();";


    $link="#";
    $objCatToolBar->Add("moveright",admin_language("la_ToolTip_Next")." ".admin_language("la_Text_Step"),$link,$MouseOver,$MouseOut,$onClick,"tool_next.gif");
  }
  
  $title = admin_language("la_tab_upgrade_license");
  
  int_header($objCatToolBar,NULL,$title);
}

$SubmitUrl = $adminURL."/install.php";
//$SubmitUrl = $adminURL."/install.php";
?>
         
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<form name="restore1" TARGET="<?php echo $ro_perm ? 'main' : '_top'; ?>" METHOD="POST" action="<?php echo $SubmitUrl; ?>">	
<?php int_subsection_title(prompt_language("la_Prompt_Warning"));  ?>
 <TR <?php echo int_table_color(); ?>> 
       <TD COLSPAN="2"><span class=\"text\"><?php echo prompt_language("la_Text_Update_Licence"); ?>  
            </span> 
       </TD>
    </TR>

   <TR <?php echo int_table_color(); ?>> 
      <td width=\"60%\" valign=\"top\"><span class=\"text\"><?php echo prompt_language("la_prompt_Root_Password"); ?></span></td>
       <TD > 
 	  	<INPUT type="password" name="UserPass" class="text" size="50" value=''>
  	  </TD>
   </TR>
   <input type=hidden name="state" value="reinstall_process">
   <input type=hidden name="install_type" value="8">
   <input type=hidden name="next_step" value="2">
   <input type=hidden name="UserName" value="root">
   <input type=hidden name="inp_opt" value="3">
</FORM>
</TABLE>
<?php
int_footer();
?>