2015-05-05 03:00:01 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
2015-08-17 02:24:22 +02:00
|
|
|
// Bludit version
|
2023-07-15 15:58:33 +02:00
|
|
|
define('BLUDIT_VERSION', '3.15.0');
|
2023-07-15 16:16:24 +02:00
|
|
|
define('BLUDIT_CODENAME', 'Krakow');
|
2023-07-15 15:58:33 +02:00
|
|
|
define('BLUDIT_RELEASE_DATE', '2023-07-15');
|
2023-07-15 16:16:24 +02:00
|
|
|
define('BLUDIT_BUILD', '20230715');
|
2015-08-17 02:24:22 +02:00
|
|
|
|
2022-09-07 17:03:45 +02:00
|
|
|
// Change to TRUE for debugging
|
2024-06-23 21:46:43 +02:00
|
|
|
define('DEBUG_MODE', TRUE);
|
2019-04-07 20:43:42 +02:00
|
|
|
define('DEBUG_TYPE', 'INFO'); // INFO, TRACE
|
2022-09-07 17:03:45 +02:00
|
|
|
|
|
|
|
// This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.
|
|
|
|
ini_set("display_errors", 0);
|
|
|
|
|
|
|
|
// Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed.
|
|
|
|
// It's strongly recommended to keep display_startup_errors off, except for debugging.
|
2023-07-15 15:58:33 +02:00
|
|
|
ini_set('display_startup_errors', 0);
|
2022-09-07 17:03:45 +02:00
|
|
|
|
|
|
|
// If disabled, error message will be solely plain text instead HTML code.
|
|
|
|
ini_set("html_errors", 0);
|
|
|
|
|
|
|
|
// Tells whether script error messages should be logged to the server's error log or error_log.
|
|
|
|
ini_set('log_errors', 1);
|
|
|
|
|
2017-10-04 00:00:54 +02:00
|
|
|
if (DEBUG_MODE) {
|
2022-09-07 17:03:45 +02:00
|
|
|
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
|
|
|
|
} else {
|
|
|
|
error_reporting(E_ERROR);
|
2015-07-26 19:35:29 +02:00
|
|
|
}
|
|
|
|
|
2015-08-17 02:24:22 +02:00
|
|
|
// PHP paths
|
2015-06-22 00:01:07 +02:00
|
|
|
// PATH_ROOT and PATH_BOOT are defined in index.php
|
2023-07-15 15:58:33 +02:00
|
|
|
define('PATH_LANGUAGES', PATH_ROOT . 'bl-languages' . DS);
|
|
|
|
define('PATH_THEMES', PATH_ROOT . 'bl-themes' . DS);
|
|
|
|
define('PATH_PLUGINS', PATH_ROOT . 'bl-plugins' . DS);
|
|
|
|
define('PATH_KERNEL', PATH_ROOT . 'bl-kernel' . DS);
|
|
|
|
define('PATH_CONTENT', PATH_ROOT . 'bl-content' . DS);
|
|
|
|
|
|
|
|
define('PATH_ABSTRACT', PATH_KERNEL . 'abstract' . DS);
|
|
|
|
define('PATH_RULES', PATH_KERNEL . 'boot' . DS . 'rules' . DS);
|
|
|
|
define('PATH_HELPERS', PATH_KERNEL . 'helpers' . DS);
|
|
|
|
define('PATH_AJAX', PATH_KERNEL . 'ajax' . DS);
|
|
|
|
define('PATH_CORE_JS', PATH_KERNEL . 'js' . DS);
|
|
|
|
|
|
|
|
define('PATH_PAGES', PATH_CONTENT . 'pages' . DS);
|
|
|
|
define('PATH_DATABASES', PATH_CONTENT . 'databases' . DS);
|
|
|
|
define('PATH_PLUGINS_DATABASES', PATH_CONTENT . 'databases' . DS . 'plugins' . DS);
|
|
|
|
define('PATH_TMP', PATH_CONTENT . 'tmp' . DS);
|
|
|
|
define('PATH_UPLOADS', PATH_CONTENT . 'uploads' . DS);
|
|
|
|
define('PATH_WORKSPACES', PATH_CONTENT . 'workspaces' . DS);
|
|
|
|
|
|
|
|
define('PATH_UPLOADS_PAGES', PATH_UPLOADS . 'pages' . DS);
|
|
|
|
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS . 'profiles' . DS);
|
|
|
|
define('PATH_UPLOADS_THUMBNAILS', PATH_UPLOADS . 'thumbnails' . DS);
|
|
|
|
|
|
|
|
define('PATH_ADMIN', PATH_KERNEL . 'admin' . DS);
|
|
|
|
define('PATH_ADMIN_THEMES', PATH_ADMIN . 'themes' . DS);
|
|
|
|
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN . 'controllers' . DS);
|
|
|
|
define('PATH_ADMIN_VIEWS', PATH_ADMIN . 'views' . DS);
|
|
|
|
|
|
|
|
define('DEBUG_FILE', PATH_CONTENT . 'debug.txt');
|
2017-05-03 21:10:03 +02:00
|
|
|
|
2017-05-08 21:26:06 +02:00
|
|
|
// PAGES DATABASE
|
2023-07-15 15:58:33 +02:00
|
|
|
define('DB_PAGES', PATH_DATABASES . 'pages.php');
|
|
|
|
define('DB_SITE', PATH_DATABASES . 'site.php');
|
|
|
|
define('DB_CATEGORIES', PATH_DATABASES . 'categories.php');
|
|
|
|
define('DB_TAGS', PATH_DATABASES . 'tags.php');
|
|
|
|
define('DB_SYSLOG', PATH_DATABASES . 'syslog.php');
|
|
|
|
define('DB_USERS', PATH_DATABASES . 'users.php');
|
|
|
|
define('DB_SECURITY', PATH_DATABASES . 'security.php');
|
2017-05-09 00:24:15 +02:00
|
|
|
|
2017-12-10 22:14:12 +01:00
|
|
|
// User environment variables
|
2023-07-15 15:58:33 +02:00
|
|
|
include(PATH_KERNEL . 'boot' . DS . 'variables.php');
|
2017-10-13 00:15:13 +02:00
|
|
|
|
2017-05-16 00:46:20 +02:00
|
|
|
// Set internal character encoding
|
2016-07-26 01:40:51 +02:00
|
|
|
mb_internal_encoding(CHARSET);
|
2015-08-17 02:24:22 +02:00
|
|
|
|
2017-05-16 00:46:20 +02:00
|
|
|
// Set HTTP output character encoding
|
2016-07-26 01:40:51 +02:00
|
|
|
mb_http_output(CHARSET);
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2015-08-17 02:24:22 +02:00
|
|
|
// Inclde Abstract Classes
|
2023-07-15 15:58:33 +02:00
|
|
|
include(PATH_ABSTRACT . 'dbjson.class.php');
|
|
|
|
include(PATH_ABSTRACT . 'dblist.class.php');
|
|
|
|
include(PATH_ABSTRACT . 'plugin.class.php');
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2015-08-17 02:24:22 +02:00
|
|
|
// Inclde Classes
|
2023-07-15 15:58:33 +02:00
|
|
|
include(PATH_KERNEL . 'pages.class.php');
|
|
|
|
include(PATH_KERNEL . 'users.class.php');
|
|
|
|
include(PATH_KERNEL . 'tags.class.php');
|
|
|
|
include(PATH_KERNEL . 'language.class.php');
|
|
|
|
include(PATH_KERNEL . 'site.class.php');
|
|
|
|
include(PATH_KERNEL . 'categories.class.php');
|
|
|
|
include(PATH_KERNEL . 'syslog.class.php');
|
|
|
|
include(PATH_KERNEL . 'pagex.class.php');
|
|
|
|
include(PATH_KERNEL . 'category.class.php');
|
|
|
|
include(PATH_KERNEL . 'tag.class.php');
|
|
|
|
include(PATH_KERNEL . 'user.class.php');
|
|
|
|
include(PATH_KERNEL . 'url.class.php');
|
|
|
|
include(PATH_KERNEL . 'login.class.php');
|
|
|
|
include(PATH_KERNEL . 'parsedown.class.php');
|
|
|
|
include(PATH_KERNEL . 'security.class.php');
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2016-05-29 19:21:11 +02:00
|
|
|
// Include functions
|
2023-07-15 15:58:33 +02:00
|
|
|
include(PATH_KERNEL . 'functions.php');
|
2016-05-29 19:21:11 +02:00
|
|
|
|
2015-08-17 02:24:22 +02:00
|
|
|
// Include Helpers Classes
|
2023-07-15 15:58:33 +02:00
|
|
|
include(PATH_HELPERS . 'text.class.php');
|
|
|
|
include(PATH_HELPERS . 'log.class.php');
|
|
|
|
include(PATH_HELPERS . 'date.class.php');
|
|
|
|
include(PATH_HELPERS . 'theme.class.php');
|
|
|
|
include(PATH_HELPERS . 'session.class.php');
|
|
|
|
include(PATH_HELPERS . 'redirect.class.php');
|
|
|
|
include(PATH_HELPERS . 'sanitize.class.php');
|
|
|
|
include(PATH_HELPERS . 'valid.class.php');
|
|
|
|
include(PATH_HELPERS . 'email.class.php');
|
|
|
|
include(PATH_HELPERS . 'filesystem.class.php');
|
|
|
|
include(PATH_HELPERS . 'alert.class.php');
|
|
|
|
include(PATH_HELPERS . 'paginator.class.php');
|
|
|
|
include(PATH_HELPERS . 'image.class.php');
|
|
|
|
include(PATH_HELPERS . 'tcp.class.php');
|
|
|
|
include(PATH_HELPERS . 'dom.class.php');
|
|
|
|
include(PATH_HELPERS . 'cookie.class.php');
|
|
|
|
|
|
|
|
if (file_exists(PATH_KERNEL . 'bludit.pro.php')) {
|
|
|
|
include(PATH_KERNEL . 'bludit.pro.php');
|
2017-06-29 22:13:25 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 03:00:01 +02:00
|
|
|
// Objects
|
2018-10-07 14:03:58 +02:00
|
|
|
$pages = new Pages();
|
|
|
|
$users = new Users();
|
|
|
|
$tags = new Tags();
|
2020-06-15 16:27:12 +02:00
|
|
|
$categories = new Categories();
|
2018-08-03 18:59:23 +02:00
|
|
|
$site = new Site();
|
2018-07-17 19:13:01 +02:00
|
|
|
$url = new Url();
|
|
|
|
$security = new Security();
|
2018-08-03 18:59:23 +02:00
|
|
|
$syslog = new Syslog();
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2016-01-21 01:29:01 +01:00
|
|
|
// --- Relative paths ---
|
|
|
|
// This paths are relative for the user / web browsing.
|
|
|
|
|
|
|
|
// Base URL
|
2015-12-09 01:56:31 +01:00
|
|
|
// The user can define the base URL.
|
|
|
|
// Left empty if you want to Bludit try to detect the base URL.
|
|
|
|
$base = '';
|
|
|
|
|
2017-10-04 00:00:54 +02:00
|
|
|
if (!empty($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['SCRIPT_NAME']) && empty($base)) {
|
2015-12-09 01:56:31 +01:00
|
|
|
$base = str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_NAME']);
|
|
|
|
$base = dirname($base);
|
2017-10-04 00:00:54 +02:00
|
|
|
} elseif (empty($base)) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$base = empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
|
2015-12-09 01:56:31 +01:00
|
|
|
$base = dirname($base);
|
|
|
|
}
|
2015-09-18 02:37:14 +02:00
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
if (strpos($_SERVER['REQUEST_URI'], $base) !== 0) {
|
2017-09-05 23:46:45 +02:00
|
|
|
$base = '/';
|
2023-07-15 15:58:33 +02:00
|
|
|
} elseif ($base != DS) {
|
2015-12-09 01:56:31 +01:00
|
|
|
$base = trim($base, '/');
|
2023-07-15 15:58:33 +02:00
|
|
|
$base = '/' . $base . '/';
|
2017-09-05 23:46:45 +02:00
|
|
|
} else {
|
2015-11-14 00:41:30 +01:00
|
|
|
// Workaround for Windows Web Servers
|
|
|
|
$base = '/';
|
|
|
|
}
|
2015-09-18 02:37:14 +02:00
|
|
|
|
2016-01-21 01:29:01 +01:00
|
|
|
define('HTML_PATH_ROOT', $base);
|
2023-07-15 15:58:33 +02:00
|
|
|
define('HTML_PATH_THEMES', HTML_PATH_ROOT . 'bl-themes/');
|
|
|
|
define('HTML_PATH_THEME', HTML_PATH_THEMES . $site->theme() . '/');
|
|
|
|
define('HTML_PATH_THEME_CSS', HTML_PATH_THEME . 'css/');
|
|
|
|
define('HTML_PATH_THEME_JS', HTML_PATH_THEME . 'js/');
|
|
|
|
define('HTML_PATH_THEME_IMG', HTML_PATH_THEME . 'img/');
|
|
|
|
define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT . ADMIN_URI_FILTER . '/');
|
|
|
|
define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT . 'bl-kernel/admin/themes/' . $site->adminTheme() . '/');
|
|
|
|
define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME . 'js/');
|
|
|
|
define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME . 'css/');
|
|
|
|
define('HTML_PATH_CORE_JS', HTML_PATH_ROOT . 'bl-kernel/js/');
|
|
|
|
define('HTML_PATH_CORE_CSS', HTML_PATH_ROOT . 'bl-kernel/css/');
|
|
|
|
define('HTML_PATH_CORE_IMG', HTML_PATH_ROOT . 'bl-kernel/img/');
|
|
|
|
define('HTML_PATH_CONTENT', HTML_PATH_ROOT . 'bl-content/');
|
|
|
|
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT . 'bl-content/uploads/');
|
|
|
|
define('HTML_PATH_UPLOADS_PAGES', HTML_PATH_UPLOADS . 'pages/');
|
|
|
|
define('HTML_PATH_UPLOADS_PROFILES', HTML_PATH_UPLOADS . 'profiles/');
|
|
|
|
define('HTML_PATH_UPLOADS_THUMBNAILS', HTML_PATH_UPLOADS . 'thumbnails/');
|
|
|
|
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT . 'bl-plugins/');
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2017-05-30 21:54:09 +02:00
|
|
|
// --- Objects with dependency ---
|
2023-07-15 15:58:33 +02:00
|
|
|
$language = new Language($site->language());
|
|
|
|
$url->checkFilters($site->uriFilters());
|
2017-05-30 21:54:09 +02:00
|
|
|
|
|
|
|
// --- CONSTANTS with dependency ---
|
|
|
|
|
2017-06-04 21:08:31 +02:00
|
|
|
// Tag URI filter
|
2018-07-17 19:13:01 +02:00
|
|
|
define('TAG_URI_FILTER', $url->filters('tag'));
|
2017-06-04 21:08:31 +02:00
|
|
|
|
|
|
|
// Category URI filter
|
2018-07-17 19:13:01 +02:00
|
|
|
define('CATEGORY_URI_FILTER', $url->filters('category'));
|
2017-06-04 21:08:31 +02:00
|
|
|
|
|
|
|
// Page URI filter
|
2018-07-17 19:13:01 +02:00
|
|
|
define('PAGE_URI_FILTER', $url->filters('page'));
|
2017-06-04 21:08:31 +02:00
|
|
|
|
|
|
|
// Content order by: date / position
|
2018-07-17 19:13:01 +02:00
|
|
|
define('ORDER_BY', $site->orderBy());
|
2017-06-04 21:08:31 +02:00
|
|
|
|
2018-04-22 17:45:31 +02:00
|
|
|
// Allow unicode characters in the URL
|
2018-07-17 19:13:01 +02:00
|
|
|
define('EXTREME_FRIENDLY_URL', $site->extremeFriendly());
|
2018-04-22 17:45:31 +02:00
|
|
|
|
2018-07-07 12:04:34 +02:00
|
|
|
// Minutes to execute the autosave function
|
2018-07-17 19:13:01 +02:00
|
|
|
define('AUTOSAVE_INTERVAL', $site->autosaveInterval());
|
2018-07-07 12:04:34 +02:00
|
|
|
|
2018-10-06 19:39:34 +02:00
|
|
|
// TRUE for upload images restric to a pages, FALSE to upload images in common
|
|
|
|
define('IMAGE_RESTRICT', $site->imageRestrict());
|
|
|
|
|
|
|
|
// TRUE to convert relatives images to absoultes, FALSE No changes apply
|
|
|
|
define('IMAGE_RELATIVE_TO_ABSOLUTE', $site->imageRelativeToAbsolute());
|
|
|
|
|
2019-03-09 18:53:03 +01:00
|
|
|
// TRUE if the markdown parser is enabled
|
|
|
|
define('MARKDOWN_PARSER', $site->markdownParser());
|
|
|
|
|
2016-01-21 01:29:01 +01:00
|
|
|
// --- PHP paths with dependency ---
|
2017-05-16 00:46:20 +02:00
|
|
|
// This paths are absolutes for the OS
|
2023-07-15 15:58:33 +02:00
|
|
|
define('THEME_DIR', PATH_ROOT . 'bl-themes' . DS . $site->theme() . DS);
|
|
|
|
define('THEME_DIR_PHP', THEME_DIR . 'php' . DS);
|
|
|
|
define('THEME_DIR_CSS', THEME_DIR . 'css' . DS);
|
|
|
|
define('THEME_DIR_JS', THEME_DIR . 'js' . DS);
|
|
|
|
define('THEME_DIR_IMG', THEME_DIR . 'img' . DS);
|
|
|
|
define('THEME_DIR_LANG', THEME_DIR . 'languages' . DS);
|
2016-05-18 04:36:23 +02:00
|
|
|
|
2016-01-11 23:51:00 +01:00
|
|
|
// --- Absolute paths with domain ---
|
2016-01-21 01:29:01 +01:00
|
|
|
// This paths are absolutes for the user / web browsing.
|
2018-07-17 19:13:01 +02:00
|
|
|
define('DOMAIN', $site->domain());
|
2023-07-15 15:58:33 +02:00
|
|
|
define('DOMAIN_BASE', DOMAIN . HTML_PATH_ROOT);
|
|
|
|
define('DOMAIN_CORE_JS', DOMAIN . HTML_PATH_CORE_JS);
|
|
|
|
define('DOMAIN_CORE_CSS', DOMAIN . HTML_PATH_CORE_CSS);
|
|
|
|
define('DOMAIN_THEME', DOMAIN . HTML_PATH_THEME);
|
|
|
|
define('DOMAIN_THEME_CSS', DOMAIN . HTML_PATH_THEME_CSS);
|
|
|
|
define('DOMAIN_THEME_JS', DOMAIN . HTML_PATH_THEME_JS);
|
|
|
|
define('DOMAIN_THEME_IMG', DOMAIN . HTML_PATH_THEME_IMG);
|
|
|
|
define('DOMAIN_ADMIN_THEME', DOMAIN . HTML_PATH_ADMIN_THEME);
|
|
|
|
define('DOMAIN_ADMIN_THEME_CSS', DOMAIN . HTML_PATH_ADMIN_THEME_CSS);
|
|
|
|
define('DOMAIN_ADMIN_THEME_JS', DOMAIN . HTML_PATH_ADMIN_THEME_JS);
|
|
|
|
define('DOMAIN_UPLOADS', DOMAIN . HTML_PATH_UPLOADS);
|
|
|
|
define('DOMAIN_UPLOADS_PAGES', DOMAIN . HTML_PATH_UPLOADS_PAGES);
|
|
|
|
define('DOMAIN_UPLOADS_PROFILES', DOMAIN . HTML_PATH_UPLOADS_PROFILES);
|
|
|
|
define('DOMAIN_UPLOADS_THUMBNAILS', DOMAIN . HTML_PATH_UPLOADS_THUMBNAILS);
|
|
|
|
define('DOMAIN_PLUGINS', DOMAIN . HTML_PATH_PLUGINS);
|
|
|
|
define('DOMAIN_CONTENT', DOMAIN . HTML_PATH_CONTENT);
|
|
|
|
|
|
|
|
define('DOMAIN_ADMIN', DOMAIN_BASE . ADMIN_URI_FILTER . '/');
|
|
|
|
|
|
|
|
define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE . TAG_URI_FILTER, false, true));
|
|
|
|
define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE . CATEGORY_URI_FILTER, false, true));
|
|
|
|
define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_URI_FILTER, false, true));
|
2017-05-17 00:04:53 +02:00
|
|
|
|
2017-05-19 00:45:14 +02:00
|
|
|
$ADMIN_CONTROLLER = '';
|
2017-05-17 18:48:51 +02:00
|
|
|
$ADMIN_VIEW = '';
|
2017-05-19 00:45:14 +02:00
|
|
|
$ID_EXECUTION = uniqid(); // string 13 characters long
|
2018-07-17 19:13:01 +02:00
|
|
|
$WHERE_AM_I = $url->whereAmI();
|
2017-05-17 18:48:51 +02:00
|
|
|
|
2017-06-04 21:08:31 +02:00
|
|
|
// --- Objects shortcuts ---
|
2018-01-25 23:58:42 +01:00
|
|
|
$L = $language;
|
2017-06-04 21:08:31 +02:00
|
|
|
|
2017-05-16 00:46:20 +02:00
|
|
|
// DEBUG: Print constants
|
|
|
|
// $arr = array_filter(get_defined_constants(), 'is_string');
|
|
|
|
// echo json_encode($arr);
|
2017-07-02 18:55:27 +02:00
|
|
|
// exit;
|