<?php
-if (version_compare(PHP_VERSION, '8.0.0', '<'))
-{
- die("This webserver is using PHP version ".PHP_VERSION." but we require at least PHP 8.0.0.<br>".
- "If you already installed PHP8 but are still seeing this error, then it means ".
- "apache/nginx/.. is loading an older PHP version. Eg. on Debian/Ubuntu you need ".
- "<code>apt-get install libapache2-mod-php8.2</code> (or a similar version) and ".
- "<code>apt-get remove libapache2-mod-php7.4</code> (or a similar version). ".
- "You may also need to choose again the PHP module to load in apache via <code>a2enmod php8.2</code>");
+if (ini_get('output_buffering') == true) {
+ ini_set('output_buffering', 'off');
+}
+if (ini_get('zlib.output_compression') == true) {
+ ini_set('zlib.output_compression', 'off');
}
-$loaded_extensions = get_loaded_extensions();
-if (!in_array("mbstring", $loaded_extensions))
+function check_requirements()
{
- die("The PHP module 'mbstrings' need to be loaded. ".
- "You need to install the php-mbstring package and restart the webserver.<br>".
- "If you are on Debian/Ubuntu then run <code>apt-get install php-mbstring</code> ".
- "and restart your webserver (apache2/nginx/..).");
+ if (version_compare(PHP_VERSION, '8.0.0', '<'))
+ {
+ die("This webserver is using PHP version ".PHP_VERSION." but we require at least PHP 8.0.0.<br>".
+ "If you already installed PHP8 but are still seeing this error, then it means ".
+ "apache/nginx/.. is loading an older PHP version. Eg. on Debian/Ubuntu you need ".
+ "<code>apt-get install libapache2-mod-php8.2</code> (or a similar version) and ".
+ "<code>apt-get remove libapache2-mod-php7.4</code> (or a similar version). ".
+ "You may also need to choose again the PHP module to load in apache via <code>a2enmod php8.2</code>");
+ }
+
+ $loaded_extensions = get_loaded_extensions();
+ $required_extensions = ["mbstring", "sodium"];
+ $missing_extensions = [];
+ foreach ($required_extensions as $mod)
+ if (!in_array($mod, $loaded_extensions))
+ $missing_extensions[] = $mod;
+
+ if (count($missing_extensions) > 0)
+ {
+ $text = "<html>The following PHP module(s) need to be loaded:<br>\n<ul>\n";
+ $cmd = 'apt-get install';
+ foreach($missing_extensions as $mod)
+ {
+ $text .= "<li>$mod</li>\n";
+ $cmd .= " php-$mod";
+ }
+ $text .= "</ul>\n";
+ $text .= "You need to install/enable these PHP packages and restart the webserver.<br>".
+ "If you are on Debian/Ubuntu then run <code>$cmd</code> ".
+ "and restart your webserver (eg: <code>systemctl restart apache2</code> for apache).";
+ die($text);
+ }
}
+check_requirements(); /* very early !! */
+
define('UPATH', dirname(__DIR__));
function get_config($setting)
function page_requires_no_config()
{
if (str_ends_with($_SERVER['SCRIPT_FILENAME'],"install.php") ||
- str_ends_with($_SERVER['SCRIPT_FILENAME'],"installation.php"))
+ str_ends_with($_SERVER['SCRIPT_FILENAME'],"installation.php"))
{
return TRUE;
}
function page_requires_no_login()
{
if (str_ends_with($_SERVER['SCRIPT_FILENAME'],"login/index.php") ||
- page_requires_no_config())
+ page_requires_no_config())
{
return TRUE;
}
function config_is_file_item($name)
{
if (($name == "plugins") ||
- ($name == "mysql") ||
- ($name == "base_url") ||
- ($name == "secrets"))
+ ($name == "mysql") ||
+ ($name == "base_url") ||
+ ($name == "secrets"))
{
return true;
}
if ($str === null)
die("Error while running write_config_file() -- weird!");
if (!fwrite($fd, "<?php\n".
- "/* This config file is written automatically by the UnrealIRCd webpanel.\n".
- " * You are not really supposed to edit it manually.\n".
- " */\n".
- '$config = '.$str.";\n"))
+ "/* This config file is written automatically by the UnrealIRCd webpanel.\n".
+ " * You are not really supposed to edit it manually.\n".
+ " */\n".
+ '$config = '.$str.";\n"))
{
die("Error writing to config file $tmpfile (on fwrite).<br>");
}
/* Otherwise write the whole config.
* TODO: avoid writing settings file if unneeded,
- * as it is more noisy than db settings.
+ * as it is more noisy than db settings.
*/
$db_settings = [];
}
/* - encrypting rpc_password */
if (isset($config['unrealircd']) &&
- isset($config['unrealircd']['rpc_password']) &&
- !str_starts_with($config['unrealircd']['rpc_password'], "secret:"))
+ isset($config['unrealircd']['rpc_password']) &&
+ !str_starts_with($config['unrealircd']['rpc_password'], "secret:"))
{
$ret = secret_encrypt($config['unrealircd']['rpc_password']);
if ($ret !== false)
require_once UPATH . "/Classes/class-message.php";
require_once UPATH . "/Classes/class-rpc.php";
require_once UPATH . "/Classes/class-paneluser.php";
-require_once UPATH . "/plugins.php";
+require_once UPATH . "/Classes/class-notes.php";
+require_once UPATH . "/Classes/class-plugins.php";
/* Do various checks and reading, except during setup step 1. */
if (!page_requires_no_config())
}
$pages = [
- "Overview" => ["script"=>""],
- "Users" => ["script"=>"users/index.php"],
- "Channels" => ["script"=>"channels/index.php"],
- "Servers" => ["script"=>"servers/index.php"],
+ "Overview" => ["script"=>""],
+ "Users" => ["script"=>"users/index.php"],
+ "Channels" => ["script"=>"channels/index.php"],
+ "Servers" => ["script"=>"servers/index.php"],
"Server Bans" => [
"Server Bans" => ["script" => "server-bans/index.php"],
"Name Bans" => ["script" => "server-bans/name-bans.php"],
"Ban Exceptions" => ["script" => "server-bans/ban-exceptions.php"],
],
- "Spamfilter" => ["script" => "spamfilter.php"],
+ "Spamfilter" => ["script" => "server-bans/spamfilter.php"],
"Logs" => ["script" => "logs/index.php"],
"Tools" => [
"IP WHOIS" => ["script" => "tools/ip-whois.php","no_irc_server_required"=>true],
],
"Settings" => [
- "Plugins" => ["script" => "settings/plugins.php","no_irc_server_required"=>true],
+ "General Settings" => ["script" => "settings/general.php"],
"RPC Servers" => ["script" => "settings/rpc-servers.php","no_irc_server_required"=>true],
],
-
- "News" => ["script" => "news.php","no_irc_server_required"=>true],
];
+
if (!panel_start_session())
{
if (!page_requires_no_login())
"no_irc_server_required"=>true
];
}
+ if (current_user_can(PERMISSION_MANAGE_PLUGINS))
+ {
+ $pages["Settings"]["Plugins"] = ["script" => "settings/plugins.php"];
+ }
$user = unreal_get_current_user();
if ($user)
{
*/
$current_page = get_current_page($current_page_name);
+
+
+global $rightClickMenu;
+$rightClickMenu = [
+ [
+ "text" => "Copy",
+ "onclick" => "copy_to_clipboard(window.getSelection().toString())",
+ "icon" => "fa-clipboard"
+ ],
+ [
+ "text" => "Paste",
+ "onclick" => "paste_from_clipboard()",
+ "icon" => "fa-paint-brush",
+ ],
+];
+
+// register our menu
+Hook::run(HOOKTYPE_RIGHTCLICK_MENU, $rightClickMenu);