<?php
/*--------------------------------------------------\
| onlinksoft    	|   Abdullah    | login file        |
|---------------------------------------------------|
| For use with:                                    	|
|									|
| http://www.onlinksofts.com/  	            			|
|                           			|
\--------------------------------------------------*/
	if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root']))
		die(_("Restricted access"));

//echo $UTF8_fontfile;

	echo "<body id='loginscreen' $onload>\n"; ?>
	<style>
	.LogoHeader font { color: #000 !important; }
</style><?php 

	//echo "<table class='titletext'><tr><td>$title</td></tr></table>\n";
	
	div_start('login');
	
	start_form(false, false, $_SESSION['timeout']['uri'], "loginform");
	
	echo "<div class='LogoHeader' style='background: #fff !important;'>";
	if (!$login_timeout) { // FA logo
    	if(file_exists(dirname(__FILE__) .'/images/'.kv_get_option('logo'))){
			$logo_img = kv_get_option('logo').'?'.rand(2,5);
		}else
			$logo_img = 'onlinksoft.png?'.rand(2,5);
    	echo "<a target='_blank' href='".kv_get_option('powered_url')."'><img src='$path_to_root/themes/onlinksoft/images/$logo_img' alt='".kv_get_option('powered_name')."' height='100' onload='fixPNG(this)' border='0' style='max-width: 250px;'/></a>";
	} else { 
		echo "<font size=5>"._('Authorization timeout')."</font>";
	} 
	echo "</div>\n";	

	echo "<input type='hidden' id=ui_mode name='ui_mode' value='".$_SESSION["wa_current_user"]->ui_mode."' >\n";
	div_start('Login_Div');
	echo '<div class="ContentLogin"> Login </div>'; 
	start_table(false, "class='login'");
	/*if (!$login_timeout){
		if(kv_get_option('hide_version') == 0 )
			table_section_title(_("Version")." $version   Build ".$SysPrefs->build_version ." - "._("Login"));
		else
			table_section_title(_("Login"));
	}*/
	$value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($SysPrefs->allow_demo_mode ? "demouser":"");	
	
	text_cells( null, "user_name_entry_field", $value, 20, 30, false, "", "", " placeholder='Username' ");

	$password = $SysPrefs->allow_demo_mode ? "password":"";

	//password_row('password', $password);
	echo '<tr> <td><input type="password" name="password" size="20" maxlength="20" value="" placeholder="Password"> </td> </tr>';

	// if ($login_timeout) {
		hidden('company_login_name', 0);
// 	} else {
// 		if (isset($_SESSION['wa_current_user']->company))
// 			$coy =  $_SESSION['wa_current_user']->company;
// 		else
// 			$coy = $def_coy;
// 		if (!@$text_company_selection) {
// 			echo "<tr><td><select name='company_login_name'>\n";
// 			for ($i = 0; $i < count($db_connections); $i++)
// 				echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>";
// 			echo "</select>\n";
// 			echo "</td></tr>";
// 		} else {
// //			$coy = $def_coy;
// 			text_cells(_("Company"), "company_login_nickname", "", 20, 50);
// 		}
		start_row();
		label_cell($demo_text, "colspan=2 align='center' id='log_msg'");
		end_row();
// 	}; 
	end_table(1);
	echo "<center><input type='submit' class='buttonui btn-block btn-large' value='&nbsp;&nbsp;"._("Login")."' name='SubmitUser'"
		.($login_timeout ? '':" onclick='set_fullmode();'").(isset($blocked_msg) ? " disabled" : '')." ></center>\n";

	
?>
