mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
Allow pages to be placed in templates folder (second attempt)
This commit is contained in:
parent
ba4d2a9c48
commit
5ccfcd541e
22
index.php
22
index.php
@ -74,6 +74,14 @@ if((!isset($config['installed']) || !$config['installed']) && file_exists(BASE .
|
|||||||
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once SYSTEM . 'init.php';
|
||||||
|
require_once SYSTEM . 'template.php';
|
||||||
|
|
||||||
|
// verify myaac tables exists in database
|
||||||
|
if(!$db->hasTable('myaac_account_actions')) {
|
||||||
|
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
||||||
|
}
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
if(empty($uri) || isset($_REQUEST['template'])) {
|
if(empty($uri) || isset($_REQUEST['template'])) {
|
||||||
$_REQUEST['p'] = 'news';
|
$_REQUEST['p'] = 'news';
|
||||||
@ -81,7 +89,11 @@ if(empty($uri) || isset($_REQUEST['template'])) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$tmp = strtolower($uri);
|
$tmp = strtolower($uri);
|
||||||
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
|
if (!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(TEMPLATES . $template_name . '/pages/' . $tmp . '.php')) {
|
||||||
|
$_REQUEST['p'] = $uri;
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
else if (!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
|
||||||
$_REQUEST['p'] = $uri;
|
$_REQUEST['p'] = $uri;
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
@ -180,18 +192,10 @@ define('PAGE', $page);
|
|||||||
|
|
||||||
$template_place_holders = array();
|
$template_place_holders = array();
|
||||||
|
|
||||||
require_once SYSTEM . 'init.php';
|
|
||||||
|
|
||||||
// verify myaac tables exists in database
|
|
||||||
if(!$db->hasTable('myaac_account_actions')) {
|
|
||||||
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// event system
|
// event system
|
||||||
require_once SYSTEM . 'hooks.php';
|
require_once SYSTEM . 'hooks.php';
|
||||||
$hooks = new Hooks();
|
$hooks = new Hooks();
|
||||||
$hooks->load();
|
$hooks->load();
|
||||||
require_once SYSTEM . 'template.php';
|
|
||||||
require_once SYSTEM . 'login.php';
|
require_once SYSTEM . 'login.php';
|
||||||
require_once SYSTEM . 'status.php';
|
require_once SYSTEM . 'status.php';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user