', $name, '';
echo '
';
}
require 'vendor/autoload.php';
require 'apps/config.php';
$templates = new League\Plates\Engine('template');
if (file_exists('config/config.php')) {
$config = MyConfig::read('config');
} else {
$page = 'install';
}
require 'apps/input.php';
if (!empty($page) && $page === 'about') {
echo $templates->render($page);
}
if (!empty($page) && $page === 'install' && !file_exists('config/config.php')) {
if (!isset($createLogin) && empty($createLogin)) {
echo $templates->render($page, ['missing' => 'login']);
exit();
}
if (!isset($createPassword) && empty($createPassword)) {
echo $templates->render($page, ['missing' => 'password']);
exit();
}
if (!isset($createPath) && empty($createPath)) {
echo $templates->render($page, ['missing' => 'path']);
exit();
}
$conf = array('login' => $createLogin, 'password' => $createPassword, 'listOfDestPath' => $createPath);
$config = MyConfig::write('config', $conf);
$page = 'login';
}
if (!empty($page) && $page === 'login') {
$loginError = false;
if (!empty($_POST['login'])) {
$login = filter_input(INPUT_POST, 'login', FILTER_SANITIZE_SPECIAL_CHARS);
if ($login !== $config['login']) {
$loginError = true;
}
} else {
$loginError = true;
}
if (!empty($_POST['password'])) {
if (!password_verify($_POST['password'], $config['password'])) {
$loginError = true;
}
} else {
$loginError = true;
}
if ($loginError) {
echo $templates->render('login');
} else {
echo $templates->render('addVideo', array('listOfDestPath' => $config['listOfDestPath']));
}
$_SESSION['login'] = 'logged';
}
if (empty($page)) {
if (isset($_SESSION['login']) && $_SESSION['login'] === 'logged') {
echo $templates->render('addVideo', array('listOfDestPath' => $config['listOfDestPath']));
} else {
echo $templates->render('login');
}
}
//echo $templates->render($page);