Updated to latest version of CMS
This commit is contained in:
parent
ccdf8fbb81
commit
edf41b1198
76 changed files with 465 additions and 1162 deletions
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
<?php global $basepath, $config;
|
||||
/**
|
||||
* Project: astat - simple site engine
|
||||
* Project: BeCast WebEngine - simple site engine
|
||||
* File: init_core.inc.php
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -17,28 +17,31 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* @link http://www.astat.org SVN: $URL: http://svn.becast.at/astat/trunk/core/init_core.inc.php $
|
||||
* @copyright 2009 becast.at
|
||||
* @link http://www.becast.at
|
||||
* @copyright 2009-2025 becast.at
|
||||
* @author Bernhard Jaud <bernhard at becast dot at>
|
||||
* @package astat core
|
||||
* @package BcWe core
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
* @version $Id: init_core.inc.php 148 2012-03-27 19:48:30Z genuineparts $
|
||||
*/
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('in_astat', true);
|
||||
define("INBCWE", true);
|
||||
|
||||
function getTime() {
|
||||
function getTime(): string
|
||||
{
|
||||
$timer = explode( ' ', microtime() );
|
||||
$timer = $timer[1] + $timer[0];
|
||||
return $timer;
|
||||
return $timer[1] . $timer[0];
|
||||
}
|
||||
|
||||
$start = getTime();
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
require dirname(dirname(__FILE__)).'/inc/config.inc.php';
|
||||
|
||||
if(!is_file(dirname(__FILE__, 2) .'/inc/config.inc.php')){
|
||||
header("Location: install/install.php");
|
||||
} else {
|
||||
require dirname(__FILE__, 2) . '/inc/config.inc.php';
|
||||
}
|
||||
/**
|
||||
* Smarty
|
||||
*/
|
||||
|
@ -53,42 +56,37 @@ require $basepath.'database/'.$config['db_class'].'.class.php';
|
|||
/**
|
||||
* Functions
|
||||
*/
|
||||
include dirname(dirname(__FILE__)).'/inc/functions.class.php';
|
||||
include dirname(__FILE__, 2) .'/inc/functions.class.php';
|
||||
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
require dirname(dirname(__FILE__)).'/inc/logger.class.php';
|
||||
require dirname(__FILE__, 2) .'/inc/logger.class.php';
|
||||
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
require dirname(dirname(__FILE__)).'/inc/datacache.class.php';
|
||||
|
||||
/**
|
||||
* Cache
|
||||
*/
|
||||
require dirname(dirname(__FILE__)).'/inc/cache.class.php';
|
||||
require dirname(__FILE__, 2) .'/inc/datacache.class.php';
|
||||
|
||||
/**
|
||||
* Errors
|
||||
*/
|
||||
include dirname(dirname(__FILE__)).'/inc/error.class.php';
|
||||
include dirname(__FILE__, 2) .'/inc/error.class.php';
|
||||
|
||||
/**
|
||||
* Plugins
|
||||
*/
|
||||
include dirname(dirname(__FILE__)).'/inc/plugin.class.php';
|
||||
include dirname(__FILE__, 2) .'/inc/plugin.class.php';
|
||||
|
||||
/**
|
||||
* Mail
|
||||
*/
|
||||
include dirname(dirname(__FILE__)).'/inc/mail.class.php';
|
||||
include dirname(__FILE__, 2) .'/inc/mail.class.php';
|
||||
|
||||
/**
|
||||
* Captcha
|
||||
*/
|
||||
include dirname(dirname(__FILE__)).'/inc/captcha.class.php';
|
||||
include dirname(__FILE__, 2) .'/inc/captcha.class.php';
|
||||
$plugin=new plugins();
|
||||
|
||||
$db= new db($config['host'], $config['user'], $config['pass'], $config['db'],'utf8', true);
|
||||
|
@ -97,7 +95,7 @@ $db= new db($config['host'], $config['user'], $config['pass'], $config['db'],'ut
|
|||
* Select $config vars form Database
|
||||
*
|
||||
*/
|
||||
$result = $db->query("SELECT `name`, `value` FROM " . $config['prefix'] . "config");
|
||||
$result = $db->query("SELECT `name`, `value` FROM `" . $config['prefix'] . "config`");
|
||||
while ($row = $db->fetch_array($result)){
|
||||
$config[$row['name']] = $row['value'];
|
||||
}
|
||||
|
@ -116,10 +114,16 @@ if($config['LCLANG']){
|
|||
$cache=new datacache();
|
||||
|
||||
/**
|
||||
* Start Datacache
|
||||
*
|
||||
* Start Cache
|
||||
* I think this is vestigial and can be deleted. Hesitant to remove it because some instance in the wild may use this?
|
||||
*/
|
||||
$ccache=new cache();
|
||||
if(isset($config['MEMCACHE_SERVER'])) {
|
||||
/**
|
||||
* Cache
|
||||
*/
|
||||
require dirname(__FILE__, 2) .'/inc/cache.class.php';
|
||||
$ccache = new cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Look if we have a path Variable and try to autoset if not.
|
||||
|
@ -130,7 +134,7 @@ if(!isset($config['path'])){
|
|||
$last = array_pop($path);
|
||||
$path = str_replace('/' . $last, '', $_SERVER['SCRIPT_NAME']);
|
||||
$config['path'] = $path;
|
||||
$db->query("INSERT INTO " . $config['prefix'] . "config (`name`, `value`, `title`, `description`, `option`, `category`) VALUES
|
||||
$db->query("INSERT INTO `" . $config['prefix'] . "config` (`name`, `value`, `title`, `description`, `option`, `category`) VALUES
|
||||
( 'path', '".$path."', 'Pfad', 'Der Pfad auf ihrem Webserver z.b. /cms', 'text', 1)");
|
||||
}else{
|
||||
$path=$config['path'];
|
||||
|
@ -140,7 +144,7 @@ if(!isset($config['path'])){
|
|||
* Start Logger
|
||||
*
|
||||
*/
|
||||
$log=new logger($config['logtype'],dirname(dirname(__FILE__)).'/logs/'.$config['logfile'],$config['loglevel']);
|
||||
$log=new logger($config['logtype'], dirname(__FILE__, 2) .'/logs/'.$config['logfile'],$config['loglevel']);
|
||||
$tpl = new Smarty();
|
||||
$error = new errorhandler();
|
||||
$functions = new functions();
|
||||
|
@ -150,10 +154,9 @@ $root = $_SERVER['DOCUMENT_ROOT'] . $config['path'];
|
|||
* Start Language
|
||||
*
|
||||
*/
|
||||
require dirname(dirname(__FILE__)).'/inc/lang.class.php';
|
||||
require dirname(__FILE__, 2) .'/inc/lang.class.php';
|
||||
$lang=new lang();
|
||||
|
||||
|
||||
/**
|
||||
* Check if we have a Theme variable and the Theme exists
|
||||
* @TODO Theme Management
|
||||
|
@ -171,8 +174,12 @@ if(isset($config['theme']) && $config['theme']!='' && is_dir($root . '/themes/'.
|
|||
$tpl->setCompileDir($root . '/core/template/templates_c');
|
||||
$tpl->setCacheDir($root . '/core/template/cache');
|
||||
$tpl->setConfigDir($root . '/core/template/config');
|
||||
$tpl->loadFilter(\Smarty\Smarty::FILTER_OUTPUT,'trimwhitespace');
|
||||
$tpl->registerFilter("output", "lang");
|
||||
try {
|
||||
$tpl->registerFilter(\Smarty\Smarty::FILTER_OUTPUT, 'trimwhitespace');
|
||||
$tpl->registerFilter(\Smarty\Smarty::FILTER_OUTPUT, "lang");
|
||||
} catch (\Smarty\Exception $e) {
|
||||
$log->write("Smarty Register Filter error", $e->getMessage());
|
||||
}
|
||||
//var_dump($tpl -> getAutoloadFilters());
|
||||
/**
|
||||
* Well... This should vanish with Thememanagement
|
||||
|
@ -186,7 +193,7 @@ $addnav['left'] = TRUE;
|
|||
* Start Sessions
|
||||
*
|
||||
*/
|
||||
require dirname(dirname(__FILE__)).'/inc/sessions.class.php';
|
||||
require dirname(__FILE__, 2) .'/inc/sessions.class.php';
|
||||
$session=new session();
|
||||
|
||||
|
||||
|
@ -194,12 +201,14 @@ $session=new session();
|
|||
* Initiate Core Class
|
||||
*
|
||||
*/
|
||||
require dirname(dirname(__FILE__)).'/inc/core.class.php';
|
||||
require dirname(__FILE__, 2) .'/inc/core.class.php';
|
||||
$core=new core($db, $log, $tpl);
|
||||
|
||||
if(defined('INSTALLED')){
|
||||
if(is_dir(dirname(dirname(__FILE__)).'/install')){
|
||||
return $core->message($lang->_('DELINSTALLDIR'), $lang->_('DELINSTALLDIRTEXT'),FALSE);
|
||||
if(is_dir(dirname(__FILE__, 2) .'/install')){
|
||||
$session->page_begin("Maintenance", FALSE);
|
||||
$core->message($lang->_('DELINSTALLDIR'), $lang->_('DELINSTALLDIRTEXT'),FALSE);
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
header("Location: install/install.php");
|
||||
|
@ -211,7 +220,7 @@ $captcha = new captcha();
|
|||
* OpenID
|
||||
*/
|
||||
if($config['use_openid']==1){
|
||||
include dirname(dirname(__FILE__)).'/inc/SimpleOpenID.class.php';
|
||||
include dirname(__FILE__, 2) .'/inc/SimpleOpenID.class.php';
|
||||
}
|
||||
/**
|
||||
* Get all *.plugin.php files from the Modules and register the Pluginhooks
|
||||
|
@ -250,13 +259,11 @@ function langstr($treffer)
|
|||
* Its useful but "undocumented".
|
||||
*
|
||||
*/
|
||||
$moduledir = dirname(dirname(__FILE__)).'/core/modules';
|
||||
$moduledir = dirname(__FILE__, 2) .'/core/modules';
|
||||
$modules = opendir($moduledir);
|
||||
while ($mods = readdir($modules)) {
|
||||
if (preg_match('/^.*?\.class.php$/', $mods)) {
|
||||
require_once($moduledir.'/'.$mods);
|
||||
}
|
||||
}
|
||||
@closedir($modules);
|
||||
|
||||
?>
|
||||
@closedir($modules);
|
Loading…
Add table
Add a link
Reference in a new issue