2016-08-01 12:07:56 +00:00
|
|
|
<?php
|
2015-10-31 14:42:25 +00:00
|
|
|
require_once __DIR__.'/vendor/autoload.php';
|
2015-10-29 20:19:40 +00:00
|
|
|
use Alltube\VideoDownload;
|
2016-04-08 17:06:41 +00:00
|
|
|
use Alltube\Controller\FrontController;
|
2015-10-29 20:19:40 +00:00
|
|
|
|
2016-07-27 00:19:29 +00:00
|
|
|
if (strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) {
|
|
|
|
header('Location: '.str_ireplace('/index.php', '/', $_SERVER['REQUEST_URI']));
|
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
2016-03-29 23:39:47 +00:00
|
|
|
$app = new \Slim\App();
|
|
|
|
$container = $app->getContainer();
|
|
|
|
$container['view'] = function ($c) {
|
|
|
|
$view = new \Slim\Views\Smarty(__DIR__.'/templates/');
|
|
|
|
|
|
|
|
$view->addSlimPlugins($c['router'], $c['request']->getUri());
|
2016-04-08 17:06:41 +00:00
|
|
|
$view->registerPlugin('modifier', 'noscheme', 'Smarty_Modifier_noscheme');
|
2016-04-06 11:19:27 +00:00
|
|
|
|
2016-03-29 23:39:47 +00:00
|
|
|
|
|
|
|
return $view;
|
|
|
|
};
|
|
|
|
|
2016-07-22 12:43:50 +00:00
|
|
|
$controller = new FrontController($container);
|
2016-04-08 17:06:41 +00:00
|
|
|
|
2016-04-30 23:25:08 +00:00
|
|
|
$container['errorHandler'] = array($controller, 'error');
|
|
|
|
|
2015-10-29 20:23:02 +00:00
|
|
|
$app->get(
|
|
|
|
'/',
|
2016-04-08 17:06:41 +00:00
|
|
|
array($controller, 'index')
|
2016-06-09 19:15:44 +00:00
|
|
|
)->setName('index');
|
2015-10-29 20:23:02 +00:00
|
|
|
$app->get(
|
|
|
|
'/extractors',
|
2016-04-08 17:06:41 +00:00
|
|
|
array($controller, 'extractors')
|
2016-03-29 23:39:47 +00:00
|
|
|
)->setName('extractors');
|
2015-10-29 20:23:02 +00:00
|
|
|
$app->get(
|
|
|
|
'/video',
|
2016-04-08 17:06:41 +00:00
|
|
|
array($controller, 'video')
|
2016-03-29 23:39:47 +00:00
|
|
|
)->setName('video');
|
2015-10-31 10:48:14 +00:00
|
|
|
$app->get(
|
|
|
|
'/redirect',
|
2016-04-08 17:06:41 +00:00
|
|
|
array($controller, 'redirect')
|
2016-04-10 19:42:38 +00:00
|
|
|
)->setName('redirect');
|
2015-10-31 10:48:14 +00:00
|
|
|
$app->get(
|
|
|
|
'/json',
|
2016-04-08 17:06:41 +00:00
|
|
|
array($controller, 'json')
|
2015-10-31 10:48:14 +00:00
|
|
|
);
|
2015-10-29 20:19:40 +00:00
|
|
|
$app->run();
|