<?php include INSTALL_PATH.'view/htm/header.inc.htm';?>

<div class="row mt-3">
	<div class="col-lg-8 offset-lg-2">
		<div class="card">
			<div class="card-body">
				<h3><?php echo lang('step_1_title');?></h3>
				<div class="table-responsive">
					<table class="table table-fixed">
						<tr align="center">
							<th align="left" width="200"><b><?php echo lang('runtime_env_check');?></b></th>
							<th width="100"><?php echo lang('required');?></th>
							<th width="100"><?php echo lang('current');?></th>
							<th width="100"><?php echo lang('check_result');?></th>
						</tr>
						<?php foreach($env as $v) { ?>
						<tr align="center">
							<td><?php echo $v['name'];?></td>
							<td><?php echo $v['need'];?></td>
							<td><?php echo $v['current'];?></td>
							<td>
							<?php if($v['status'] == 1) { ?>
								<div class="text-success"><i class="icon-ok"></i><?php echo lang('passed');?></div>
							<?php } elseif($v['status'] == 2) { ?>
								<div class="text-success"><i class="icon-ok" title="<?php echo lang('not_the_best');?>"></i><?php echo lang('passed');?></div>
							<?php } elseif($v['status'] == 0) { $succeed = 0; ?>
								<div class="text-danger"><i class="icon-remove"></i><?php echo lang('not_passed');?></div>
							<?php } ?>
							</td>
						</tr>
						<?php } ?>
						
						<tr align="center">
							<th colspan="4" align="left"><b><?php echo lang('dir_writable_check');?></b></th>
						</tr>
				
						<?php foreach($write as $k=>$v) { ?>
						<tr>
							<td colspan="3"><?php echo $k;?></td>
							<td align="center">
								<?php if($v) { ?><div class="text-success"><i class="icon-check"></i><?php echo lang('writable');?></div><?php } ?>
								<?php if(!$v) { $succeed = 0;?><div class="text-danger"><i class="icon-remove"></i><?php echo lang('unwritable');?></div><?php } ?>
							</td>
						</tr>
						<?php } ?>
						
						<tr align="center">
							<th colspan="4" align="left"><b><?php echo lang('function_check');?></b></th>
						</tr>
				
						<tr>
							<td colspan="3">
								glob()
								<?php if(!function_exists('glob')) { ?>
								<p class="text-small text-danger"><?php echo lang('function_glob_not_exists');?></p>
								<?php } ?>
							</td>
							<td align="center">
								<?php if(function_exists('glob')) { ?>
									<div class="text-success"><i class="icon-check"></i><?php echo lang('supported');?></div>
								<?php } else { ?>
									<div class="text-danger"><i class="icon-close"></i><?php echo lang('not_supported');?></div>
								<?php } ?>
							</td>
						</tr>
				
						<tr>
							<td colspan="3">
								gzinflate()
								<?php if(!function_exists('gzinflate')) { ?>
								<p class="text-small text-danger"><?php echo lang('function_gzcompress_not_exists');?></p>
								<?php } ?>
							</td>
							<td align="center">
								<?php if(function_exists('gzinflate')) { ?>
									<div class="text-success"><i class="icon-check"></i><?php echo lang('supported');?></div>
								<?php } else { ?>
									<div class="text-danger"><i class="icon-close"></i><?php echo lang('not_supported');?></div>
								<?php } ?>
							</td>
						</tr>
				
						<tr>
							<td colspan="3">
								mb_substr()
								<?php if(!function_exists('mb_substr')) { ?>
								<p class="text-small text-danger"><?php echo lang('function_mb_substr_not_exists');?></p>
								<?php } ?>
							</td>
							<td align="center">
								<?php if(function_exists('mb_substr')) { ?>
									<div class="text-success"><i class="icon-check"></i><?php echo lang('supported');?></div>
								<?php } else { ?>
									<div class="text-danger"><i class="icon-close"></i><?php echo lang('not_supported');?></div>
								<?php } ?>
							</td>
						</tr>
				
					</table>
				</div>
			</div>
		</div>

		<div class="text-center m-3">
			<button class="btn btn-secondary" onclick="window.location.reload()"><?php echo lang('check_again');?></button>
			<button class="btn btn-primary" onclick="window.location='index.php?action=db'" <?php echo !$succeed ? 'disabled' : '';?>><?php echo lang('next_step');?></button>
		</div>

	</div>
</div>

<?php include INSTALL_PATH.'view/htm/footer.inc.htm';?>
