Permalink
Browse files

initial port of whsuite

  • Loading branch information...
mikebarlow committed Sep 23, 2016
1 parent 87dd6af commit bd5ad10c09a2c571acdeeda4d1e2da57fcde634c
Showing 772 changed files with 80,674 additions and 0 deletions.
View
@@ -0,0 +1,11 @@
.DS_Store
www/whsuite/app/configs/database.php
www/whsuite/app/storage/logs/*.log
www/whsuite/app/storage/translations/*
www/whsuite/app/storage/uploader/*
www/whsuite/vendor/*
www/whsuite/composer.lock
*.installed
www/cgi-bin
.idea/*
www/whsuite/app/addons/*
View
@@ -0,0 +1,56 @@
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
#################################################################
# Modify the line below and amend as neccessary. If you are
# running WHSuite in a subdirectory, add that to the RewriteBase
# with a trailing slash.
#################################################################
RewriteBase /
</IfModule>
#################################################################
# You should not need to edit below this line in most situations
#################################################################
Options -MultiViews
Options -Indexes
<IfModule mod_rewrite.c>
RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond $1 !^(assets|addon-assets)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ $1/ [L,R=301]
# Append a trailing slash
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
# Check for install dir
RewriteCond $1 ^(install)
RewriteRule ^(.*)$ install.php?/$1 [NC,QSA,L]
# Main framework calls
# check it's not an actual file / directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond $1 !^(assets|addon-assets)
RewriteRule ^(.*)$ index.php?/$1 [NC,QSA,L]
# assets - overwritten addon asset
RewriteRule ^assets/([a-zA-Z0-9._-]*)/([admin_|client_][a-zA-Z0-9.-_]*)/([a-zA-Z]*)/([a-zA-Z0-9.\-_@]*)$ assets.php?addon=$1&theme=$2&type=$3&asset=$4 [NC,QSA,L]
RewriteRule ^addon-assets/([a-zA-Z0-9._\-]*)/([admin_|client_][a-zA-Z0-9.\-_]*)/([a-zA-Z]*)/([a-zA-Z0-9.\-_@]*)$ assets.php?addon=$1&theme=$2&type=$3&asset=$4&path=addon [NC,QSA,L]
# assets - main asset
RewriteRule ^assets/([admin_|client_][a-zA-Z0-9._\-]*)/([a-zA-Z]*)/(.*)$ assets.php?theme=$1&type=$2&asset=$3 [NC,QSA,L]
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
</IfModule>
View
@@ -0,0 +1,123 @@
<?php
if (! defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
// include the setup
if (file_exists('inc' . DS . 'inc.php')) {
require_once('inc' . DS . 'inc.php');
} else {
die("Fatal Error: System includes file not found!");
}
// double check we're not trying to go into a directory we shouldn't be!
$proceed = true;
if (is_array($_GET)) {
foreach ($_GET as $key => $value) {
if (strpos($value, '../') !== false) {
$proceed = false;
}
}
} else {
$proceed = false;
}
// check if we can proceed
if ($proceed) {
// build path to the asset
if (isset($_GET['path'])) {
// addon asset
// go straight to addon directory
$asset_path = ADDON_DIR . DS;
if (! empty($_GET['addon'])) {
$asset_path .= $_GET['addon'] . DS;
}
$asset_path .= 'assets' . DS;
if (! empty($_GET['type'])) {
$asset_path .= $_GET['type'] . DS;
}
if (! empty($_GET['asset'])) {
$asset_path .= $_GET['asset'];
}
} else {
// addon or main asset
// build up the path, if addon exists, add it in for addon overwrite.
$asset_path = APP_DIR . DS . 'themes' . DS;
if (! empty($_GET['theme'])) {
$asset_path .= $_GET['theme'] . DS;
}
if (! empty($_GET['addon'])) {
$asset_path .= $_GET['addon'] . DS;
}
$asset_path .= 'assets' . DS;
if (! empty($_GET['type'])) {
$asset_path .= $_GET['type'] . DS;
}
if (! empty($_GET['asset'])) {
$asset_path .= $_GET['asset'];
}
}
// clean up
$asset_path = htmlentities($asset_path, ENT_QUOTES);
if (file_exists($asset_path) && is_file($asset_path)) {
// get the mime type
if (substr($asset_path, -3) == '.js') {
$mime_type = 'text/javascript';
} elseif (substr($asset_path, -4) == '.css') {
$mime_type = 'text/css';
} else {
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mime_type = $finfo->file($asset_path);
}
// display
ob_start();
header("Content-type: " . $mime_type);
echo file_get_contents($asset_path);
ob_end_flush();
die();
}
}
// if we're here, something went wrong, most likely the file doesn't exist.
header("Location: /page-not-found");
View
Binary file not shown.
View
@@ -0,0 +1,51 @@
<?php
// ----------------------------------------------------------------------
// WHSUITE Folder name
// ----------------------------------------------------------------------
$whs_dir_name = 'whsuite';
// ----------------------------------------------------------------------
// WHSUITE Folder Location - relative to the index.php / asset.php files
// ----------------------------------------------------------------------
$whs_dir = '';
// ----------------------------------------------------------------------
// Development Mode - Used to turn on error reporting
// (shoud not be used in a production environment!)
// ----------------------------------------------------------------------
define('DEV_MODE', false);
// ----------------------------------------------------------------------
// DON'T EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
// ----------------------------------------------------------------------
// Define some constants
define('DOC_ROOT', rtrim(realpath($_SERVER['DOCUMENT_ROOT']), '/'));
define('PUBLIC_DIR', dirname(__DIR__));
// work out if WHSuite is in a Sub directory (i.e. mysite.com/billing) so we can amend URLS as required
list($prefix, $url_prefix) = explode(DOC_ROOT, PUBLIC_DIR);
if (! empty($url_prefix) && substr($url_prefix, 0, 1) != '/') {
$url_prefix = '/' . $url_prefix;
}
define('URL_PREFIX', $url_prefix);
define('ROOT_DIR', PUBLIC_DIR . DS . $whs_dir);
define('SYS_DIR', PUBLIC_DIR . DS . $whs_dir . $whs_dir_name . DS . 'system');
define('APP_DIR', PUBLIC_DIR . DS . $whs_dir . $whs_dir_name . DS . 'app');
define('ADDON_DIR', PUBLIC_DIR . DS . $whs_dir . $whs_dir_name . DS . 'app' . DS . 'addons');
define('STORAGE_DIR', PUBLIC_DIR . DS . $whs_dir . $whs_dir_name . DS . 'app' . DS . 'storage');
define('VENDOR_DIR', PUBLIC_DIR . DS . $whs_dir . $whs_dir_name . DS . 'vendor');
define('INSTALLER_DIR', APP_DIR . DS . 'installer');
View
@@ -0,0 +1 @@
<?php die('Access Denied'); ?>
View
@@ -0,0 +1,25 @@
<?php
date_default_timezone_set('UTC');
if (! defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
// include the setup
if (file_exists('inc' . DS . 'inc.php')) {
require_once('inc' . DS . 'inc.php');
} else {
die("Fatal Error: System includes file not found!");
}
// Go!
if (file_exists(SYS_DIR . DS . 'bootstrap.php')) {
require_once(SYS_DIR . DS . 'bootstrap.php');
} else {
die("Fatal Error: System bootstrap file not found!");
}
View
@@ -0,0 +1,24 @@
<?php
date_default_timezone_set('UTC');
// Version that will be installed
define('INSTALL_VERSION', '1.1.2');
if (! defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
// include the setup
if (file_exists('inc' . DS . 'inc.php')) {
require_once('inc' . DS . 'inc.php');
} else {
die("Fatal Error: System includes file not found!");
}
// Go!
if (file_exists(INSTALLER_DIR . DS . 'bootstrap.php')) {
require_once(INSTALLER_DIR . DS . 'bootstrap.php');
} else {
die("Fatal Error: System bootstrap file not found!");
}
View
@@ -0,0 +1 @@
Deny from all
Oops, something went wrong.

0 comments on commit bd5ad10

Please sign in to comment.