<?php
/*
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
Developed by Samir Shelenko and Alexander Zemlyanoy  (https://vk.com/id00v / https://vk.com/mrsasha082)
*/
?>
<?php echo $admheader ?>
<?php
   $mysqlExists = false;
   if(function_exists("mysqli_connect"))
    $mysqlExists = true;
   
   $ssh2Exists = false;
   if(function_exists("ssh2_connect"))
    $ssh2Exists = true;
   
   $gdExists = false;
   if(function_exists("gd_info"))
    $gdExists = true;

   $modRewriteExists = false;
   if(function_exists('apache_get_modules')) {
    $modRewriteExists = in_array('mod_rewrite', apache_get_modules());
   } else {
    // nginx/php-fpm: mod_rewrite не применим, ЧПУ обеспечивает сам веб-сервер
    $modRewriteExists = (bool)preg_match('~/(main|admin|account|servers)/~', @$_SERVER['REQUEST_URI']);
   }
?>
<div class="content d-flex flex-column flex-column-fluid" id="kt_content">
	<div class="d-flex flex-column-fluid">
		<div class="container">
			<div class="row">
				<div class="col-xl-12">
					<div class="card card-custom mb-3">
						<div class="card-body">
							<div class="table-responsive">
								<table class="table table-head-custom table-vertical-center">
									<thead>
										<tr class="text-left">
											<th>Функция</th>
											<th>Статус</th>
											<th>Установка</th>
											<th>Информация</th>
										</tr>
									</thead>
									<tbody>
										<tr>
											<td>Система</td>
											<td>REDL.IO — Хостинг с искусственным интеллектом</td>
											<td><i class="fa fa-check-circle"></i></td>
											<td><?php echo php_uname() ?></td>
										</tr>
										<tr>
											<td>php_mysql</td>
											<td><?php if($mysqlExists): ?>Установлен<?php else: ?>Не установлен<?php endif; ?></td>
											<td><?php if($mysqlExists): ?><i class="fa fa-check-circle"></i><?php else: ?><code>apt-get install php-mysql</code><?php endif; ?></td>
											<td>Работоспособность бд для сервера.</td>
										</tr>
										<tr>
											<td>php_ssh2</td>
											<td><?php if($ssh2Exists): ?>Установлен<?php else: ?>Не установлен<?php endif; ?></td>
											<td><?php if($ssh2Exists): ?><i class="fa fa-check-circle"></i><?php else: ?><code>apt-get install libssh2-php</code><?php endif; ?></td>
											<td>Подключение по ssh.</td>
										</tr>
										<tr>
											<td>php_gd</td>
											<td><?php if($gdExists): ?>Установлен<?php else: ?>Не установлен<?php endif; ?></td>
											<td><?php if($gdExists): ?><i class="fa fa-check-circle"></i><?php else: ?><code>apt-get install php-gd</code><?php endif; ?></td>
											<td>Просмотр каптчи.</td>
										</tr>
										<tr>
											<td>mod_rewrite</td>
											<td><?php if($modRewriteExists): ?>Установлен<?php else: ?>Не установлен<?php endif; ?></td>
											<td><?php if($modRewriteExists): ?><i class="fa fa-check-circle"></i><?php else: ?><code>a2enmod rewrite</code><?php endif; ?></td>
											<td>Кэширование памяти.</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
				<?php if($user_access_level == 3):?>
				<div class="col-xl-12">
					<div class="card card-custom mb-3">
						<div class="card-body">
							<div class="table-responsive">
								<table class="table table-head-custom table-vertical-center">
									<thead>
										<tr>
											<th>Время</th>
											<th>Ссылка для браузера</th>
											<th>Crontab</th>
										</tr>
									</thead>
									<tbody>
										<tr>
											<td>1 раз в 00:00</td>
											<td><?php echo $url ?>main/cron/index?token=<?php echo $token ?></td>
											<td><code>0 0 * * * curl http://127.0.0.1/main/cron/index?token=<?php echo $token ?></code></td>
										</tr>
										<tr>
											<td>1 раз в минуту</td>
											<td><?php echo $url ?>main/cron/gameServers?token=<?php echo $token ?></td>
											<td><code>*/1 * * * * curl http://127.0.0.1/main/cron/gameServers?token=<?php echo $token ?></code></td>
										</tr>
										<tr>
											<td>1 раз в минуту</td>
											<td><?php echo $url ?>main/cron/tasks?token=<?php echo $token ?></td>
											<td><code>*/1 * * * * curl http://127.0.0.1/main/cron/tasks?token=<?php echo $token ?></code></td>
										</tr>
										<tr>
											<td>1 раз в 10 минут</td>
											<td><?php echo $url ?>main/cron/serverReloader?token=<?php echo $token ?></td>
											<td><code>0 */10 * * * curl http://127.0.0.1/main/cron/serverReloader?token=<?php echo $token ?></code></td>
										</tr>
										<tr>
											<td>1 раз в 30 минут</td>
											<td><?php echo $url ?>main/cron/stopServers?token=<?php echo $token ?></td>
											<td><code>*/30 * * * * curl http://127.0.0.1/main/cron/stopServers?token=<?php echo $token ?></code></td>
										</tr>
										<tr>
											<td>1 раз в 30 минут</td>
											<td><?php echo $url ?>main/cron/stopServersQuery?token=<?php echo $token ?></td>
											<td><code>*/30 * * * * curl http://127.0.0.1/main/cron/stopServersQuery?token=<?php echo $token ?></code></td>
										</tr>
										<tr>
											<td>1 раз в час</td>
											<td><?php echo $url ?>main/cron/updateStats?token=<?php echo $token ?></td>
											<td><code>* */1 * * * curl http://127.0.0.1/main/cron/updateStats?token=<?php echo $token ?></code></td>
										</tr>
										<tr>
											<td>1 раз в час</td>
											<td><?php echo $url ?>main/cron/updateStatsLocations?token=<?php echo $token ?></td>
											<td><code>* */1 * * * curl http://127.0.0.1/main/cron/updateStatsLocations?token=<?php echo $token ?></code></td>
										</tr>
										<tr>
											<td>1 раз в неделю</td>
											<td><?php echo $url ?>main/cron/clearLogs?token=<?php echo $token ?></td>
											<td><code>0 * */7 * * curl http://127.0.0.1/main/cron/clearLogs?token=<?php echo $token ?></code></td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
				<?php endif; ?>
			</div>
		</div>
	</div>
</div>
<?echo $footer?>