Restructed project and added docker support.

This commit is contained in:
2018-03-21 19:17:31 +00:00
parent f42396d784
commit 89d164f615
63 changed files with 155 additions and 140 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
.git

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
/html/head-custom.php
/config.local.php
/.htaccess
/.idea

12
Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM php:7.0-apache
COPY . /srv/app
RUN chown -R www-data:www-data /srv/app
ENV APACHE_DOCUMENT_ROOT /srv/app/src
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
EXPOSE 80

0
Saved/.gitkeep Normal file
View File

View File

@@ -1,4 +0,0 @@
Order deny,allow
Deny From All
Allow From home.xnet.tk
Options +Indexes

View File

@@ -1,32 +0,0 @@
<?php
define('BASE_PATH', dirname(__FILE__));
chdir(BASE_PATH);
ini_set('display_errors', True);
error_reporting(E_ALL);
function sys_autoload($class)
{
if (strpos($class, '_') !== False)
{
$path = 'Classes/'.str_replace('_', '/', $class);
if (is_file($path.'.php'))
include_once($path.'.php');
}
if (is_file("Classes/$class/$class.php"))
include_once("Classes/$class/$class.php");
if (is_file("Classes/$class.php"))
include_once("Classes/$class.php");
}
spl_autoload_register('sys_autoload');
require('config.php');
require('functions.php');
System::Init($config);

View File

@@ -78,7 +78,7 @@ class HtRule_List
$this->id = uniqid();
$ds = DIRECTORY_SEPARATOR;
$dir = BASE_PATH.$ds.'Saved'.$ds;
$dir = SAVED_PATH.$ds;
$dir .= substr($this->id, 0,2).$ds;
$dir .= substr($this->id, 2,2).$ds;

View File

@@ -20,7 +20,9 @@ class System
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
session_set_cookie_params(60*60*24, self::$config->BasePath, $_SERVER['HTTP_HOST'], False, True);
$path = parse_url(self::$config->BasePath, PHP_URL_PATH);
session_set_cookie_params(60*60*24, $path, $_SERVER['HTTP_HOST'], False, True);
session_start();
}
}

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 980 B

View File

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 536 B

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 415 B

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -1,10 +1,10 @@
<?php
$config = array();
$config['BasePath'] = (@$_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].'/';
$config['Debug'] = False;
if (is_file('config.local.php'))
<?php
$config = array();
$config['BasePath'] = (@$_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].'/';
$config['Debug'] = False;
if (is_file('config.local.php'))
include('config.local.php');

View File

@@ -1,21 +1,21 @@
<div style="clear: both;">&nbsp;</div>
</div> <!-- / content -->
<?php if (isset($sidebar) && $sidebar == True) include('sidebar.php'); ?>
</div><!-- / page-content -->
</div><!-- / page-bgbtm -->
</div><!-- / page-bgtop -->
</div><!-- / page -->
</div><!-- / wrapper -->
<?php include('footer.php'); ?>
<div style="clear: both;">&nbsp;</div>
<?php
if (is_file(dirname(__FILE__).'/bottom-custom.php'))
include(dirname(__FILE__).'/bottom-custom.php');
?>
</body>
</html>
<!--
GentleBreeze Design by Free CSS Templates
<div style="clear: both;">&nbsp;</div>
</div> <!-- / content -->
<?php if (isset($sidebar) && $sidebar == True) include('sidebar.php'); ?>
</div><!-- / page-content -->
</div><!-- / page-bgbtm -->
</div><!-- / page-bgtop -->
</div><!-- / page -->
</div><!-- / wrapper -->
<?php include('footer.php'); ?>
<div style="clear: both;">&nbsp;</div>
<?php
if (is_file(dirname(__FILE__).'/bottom-custom.php'))
include(dirname(__FILE__).'/bottom-custom.php');
?>
</body>
</html>
<!--
GentleBreeze Design by Free CSS Templates
-->

View File

@@ -1,74 +1,74 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="keywords" content="htaccess, htaccess builder, htaccess generator, apache, apache rewrite, rewrite" />
<meta name="description" content="Build htaccess rules for apache 2 easily." />
<title>Htaccess Builder</title>
<base href="<?php echo System::Config()->BasePath; ?>"/>
<link href="Media/style.css" rel="stylesheet" type="text/css"/>
<link href='http://fonts.googleapis.com/css?family=Oswald|Arvo|Telex' rel='stylesheet' type='text/css'/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
if(typeof jQuery == 'undefined'){document.write("<scr"+"ipt src=\"Media/jquery.min.js\" type=\"text/javascript\"><\/scr"+"ipt>");}
</script>
<?php if (defined('CREATOR')): ?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" type="text/javascript"></script>
<link href="Media/impromptu.css" rel="stylesheet" type="text/css"/>
<script src="Media/jquery-impromptu.3.2.min.js" type="text/javascript"></script>
<link href="Media/tooltipster-1.2/css/tooltipster.css" rel="stylesheet" type="text/css"/>
<script src="Media/tooltipster-1.2/js/jquery.tooltipster.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="Media/index.js" type="text/javascript"></script>
<script src="Media/rules.js" type="text/javascript"></script>
<?php endif; ?>
<?php if (System::Config()->Debug): ?>
<style type="text/css">
body {
background-color: #700000;
}
</style>
<?php endif; ?>
<?php
if (is_file(dirname(__FILE__).'/head-custom.php'))
include(dirname(__FILE__).'/head-custom.php');
?>
<?php if (isset($head)) echo $head; ?>
</head>
<body id="<?php if (isset($pageid)) echo $pageid; ?>">
<a href="https://github.com/sam159/HtaccessBuilder"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub"></a>
<div id="wrapper">
<div id="header-wrapper">
<div id="header">
<div id="logo">
<h1><a href="#">Htaccess Builder</a></h1>
<p>
Beta!
</p>
</div>
</div>
</div>
<div id="menu-wrapper">
<div id="menu">
<ul>
<li class="page-builder"><a href="">Builder</a></li>
</ul>
</div>
</div>
<?php $class = ''; if (!isset($sidebar) || $sidebar == False) $class = 'class="fullwidth"'?>
<div id="page" <?=$class?>>
<div id="page-bgtop" <?=$class?>>
<div id="page-bgbtm" <?=$class?>>
<div id="page-content" <?=$class?>>
<?php if (isset($sidebar) && $sidebar == True): ?>
<div id="content">
<?php else: ?>
<div id="content-fullwidth">
<?php endif; ?>
<noscript>
<div id="js-notice">
Javascript is required to use this website :(
</div>
</noscript>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="keywords" content="htaccess, htaccess builder, htaccess generator, apache, apache rewrite, rewrite" />
<meta name="description" content="Build htaccess rules for apache 2 easily." />
<title>Htaccess Builder</title>
<base href="<?php echo System::Config()->BasePath; ?>"/>
<link href="Media/style.css" rel="stylesheet" type="text/css"/>
<link href='http://fonts.googleapis.com/css?family=Oswald|Arvo|Telex' rel='stylesheet' type='text/css'/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
if(typeof jQuery == 'undefined'){document.write("<scr"+"ipt src=\"Media/jquery.min.js\" type=\"text/javascript\"><\/scr"+"ipt>");}
</script>
<?php if (defined('CREATOR')): ?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" type="text/javascript"></script>
<link href="Media/impromptu.css" rel="stylesheet" type="text/css"/>
<script src="Media/jquery-impromptu.3.2.min.js" type="text/javascript"></script>
<link href="Media/tooltipster-1.2/css/tooltipster.css" rel="stylesheet" type="text/css"/>
<script src="Media/tooltipster-1.2/js/jquery.tooltipster.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="Media/index.js" type="text/javascript"></script>
<script src="Media/rules.js" type="text/javascript"></script>
<?php endif; ?>
<?php if (System::Config()->Debug): ?>
<style type="text/css">
body {
background-color: #700000;
}
</style>
<?php endif; ?>
<?php
if (is_file(dirname(__FILE__).'/head-custom.php'))
include(dirname(__FILE__).'/head-custom.php');
?>
<?php if (isset($head)) echo $head; ?>
</head>
<body id="<?php if (isset($pageid)) echo $pageid; ?>">
<a href="https://github.com/sam159/HtaccessBuilder"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub"></a>
<div id="wrapper">
<div id="header-wrapper">
<div id="header">
<div id="logo">
<h1><a href="#">Htaccess Builder</a></h1>
<p>
Beta!
</p>
</div>
</div>
</div>
<div id="menu-wrapper">
<div id="menu">
<ul>
<li class="page-builder"><a href="">Builder</a></li>
</ul>
</div>
</div>
<?php $class = ''; if (!isset($sidebar) || $sidebar == False) $class = 'class="fullwidth"'?>
<div id="page" <?=$class?>>
<div id="page-bgtop" <?=$class?>>
<div id="page-bgbtm" <?=$class?>>
<div id="page-content" <?=$class?>>
<?php if (isset($sidebar) && $sidebar == True): ?>
<div id="content">
<?php else: ?>
<div id="content-fullwidth">
<?php endif; ?>
<noscript>
<div id="js-notice">
Javascript is required to use this website :(
</div>
</noscript>
<img id="loading" src="Media/Images/loading.gif" alt="[*]" style="display: none;"/>

35
src/includer.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
define('BASE_PATH', dirname(__FILE__));
chdir(BASE_PATH);
if (array_key_exists('SAVED_PATH', $_ENV)) {
define('SAVED_PATH', $_ENV['SAVED_PATH']);
} else {
define('SAVED_PATH', realpath(BASE_PATH . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Saved'));
}
function sys_autoload($class)
{
if (strpos($class, '_') !== False) {
$path = 'Classes/' . str_replace('_', '/', $class);
if (is_file($path . '.php'))
include_once($path . '.php');
}
if (is_file("Classes/$class/$class.php"))
include_once("Classes/$class/$class.php");
if (is_file("Classes/$class.php"))
include_once("Classes/$class.php");
}
spl_autoload_register('sys_autoload');
require('config.php');
require('functions.php');
System::Init($config);