<?php
##############################################################
##In-portal													##
##############################################################
##					      In-portal							##
##					Intechnic Corporation					##
##			   All Rights Reserved, 1998-2002				##
##															##	
##	No portion of this code may be copied, reproduced or	##	
##	   otherwise redistributed without proper written		##
##	  consent of Intechnic Corporation.  Violation will		##
##	   result in revocation of the license and support		##
##	 privileges along maximum prosecution allowed by law.	##
##############################################################
if(!strlen($pathtoroot))
{
  $path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
  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;
//print_r($_GET);
//print_r($_POST);
require_once($pathtoroot."kernel/startup.php");
//admin only util

/* set the destination of the image upload, relative to the root path */
$DestDir = "kernel/images/";
    
$localURL=$rootURL."kernel/";
$browseURL = $adminURL."/browse";

//$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."/browse/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");

$m = GetModuleArray();
foreach($m as $key=>$value)
{
    $path = $pathtoroot. $value."admin/include/parser.php";
    if(file_exists($path))
    {
      include_once($path);
    }
}

$objLangList = new clsLanguageList();

if (isset($_POST["itemlist"]))
{         
  $LangIds = implode(",",$_POST["itemlist"]);
  $sql = "SELECT * FROM ".$objLangList->SourceTable." WHERE LanguageId IN ($LangIds)";

  $objLangList->Query_Item($sql);
  $names = array();
  foreach($objLangList->Items as $l)
  {
  	$names[] = $l->Get("PackName");
  }
  $names = implode(",",$names);
}   
$action = "m_lang_export";
$section = "in-portal:lang_export";
$envar = "env=".BuildEnv();

$title = prompt_language("la_Text_Export")." ".prompt_language("la_Text_Languages")." - ".$names." - ".admin_language("la_Step")." 1";

//Display header
$sec = $objSections->GetSection($section);
$objCatToolBar = new clsToolBar();
$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('language','LangEditStatus','".$admin."/config/addlang_export_result.php',1);",$imagesURL."/toolbar/tool_select.gif");
$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('language','LangEditStatus','".$admin."/config/config_lang.php',2);",$imagesURL."/toolbar/tool_cancel.gif");
  
int_header($objCatToolBar,NULL,$title);
?>
<FORM enctype="multipart/form-data" ID="language" NAME="language" method="POST" ACTION="">
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<?php int_subsection_title(prompt_language("la_tab_General")); ?>

<TR <?php int_table_color(); ?> >
  <TD>     
     <SPAN id="prompt_filename" class="text"><?php echo prompt_language("la_prompt_ExportFileName"); ?></SPAN></TD>
  <TD><I><SPAN id="rootpath" CLASS="text"><?php echo $pathtoroot.$admin."/export/"; ?></SPAN></i><input ID="filename" type=text NAME="filename" VALUE=""></TD>
  <TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
  <TD><SPAN id="prompt_localname"><?php echo prompt_language("la_prompt_LoadLangTypes"); ?></SPAN></TD>
  <TD><input type=checkbox NAME="langtypes[]" VALUE="1" CHECKED> <?php echo prompt_language("la_Text_FrontEnd"); ?>
    <input type=checkbox NAME="langtypes[]" VALUE="2" CHECKED><?php echo prompt_language("la_Text_Admin"); ?> </TD>
  <TD></TD>
</TR>
      <input type=hidden NAME="Action" VALUE="<?php echo $action; ?>">
      <INPUT TYPE="HIDDEN" NAME="LangList" VALUE="<?php echo $LangIds; ?>">
      <input type="hidden" name="LangEditStatus" VALUE="0">
</TABLE>
</FORM>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<!-- END CODE-->
<?php int_footer(); ?>