Redirect with PHP instead of .htaccess

This commit is contained in:
Pierre Rudloff 2015-01-07 10:42:44 +01:00
parent 39f81c3674
commit 816b556c65
7 changed files with 32 additions and 7 deletions

View file

@ -1,5 +1 @@
AddType application/x-web-app-manifest+json .webapp AddType application/x-web-app-manifest+json .webapp
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/maintenance.php
RewriteRule ^(.*)\.php$ /maintenance.php [R=301]
RewriteRule ^$ /maintenance.php [R=301]

View file

@ -10,6 +10,8 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro * @link http://rudloff.pro
* */ * */
require_once 'config.php';
require_once 'common.php';
require_once 'download.php'; require_once 'download.php';
if (isset($_GET["url"])) { if (isset($_GET["url"])) {
if (isset($_GET['audio'])) { if (isset($_GET['audio'])) {

18
common.php Normal file
View file

@ -0,0 +1,18 @@
<?php
/**
* PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/)
* PHP file included on all pages
*
* PHP Version 5.3.10
*
* @category Youtube-dl
* @package Youtubedl
* @author Pierre Rudloff <rudloff@strasweb.fr>
* @author Olivier Haquette <contact@olivierhaquette.fr>
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro
* */
if (MAINTENANCE) {
header('Location: maintenance.php'); exit;
}
?>

View file

@ -15,4 +15,5 @@ define('YOUTUBE_DL', './youtube-dl');
define('PYTHON', '/usr/bin/python'); define('PYTHON', '/usr/bin/python');
define('PARAMS', '--no-playlist --no-warnings'); define('PARAMS', '--no-playlist --no-warnings');
define('CONVERT', true); define('CONVERT', true);
define('MAINTENANCE', false);
?> ?>

View file

@ -12,7 +12,8 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro * @link http://rudloff.pro
* */ * */
require_once 'config.php';
require_once 'common.php';
require 'head.php'; require 'head.php';
?> ?>

View file

@ -12,6 +12,8 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro * @link http://rudloff.pro
* */ * */
require_once 'config.php';
require_once 'common.php';
require 'head.php'; require 'head.php';
?> ?>
@ -19,7 +21,6 @@ require 'head.php';
<?php <?php
require 'header.php'; require 'header.php';
require 'config.php';
?> ?>
<div class="wrapper"> <div class="wrapper">

View file

@ -12,6 +12,10 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html * @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro * @link http://rudloff.pro
* */ * */
require_once 'config.php';
if (!MAINTENANCE) {
header('Location: index.php'); exit;
}
require 'head.php'; require 'head.php';
?> ?>
@ -25,7 +29,9 @@ require 'head.php';
<div class="main"> <div class="main">
<h1><img itemprop="image" class="logo" src="img/logo.png" <h1><img itemprop="image" class="logo" src="img/logo.png"
alt="AllTube Download" width="328" height="284"></h1> alt="AllTube Download" width="328" height="284"></h1>
<div>Due to some issues with our server, we have to disable AllTube for a few days. Sorry for the inconvenience.</div> <div>Due to some issues with our server,
we have to disable AllTube for a few days.
Sorry for the inconvenience.</div>
</div> </div>
</div> </div>