From 6da1c5674ce55be506f00e6871453ad4d98ac6f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz>
Date: Mon, 3 Oct 2022 22:11:33 +0200
Subject: [PATCH] Vypnuti reauth ACP

---
 .gitlab-ci.yml                                |  2 +-
 phpbb/adm/index.php                           | 90 +++++++++++++++++++
 .../{pirati => pirates}/pirid/composer.json   |  0
 .../pirid/config/services.yml                 |  0
 .../pirid/language/cs/acp/common.php          |  0
 .../pirid/language/cs/common.php              |  0
 .../pirid/language/en/acp/common.php          |  0
 .../pirid/language/en/common.php              |  0
 .../ext/{pirati => pirates}/pirid/pirati.php  |  0
 .../styles/prosilver/template/login_body.html | 38 --------
 10 files changed, 91 insertions(+), 39 deletions(-)
 create mode 100644 phpbb/adm/index.php
 rename phpbb/ext/{pirati => pirates}/pirid/composer.json (100%)
 rename phpbb/ext/{pirati => pirates}/pirid/config/services.yml (100%)
 rename phpbb/ext/{pirati => pirates}/pirid/language/cs/acp/common.php (100%)
 rename phpbb/ext/{pirati => pirates}/pirid/language/cs/common.php (100%)
 rename phpbb/ext/{pirati => pirates}/pirid/language/en/acp/common.php (100%)
 rename phpbb/ext/{pirati => pirates}/pirid/language/en/common.php (100%)
 rename phpbb/ext/{pirati => pirates}/pirid/pirati.php (100%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 00e6dcf..e80bd16 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ image: docker:20.10.9
 
 variables:
   DOCKER_TLS_CERTDIR: "/certs"
-  BUILD_VERSION: p1
+  BUILD_VERSION: p2
 
 services:
   - docker:20.10.9-dind
diff --git a/phpbb/adm/index.php b/phpbb/adm/index.php
new file mode 100644
index 0000000..1b8b55b
--- /dev/null
+++ b/phpbb/adm/index.php
@@ -0,0 +1,90 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+/**
+*/
+define('IN_PHPBB', true);
+define('ADMIN_START', true);
+define('NEED_SID', true);
+
+// Include files
+$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
+$phpEx = substr(strrchr(__FILE__, '.'), 1);
+require($phpbb_root_path . 'common.' . $phpEx);
+require($phpbb_root_path . 'includes/functions_acp.' . $phpEx);
+require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
+require($phpbb_root_path . 'includes/functions_module.' . $phpEx);
+
+// Start session management
+$user->session_begin();
+$auth->acl($user->data);
+$user->setup('acp/common');
+// End session management
+
+// Have they authenticated (again) as an admin for this session?
+if (!isset($user->data['session_admin']) || !$user->data['session_admin'])
+{
+//	login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
+}
+
+// Is user any type of admin? No, then stop here, each script needs to
+// check specific permissions but this is a catchall
+if (!$auth->acl_get('a_'))
+{
+	send_status_line(403, 'Forbidden');
+	trigger_error('NO_ADMIN');
+}
+
+// We define the admin variables now, because the user is now able to use the admin related features...
+define('IN_ADMIN', true);
+
+// Some oft used variables
+$file_uploads	= (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_uploads')) === 'on') ? true : false;
+$module_id		= $request->variable('i', '');
+$mode			= $request->variable('mode', '');
+
+// Set custom style for admin area
+$template->set_custom_style(array(
+	array(
+		'name' 		=> 'adm',
+		'ext_path' 	=> 'adm/style/',
+	),
+), $phpbb_admin_path . 'style');
+
+$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
+$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
+
+// Instantiate new module
+$module = new p_master();
+
+// Instantiate module system and generate list of available modules
+$module->list_modules('acp');
+
+// Select the active module
+$module->set_active($module_id, $mode);
+
+// Assign data to the template engine for the list of modules
+// We do this before loading the active module for correct menu display in trigger_error
+$module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.$phpEx"));
+
+// Load and execute the relevant module
+$module->load_active();
+
+// Generate the page
+adm_page_header($module->get_page_title());
+
+$template->set_filenames(array(
+	'body' => $module->get_tpl_name(),
+));
+
+adm_page_footer();
diff --git a/phpbb/ext/pirati/pirid/composer.json b/phpbb/ext/pirates/pirid/composer.json
similarity index 100%
rename from phpbb/ext/pirati/pirid/composer.json
rename to phpbb/ext/pirates/pirid/composer.json
diff --git a/phpbb/ext/pirati/pirid/config/services.yml b/phpbb/ext/pirates/pirid/config/services.yml
similarity index 100%
rename from phpbb/ext/pirati/pirid/config/services.yml
rename to phpbb/ext/pirates/pirid/config/services.yml
diff --git a/phpbb/ext/pirati/pirid/language/cs/acp/common.php b/phpbb/ext/pirates/pirid/language/cs/acp/common.php
similarity index 100%
rename from phpbb/ext/pirati/pirid/language/cs/acp/common.php
rename to phpbb/ext/pirates/pirid/language/cs/acp/common.php
diff --git a/phpbb/ext/pirati/pirid/language/cs/common.php b/phpbb/ext/pirates/pirid/language/cs/common.php
similarity index 100%
rename from phpbb/ext/pirati/pirid/language/cs/common.php
rename to phpbb/ext/pirates/pirid/language/cs/common.php
diff --git a/phpbb/ext/pirati/pirid/language/en/acp/common.php b/phpbb/ext/pirates/pirid/language/en/acp/common.php
similarity index 100%
rename from phpbb/ext/pirati/pirid/language/en/acp/common.php
rename to phpbb/ext/pirates/pirid/language/en/acp/common.php
diff --git a/phpbb/ext/pirati/pirid/language/en/common.php b/phpbb/ext/pirates/pirid/language/en/common.php
similarity index 100%
rename from phpbb/ext/pirati/pirid/language/en/common.php
rename to phpbb/ext/pirates/pirid/language/en/common.php
diff --git a/phpbb/ext/pirati/pirid/pirati.php b/phpbb/ext/pirates/pirid/pirati.php
similarity index 100%
rename from phpbb/ext/pirati/pirid/pirati.php
rename to phpbb/ext/pirates/pirid/pirati.php
diff --git a/phpbb/styles/prosilver/template/login_body.html b/phpbb/styles/prosilver/template/login_body.html
index 09826a7..4de7bf0 100644
--- a/phpbb/styles/prosilver/template/login_body.html
+++ b/phpbb/styles/prosilver/template/login_body.html
@@ -6,44 +6,6 @@
 
 	<div class="content">
 		<h2 class="login-title"><!-- IF LOGIN_EXPLAIN -->{LOGIN_EXPLAIN}<!-- ELSE -->{L_LOGIN}<!-- ENDIF --></h2>
-
-		<fieldset <!-- IF not S_CONFIRM_CODE -->class="fields1"<!-- ELSE -->class="fields2"<!-- ENDIF -->>
-		<!-- IF LOGIN_ERROR --><div class="error">{LOGIN_ERROR}</div><!-- ENDIF -->
-		<dl>
-			<dt><label for="{USERNAME_CREDENTIAL}">{L_USERNAME}{L_COLON}</label></dt>
-			<dd><input type="text" tabindex="1" name="{USERNAME_CREDENTIAL}" id="{USERNAME_CREDENTIAL}" size="25" value="{USERNAME}" class="inputbox autowidth" /></dd>
-		</dl>
-		<dl>
-			<dt><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></dt>
-			<dd><input type="password" tabindex="2" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" autocomplete="off" /></dd>
-			<!-- IF S_DISPLAY_FULL_LOGIN and (U_SEND_PASSWORD or U_RESEND_ACTIVATION) -->
-				<!-- IF U_RESEND_ACTIVATION --><dd><a href="{U_RESEND_ACTIVATION}">{L_RESEND_ACTIVATION}</a></dd><!-- ENDIF -->
-			<!-- ENDIF -->
-		</dl>
-		<!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
-			<!-- DEFINE $CAPTCHA_TAB_INDEX = 3 -->
-			<!-- INCLUDE {CAPTCHA_TEMPLATE} -->
-		<!-- ENDIF -->
-		<!-- IF S_DISPLAY_FULL_LOGIN -->
-		<dl>
-			<!-- IF S_AUTOLOGIN_ENABLED --><dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="4" /> {L_LOG_ME_IN}</label></dd><!-- ENDIF -->
-			<dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="5" /> {L_HIDE_ME}</label></dd>
-		</dl>
-		<!-- ENDIF -->
-
-		{S_LOGIN_REDIRECT}
-		{S_FORM_TOKEN_LOGIN}
-		<dl>
-			<dt>&nbsp;</dt>
-			<dd>{S_HIDDEN_FIELDS}<input type="submit" name="login" tabindex="6" value="{L_LOGIN}" class="button1" /></dd>
-		</dl>
-		</fieldset>
-		<!-- IF not U_SEND_PASSWORD -->
-			<p>V rámci technologického upgradu pirátské infrastruktury lze reset zapomenutého hesla provést pouze na adrese <a href="https://auth.pirati.cz">https://auth.pirati.cz</a>. Využijte možnost "Zapomenuté heslo?", zadejte vaše uživatelské jméno z fóra nebo e-mail z fóra. Následně obdržíte e-mail s instrukcemi pro změnu hesla.</p>
-			<p>Hesla se mezi "Pirátskou identitou" a Fórem synchronizují jednou za 10 minut.</p>
-			<p>Pro změnu registračního e-mailu využijte editaci profilu na <a href="https://auth.pirati.cz/auth/realms/pirati/account/">https://auth.pirati.cz/auth/realms/pirati/account/</a>, pro změnu či vytvoření kontaktní adresy můžete využít editaci profilu na <a href="https://nalodeni.pirati.cz">https://nalodeni.pirati.cz</a>, kam se lze přihlásit pomocí "Pirátské identity".</p>
-			<p>Pozn.: jako registrační e-mailovou adresu na Pirátské identitě není možné používat adresu ve tvaru @pirati.cz.</p>
-		<!-- ENDIF -->
 	</div>
 
 	<!-- IF not S_ADMIN_AUTH and PROVIDER_TEMPLATE_FILE -->
-- 
GitLab