Skip to content
Permalink
Browse files

Major rearrangement of directory structure.

Let's hopefully never do this scale of change again.
  • Loading branch information
OtakuMegane committed Feb 20, 2020
1 parent e3e2931 commit 70eb7e1410e67367f21cc5e94e00f6b95a6e51b0
Showing 322 changed files with 191 additions and 98 deletions.
@@ -2,14 +2,14 @@
Basic installation guide. Should be enough to get things up and running.

1. Unzip the files for Nelliel and copy them to the location desired.
2. Make sure the PHP process has read, write and execute permissions on the parent directory, `configuration` directory and the `board_files` directory. On Linux this would be `chmod 755` or `chmod 775` depending on how your host is set up.
2. Make sure the PHP process has read, write and execute permissions on the main directory and the `nelliel_core` directory. On Linux this would normally be `chmod 755` or `chmod 775` depending on how your host is set up.
3. If using MySQL, MariaDB or PostgreSQL you need a database and a user that has CREATE, ALTER and DROP permissions for that database.
For SQLite you just need the path to where you wish the database file to be stored. **This must not be a web-accessible location!**
4. Go to the `configuration` directory and rename `config.php.example` to `config.php` then open the file to edit settings. Only a few of these settings need to be changed:
- `defaultadmin` and `defaultadmin_pass` need to be set to a value. This will be used to create a basic administrative user.
4. Go to the `nelliel_core/configuration` directory and rename `config.php.example` to `config.php` then open the file to edit settings. Only a few of these settings are required to be changed:
- `super_admin` and `super_admin_pass` need to be set to a value. This will be used temporarily to create a site owner account.
- Change `default_locale` if you want a language other than American English. If Nelliel can't find the language file for `default_locale` it will fall back to U.S. English.
- Set `sqltype` to whichever type of database you are using. The current options are MYSQL, MARIADB, POSTGRESQL and SQLITE
- There is a configuration section for each type of SQL database. You only need to configure for the type of database you are using; the others can be left alone.
5. Go to `imgboard.php?install` in a browser and give it a moment to run the install routines. If anything goes wrong it should give a relevant error message.
6. If installation is successful you should receive a success message and a link to default home page. From there you can log in to create boards and further configure the script. You can also go to `imgboard.php?module=login` to access the login page.
7. Once you have logged in and confirmed things are working, go back to the `config.php` and set `defaultadmin` and `defaultadmin_pass` back to empty.
7. Once you have logged in and confirmed things are working, go back to the `config.php` and set `super_admin` and `super_admin_pass` back to empty.
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.
@@ -5,4 +5,3 @@ name = "Nelliel"
version = "1.0"
description = "Nelliel style"
style_type = "css"

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -37,7 +37,7 @@ Error 60: Filename purged by filter. (classes/FileHandler.php)
Error 101: No acceptable password hashing. (crypt.php)
Error 102: InnoDB engine unavailable. (Setup/Setup.php)
Error 103: Failed to create database table. (classes/TableHandler.php)
Error 104: board_files not writable. (Setup/Setup.php)
Error 104: nelliel_core not writable. (Setup/Setup.php)
Error 105: Main directory not writable. (Setup/Setup.php)
Error 106: Config directory not writable. (Setup/Setup.php)
Error 107: Install not done. (imgboard.php)
@@ -3,9 +3,9 @@
define('NELLIEL_COPYRIGHT', '2010-2019 Nelliel Project'); // Copyright line
define('NELLIEL_PACKAGE', 'Nelliel'); // Package
define('BASE_PATH', realpath('./') . '/'); // Base path for script
define('FILES_PATH', BASE_PATH . 'board_files/'); // Base board files path
define('INCLUDE_PATH', FILES_PATH . 'include/'); // Base include files path
define('LIBRARY_PATH', FILES_PATH . 'libraries/'); // Libraries path
define('NELLIEL_CORE_PATH', BASE_PATH . 'nelliel_core/'); // Base board files path
define('INCLUDE_PATH', NELLIEL_CORE_PATH . 'include/'); // Base include files path
define('LIBRARY_PATH', NELLIEL_CORE_PATH . 'libraries/'); // Libraries path

require_once INCLUDE_PATH . 'autoload.php';
require_once INCLUDE_PATH . 'initializations.php';
@@ -49,7 +49,7 @@
define('SETUP_GOOD', true);
ignore_user_abort(true);

require_once CONFIG_FILE_PATH . 'generated.php';
require_once GENERATED_FILE_PATH . 'generated.php';
require_once INCLUDE_PATH . 'dispatch/central_dispatch.php';

nel_central_dispatch();
@@ -23,8 +23,8 @@ $base_config['super_admin_pass'] = '';
// The fallback default value for locale.
// If a locale is specified elsewhere but no language file exists for it, Nelliel will use this value instead.
// Locale should follow the standard format using ISO-639 language and ISO-3166 country codes.
// e.g. 'en_US' for 'English (United Sates)', 'en_GB' for 'English (United Kingdom)'
// The available locales and their translations can be found in the directory 'board_files/language/locale'
// e.g. 'en_US' for 'English (United States)', 'en_GB' for 'English (United Kingdom)'
// The available locales and their translations can be found in the directory 'nelliel_core/language/locale'
$base_config['default_locale'] = 'en_US';

// Forces Nelliel to only allow sessions over a secure connection.
@@ -106,7 +106,6 @@ $db_config['postgresql_password'] = '';
$db_config['postgresql_schema'] = 'public';

// The character encoding to use.
// You must make sure this matches or is compatible with what the database uses!
$db_config['postgresql_encoding'] = 'UTF-8';

//
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.
@@ -59,8 +59,8 @@ public function add()
}

$icon_set_id = $_GET['icon-set-id'];
$ini_parser = new \Nelliel\INIParser(new \Nelliel\FileHandler());
$icon_set_inis = $ini_parser->parseDirectories(ICON_SETS_FILE_PATH, 'icon_set_info.ini');
$front_end_data = new \Nelliel\FrontEndData($this->database);
$icon_set_inis = $front_end_data->getIconSetInis();

foreach ($icon_set_inis as $ini)
{
@@ -71,8 +71,7 @@ public function add()
}

$prepared = $this->database->prepare(
'INSERT INTO "' . ASSETS_TABLE .
'" ("id", "type", "is_default", "info") VALUES (?, ?, ?, ?)');
'INSERT INTO "' . ASSETS_TABLE . '" ("id", "type", "is_default", "info") VALUES (?, ?, ?, ?)');
$this->database->executePrepared($prepared, [$icon_set_id, 'icon-set', 0, $info]);
$this->renderPanel();
}
@@ -108,7 +107,8 @@ public function makeDefault()
$icon_set_id = $_GET['icon-set-id'];
$set_type = $_GET['set-type'];
$this->database->exec('UPDATE "' . ASSETS_TABLE . '" SET "is_default" = 0 WHERE "type" = \'icon-set\'');
$prepared = $this->database->prepare('UPDATE "' . ASSETS_TABLE . '" SET "is_default" = 1 WHERE "id" = ? AND "type" = \'icon-set\'');
$prepared = $this->database->prepare(
'UPDATE "' . ASSETS_TABLE . '" SET "is_default" = 1 WHERE "id" = ? AND "type" = \'icon-set\'');
$this->database->executePrepared($prepared, [$icon_set_id]);
$this->renderPanel();
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -59,8 +59,8 @@ public function add()
}

$style_id = $_GET['style-id'];
$ini_parser = new \Nelliel\INIParser(new \Nelliel\FileHandler());
$style_inis = $ini_parser->parseDirectories(STYLES_FILE_PATH, 'style_info.ini');
$front_end_data = new \Nelliel\FrontEndData($this->database);
$style_inis = $front_end_data->getStyleInis();

foreach ($style_inis as $ini)
{
@@ -59,8 +59,9 @@ public function add()
}

$template_id = $_GET['template-id'];
$ini_parser = new \Nelliel\INIParser(new \Nelliel\FileHandler());
$template_inis = $ini_parser->parseDirectories(TEMPLATES_FILE_PATH, 'template_info.ini');
$front_end_data = new \Nelliel\FrontEndData($this->database);
$template_inis = $front_end_data->getTemplateInis();
$info = '';

foreach ($template_inis as $ini)
{
@@ -70,9 +71,13 @@ public function add()
}
}

$prepared = $this->database->prepare(
'INSERT INTO "' . TEMPLATES_TABLE . '" ("id", "type", "is_default", "info") VALUES (?, ?, ?, ?)');
$this->database->executePrepared($prepared, [$template_id, 'template', 0, $info]);
if ($info !== '')
{
$prepared = $this->database->prepare(
'INSERT INTO "' . TEMPLATES_TABLE . '" ("id", "type", "is_default", "info") VALUES (?, ?, ?, ?)');
$this->database->executePrepared($prepared, [$template_id, 'template', 0, $info]);
}

$this->renderPanel();
}

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.
@@ -302,7 +302,7 @@ private function addPHPMatch(array &$strings, array $entry, int $default_categor
private function parseHTMLFiles(array $strings, string $default_category)
{
$file_handler = new \Nelliel\FileHandler();
$html_files = $file_handler->recursiveFileList(TEMPLATES_FILE_PATH . 'nelliel_basic/');
$html_files = $file_handler->recursiveFileList(CORE_TEMPLATES_FILE_PATH . 'nelliel_basic/'); // TODO: Be able to parse custom template sets
$html_files = array_merge($html_files, $file_handler->recursiveFileList(INCLUDE_PATH));
$render = new \Nelliel\RenderCoreDOM();

File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -145,9 +145,11 @@ public function render(array $parameters, bool $data_only)
{
$front_end_data = new \Nelliel\FrontEndData($this->domain->database());
$icon_set = $front_end_data->filetypeIconSet($this->domain->setting('filetype_icon_set_id'));
$icons_web_path = '//' . $web_paths['base_domain'] . ICON_SETS_WEB_PATH . $icon_set['directory'] .
$web_path = $front_end_data->iconSetIsCore($this->domain->setting('filetype_icon_set_id')) ? CORE_ICON_SETS_WEB_PATH : CUSTOM_ICON_SETS_WEB_PATH;
$icons_web_path = '//' . $web_paths['base_domain'] . $web_path . $icon_set['directory'] .
'/';
$icons_file_path = ICON_SETS_FILE_PATH . $icon_set['directory'] . '/';
$file_path = $front_end_data->iconSetIsCore($this->domain->setting('filetype_icon_set_id')) ? CORE_ICON_SETS_FILE_PATH : CUSTOM_ICON_SETS_FILE_PATH;
$icons_file_path = $file_path . $icon_set['directory'] . '/';
$format_icon = utf8_strtolower($file['format']) . '.png';
$type_icon = utf8_strtolower($file['type']) . '.png';

@@ -167,7 +169,7 @@ public function render(array $parameters, bool $data_only)

if ($file['spoiler'])
{
$this->render_data['preview_url'] = '//' . $web_paths['base_domain'] . IMAGES_WEB_PATH .
$this->render_data['preview_url'] = '//' . $web_paths['base_domain'] . CORE_IMAGES_WEB_PATH .
'covers/spoiler_alert.png';
$this->render_data['preview_width'] = ($max_width < 128) ? $max_width : '128';
$this->render_data['preview_height'] = ($max_height < 128) ? $max_height : '128';
@@ -36,7 +36,6 @@ public function render(array $parameters, bool $data_only)
}

$this->render_data['nelliel_version'] = NELLIEL_VERSION;
$this->render_data['js_ui_url'] = $dotdot . SCRIPTS_WEB_PATH . 'ui.js';
$output = $this->output('footer', $data_only, true);
return $output;
}
@@ -54,7 +53,7 @@ public function buildStyles(string $dotdot)
$info = json_decode($style['info'], true);
$style_data['stylesheet'] = ($style['is_default']) ? 'stylesheet' : 'alternate stylesheet';
$style_data['style_id'] = $style['id'];
$style_data['stylesheet_url'] = $dotdot . STYLES_WEB_PATH . $info['directory'] . '/' . $info['main_file'];
$style_data['stylesheet_url'] = $dotdot . CUSTOM_STYLES_WEB_PATH . $info['directory'] . '/' . $info['main_file'];
$style_data['style_name'] = $info['name'];
$style_set[] = $style_data;
}
@@ -28,22 +28,25 @@ public function render(array $parameters, bool $data_only)
$session = new \Nelliel\Account\Session();
$site_domain = new \Nelliel\DomainSite($this->database);
$dotdot = ($parameters['dotdot']) ?? '';
$this->render_data['main_js_file'] = $dotdot . SCRIPTS_WEB_PATH . 'nel.js';
$this->render_data['main_js_file'] = $dotdot . ASSETS_CORE_WEB_PATH . 'scripts/nel.js';
$this->render_data['js_ui_url'] = $dotdot . ASSETS_CORE_WEB_PATH . 'scripts/ui.js';
$this->render_data['js_onload'] = 'window.onload = function () {nelliel.setup.doImportantStuff(\'' .
$this->domain->id() . '\', \'' . $session->inModmode($this->domain) . '\');};';
$this->render_data['js_set_style'] = 'setStyle(nelliel.core.getCookie("style-' . $this->domain->id() . '"));';
$styles = $this->database->executeFetchAll(
'SELECT * FROM "' . ASSETS_TABLE . '" WHERE "type" = \'style\' ORDER BY "entry", "is_default" DESC',
PDO::FETCH_ASSOC);
$style_set = array();
$front_end_data = new \Nelliel\FrontEndData($this->database);

foreach ($styles as $style)
{
$style_data = array();
$info = json_decode($style['info'], true);
$style_data['stylesheet'] = ($style['is_default']) ? 'stylesheet' : 'alternate stylesheet';
$style_data['style_id'] = $style['id'];
$style_data['stylesheet_url'] = $dotdot . STYLES_WEB_PATH . $info['directory'] . '/' . $info['main_file'];
$web_path = ($front_end_data->styleIsCore($style['id'])) ? CORE_STYLES_WEB_PATH : CUSTOM_STYLES_WEB_PATH;
$style_data['stylesheet_url'] = $dotdot . $web_path . $info['directory'] . '/' . $info['main_file'];
$style_data['style_name'] = $info['name'];
$this->render_data['stylesheets'][] = $style_data;
}
File renamed without changes.
File renamed without changes.
@@ -81,7 +81,7 @@ private function styles(array $parameters, bool $data_only)
$info = json_decode($style['info'], true);
$style_data['stylesheet'] = ($style['is_default']) ? 'stylesheet' : 'alternate stylesheet';
$style_data['style_id'] = $style['id'];
$style_data['stylesheet_url'] = $dotdot . STYLES_WEB_PATH . $info['directory'] . '/' . $info['main_file'];
$style_data['stylesheet_url'] = $dotdot . CUSTOM_STYLES_WEB_PATH . $info['directory'] . '/' . $info['main_file'];
$style_data['style_name'] = $info['name'];
$render_data[] = $style_data;
}
File renamed without changes.
@@ -68,8 +68,8 @@ public function render(array $parameters, bool $data_only)
$this->render_data['installed_list'][] = $set_data;
}

$ini_parser = new \Nelliel\INIParser($this->file_handler);
$icon_set_inis = $ini_parser->parseDirectories(ICON_SETS_WEB_PATH, 'icon_set_info.ini');
$front_end_data = new \Nelliel\FrontEndData($this->database);
$icon_set_inis = $front_end_data->getIconSetInis();
$bgclass = 'row1';

foreach ($icon_set_inis as $icon_set)
@@ -68,8 +68,8 @@ public function render(array $parameters, bool $data_only)
$this->render_data['installed_list'][] = $style_data;
}

$ini_parser = new \Nelliel\INIParser(new \Nelliel\FileHandler());
$style_inis = $ini_parser->parseDirectories(STYLES_WEB_PATH, 'style_info.ini');
$front_end_data = new \Nelliel\FrontEndData($this->database);
$style_inis = $front_end_data->getStyleInis();
$bgclass = 'row1';

foreach ($style_inis as $style)
@@ -64,8 +64,8 @@ public function render(array $parameters, bool $data_only)
$this->render_data['installed_list'][] = $template_data;
}

$ini_parser = new \Nelliel\INIParser($this->file_handler);
$template_inis = $ini_parser->parseDirectories(TEMPLATES_FILE_PATH, 'template_info.ini');
$front_end_data = new \Nelliel\FrontEndData($this->database);
$template_inis = $front_end_data->getTemplateInis();
$bgclass = 'row1';

foreach ($template_inis as $template)
@@ -75,7 +75,7 @@ public function render(array $parameters, bool $data_only)