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

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);