Skip to content

Commit 1c36de9

Browse files
committed
Merge pull request #2123 from MPOS/move-internals
[CLEANUP] Move internals
2 parents 75bda55 + fcaffe7 commit 1c36de9

File tree

572 files changed

+103
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

572 files changed

+103
-67
lines changed

Diff for: .gitignore

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Local Config
2-
/public/include/config/global.inc.php
3-
/public/include/config/security.inc.php
2+
/include/config/global.inc.php
3+
/include/config/security.inc.php
44

55
# Templates
6-
/public/templates/compile/*.php
7-
/public/templates/compile/**
8-
/public/templates/cache/*.php
9-
/public/templates/cache/**
6+
/templates/compile/*.php
7+
/templates/compile/**
8+
/templates/cache/*.php
9+
/templates/cache/**
1010

1111
# Logs
1212
/cronjobs/logs
1313
/cronjobs/logs/**.txt.*.gz
1414
/logs/*
1515

1616
# Test configs
17-
public/include/config/global.inc.scrypt.php
18-
public/include/config/global.inc.sha.php
17+
/include/config/global.inc.scrypt.php
18+
/include/config/global.inc.sha.php
1919

2020
# IDE Settings
2121
/.idea/*

Diff for: .htaccess

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
ErrorDocument 404 /public/index.php?page=error&action=404
22
RedirectMatch 404 /logs(/|$)
3-
Options -Indexes
3+
RedirectMatch 404 /templtes(/|$)
4+
RedirectMatch 404 /include(/|$)
5+
RedirectMatch 404 /scripts(/|$)
6+
RedirectMatch 404 /sql(/|$)
7+
RedirectMatch 404 /upgrade(/|$)
8+
RedirectMatch 404 /cronjobs(/|$)
9+
RedirectMatch 404 /tests(/|$)
10+
Options -Indexes

Diff for: cronjobs/logs/README.md

-1
This file was deleted.

Diff for: cronjobs/shared.inc.php

+4-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
3535

3636
// MODIFY THIS
3737
// We need to find our include files so set this properly
38-
define("BASEPATH", "../public/");
38+
define("BASEPATH", dirname(__FILE__) . "/");
3939

4040
/*****************************************************
4141
* No need to change beyond this point *
@@ -48,14 +48,8 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
4848
$cron_name = basename($_SERVER['PHP_SELF'], '.php');
4949

5050
// Include our configuration (holding defines for the requires)
51-
require_once(BASEPATH . 'include/config/global.inc.dist.php');
52-
require_once(BASEPATH . 'include/config/global.inc.php');
53-
54-
require_once(BASEPATH . 'include/config/security.inc.dist.php');
55-
@include_once(BASEPATH . 'include/config/security.inc.php');
56-
57-
require_once(BASEPATH . 'include/bootstrap.php');
58-
require_once(BASEPATH . 'include/version.inc.php');
51+
require_once(BASEPATH . '../include/bootstrap.php');
52+
require_once(BASEPATH . '../include/version.inc.php');
5953

6054
// Command line switches
6155
array_shift($argv);
@@ -69,7 +63,7 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
6963
}
7064

7165
// Load 3rd party logging library for running crons
72-
$log = KLogger::instance( 'logs/' . $cron_name, KLogger::INFO );
66+
$log = KLogger::instance( BASEPATH . '../logs/' . $cron_name, KLogger::INFO );
7367
$log->LogDebug('Starting ' . $cron_name);
7468

7569
// Load the start time for later runtime calculations for monitoring

Diff for: public/include/admin_checks.php renamed to include/admin_checks.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
}
5454

5555
// check if we can write templates/cache and templates/compile -> error
56-
if (!is_writable(THEME_DIR.'/cache')) {
56+
if (!is_writable(TEMPLATE_DIR . '/cache')) {
5757
$error[] = "templates/cache folder is not writable for uid {$apache_user['name']}";
5858
}
59-
if (!is_writable(THEME_DIR.'/compile')) {
59+
if (!is_writable(TEMPLATE_DIR . '/compile')) {
6060
$error[] = "templates/compile folder is not writable for uid {$apache_user['name']}";
6161
}
6262

File renamed without changes.

Diff for: public/include/bootstrap.php renamed to include/bootstrap.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
// Used for performance calculations
44
$dStartTime = microtime(true);
55

6-
define('INCLUDE_DIR', BASEPATH . 'include');
6+
define('INCLUDE_DIR', BASEPATH . '../include');
77
define('CLASS_DIR', INCLUDE_DIR . '/classes');
88
define('PAGES_DIR', INCLUDE_DIR . '/pages');
9-
define('THEME_DIR', BASEPATH . 'templates');
9+
define('TEMPLATE_DIR', BASEPATH . '../templates');
1010

1111
$quickstartlink = "<a href='https://github.com/MPOS/php-mpos/wiki/Quick-Start-Guide' title='MPOS Quick Start Guide'>Quick Start Guide</a>";
1212

1313
// Include our configuration (holding defines for the requires)
14-
if (!include_once(BASEPATH . 'include/config/global.inc.dist.php')) die('Unable to load base global config from ['.BASEPATH . 'include/config/global.inc.dist.php' . '] - '.$quickstartlink);
15-
if (!@include_once(BASEPATH . 'include/config/global.inc.php')) die('Unable to load your global config from ['.BASEPATH . 'include/config/global.inc.php' . '] - '.$quickstartlink);
14+
if (!include_once(INCLUDE_DIR . '/config/global.inc.dist.php')) die('Unable to load base global config from ['.INCLUDE_DIR. '/config/global.inc.dist.php' . '] - '.$quickstartlink);
15+
if (!@include_once(INCLUDE_DIR . '/config/global.inc.php')) die('Unable to load your global config from ['.INCLUDE_DIR. '/config/global.inc.php' . '] - '.$quickstartlink);
1616

1717
// load our security configs
18-
if (!include_once(BASEPATH . 'include/config/security.inc.dist.php')) die('Unable to load base security config from ['.BASEPATH . 'include/config/security.inc.dist.php' . '] - '.$quickstartlink);
19-
if (@file_exists(BASEPATH . 'include/config/security.inc.php')) include_once(BASEPATH . 'include/config/security.inc.php');
18+
if (!include_once(INCLUDE_DIR . '/config/security.inc.dist.php')) die('Unable to load base security config from ['.INCLUDE_DIR. '/config/security.inc.dist.php' . '] - '.$quickstartlink);
19+
if (@file_exists(INCLUDE_DIR . '/config/security.inc.php')) include_once(INCLUDE_DIR . '/config/security.inc.php');
2020

2121
// start our session, we need it for smarty caching
2222
session_set_cookie_params(time()+$config['cookie']['duration'], $config['cookie']['path'], $config['cookie']['domain'], $config['cookie']['secure'], $config['cookie']['httponly']);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: public/include/classes/logger.class.php renamed to include/classes/logger.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Logger {
55
private $logging = false;
66
public function __construct($config) {
77
if ($config['logging']['enabled'] && $config['logging']['level'] > 0) {
8-
$this->KLogger = KLogger::instance($config['logging']['path'], $config['logging']['level']);
8+
$this->KLogger = KLogger::instance($config['logging']['path'] . '/website', $config['logging']['level']);
99
$this->logging = true;
1010
$this->floatStartTime = microtime(true);
1111
}

Diff for: public/include/classes/mail.class.php renamed to include/classes/mail.class.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public function sendMail($template, $aData, $throttle=false) {
7474
}
7575

7676
// Prepare the smarty templates used
77-
$this->smarty->clearCache(BASEPATH . 'templates/mail/' . $template . '.tpl');
78-
$this->smarty->clearCache(BASEPATH . 'templates/mail/subject.tpl');
77+
$this->smarty->clearCache(TEMPLATE_DIR . '/mail/' . $template . '.tpl');
78+
$this->smarty->clearCache(TEMPLATE_DIR . '/mail/subject.tpl');
7979
$this->smarty->assign('WEBSITENAME', $this->setting->getValue('website_name'));
8080
$this->smarty->assign('SUBJECT', $aData['subject']);
8181
$this->smarty->assign('DATA', $aData);
@@ -84,12 +84,12 @@ public function sendMail($template, $aData, $throttle=false) {
8484
$senderEmail = $this->setting->getValue('website_email', '[email protected]');
8585
$senderName = $this->setting->getValue('website_name', '[email protected]');
8686
$message = Swift_Message::newInstance()
87-
->setSubject($this->smarty->fetch(BASEPATH . 'templates/mail/subject.tpl'))
87+
->setSubject($this->smarty->fetch(TEMPLATE_DIR . '/mail/subject.tpl'))
8888
->setFrom(array( $senderEmail => $senderName))
8989
->setTo($aData['email'])
9090
->setSender($senderEmail)
9191
->setReturnPath($senderEmail)
92-
->setBody($this->smarty->fetch(BASEPATH . 'templates/mail/' . $template . '.tpl'), 'text/html');
92+
->setBody($this->smarty->fetch(TEMPLATE_DIR . '/mail/' . $template . '.tpl'), 'text/html');
9393
if (isset($aData['senderName']) &&
9494
isset($aData['senderEmail']) &&
9595
strlen($aData['senderName']) > 0 &&
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: public/include/classes/template.class.php renamed to include/classes/template.class.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ public function getFullpath($name) {
1717

1818
/**
1919
* Get all available themes
20-
* Read theme folders from THEME_DIR
20+
* Read theme folders from TEMPLATE_DIR
2121
*
2222
* @return array - list of available themes
2323
*/
2424
public function getThemes() {
2525
$this->debug->append("STA " . __METHOD__, 4);
26-
$aTmpThemes = glob(THEME_DIR . '/*');
26+
$aTmpThemes = glob(TEMPLATE_DIR . '/*');
2727
$aThemes = array();
2828
foreach ($aTmpThemes as $dir) {
2929
if (basename($dir) != 'cache' && basename($dir) != 'compile' && basename($dir) != 'mail') $aThemes[basename($dir)] = basename($dir);
@@ -86,12 +86,12 @@ public function getActiveTemplates() {
8686
/**
8787
* Return the content of specific template file
8888
*
89-
* @param $file - file of template related to THEME_DIR
89+
* @param $file - file of template related to TEMPLATE_DIR
9090
* @return string - content of the template file
9191
*/
9292
public function getTemplateContent($file) {
9393
$this->debug->append("STA " . __METHOD__, 4);
94-
$filepath = THEME_DIR . '/' . $file;
94+
$filepath = TEMPLATE_DIR . '/' . $file;
9595
return file_get_contents($filepath);
9696
}
9797

@@ -103,7 +103,7 @@ public function getTemplateContent($file) {
103103
*/
104104
public function getTemplateFiles($theme) {
105105
$this->debug->append("STA " . __METHOD__, 4);
106-
$folder = THEME_DIR . '/' . $theme;
106+
$folder = TEMPLATE_DIR . '/' . $theme;
107107

108108
$dir = new RecursiveDirectoryIterator($folder);
109109
$ite = new RecursiveIteratorIterator($dir);
@@ -130,7 +130,7 @@ public function getTemplatesTree($themes = null) {
130130

131131
$templates = array();
132132
foreach($themes as $theme) {
133-
$templates[$theme] = $this->_getTemplatesTreeRecursive(THEME_DIR . '/' . $theme);
133+
$templates[$theme] = $this->_getTemplatesTreeRecursive(TEMPLATE_DIR . '/' . $theme);
134134
}
135135

136136
return $templates;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)