<?php
@include 'adminsession.php';
session_cache_limiter('none');
session_start();
//This code is copyright (c) ViciSoft SL, all rights reserved.
//The contents of this file are protected under law as the intellectual property
//of ViciSoft SL. Any use, reproduction, disclosure or copying
//of any kind without the express and written permission of ViciSoft SL is forbidden.
//Author: Vince Reid, vincereid@gmail.com
$isvsadmindir=TRUE;
include 'db_conn_open.php';
include 'inc/languageadmin.php';
include 'inc/incfunctions.php';
$languageid=1;
$result=ect_query('SELECT storelang FROM admin WHERE adminid=1') or ect_error();
if($rs=ect_fetch_assoc($result)){
	$storelangarr=explode('|',$rs['storelang']);
	$storelang=@$storelangarr[0];
}
ect_free_result($result);
if(getpost('posted')=='1' && is_numeric(getpost('id'))){
	$result=ect_query('SELECT ordID,ordLang FROM orders WHERE ordID='.getpost('id')) or ect_error();
	if($rs=ect_fetch_assoc($result)) $languageid=$rs['ordLang']+1; else $languageid=1;
	ect_free_result($result);
	if($languageid>1){
		if($languageid==2) $storelang=@$storelangarr[1];
		if($languageid==3) $storelang=@$storelangarr[2];
	}
}
if(@$storelang=='') $storelang='en'; // de dk en es fr it nl pt
include 'inc/languagefile_'.$storelang.'.php';
include 'includes.php';
include 'inc/incemail.php';
if(@$storesessionvalue=="") $storesessionvalue="virtualstore";
if(!@$GLOBALS['disallowlogin']) include 'inc/incloginfunctions.php';
if(@$_SESSION["loggedon"]!=$storesessionvalue || @$GLOBALS['disallowlogin']){
	if(@$_SERVER["HTTPS"]=="on" || @$_SERVER["SERVER_PORT"]=="443")$prot='https://';else $prot='http://';
	header('Location: '.$prot.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/login.php');
	exit;
}
$isprinter=FALSE;
$ordGrandTotal=$ordTotal=$ordStateTax=$ordHSTTax=$ordCountryTax=$ordShipping=$ordHandling=$ordDiscount=0;
$affilID=$ordState=$ordCountry=$ordDiscountText='';
	if(@$_POST['posted']=='1'){
		$alreadygotadmin = getadminsettings();
		$GLOBALS['isresendemail']=TRUE;
		do_order_success(@$_POST['id'],$emailAddr,@$_POST['store']=='1',FALSE,@$_POST['customer']=='1',@$_POST['affiliate']=='1',@$_POST['manufacturer']=='1' ? 2 : FALSE);
?>
<div style="margin:100px 0">
	<div style="text-align:center;margin:100px 0"><?php print $yyOpSuc?></div>
	<div style="text-align:center;margin-bottom:20px"><input type="button" value="<?php print $GLOBALS['xxClsWin']?>" onclick="document.getElementById('preloaderdiv').style.display='none'"></div>
</div>
<?php
	}elseif(trim(@$_GET["id"])!=""){ ?>
<div class="ectsoftwrapper" id="ectsoftwrapper">
<table width="100%" cellspacing="2" cellpadding="2">
<tr><td colspan="2" align="center"><strong><?php print $yySendFo?></strong></td></tr>
<tr><td align="right" width="50%"><?php print $yyCusto?>: </td><td align="left"><input type="checkbox" id="customer" value="1" checked></td></tr>
<tr><td align="right"><?php print $yyAffili?>: </td><td align="left"><input type="checkbox" id="affiliate" value="1"></td></tr>
<tr><td align="right"><?php print $yyManDes?>: </td><td align="left"><input type="checkbox" id="manufacturer" value="1"></td></tr>
<tr><td align="right"><?php print $xxOrdStr?>: </td><td align="left"><input type="checkbox" id="store" value="1"></td></tr>
<tr><td colspan="2" align="center">&nbsp;<br><input type="button" value="<?php print $yyClsWin?>" onclick="document.getElementById('preloaderdiv').style.display='none'"> <input type="button" value="<?php print $yySubmit?>" onclick="executeemailpopup()"></td></tr>
</table>
</div>
<?php
	} ?>