2015-03-08 18:02:59 +01:00
|
|
|
<?php
|
2015-07-15 02:07:07 +02:00
|
|
|
|
|
|
|
/*
|
2016-01-21 02:46:13 +01:00
|
|
|
* Bludit
|
2016-02-14 17:45:33 +01:00
|
|
|
* https://www.bludit.com
|
2015-07-15 02:07:07 +02:00
|
|
|
* Author Diego Najar
|
|
|
|
* Bludit is opensource software licensed under the MIT license.
|
|
|
|
*/
|
2015-08-17 02:24:22 +02:00
|
|
|
|
2015-11-09 00:26:19 +01:00
|
|
|
// Check PHP version
|
2019-05-18 20:11:32 +02:00
|
|
|
if (version_compare(phpversion(), '5.6', '<')) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$errorText = 'Current PHP version ' . phpversion() . ', you need > 5.6.';
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-06-25 23:17:43 +02:00
|
|
|
exit($errorText);
|
2015-11-09 00:26:19 +01:00
|
|
|
}
|
|
|
|
|
2017-01-10 17:43:38 +01:00
|
|
|
// Check PHP modules
|
2018-06-25 23:17:43 +02:00
|
|
|
$modulesRequired = array('mbstring', 'json', 'gd', 'dom');
|
|
|
|
$modulesRequiredExit = false;
|
|
|
|
$modulesRequiredMissing = '';
|
|
|
|
foreach ($modulesRequired as $module) {
|
|
|
|
if (!extension_loaded($module)) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$errorText = 'PHP module <b>' . $module . '</b> is not installed.';
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-06-25 23:17:43 +02:00
|
|
|
|
|
|
|
$modulesRequiredExit = true;
|
2023-07-15 15:58:33 +02:00
|
|
|
$modulesRequiredMissing .= $errorText . PHP_EOL;
|
2018-06-25 23:17:43 +02:00
|
|
|
}
|
2017-01-10 17:43:38 +01:00
|
|
|
}
|
2018-06-25 23:17:43 +02:00
|
|
|
if ($modulesRequiredExit) {
|
|
|
|
echo 'PHP modules missing:';
|
|
|
|
echo $modulesRequiredMissing;
|
|
|
|
echo '';
|
|
|
|
echo '<a href="https://docs.bludit.com/en/getting-started/requirements">Please read Bludit requirements</a>.';
|
|
|
|
exit(0);
|
2017-01-10 17:43:38 +01:00
|
|
|
}
|
|
|
|
|
2015-05-05 03:00:01 +02:00
|
|
|
// Security constant
|
2015-03-08 18:02:59 +01:00
|
|
|
define('BLUDIT', true);
|
2015-08-17 02:24:22 +02:00
|
|
|
|
2015-06-22 00:01:07 +02:00
|
|
|
// Directory separator
|
|
|
|
define('DS', DIRECTORY_SEPARATOR);
|
|
|
|
|
2015-08-17 02:24:22 +02:00
|
|
|
// PHP paths
|
2023-07-15 15:58:33 +02:00
|
|
|
define('PATH_ROOT', __DIR__ . DS);
|
|
|
|
define('PATH_CONTENT', PATH_ROOT . 'bl-content' . DS);
|
|
|
|
define('PATH_KERNEL', PATH_ROOT . 'bl-kernel' . DS);
|
|
|
|
define('PATH_LANGUAGES', PATH_ROOT . 'bl-languages' . DS);
|
|
|
|
define('PATH_UPLOADS', PATH_CONTENT . 'uploads' . DS);
|
|
|
|
define('PATH_TMP', PATH_CONTENT . 'tmp' . DS);
|
|
|
|
define('PATH_PAGES', PATH_CONTENT . 'pages' . DS);
|
|
|
|
define('PATH_WORKSPACES', PATH_CONTENT . 'workspaces' . DS);
|
|
|
|
define('PATH_DATABASES', PATH_CONTENT . 'databases' . DS);
|
|
|
|
define('PATH_PLUGINS_DATABASES', PATH_CONTENT . 'databases' . DS . 'plugins' . DS);
|
|
|
|
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS . 'profiles' . DS);
|
|
|
|
define('PATH_UPLOADS_THUMBNAILS', PATH_UPLOADS . 'thumbnails' . DS);
|
|
|
|
define('PATH_UPLOADS_PAGES', PATH_UPLOADS . 'pages' . DS);
|
|
|
|
define('PATH_HELPERS', PATH_KERNEL . 'helpers' . DS);
|
|
|
|
define('PATH_ABSTRACT', PATH_KERNEL . 'abstract' . DS);
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2017-09-05 23:46:45 +02:00
|
|
|
// Protecting against Symlink attacks
|
2016-02-20 17:16:31 +01:00
|
|
|
define('CHECK_SYMBOLIC_LINKS', TRUE);
|
|
|
|
|
2017-09-05 23:46:45 +02:00
|
|
|
// Filename for pages
|
2017-07-15 15:47:37 +02:00
|
|
|
define('FILENAME', 'index.txt');
|
2016-07-17 01:19:10 +02:00
|
|
|
|
2016-01-17 22:11:20 +01:00
|
|
|
// Domain and protocol
|
|
|
|
define('DOMAIN', $_SERVER['HTTP_HOST']);
|
|
|
|
|
2017-09-05 23:46:45 +02:00
|
|
|
if (!empty($_SERVER['HTTPS'])) {
|
2016-01-17 22:11:20 +01:00
|
|
|
define('PROTOCOL', 'https://');
|
2017-09-05 23:46:45 +02:00
|
|
|
} else {
|
2016-01-17 22:11:20 +01:00
|
|
|
define('PROTOCOL', 'http://');
|
|
|
|
}
|
|
|
|
|
2016-01-21 01:29:01 +01:00
|
|
|
// Base URL
|
2017-09-05 23:46:45 +02:00
|
|
|
// Change the base URL or leave it empty if you want to Bludit try to detect the base URL.
|
2016-01-17 22:11:20 +01:00
|
|
|
$base = '';
|
|
|
|
|
2017-09-05 23:46:45 +02:00
|
|
|
if (!empty($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['SCRIPT_NAME']) && empty($base)) {
|
2016-01-17 22:11:20 +01:00
|
|
|
$base = str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_NAME']);
|
|
|
|
$base = dirname($base);
|
2017-09-05 23:46:45 +02:00
|
|
|
} elseif (empty($base)) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$base = empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
|
2016-01-17 22:11:20 +01:00
|
|
|
$base = dirname($base);
|
|
|
|
}
|
2015-11-16 05:20:58 +01: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) {
|
2016-01-17 22:11:20 +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-16 05:20:58 +01:00
|
|
|
// Workaround for Windows Web Servers
|
|
|
|
$base = '/';
|
|
|
|
}
|
|
|
|
|
2015-05-15 00:07:45 +02:00
|
|
|
define('HTML_PATH_ROOT', $base);
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2015-08-17 02:24:22 +02:00
|
|
|
// Log separator
|
|
|
|
define('LOG_SEP', ' | ');
|
|
|
|
|
2015-08-04 05:10:12 +02:00
|
|
|
// JSON
|
2017-09-05 23:46:45 +02:00
|
|
|
if (!defined('JSON_PRETTY_PRINT')) {
|
2015-05-15 00:07:45 +02:00
|
|
|
define('JSON_PRETTY_PRINT', 128);
|
|
|
|
}
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2015-08-26 05:42:32 +02:00
|
|
|
// Database format date
|
2016-01-08 00:43:09 +01:00
|
|
|
define('DB_DATE_FORMAT', 'Y-m-d H:i:s');
|
2015-08-26 05:42:32 +02:00
|
|
|
|
2015-08-17 02:24:22 +02:00
|
|
|
// Charset, default UTF-8.
|
2015-08-07 04:13:55 +02:00
|
|
|
define('CHARSET', 'UTF-8');
|
|
|
|
|
2017-09-05 23:46:45 +02:00
|
|
|
// Default language file
|
2017-09-04 23:09:45 +02:00
|
|
|
define('DEFAULT_LANGUAGE_FILE', 'en.json');
|
|
|
|
|
2017-09-05 23:46:45 +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-09-05 23:46:45 +02:00
|
|
|
// Set HTTP output character encoding
|
2016-07-26 01:40:51 +02:00
|
|
|
mb_http_output(CHARSET);
|
2015-08-07 04:13:55 +02:00
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
// Directory permissions
|
|
|
|
define('DIR_PERMISSIONS', 0755);
|
2016-01-21 01:29:01 +01:00
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
// --- PHP Classes ---
|
2023-07-15 15:58:33 +02:00
|
|
|
include(PATH_ABSTRACT . 'dbjson.class.php');
|
|
|
|
include(PATH_HELPERS . 'sanitize.class.php');
|
|
|
|
include(PATH_HELPERS . 'valid.class.php');
|
|
|
|
include(PATH_HELPERS . 'text.class.php');
|
|
|
|
include(PATH_HELPERS . 'log.class.php');
|
|
|
|
include(PATH_HELPERS . 'date.class.php');
|
|
|
|
include(PATH_KERNEL . 'language.class.php');
|
2015-08-04 05:10:12 +02:00
|
|
|
|
2016-02-10 02:10:12 +01:00
|
|
|
// --- LANGUAGE and LOCALE ---
|
2017-09-05 23:46:45 +02:00
|
|
|
// Try to detect the language from browser or headers
|
|
|
|
$languageFromHTTP = 'en';
|
2017-09-04 23:09:45 +02:00
|
|
|
$localeFromHTTP = 'en_US';
|
|
|
|
|
|
|
|
if (isset($_GET['language'])) {
|
|
|
|
$languageFromHTTP = Sanitize::html($_GET['language']);
|
|
|
|
} else {
|
|
|
|
// Try to detect the language browser
|
|
|
|
$languageFromHTTP = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
|
|
|
|
2016-02-10 02:10:12 +01:00
|
|
|
// Try to detect the locale
|
2017-09-04 23:09:45 +02:00
|
|
|
if (function_exists('locale_accept_from_http')) {
|
2016-02-10 02:10:12 +01:00
|
|
|
$localeFromHTTP = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
|
}
|
2016-01-17 01:11:58 +01:00
|
|
|
}
|
|
|
|
|
2017-09-05 23:46:45 +02:00
|
|
|
$finalLanguage = 'en';
|
|
|
|
$languageFiles = getLanguageList();
|
2023-07-15 15:58:33 +02:00
|
|
|
foreach ($languageFiles as $fname => $native) {
|
|
|
|
if (($languageFromHTTP == $fname) || ($localeFromHTTP == $fname)) {
|
2017-09-05 23:46:45 +02:00
|
|
|
$finalLanguage = $fname;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-08 00:16:35 +02:00
|
|
|
$L = $language = new Language($finalLanguage);
|
2015-08-16 12:34:53 +02:00
|
|
|
|
2016-02-10 02:10:12 +01:00
|
|
|
// Set locale
|
2015-10-26 02:11:46 +01:00
|
|
|
setlocale(LC_ALL, $localeFromHTTP);
|
|
|
|
|
|
|
|
// --- TIMEZONE ---
|
|
|
|
|
|
|
|
// Check if timezone is defined in php.ini
|
2015-10-24 01:23:33 +02:00
|
|
|
$iniDate = ini_get('date.timezone');
|
2017-09-05 23:46:45 +02:00
|
|
|
if (empty($iniDate)) {
|
2016-02-10 02:10:12 +01:00
|
|
|
// Timezone not defined in php.ini, then set UTC as default.
|
2015-10-24 01:23:33 +02:00
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
}
|
|
|
|
|
2015-05-15 00:07:45 +02:00
|
|
|
// ============================================================================
|
|
|
|
// FUNCTIONS
|
|
|
|
// ============================================================================
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2015-10-26 02:11:46 +01:00
|
|
|
// Returns an array with all languages
|
2023-07-15 15:58:33 +02:00
|
|
|
function getLanguageList()
|
|
|
|
{
|
|
|
|
$files = glob(PATH_LANGUAGES . '*.json');
|
2015-08-04 05:10:12 +02:00
|
|
|
$tmp = array();
|
2017-09-06 20:11:28 +02:00
|
|
|
foreach ($files as $file) {
|
2015-08-04 05:10:12 +02:00
|
|
|
$t = new dbJSON($file, false);
|
|
|
|
$native = $t->db['language-data']['native'];
|
|
|
|
$locale = basename($file, '.json');
|
|
|
|
$tmp[$locale] = $native;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $tmp;
|
|
|
|
}
|
|
|
|
|
2017-05-17 18:48:51 +02:00
|
|
|
// Check if Bludit is installed
|
2023-07-15 15:58:33 +02:00
|
|
|
function alreadyInstalled()
|
|
|
|
{
|
|
|
|
return file_exists(PATH_DATABASES . 'site.php');
|
2015-05-05 03:00:01 +02:00
|
|
|
}
|
|
|
|
|
2017-09-05 23:46:45 +02:00
|
|
|
// Check write permissions and .htaccess file
|
2015-05-15 00:07:45 +02:00
|
|
|
function checkSystem()
|
2015-05-05 03:00:01 +02:00
|
|
|
{
|
2018-06-25 23:17:43 +02:00
|
|
|
$output = array();
|
2015-08-04 05:10:12 +02:00
|
|
|
|
2018-03-04 21:43:30 +01:00
|
|
|
// Try to create .htaccess
|
2018-03-02 15:10:48 +01:00
|
|
|
$htaccessContent = 'AddDefaultCharset UTF-8
|
|
|
|
|
|
|
|
<IfModule mod_rewrite.c>
|
|
|
|
|
|
|
|
# Enable rewrite rules
|
|
|
|
RewriteEngine on
|
|
|
|
|
2018-03-04 21:43:30 +01:00
|
|
|
# Base directory
|
2023-07-15 15:58:33 +02:00
|
|
|
RewriteBase ' . HTML_PATH_ROOT . '
|
2018-03-04 21:43:30 +01:00
|
|
|
|
2018-09-05 22:55:14 +02:00
|
|
|
# Deny direct access to the next directories
|
2018-09-18 23:59:38 +02:00
|
|
|
RewriteRule ^bl-content/(databases|workspaces|pages|tmp)/.*$ - [R=404,L]
|
2018-03-02 15:10:48 +01:00
|
|
|
|
|
|
|
# All URL process by index.php
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
2019-05-17 20:28:48 +02:00
|
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
2018-03-02 15:10:48 +01:00
|
|
|
RewriteRule ^(.*) index.php [PT,L]
|
|
|
|
|
|
|
|
</IfModule>';
|
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
if (!file_put_contents(PATH_ROOT . '.htaccess', $htaccessContent)) {
|
2018-03-04 21:43:30 +01:00
|
|
|
if (!empty($_SERVER['SERVER_SOFTWARE'])) {
|
|
|
|
$webserver = Text::lowercase($_SERVER['SERVER_SOFTWARE']);
|
|
|
|
if (Text::stringContains($webserver, 'apache') || Text::stringContains($webserver, 'litespeed')) {
|
2018-03-04 21:51:12 +01:00
|
|
|
$errorText = 'Missing file, upload the file .htaccess';
|
2023-07-15 15:58:33 +02:00
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-06-25 23:17:43 +02:00
|
|
|
array_push($output, $errorText);
|
2018-03-02 15:10:48 +01:00
|
|
|
}
|
2016-08-31 02:57:24 +02:00
|
|
|
}
|
2015-08-04 05:10:12 +02:00
|
|
|
}
|
|
|
|
|
2018-03-02 16:03:00 +01:00
|
|
|
// Check mod_rewrite module
|
2023-07-15 15:58:33 +02:00
|
|
|
if (function_exists('apache_get_modules')) {
|
2018-03-02 16:03:00 +01:00
|
|
|
if (!in_array('mod_rewrite', apache_get_modules())) {
|
|
|
|
$errorText = 'Module mod_rewrite is not installed or loaded.';
|
2023-07-15 15:58:33 +02:00
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-06-25 23:17:43 +02:00
|
|
|
array_push($output, $errorText);
|
2016-08-31 02:57:24 +02:00
|
|
|
}
|
2015-08-04 05:10:12 +02:00
|
|
|
}
|
|
|
|
|
2016-01-17 01:11:58 +01:00
|
|
|
// Try to create the directory content
|
2018-06-25 23:17:43 +02:00
|
|
|
@mkdir(PATH_CONTENT, DIR_PERMISSIONS, true);
|
2016-01-17 01:11:58 +01:00
|
|
|
|
|
|
|
// Check if the directory content is writeable.
|
2017-09-05 23:46:45 +02:00
|
|
|
if (!is_writable(PATH_CONTENT)) {
|
2018-03-04 21:51:12 +01:00
|
|
|
$errorText = 'Writing test failure, check directory "bl-content" permissions.';
|
2023-07-15 15:58:33 +02:00
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-06-25 23:17:43 +02:00
|
|
|
array_push($output, $errorText);
|
2015-08-04 05:10:12 +02:00
|
|
|
}
|
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
return $output;
|
2015-05-05 03:00:01 +02:00
|
|
|
}
|
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
// Install Bludit
|
|
|
|
function install($adminPassword, $timezone)
|
2015-05-15 00:07:45 +02:00
|
|
|
{
|
2018-08-05 17:54:20 +02:00
|
|
|
global $L;
|
2015-08-07 04:13:55 +02:00
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
if (!date_default_timezone_set($timezone)) {
|
2016-02-10 02:10:12 +01:00
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
}
|
2015-10-24 22:43:50 +02:00
|
|
|
|
|
|
|
$currentDate = Date::current(DB_DATE_FORMAT);
|
|
|
|
|
2015-08-04 05:10:12 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Create directories
|
|
|
|
// ============================================================================
|
|
|
|
|
2018-07-07 12:04:34 +02:00
|
|
|
// Directories for initial pages
|
|
|
|
$pagesToInstall = array('example-page-1-slug', 'example-page-2-slug', 'example-page-3-slug', 'example-page-4-slug');
|
|
|
|
foreach ($pagesToInstall as $page) {
|
2023-07-15 15:58:33 +02:00
|
|
|
if (!mkdir(PATH_PAGES . $L->get($page), DIR_PERMISSIONS, true)) {
|
|
|
|
$errorText = 'Error when trying to created the directory=>' . PATH_PAGES . $L->get($page);
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-07-07 12:04:34 +02:00
|
|
|
}
|
2018-06-25 23:17:43 +02:00
|
|
|
}
|
|
|
|
|
2018-07-07 12:04:34 +02:00
|
|
|
// Directories for initial plugins
|
2023-07-15 15:58:33 +02:00
|
|
|
$pluginsToInstall = array('tinymce', 'about', 'visits-stats', 'robots', 'canonical', 'alternative');
|
2018-07-07 12:04:34 +02:00
|
|
|
foreach ($pluginsToInstall as $plugin) {
|
2023-07-15 15:58:33 +02:00
|
|
|
if (!mkdir(PATH_PLUGINS_DATABASES . $plugin, DIR_PERMISSIONS, true)) {
|
|
|
|
$errorText = 'Error when trying to created the directory=>' . PATH_PLUGINS_DATABASES . $plugin;
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-07-07 12:04:34 +02:00
|
|
|
}
|
2015-11-16 05:20:58 +01:00
|
|
|
}
|
|
|
|
|
2018-07-07 12:04:34 +02:00
|
|
|
// Directories for upload files
|
2018-06-25 23:17:43 +02:00
|
|
|
if (!mkdir(PATH_UPLOADS_PROFILES, DIR_PERMISSIONS, true)) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$errorText = 'Error when trying to created the directory=>' . PATH_UPLOADS_PROFILES;
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2015-08-04 05:10:12 +02:00
|
|
|
}
|
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
if (!mkdir(PATH_UPLOADS_THUMBNAILS, DIR_PERMISSIONS, true)) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$errorText = 'Error when trying to created the directory=>' . PATH_UPLOADS_THUMBNAILS;
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2016-05-26 23:48:41 +02:00
|
|
|
}
|
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
if (!mkdir(PATH_TMP, DIR_PERMISSIONS, true)) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$errorText = 'Error when trying to created the directory=>' . PATH_TMP;
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2016-01-03 22:04:54 +01:00
|
|
|
}
|
|
|
|
|
2018-09-05 22:55:14 +02:00
|
|
|
if (!mkdir(PATH_WORKSPACES, DIR_PERMISSIONS, true)) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$errorText = 'Error when trying to created the directory=>' . PATH_WORKSPACES;
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-09-05 22:55:14 +02:00
|
|
|
}
|
|
|
|
|
2018-10-06 19:39:34 +02:00
|
|
|
if (!mkdir(PATH_UPLOADS_PAGES, DIR_PERMISSIONS, true)) {
|
2023-07-15 15:58:33 +02:00
|
|
|
$errorText = 'Error when trying to created the directory=>' . PATH_UPLOADS_PAGES;
|
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-10-06 19:39:34 +02:00
|
|
|
}
|
|
|
|
|
2015-08-04 05:10:12 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Create files
|
|
|
|
// ============================================================================
|
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
$dataHead = "<?php defined('BLUDIT') or die('Bludit CMS.'); ?>" . PHP_EOL;
|
2015-08-04 05:10:12 +02:00
|
|
|
|
2018-07-07 12:04:34 +02:00
|
|
|
$data = array();
|
2018-08-27 22:19:42 +02:00
|
|
|
$slugs = array();
|
2019-02-02 16:14:00 +01:00
|
|
|
$nextDate = $currentDate;
|
2018-07-07 12:04:34 +02:00
|
|
|
foreach ($pagesToInstall as $page) {
|
2018-07-17 19:13:01 +02:00
|
|
|
|
|
|
|
$slug = $page;
|
2023-07-15 15:58:33 +02:00
|
|
|
$title = Text::replace('slug', 'title', $slug);
|
|
|
|
$content = Text::replace('slug', 'content', $slug);
|
2019-02-02 16:14:00 +01:00
|
|
|
$nextDate = Date::offset($nextDate, DB_DATE_FORMAT, '-1 minute');
|
2018-07-17 19:13:01 +02:00
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
$data[$L->get($slug)] = array(
|
|
|
|
'title' => $L->get($title),
|
|
|
|
'description' => '',
|
|
|
|
'username' => 'admin',
|
|
|
|
'tags' => array(),
|
|
|
|
'type' => (($slug == 'example-page-4-slug') ? 'static' : 'published'),
|
|
|
|
'date' => $nextDate,
|
|
|
|
'dateModified' => '',
|
|
|
|
'allowComments' => true,
|
|
|
|
'position' => 1,
|
|
|
|
'coverImage' => '',
|
|
|
|
'md5file' => '',
|
|
|
|
'category' => 'general',
|
|
|
|
'uuid' => md5(uniqid()),
|
|
|
|
'parent' => '',
|
|
|
|
'template' => '',
|
|
|
|
'noindex' => false,
|
|
|
|
'nofollow' => false,
|
|
|
|
'noarchive' => false
|
2018-07-07 12:04:34 +02:00
|
|
|
);
|
2018-07-17 19:13:01 +02:00
|
|
|
|
2018-08-27 22:19:42 +02:00
|
|
|
array_push($slugs, $slug);
|
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
file_put_contents(PATH_PAGES . $L->get($slug) . DS . FILENAME, $L->get($content), LOCK_EX);
|
2018-07-07 12:04:34 +02:00
|
|
|
}
|
2023-07-15 15:58:33 +02:00
|
|
|
file_put_contents(PATH_DATABASES . 'pages.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
2015-08-04 05:10:12 +02:00
|
|
|
|
|
|
|
// File site.php
|
2017-05-30 20:28:55 +02:00
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
// If Bludit is not installed inside a folder, the URL doesn't need finish with /
|
2017-05-30 20:28:55 +02:00
|
|
|
// Example (root): https://domain.com
|
|
|
|
// Example (inside a folder): https://domain.com/folder/
|
2023-07-15 15:58:33 +02:00
|
|
|
if (HTML_PATH_ROOT == '/') {
|
|
|
|
$siteUrl = PROTOCOL . DOMAIN;
|
2017-05-30 20:28:55 +02:00
|
|
|
} else {
|
2023-07-15 15:58:33 +02:00
|
|
|
$siteUrl = PROTOCOL . DOMAIN . HTML_PATH_ROOT;
|
2017-05-30 20:28:55 +02:00
|
|
|
}
|
2015-08-04 05:10:12 +02:00
|
|
|
$data = array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'title' => 'BLUDIT',
|
|
|
|
'slogan' => $L->get('welcome-to-bludit'),
|
|
|
|
'description' => $L->get('congratulations-you-have-successfully-installed-your-bludit'),
|
|
|
|
'footer' => 'Copyright © ' . Date::current('Y'),
|
|
|
|
'itemsPerPage' => 6,
|
|
|
|
'language' => $L->currentLanguage(),
|
|
|
|
'locale' => $L->locale(),
|
|
|
|
'timezone' => $timezone,
|
|
|
|
'theme' => 'alternative',
|
|
|
|
'adminTheme' => 'booty',
|
|
|
|
'homepage' => '',
|
|
|
|
'pageNotFound' => '',
|
|
|
|
'uriPage' => '/',
|
|
|
|
'uriTag' => '/tag/',
|
|
|
|
'uriCategory' => '/category/',
|
|
|
|
'uriBlog' => '',
|
|
|
|
'url' => $siteUrl,
|
|
|
|
'emailFrom' => 'no-reply@' . DOMAIN,
|
|
|
|
'orderBy' => 'date',
|
|
|
|
'currentBuild' => '0',
|
|
|
|
'twitter' => 'https://twitter.com/bludit',
|
|
|
|
'facebook' => 'https://www.facebook.com/bluditcms',
|
|
|
|
'codepen' => '',
|
|
|
|
'github' => 'https://github.com/bludit',
|
|
|
|
'instagram' => '',
|
|
|
|
'gitlab' => '',
|
|
|
|
'linkedin' => '',
|
|
|
|
'xing' => '',
|
|
|
|
'dateFormat' => 'F j, Y',
|
|
|
|
'extremeFriendly' => true,
|
|
|
|
'autosaveInterval' => 2,
|
|
|
|
'titleFormatHomepage' => '{{site-slogan}} | {{site-title}}',
|
|
|
|
'titleFormatPages' => '{{page-title}} | {{site-title}}',
|
|
|
|
'titleFormatCategory' => '{{category-name}} | {{site-title}}',
|
|
|
|
'titleFormatTag' => '{{tag-name}} | {{site-title}}',
|
|
|
|
'imageRestrict' => true,
|
|
|
|
'imageRelativeToAbsolute' => false
|
2015-08-04 05:10:12 +02:00
|
|
|
);
|
2023-07-15 15:58:33 +02:00
|
|
|
file_put_contents(PATH_DATABASES . 'site.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
2015-08-04 05:10:12 +02:00
|
|
|
|
2015-10-30 23:44:12 +01:00
|
|
|
// File users.php
|
2017-05-21 22:01:44 +02:00
|
|
|
$salt = uniqid();
|
2023-07-15 15:58:33 +02:00
|
|
|
$passwordHash = sha1($adminPassword . $salt);
|
|
|
|
$tokenAuth = md5(uniqid() . time() . DOMAIN);
|
2015-08-04 05:10:12 +02:00
|
|
|
|
|
|
|
$data = array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'admin' => array(
|
|
|
|
'nickname' => 'Admin',
|
|
|
|
'firstName' => $L->get('Administrator'),
|
|
|
|
'lastName' => '',
|
|
|
|
'role' => 'admin',
|
|
|
|
'password' => $passwordHash,
|
|
|
|
'salt' => $salt,
|
|
|
|
'email' => '',
|
|
|
|
'registered' => $currentDate,
|
|
|
|
'tokenRemember' => '',
|
|
|
|
'tokenAuth' => $tokenAuth,
|
|
|
|
'tokenAuthTTL' => '2009-03-15 14:00',
|
|
|
|
'twitter' => '',
|
|
|
|
'facebook' => '',
|
|
|
|
'instagram' => '',
|
|
|
|
'codepen' => '',
|
|
|
|
'linkedin' => '',
|
|
|
|
'xing' => '',
|
|
|
|
'github' => '',
|
|
|
|
'gitlab' => ''
|
2015-08-04 05:10:12 +02:00
|
|
|
)
|
|
|
|
);
|
2023-07-15 15:58:33 +02:00
|
|
|
file_put_contents(PATH_DATABASES . 'users.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
2015-08-04 05:10:12 +02:00
|
|
|
|
2017-05-19 00:45:14 +02:00
|
|
|
// File syslog.php
|
|
|
|
$data = array(
|
|
|
|
array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'date' => $currentDate,
|
|
|
|
'dictionaryKey' => 'welcome-to-bludit',
|
|
|
|
'notes' => '',
|
|
|
|
'idExecution' => uniqid(),
|
|
|
|
'method' => 'POST',
|
|
|
|
'username' => 'admin'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
file_put_contents(PATH_DATABASES . 'syslog.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
2017-05-19 00:45:14 +02:00
|
|
|
|
2015-08-18 04:02:19 +02:00
|
|
|
// File security.php
|
|
|
|
$data = array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'minutesBlocked' => 5,
|
|
|
|
'numberFailuresAllowed' => 10,
|
|
|
|
'blackList' => array()
|
2015-08-18 04:02:19 +02:00
|
|
|
);
|
2023-07-15 15:58:33 +02:00
|
|
|
file_put_contents(PATH_DATABASES . 'security.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
2015-08-18 04:02:19 +02:00
|
|
|
|
2017-04-26 18:56:10 +02:00
|
|
|
// File categories.php
|
2017-05-04 21:32:18 +02:00
|
|
|
$data = array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'general' => array('name' => 'General', 'description' => '', 'template' => '', 'list' => $slugs),
|
|
|
|
'music' => array('name' => 'Music', 'description' => '', 'template' => '', 'list' => array()),
|
|
|
|
'videos' => array('name' => 'Videos', 'description' => '', 'template' => '', 'list' => array())
|
2017-05-04 21:32:18 +02:00
|
|
|
);
|
2023-07-15 15:58:33 +02:00
|
|
|
file_put_contents(PATH_DATABASES . 'categories.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
2017-04-26 18:56:10 +02:00
|
|
|
|
2015-08-31 03:18:06 +02:00
|
|
|
// File tags.php
|
2020-08-23 19:00:24 +02:00
|
|
|
$data = array();
|
2023-07-15 15:58:33 +02:00
|
|
|
file_put_contents(PATH_DATABASES . 'tags.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
2015-08-31 03:18:06 +02:00
|
|
|
|
2018-02-25 17:25:10 +01:00
|
|
|
// File plugins/about/db.php
|
2015-08-29 07:02:09 +02:00
|
|
|
file_put_contents(
|
2023-07-15 15:58:33 +02:00
|
|
|
PATH_PLUGINS_DATABASES . 'about' . DS . 'db.php',
|
|
|
|
$dataHead . json_encode(
|
2015-08-29 07:02:09 +02:00
|
|
|
array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'position' => 1,
|
|
|
|
'label' => $L->get('About'),
|
|
|
|
'text' => $L->get('this-is-a-brief-description-of-yourself-our-your-site')
|
2015-08-29 07:02:09 +02:00
|
|
|
),
|
2023-07-15 15:58:33 +02:00
|
|
|
JSON_PRETTY_PRINT
|
|
|
|
),
|
2015-08-29 07:02:09 +02:00
|
|
|
LOCK_EX
|
|
|
|
);
|
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
// File plugins/visits-stats/db.php
|
2018-06-25 23:17:43 +02:00
|
|
|
file_put_contents(
|
2023-07-15 15:58:33 +02:00
|
|
|
PATH_PLUGINS_DATABASES . 'visits-stats' . DS . 'db.php',
|
|
|
|
$dataHead . json_encode(
|
2018-06-25 23:17:43 +02:00
|
|
|
array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'numberOfDays' => 7,
|
|
|
|
'label' => $L->get('Visits'),
|
|
|
|
'excludeAdmins' => false,
|
|
|
|
'position' => 1
|
2018-06-25 23:17:43 +02:00
|
|
|
),
|
2023-07-15 15:58:33 +02:00
|
|
|
JSON_PRETTY_PRINT
|
|
|
|
),
|
2018-06-25 23:17:43 +02:00
|
|
|
LOCK_EX
|
|
|
|
);
|
2023-07-15 15:58:33 +02:00
|
|
|
mkdir(PATH_WORKSPACES . 'visits-stats', DIR_PERMISSIONS, true);
|
2018-06-25 23:17:43 +02:00
|
|
|
|
2018-08-18 16:15:38 +02:00
|
|
|
// File plugins/tinymce/db.php
|
2018-06-25 23:17:43 +02:00
|
|
|
file_put_contents(
|
2023-07-15 15:58:33 +02:00
|
|
|
PATH_PLUGINS_DATABASES . 'tinymce' . DS . 'db.php',
|
|
|
|
$dataHead . json_encode(
|
2018-06-25 23:17:43 +02:00
|
|
|
array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'position' => 1,
|
|
|
|
'toolbar1' => 'formatselect bold italic forecolor backcolor removeformat | bullist numlist table | blockquote alignleft aligncenter alignright | link unlink pagebreak image code',
|
|
|
|
'toolbar2' => '',
|
|
|
|
'plugins' => 'code autolink image link pagebreak advlist lists textpattern table'
|
2018-06-25 23:17:43 +02:00
|
|
|
),
|
2023-07-15 15:58:33 +02:00
|
|
|
JSON_PRETTY_PRINT
|
|
|
|
),
|
2018-06-25 23:17:43 +02:00
|
|
|
LOCK_EX
|
|
|
|
);
|
|
|
|
|
2019-01-28 22:11:59 +01:00
|
|
|
// File plugins/canonical/db.php
|
|
|
|
file_put_contents(
|
2023-07-15 15:58:33 +02:00
|
|
|
PATH_PLUGINS_DATABASES . 'canonical' . DS . 'db.php',
|
|
|
|
$dataHead . json_encode(
|
2019-01-28 22:11:59 +01:00
|
|
|
array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'position' => 1
|
2019-01-28 22:11:59 +01:00
|
|
|
),
|
2023-07-15 15:58:33 +02:00
|
|
|
JSON_PRETTY_PRINT
|
|
|
|
),
|
|
|
|
LOCK_EX
|
|
|
|
);
|
|
|
|
|
|
|
|
// File plugins/alternative/db.php
|
|
|
|
file_put_contents(
|
|
|
|
PATH_PLUGINS_DATABASES . 'alternative' . DS . 'db.php',
|
|
|
|
$dataHead . json_encode(
|
|
|
|
array(
|
|
|
|
'googleFonts' => false,
|
|
|
|
'showPostInformation' => false,
|
|
|
|
'dateFormat' => 'relative',
|
|
|
|
'position' => 1
|
|
|
|
),
|
|
|
|
JSON_PRETTY_PRINT
|
|
|
|
),
|
2019-01-28 22:11:59 +01:00
|
|
|
LOCK_EX
|
|
|
|
);
|
|
|
|
|
2018-07-17 23:58:01 +02:00
|
|
|
// File plugins/robots/db.php
|
|
|
|
file_put_contents(
|
2023-07-15 15:58:33 +02:00
|
|
|
PATH_PLUGINS_DATABASES . 'robots' . DS . 'db.php',
|
|
|
|
$dataHead . json_encode(
|
2018-07-17 23:58:01 +02:00
|
|
|
array(
|
2023-07-15 15:58:33 +02:00
|
|
|
'position' => 1,
|
|
|
|
'robotstxt' => 'User-agent: *' . PHP_EOL . 'Allow: /'
|
2018-07-17 23:58:01 +02:00
|
|
|
),
|
2023-07-15 15:58:33 +02:00
|
|
|
JSON_PRETTY_PRINT
|
|
|
|
),
|
2018-07-17 23:58:01 +02:00
|
|
|
LOCK_EX
|
|
|
|
);
|
|
|
|
|
2015-08-04 05:10:12 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
function redirect($url)
|
|
|
|
{
|
2018-06-25 23:17:43 +02:00
|
|
|
if (!headers_sent()) {
|
2023-07-15 15:58:33 +02:00
|
|
|
header("Location:" . $url, TRUE, 302);
|
2016-10-10 23:08:00 +02:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
exit('<meta http-equiv="refresh" content="0; url="' . $url . '">');
|
2016-10-10 23:08:00 +02:00
|
|
|
}
|
|
|
|
|
2015-05-15 00:07:45 +02:00
|
|
|
// ============================================================================
|
|
|
|
// MAIN
|
|
|
|
// ============================================================================
|
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
if (alreadyInstalled()) {
|
|
|
|
$errorText = 'Bludit is already installed ;)';
|
2023-07-15 15:58:33 +02:00
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-06-25 23:17:43 +02:00
|
|
|
exit($errorText);
|
2015-05-15 00:07:45 +02:00
|
|
|
}
|
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
// Install a demo, just call the install.php?demo=true
|
|
|
|
if (isset($_GET['demo'])) {
|
|
|
|
install('demo123', 'UTC');
|
2016-10-10 23:08:00 +02:00
|
|
|
redirect(HTML_PATH_ROOT);
|
|
|
|
}
|
2015-08-04 05:10:12 +02:00
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
// Install by POST method
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
2023-07-15 15:58:33 +02:00
|
|
|
if (Text::length($_POST['password']) < 6) {
|
2018-11-12 00:27:13 +01:00
|
|
|
$errorText = $L->g('password-must-be-at-least-6-characters-long');
|
2023-07-15 15:58:33 +02:00
|
|
|
error_log('[ERROR] ' . $errorText, 0);
|
2018-11-12 00:27:13 +01:00
|
|
|
} else {
|
|
|
|
install($_POST['password'], $_POST['timezone']);
|
|
|
|
redirect(HTML_PATH_ROOT);
|
|
|
|
}
|
2015-05-15 00:07:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2018-06-25 23:17:43 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
2023-07-15 15:58:33 +02:00
|
|
|
|
2015-05-15 00:07:45 +02:00
|
|
|
<head>
|
2018-08-05 17:54:20 +02:00
|
|
|
<title><?php echo $L->get('Bludit Installer') ?></title>
|
2018-06-25 23:17:43 +02:00
|
|
|
<meta charset="<?php echo CHARSET ?>">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<meta name="robots" content="noindex,nofollow">
|
2015-05-15 00:07:45 +02:00
|
|
|
|
2015-10-24 01:23:33 +02:00
|
|
|
<!-- Favicon -->
|
2020-02-08 19:19:15 +01:00
|
|
|
<link rel="icon" type="image/png" href="bl-kernel/img/favicon.png?version=<?php echo time() ?>">
|
2015-05-15 00:07:45 +02:00
|
|
|
|
2015-10-24 01:23:33 +02:00
|
|
|
<!-- CSS -->
|
2018-07-02 00:24:53 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="bl-kernel/css/bootstrap.min.css?version=<?php echo time() ?>">
|
2018-06-25 23:17:43 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="bl-kernel/admin/themes/booty/css/bludit.css?version=<?php echo time() ?>">
|
2015-10-24 01:23:33 +02:00
|
|
|
|
|
|
|
<!-- Javascript -->
|
2018-07-02 00:24:53 +02:00
|
|
|
<script charset="utf-8" src="bl-kernel/js/jquery.min.js?version=<?php echo time() ?>"></script>
|
2018-07-17 19:13:01 +02:00
|
|
|
<script charset="utf-8" src="bl-kernel/js/bootstrap.bundle.min.js?version=<?php echo time() ?>"></script>
|
2018-07-02 00:24:53 +02:00
|
|
|
<script charset="utf-8" src="bl-kernel/js/jstz.min.js?version=<?php echo time() ?>"></script>
|
2015-10-24 01:23:33 +02:00
|
|
|
</head>
|
2023-07-15 15:58:33 +02:00
|
|
|
|
2018-06-25 23:17:43 +02:00
|
|
|
<body class="login">
|
2023-07-15 15:58:33 +02:00
|
|
|
<div class="container">
|
|
|
|
<div class="row justify-content-md-center pt-5">
|
|
|
|
<div class="col-md-4 pt-5">
|
|
|
|
<h1 class="text-center mb-5 mt-5 font-weight-normal text-uppercase" style="color: #555;"><?php echo $L->get('Bludit Installer') ?></h1>
|
|
|
|
<?php
|
|
|
|
$system = checkSystem();
|
|
|
|
if (!empty($system)) {
|
|
|
|
foreach ($system as $error) {
|
|
|
|
echo '
|
2018-09-26 17:55:19 +02:00
|
|
|
<table class="table">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2023-07-15 15:58:33 +02:00
|
|
|
<th>' . $error . '</th>
|
2018-09-26 17:55:19 +02:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
';
|
2023-07-15 15:58:33 +02:00
|
|
|
}
|
|
|
|
} elseif (isset($_GET['language'])) {
|
|
|
|
?>
|
|
|
|
<p><?php echo $L->get('choose-a-password-for-the-user-admin') ?></p>
|
|
|
|
|
|
|
|
<?php if (!empty($errorText)) : ?>
|
|
|
|
<div class="alert alert-danger"><?php echo $errorText ?></div>
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
<form id="jsformInstaller" method="post" action="" autocomplete="off">
|
|
|
|
<input type="hidden" name="timezone" id="jstimezone" value="UTC">
|
|
|
|
|
|
|
|
<div class="form-group">
|
2024-06-22 16:22:05 +02:00
|
|
|
<input type="text" dir="auto" value="admin" class="form-control form-control-lg" id="jsusername" name="username" placeholder="Username" disabled>
|
2023-07-15 15:58:33 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group mb-0">
|
|
|
|
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="<?php $L->p('Password') ?>">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-check mt-2">
|
|
|
|
<input role="button" class="form-check-input" type="checkbox" value="" id="jsshowPassword">
|
|
|
|
<label class="form-check-label" for="jsshowPassword"><?php $L->p('Show password') ?></label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group mt-4">
|
|
|
|
<button type="submit" class="btn btn-primary btn-lg mr-2 w-100" name="install"><?php $L->p('Install') ?></button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
?>
|
|
|
|
<form id="jsformLanguage" method="get" action="" autocomplete="off">
|
|
|
|
<label for="jslanguage"><?php echo $L->get('Choose your language') ?></label>
|
|
|
|
<select id="jslanguage" name="language" class="form-control form-control-lg">
|
|
|
|
<?php
|
|
|
|
$htmlOptions = getLanguageList();
|
|
|
|
foreach ($htmlOptions as $fname => $native) {
|
|
|
|
echo '<option value="' . $fname . '"' . (($finalLanguage === $fname) ? ' selected="selected"' : '') . '>' . $native . '</option>';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<div class="form-group mt-4">
|
|
|
|
<button type="submit" class="btn btn-primary btn-lg mr-2 w-100"><?php $L->p('Next') ?></button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
2018-06-25 23:17:43 +02:00
|
|
|
}
|
2023-07-15 15:58:33 +02:00
|
|
|
?>
|
|
|
|
</div>
|
2015-10-24 01:23:33 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-08-04 05:10:12 +02:00
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
// Timezone
|
|
|
|
var timezone = jstz.determine();
|
|
|
|
$("#jstimezone").val(timezone.name());
|
2015-10-24 01:23:33 +02:00
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
// Show password
|
|
|
|
$("#jsshowPassword").on("click", function() {
|
|
|
|
var input = document.getElementById("jspassword");
|
2015-10-24 01:23:33 +02:00
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
if (!$(this).is(':checked')) {
|
|
|
|
input.setAttribute("type", "password");
|
|
|
|
} else {
|
|
|
|
input.setAttribute("type", "text");
|
|
|
|
}
|
|
|
|
});
|
2015-10-24 01:23:33 +02:00
|
|
|
|
2023-07-15 15:58:33 +02:00
|
|
|
});
|
|
|
|
</script>
|
2015-08-04 05:10:12 +02:00
|
|
|
|
2015-05-15 00:07:45 +02:00
|
|
|
</body>
|
2023-07-15 15:58:33 +02:00
|
|
|
|
2018-06-24 13:37:45 +02:00
|
|
|
</html>
|