Compare commits
27 Commits
epic-anmel
...
developmen
Author | SHA1 | Date | |
---|---|---|---|
64a5dbf74b | |||
ad0585180e | |||
3983108048 | |||
4c95333c05 | |||
3cbb6415b6 | |||
9318732f07 | |||
574f670ee0 | |||
073c167746 | |||
bca4f2639b | |||
f7ca614b38 | |||
ca02db7b28 | |||
da63fe3b3c | |||
138b3859aa | |||
f9238eef72 | |||
e7fe409ae5 | |||
a424a4e6e5 | |||
aeddfbd339 | |||
5b6b06e70d | |||
33287c4b40 | |||
923d76c085 | |||
5e107d36ca | |||
19a10e5704 | |||
b9307c2f5a | |||
c7b3072e59 | |||
b0c576bad3 | |||
30375476cc | |||
943e8dc273 |
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if (!isset($argv[1])) {
|
||||
die('No version set, please use ' . PHP_EOL .'make setup version=' . PHP_EOL);
|
||||
die('No version set, please use ' . PHP_EOL .'make deploy version=' . PHP_EOL);
|
||||
}
|
||||
$file = file_get_contents(dirname(__FILE__) . '/info.json.tpl');
|
||||
$file = str_replace('%version%', $argv[1], $file);
|
||||
|
@ -6,7 +6,7 @@
|
||||
"version": "4.3.2",
|
||||
"download_url": "http://lv-sachsen-main.bdp.mein-verein.online/wordpress/bdp-kompass-4.3.2.zip",
|
||||
"requires": "6.0",
|
||||
"tested": "6.5",
|
||||
"tested": "6.7",
|
||||
"requires_php": "8.2",
|
||||
"last_updated": "02.03.2024 16:24:00",
|
||||
"sections": {
|
||||
|
@ -6,7 +6,7 @@
|
||||
"version": "%version%",
|
||||
"download_url": "http://lv-sachsen-main.bdp.mein-verein.online/wordpress/bdp-kompass-%version%.zip",
|
||||
"requires": "6.0",
|
||||
"tested": "6.5",
|
||||
"tested": "6.7",
|
||||
"requires_php": "8.2",
|
||||
"last_updated": "%date%",
|
||||
"sections": {
|
||||
|
175
assets/mareike.css
Normal file
175
assets/mareike.css
Normal file
@ -0,0 +1,175 @@
|
||||
/* Allgemeine Anpassungen */
|
||||
body {
|
||||
--ame-ms-menu-width: 250px;
|
||||
}
|
||||
|
||||
#wpwrap {
|
||||
background-color: #f3f3f1; /* Hintergrundfarbe angepasst */
|
||||
}
|
||||
|
||||
/* Admin Menü */
|
||||
#adminmenuback, #adminmenuwrap, #adminmenu {
|
||||
width: 250px;
|
||||
background-color: #ffffff; /* Hintergrundfarbe angepasst */
|
||||
}
|
||||
|
||||
#adminmenu .wp-has-current-submenu > .wp-submenu {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#wpcontent, #wpfooter {
|
||||
margin-left: 250px;
|
||||
background-color: #ffffff;
|
||||
padding-left: 20px; /* Padding reduziert */
|
||||
}
|
||||
|
||||
#adminmenu .wp-not-current-submenu .wp-submenu, .folded #adminmenu .wp-has-current-submenu .wp-submenu, #adminmenu .ame-has-deep-submenu:not(.ame-has-highlighted-item) > .wp-submenu {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
/* Menüelemente */
|
||||
#adminmenu > li {
|
||||
padding: 10px 10px; /* Padding angepasst */
|
||||
font-weight: bold; /* Schriftstärke angepasst */
|
||||
}
|
||||
|
||||
#adminmenu > li a {
|
||||
color: #333; /* Textfarbe angepasst */
|
||||
}
|
||||
|
||||
#adminmenu > li div.wp-menu-image:before {
|
||||
color: #333; /* Iconfarbe angepasst */
|
||||
}
|
||||
|
||||
#adminmenu > li a:hover, #adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
color: #0056b3; /* Textfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
#adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
background-color: #e9ecef; /* Hintergrundfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
#adminmenu .wp-submenu, #adminmenu .wp-submenu a {
|
||||
background-color: #f8f9fa; /* Untermenü-Hintergrundfarbe angepasst */
|
||||
color: #333; /* Untermenü-Textfarbe angepasst */
|
||||
}
|
||||
|
||||
#adminmenu .wp-submenu a:hover {
|
||||
background-color: #e9ecef; /* Untermenü-Hintergrundfarbe bei Hover angepasst */
|
||||
color: #0056b3; /* Untermenü-Textfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
/* Admin Bar */
|
||||
#wpadminbar {
|
||||
background-color: #ffffff; /* Admin Bar Hintergrundfarbe angepasst */
|
||||
color: #0056b3; /* Admin Bar Textfarbe angepasst */
|
||||
}
|
||||
|
||||
#wpadminbar .ab-item, #wpadminbar a.ab-item, #wpadminbar > #wp-toolbar span.ab-label, #wpadminbar > #wp-toolbar span.noticon {
|
||||
color: #0056b3; /* Admin Bar Textfarbe angepasst */
|
||||
}
|
||||
|
||||
#wpadminbar .ab-icon, #wpadminbar .ab-icon:before, #wpadminbar .ab-item:before, #wpadminbar .ab-item:after {
|
||||
color: #0056b3; /* Admin Bar Icon-Farbe angepasst */
|
||||
}
|
||||
|
||||
#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item, #wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus, #wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus, #wpadminbar.nojs .ab-top-menu > li.menupop:hover > .ab-item, #wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
|
||||
background-color: #e9ecef; /* Admin Bar Hintergrundfarbe bei Hover angepasst */
|
||||
color: #0056b3; /* Admin Bar Textfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
#wpadminbar .quicklinks .menupop ul li a:hover, #wpadminbar .quicklinks .menupop ul li a:focus {
|
||||
background-color: #e9ecef; /* Untermenü Hintergrundfarbe bei Hover angepasst */
|
||||
color: #0056b3; /* Untermenü Textfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.button-primary {
|
||||
border-style: none;
|
||||
background-color: #0056b3 !important; /* Button Hintergrundfarbe angepasst */
|
||||
color: #ffffff !important; /* Button Textfarbe angepasst */
|
||||
box-shadow: none; /* Box-Shadow entfernt */
|
||||
}
|
||||
|
||||
.button-primary:hover {
|
||||
background-color: #004085 !important; /* Button Hintergrundfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
/* Anpassungen für Bildschirme mit unterschiedlichen Breiten */
|
||||
@media screen and (min-width: 783px) {
|
||||
#adminmenu .wp-not-current-submenu .wp-submenu {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 960px) and (min-width: 783px) {
|
||||
body.auto-fold #widgets-editor .interface-interface-skeleton {
|
||||
left: var(--ame-ms-collapsed-menu-width, 36px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Weitere Anpassungen */
|
||||
.nav-tab {
|
||||
border-color: #0056b3;
|
||||
background-color: #e9ecef;
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.about-wrap .nav-tab-active, .nav-tab-active, .nav-tab-active:hover {
|
||||
border-style: none;
|
||||
background-color: #ffffff;
|
||||
border-bottom-color: #ffffff;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Weitere spezifische Anpassungen */
|
||||
#collapse-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Spezielle Einstellungen Box */
|
||||
.bdp_setting_box {
|
||||
margin-right: 10px;
|
||||
background-color: #ffffff;
|
||||
padding: 15px;
|
||||
border: 1px solid #1d94cf;
|
||||
}
|
||||
|
||||
.bdp_setting_box label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bdp_setting_box label span {
|
||||
cursor: pointer;
|
||||
width: 10pt;
|
||||
color: #a0a0a0;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 783px) {
|
||||
.wp-has-current-submenu li a {
|
||||
width: 210px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-submenu li a:hover {
|
||||
background-color: #e9ecef !important;
|
||||
color: #0056b3 !important;
|
||||
}
|
||||
|
||||
.current .menu-top .wp-menu-name, .wp-has-current-submenu .wp-menu-name {
|
||||
background-color: #0056b3 !important;
|
||||
border-style: none !important;
|
||||
width: 202px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 783px) {
|
||||
.wp-submenu, .wp-submenu-wrap {
|
||||
background-color: #f8f9fa !important;
|
||||
width: 220px !important;
|
||||
}
|
||||
|
||||
#adminmenu .current .menu-top .wp-menu-name {
|
||||
padding: 10px;
|
||||
width: 225px !important;
|
||||
}
|
||||
}
|
@ -393,4 +393,14 @@ li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after,
|
||||
background-color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.bdp-newplugin-button:hover {
|
||||
color: #ffffff !important;
|
||||
background-color: #1d4899 !important;
|
||||
}
|
||||
|
||||
.bdp-newplugin-button {
|
||||
background-color: #ffffff !important;
|
||||
padding: 5px 20px !important;
|
||||
cursor: pointer !important;
|
||||
color: #1d4899 !important;
|
||||
}
|
||||
|
111
bdp-kompass.php
111
bdp-kompass.php
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Plugin Name: BdP Kompass
|
||||
* Description: Wordpress-Plugin zur Unterstützung von Stämmen im Bund der Pfadfinderinnen und Pfadfinder e.V. zur optimalen Verwaltung eurer Webseite
|
||||
* Version: 4.6.1
|
||||
* Version: 4.10.1
|
||||
* Tags: bdp, utility, helper
|
||||
* Requires at least: 6.0
|
||||
* Requires PHP: 8.2
|
||||
@ -13,12 +13,12 @@
|
||||
*/
|
||||
|
||||
use Bdp\Modules\EventParticipants\Controllers\MainController as EventsMain;
|
||||
use Bdp\Modules\Gruppen\Controllers\MainController as GruppenMain;
|
||||
use Bdp\Modules\KompassSettings\Controllers\SettingsPage as KomnpassSettings;
|
||||
use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as OptionsPageAlias;
|
||||
use Bdp\Modules\Mail\Controllers\MailController;
|
||||
use Bdp\Modules\Mail\Controllers\MailSettingsController;
|
||||
use Bdp\Modules\Security\Security;
|
||||
use Bdp\Modules\Seo\Seo;
|
||||
use ProtectLogin\Modules\LimitLoginAttempts\Controllers\LoginHandler;
|
||||
|
||||
require_once dirname(__FILE__) . '/includes/setup.php';
|
||||
|
||||
@ -31,11 +31,23 @@ function bdp_plugin_init() {
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
Security::ProhibitBots();
|
||||
Security::SetPageFilters();
|
||||
EventsMain::setup();
|
||||
|
||||
if (null == get_option('kompass_already_installed', null)) {
|
||||
if ( !file_exists( dirname( BDP_LV_STARTUP_FILE ) . '/../protect-login/protect-login.php' ) ) {
|
||||
$allowed_ips = get_option('kompass_limit_login_allowlist', []);
|
||||
$blocked_ips = get_option('kompass_limit_login_blocklist', []);
|
||||
$lockouts = get_option('protect_login_limit_login_lockouts', []);
|
||||
|
||||
kompass_install_plugin('https://downloads.wordpress.org/plugin/protect-login.latest-stable.zip', 'protect-login');
|
||||
|
||||
update_option('protect_login_limit_login_blocklist', $blocked_ips);
|
||||
update_option('protect_login_limit_login_allowlist', $allowed_ips);
|
||||
foreach ($lockouts as $address => $duration) {
|
||||
LoginHandler::lockout($address);
|
||||
}
|
||||
}
|
||||
|
||||
if (null == get_option('kompass_already_installed', null)) {
|
||||
Seo::setup();
|
||||
Calendar::setup();
|
||||
Security::setup();
|
||||
update_option('kompass_already_installed', true);
|
||||
wp_redirect( 'site-health.php?tab=bdp_enhanced_security');
|
||||
@ -46,35 +58,92 @@ function bdp_plugin_init() {
|
||||
|
||||
add_action('admin_menu', function () {
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
new OptionsPageAlias();
|
||||
new KomnpassSettings();
|
||||
new EventsMain();
|
||||
new MailController();
|
||||
|
||||
|
||||
|
||||
});
|
||||
add_action('wp_ajax_kompass_show_ajax', 'kompass_load_ajax_content');
|
||||
add_action('wp_ajax_nopriv_kompass_show_ajax', 'kompass_load_ajax_content');
|
||||
add_action('wp_ajax_bdp_kompass_show_ajax', 'bdp_kompass_load_ajax_content');
|
||||
add_action('wp_ajax_nopriv_bdp_kompass_show_ajax', 'bdp_kompass_load_ajax_content');
|
||||
|
||||
function register_custom_theme_directory() {
|
||||
$file = ABSPATH . '/wp-content/plugins/bdp-kompass/buena/' ;
|
||||
if (is_dir(ABSPATH . '/wp-content/themes/mareike-theme/')) {
|
||||
return;
|
||||
}
|
||||
$file = ABSPATH . '/wp-content/plugins/bdp-kompass/lib/mareike-theme/' ;
|
||||
|
||||
system('mkdir ' . ABSPATH . 'wp-content/themes/buena/');
|
||||
system('cp -r ' . $file . '* ' . ABSPATH . 'wp-content/themes/buena/');
|
||||
system('mkdir ' . ABSPATH . '/wp-content/themes/mareike-theme/');
|
||||
system('cp -r ' . $file . '* ' . ABSPATH . '/wp-content/themes/mareike-theme/');
|
||||
|
||||
switch_theme('buena');
|
||||
}
|
||||
|
||||
function enqueue_custom_password_js() {
|
||||
wp_enqueue_script( 'kompass-ajax', BDP_LV_PLUGIN_URL . '/assets/ajax.js');
|
||||
wp_enqueue_script( 'searchable-table', BDP_LV_PLUGIN_URL . '/assets/searchtable.js');
|
||||
wp_enqueue_script( 'custom-password-js', BDP_LV_PLUGIN_URL . 'assets/password.js');
|
||||
wp_localize_script( 'custom-password-js', 'php_vars', [
|
||||
'allowed_strengths' => kompass_get_minimal_password_strength(),
|
||||
'password_too_short_text' => 'Dass Passwort entspricht nicht den Anforderungen.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
add_action( 'after_setup_theme', 'kompass_after_setup_theme' );
|
||||
|
||||
add_action( 'admin_menu', ['Bdp\Modules\KompassSettings\Controllers\SettingsPage', 'add_menu'] );
|
||||
|
||||
|
||||
|
||||
function crp_custom_register_form() {
|
||||
|
||||
}
|
||||
add_action('register_form', ['Bdp\Modules\Registration\Controllers\ExtendRegistrationForm', 'execute']);
|
||||
|
||||
// Validate registration form fields
|
||||
add_filter('registration_errors', ['Bdp\Modules\Registration\Controllers\ExtendRegistrationForm', 'error_messages'], 10, 3);
|
||||
|
||||
// Save custom user meta data
|
||||
add_action('user_register', ['\Bdp\Modules\Registration\Controllers\SaveRegistration', 'execute']);
|
||||
|
||||
// Handle account activation
|
||||
|
||||
add_action('init', ['Bdp\Modules\Registration\Controllers\SaveRegistration', 'activate_user']);
|
||||
|
||||
// Prevent login if account is not activated
|
||||
|
||||
add_filter('authenticate', ['Bdp\Modules\Registration\Controllers\SaveRegistration', 'check_user_activation'], 30, 3);
|
||||
|
||||
function crp_allow_umlauts_in_usernames($username, $raw_username, $strict) {
|
||||
if (!$strict) {
|
||||
return $username;
|
||||
}
|
||||
|
||||
// Allow letters, numbers, underscores, spaces, periods, hyphens, and umlauts
|
||||
$username = preg_replace('/[^a-zA-Z0-9 _.\-äöüÄÖÜß]/', '', $raw_username);
|
||||
|
||||
return $username;
|
||||
}
|
||||
add_filter('sanitize_user', 'crp_allow_umlauts_in_usernames', 10, 3);
|
||||
|
||||
|
||||
add_action('login_message', ['Bdp\Modules\Registration\Controllers\SaveRegistration','display_custom_message']);
|
||||
|
||||
if (false === (bool)get_option('user_can_register', false)) {
|
||||
|
||||
add_filter('registration_errors', 'kompass_disable_user_registration', 10, 3);
|
||||
|
||||
function kompass_disable_user_registration($errors, $sanitized_user_login, $user_email) {
|
||||
$errors->add('registration_disabled', __('Die Registrierung ist derzeit deaktiviert.'));
|
||||
return $errors;
|
||||
}
|
||||
|
||||
add_action('login_enqueue_scripts', 'kompass_remove_register_link');
|
||||
|
||||
function kompass_remove_register_link() {
|
||||
?>
|
||||
<style>
|
||||
#registerform {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
MailSettingsController::set_smtp_if_required();
|
||||
|
||||
|
||||
|
33
changelog
33
changelog
@ -1,3 +1,36 @@
|
||||
<h4>Version 4.10.1</h4>
|
||||
<ul>
|
||||
<li>Replaced IP blocking by "Protect Login"</li>
|
||||
<li>Replaced login redirecting by "WPS Hide login"</li>
|
||||
<li>Prepared to update new kompass Version</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.8.3</h4>
|
||||
<ul>
|
||||
<li>Bugfix</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.8.2</h4>
|
||||
<ul>
|
||||
<li>Added Control element for manual cronjobs</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.8.1</h4>
|
||||
<ul>
|
||||
<li>Handling of deprecated components</h4>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.6.2</h4>
|
||||
<ul>
|
||||
<li>Bugfixes</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h4>Version 4.6.1</h4>
|
||||
<ul>
|
||||
<li>Veranstaltungsanmeldungen</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.9</h4>
|
||||
<ul>
|
||||
<li>Fehlerbehebung</li>
|
||||
|
@ -1,26 +1,11 @@
|
||||
<?php
|
||||
|
||||
if (!isset($loginHandler)) {
|
||||
$loginHandler = new \Bdp\Modules\LimitLoginAttempts\Controllers\LoginHandler();
|
||||
}
|
||||
|
||||
add_action('wp_login_failed', [$loginHandler, 'onFailedLogin']);
|
||||
add_filter('wp_authenticate_user', [$loginHandler, 'onSuccessFullLogin'], 99999, 2);
|
||||
add_filter( 'admin_enqueue_scripts', 'enqueue_custom_password_js',10 );
|
||||
|
||||
add_action('admin_init', 'kompass_admin_init');
|
||||
|
||||
if (get_option('kompass_cookies', false)) {
|
||||
$loginHandler->handleCookies();
|
||||
add_action('auth_cookie_bad_username', [$loginHandler, 'checkFailedCookies']);
|
||||
add_action('auth_cookie_valid', [$loginHandler, 'onValidCookie'], 10, 2);
|
||||
}
|
||||
|
||||
if (isset($_POST['save_kompass_balist_list_type'])) {
|
||||
updateBlockOrAllowList($_POST);
|
||||
}
|
||||
|
||||
function add_custom_admin_bar_item() {
|
||||
return;
|
||||
global $wp_admin_bar;
|
||||
|
||||
// Überprüfen, ob der Benutzer die erforderliche Berechtigung hat
|
||||
|
@ -4,161 +4,67 @@ add_action('admin_enqueue_scripts', 'bdp_update_dashboard_style');
|
||||
add_action('login_enqueue_scripts', 'bdp_update_login_style');
|
||||
|
||||
function bdp_update_login_style() {
|
||||
$css = file_get_contents(BDP_LV_PLUGIN_DIR . 'assets/dashboard.style.css.tpl');
|
||||
echo str_replace('%%BDP_LV_PLUGIN_URL%%', BDP_LV_PLUGIN_URL, $css);
|
||||
if (false === (bool)get_option( 'use_mareike_theme', false )) {
|
||||
$css = file_get_contents( BDP_LV_PLUGIN_DIR . 'assets/dashboard.style.css.tpl' );
|
||||
echo str_replace( '%%BDP_LV_PLUGIN_URL%%', BDP_LV_PLUGIN_URL, $css );
|
||||
}
|
||||
}
|
||||
|
||||
function bdp_update_dashboard_style() {
|
||||
wp_enqueue_style('custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css');
|
||||
if (true === (bool)get_option( 'use_mareike_theme', false )) {
|
||||
#wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/mareike.css' );
|
||||
wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css' );
|
||||
} else {
|
||||
wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css' );
|
||||
}
|
||||
wp_enqueue_style('custom-calendar-styles', BDP_LV_PLUGIN_URL . '/assets/calendar.css');
|
||||
wp_enqueue_style('custom-security-styles', BDP_LV_PLUGIN_URL . '/assets/security.css');
|
||||
}
|
||||
|
||||
function kompass_install_plugin($url, $slug) {
|
||||
// Überprüfen, ob die URL gültig ist
|
||||
if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
|
||||
echo 'Ungültige URL';
|
||||
return;
|
||||
}
|
||||
|
||||
function bdp_add_menu_security() {
|
||||
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
|
||||
}
|
||||
// Dateinamen und Pfad festlegen
|
||||
$tmp_file = download_url($url);
|
||||
|
||||
function bdp_add_menu_contents() {
|
||||
add_menu_page('Seiten',
|
||||
'Inhalte',
|
||||
'edit_posts',
|
||||
'edit.php?post_type=page',
|
||||
'',
|
||||
'dashicons-format-aside',
|
||||
4
|
||||
);
|
||||
// Überprüfen, ob der Download erfolgreich war
|
||||
if (is_wp_error($tmp_file)) {
|
||||
echo 'Download-Fehler: ' . $tmp_file->get_error_message();
|
||||
return;
|
||||
}
|
||||
|
||||
add_submenu_page('edit.php?post_type=page',
|
||||
'media',
|
||||
'Medienverwaltung',
|
||||
'edit_posts',
|
||||
'upload.php'
|
||||
);
|
||||
// Pfad des Plugins
|
||||
$plugin_folder = WP_PLUGIN_DIR;
|
||||
|
||||
add_submenu_page('edit.php?post_type=page',
|
||||
'comments',
|
||||
'Kommentare',
|
||||
'edit_posts',
|
||||
'edit-comments.php'
|
||||
);
|
||||
// Plugin Upgrader Klassen einbinden
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/misc.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
|
||||
|
||||
add_submenu_page('edit.php?post_type=page',
|
||||
'Beiträge',
|
||||
'Beiträge',
|
||||
'edit_posts',
|
||||
'edit.php'
|
||||
);
|
||||
// Plugin upgrader initialisieren
|
||||
$upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin());
|
||||
|
||||
// Plugin installieren
|
||||
$result = $upgrader->install($tmp_file);
|
||||
|
||||
// Temp Datei löschen
|
||||
unlink($tmp_file);
|
||||
activate_plugin($slug . '/' . $slug . '.php' );
|
||||
|
||||
|
||||
// Überprüfen, ob die Installation erfolgreich war
|
||||
if (is_wp_error($result)) {
|
||||
echo 'Installations-Fehler: ' . $result->get_error_message();
|
||||
} else {
|
||||
echo 'Plugin erfolgreich installiert';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function bdp_add_menu_mein_lv() {
|
||||
$location = BDP_LV_PLUGIN_DIR . '/modules/';
|
||||
$mainSlug = $location . 'index.php';
|
||||
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
|
||||
|
||||
add_menu_page(
|
||||
'Mein BdP',
|
||||
'BdP',
|
||||
'show_bdp',
|
||||
$mainSlug,
|
||||
'',
|
||||
BDP_LV_PLUGIN_URL . '/icon.png',
|
||||
3
|
||||
);
|
||||
|
||||
add_submenu_page($mainSlug,
|
||||
'Über',
|
||||
'Über',
|
||||
'show_bdp',
|
||||
$moduleLoad . 'about'
|
||||
);
|
||||
}
|
||||
|
||||
function bdp_add_menu_setup() {
|
||||
add_menu_page(
|
||||
'Benutzer',
|
||||
'Benutzer-Verwaltung',
|
||||
'manage_options',
|
||||
'users.php',
|
||||
'',
|
||||
'dashicons-admin-users',
|
||||
6
|
||||
);
|
||||
|
||||
|
||||
add_menu_page(
|
||||
'Allgemeine Einstellungen',
|
||||
'Webseiten-Setup',
|
||||
'manage_options',
|
||||
'options-general.php',
|
||||
'',
|
||||
'dashicons-admin-generic',
|
||||
6
|
||||
);
|
||||
|
||||
add_submenu_page('options-general.php',
|
||||
'Design-Einstellungen',
|
||||
'Template bearbeiten',
|
||||
'manage_options',
|
||||
'customize.php?return=/wp-admin/'
|
||||
);
|
||||
|
||||
add_submenu_page('options-general.php',
|
||||
'plugins',
|
||||
'Erweiterungen',
|
||||
'manage_options',
|
||||
'plugins.php'
|
||||
);
|
||||
|
||||
|
||||
add_submenu_page('options-general.php',
|
||||
'themes',
|
||||
'Designs',
|
||||
'manage_options',
|
||||
'themes.php'
|
||||
);
|
||||
|
||||
|
||||
add_submenu_page('options-general.php',
|
||||
'Sicherheit',
|
||||
'Webseiten-Sicherheit',
|
||||
'manage_options',
|
||||
'site-health.php'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function bdp_cleanup_menu()
|
||||
{
|
||||
global $submenu;
|
||||
|
||||
remove_menu_page('edit-comments.php');
|
||||
remove_menu_page('edit.php');
|
||||
remove_menu_page('edit.php?post_type=page');
|
||||
remove_menu_page('upload.php');
|
||||
remove_menu_page('themes.php');
|
||||
remove_menu_page('plugins.php');
|
||||
remove_menu_page('options-general.php');
|
||||
remove_menu_page('users.php');
|
||||
remove_menu_page('tools.php');
|
||||
|
||||
bdp_add_menu_contents();
|
||||
bdp_add_menu_setup();
|
||||
bdp_add_menu_security();
|
||||
|
||||
|
||||
remove_submenu_page('edit.php?post_type=page','post-new.php?post_type=page');
|
||||
remove_submenu_page('users.php','user-new.php');
|
||||
remove_submenu_page('users.php','profile.php');
|
||||
|
||||
remove_submenu_page('edit.php','post-new.php');
|
||||
remove_submenu_page('edit.php','edit-tags.php?taxonomy=category');
|
||||
remove_submenu_page('edit.php','edit-tags.php?taxonomy=post_tag');
|
||||
}
|
||||
|
||||
function bdp_create_menu_structure()
|
||||
{
|
||||
add_action('admin_menu', 'bdp_cleanup_menu');
|
||||
bdp_add_menu_mein_lv();
|
||||
}
|
||||
|
@ -5,64 +5,38 @@
|
||||
remove_role( 'contributor' ); // Hier 'custom_role_slug' durch den tatsächlichen Slug der zu löschenden Rolle ersetzen
|
||||
remove_role( 'author' ); // Hier 'custom_role_slug' durch den tatsächlichen Slug der zu löschenden Rolle ersetzen
|
||||
remove_role( 'editor' ); // Hier 'custom_role_slug' durch den tatsächlichen Slug der zu löschenden Rolle ersetzen
|
||||
$capabilities = array(
|
||||
'read' => true, // Die Rolle kann Beiträge lesen
|
||||
'edit_posts' => true, // Die Rolle kann Beiträge bearbeiten
|
||||
'delete_posts' => true, // Die Rolle kann Beiträge löschen
|
||||
'publish_posts' => true, // Die Rolle kann Beiträge veröffentlichen
|
||||
// Weitere Berechtigungen können nach Bedarf hinzugefügt werden
|
||||
);
|
||||
|
||||
// Rolle hinzufügen
|
||||
add_role( 'stafue', 'Stammesführung', kompass_get_capa_stafue() );
|
||||
add_role( 'grufue', 'Gruppenführung', kompass_get_capa_grufue() );
|
||||
add_role( 'aktionsleitung', 'Aktionsleitung', kompass_get_capa_aktionsleitung() );
|
||||
$role = get_role( 'director' );
|
||||
if ( null === $role ) {
|
||||
add_role(
|
||||
'director',
|
||||
true === get_option( 'solea_used_for_state', false )
|
||||
? __( 'State director', 'mareike' )
|
||||
: __( 'Club director', 'mareike' ),
|
||||
kompass_get_capa_editor()
|
||||
);
|
||||
} else {
|
||||
$role = get_role( 'director' );
|
||||
foreach ( kompass_get_capa_editor() as $capability => $value ) {
|
||||
$role->add_cap( $capability );
|
||||
}
|
||||
}
|
||||
|
||||
add_role( 'author', 'Redakteur', kompass_get_capa_editor() );
|
||||
|
||||
$role = get_role( 'administrator' );
|
||||
foreach (kompass_get_capa_stafue() as $capability => $value) {
|
||||
$role->add_cap( $capability );
|
||||
$role = get_role( 'user' );
|
||||
if ( null === $role ) {
|
||||
add_role(
|
||||
'user',
|
||||
'Standardnutzer',
|
||||
array('read' => true)
|
||||
);
|
||||
} else {
|
||||
$role->add_cap( 'read' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function kompass_get_capa_stafue() : array
|
||||
{
|
||||
return array_merge(
|
||||
[
|
||||
'create_groups' => true,
|
||||
'delete_groups' => true,
|
||||
'edit_groups' => true,
|
||||
'delete_teilis' => true,
|
||||
'move_teilis' => true,
|
||||
'create_events' => true,
|
||||
], kompass_get_capa_aktionsleitung(), kompass_get_capa_grufue(), kompass_get_capa_editor());
|
||||
}
|
||||
|
||||
|
||||
|
||||
function kompass_get_capa_aktionsleitung() : array
|
||||
{
|
||||
return [
|
||||
'show_bdp' => true,
|
||||
'create_event_teilis' => true,
|
||||
'edit_event_teilis' => true,
|
||||
'delete_event_teilis' => true,
|
||||
'send_event_mails' => true,
|
||||
];
|
||||
}
|
||||
|
||||
function kompass_get_capa_grufue() : array
|
||||
{
|
||||
return [
|
||||
'show_bdp' => true,
|
||||
'show_groups' => true,
|
||||
'create_teilis' => true,
|
||||
'edit_teilis' => true,
|
||||
'send_mails' => true
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function kompass_get_capa_editor() : array
|
||||
{
|
||||
return [
|
||||
|
@ -1,9 +1,4 @@
|
||||
<?php
|
||||
|
||||
use Bdp\Modules\EventParticipants\Controllers\MemberSummaryController;
|
||||
use Bdp\Modules\EventParticipants\Controllers\PrintParticipantListPdfController;
|
||||
use Bdp\Modules\EventParticipants\Controllers\RegisterMemberController;
|
||||
use Bdp\Modules\LimitLoginAttempts\Controllers\LoginHandler;
|
||||
use Bdp\Libs\DatabaseHandler;
|
||||
|
||||
|
||||
@ -41,12 +36,8 @@ require_once (BDP_LV_PLUGIN_DIR . '/modules/security/security.php');
|
||||
$dbHandler = new DatabaseHandler();
|
||||
function kompass_admin_init()
|
||||
{
|
||||
kompass_settings_validators();
|
||||
}
|
||||
|
||||
bdp_create_menu_structure();
|
||||
|
||||
|
||||
function bdp_kompass_load_plugin_textdomain() {
|
||||
load_textdomain( BDP_LV_PLUGIN_SLUG, BDP_LV_PLUGIN_DIR . '/lang/' . BDP_LV_PLUGIN_SLUG . '-' . get_locale() . '.mo' );
|
||||
}
|
||||
@ -55,7 +46,7 @@ function bdp_kompass_load_plugin_textdomain() {
|
||||
function kompass_after_setup_theme()
|
||||
{
|
||||
setup_site_roles();
|
||||
#register_custom_theme_directory();
|
||||
register_custom_theme_directory();
|
||||
|
||||
}
|
||||
|
||||
@ -73,7 +64,7 @@ function kompass_get_age(string $birthday) : int {
|
||||
return $compare->y;
|
||||
}
|
||||
|
||||
function kompass_load_ajax_content() {
|
||||
function bdp_kompass_load_ajax_content() {
|
||||
$class = 'Bdp\\Modules\\' . $_REQUEST['module'] . '\\Controllers\\AjaxRouterController';
|
||||
if (!class_exists($class)) {
|
||||
wp_die('Invalid module call: Module=' . $_REQUEST['module']);
|
||||
@ -83,7 +74,7 @@ function kompass_load_ajax_content() {
|
||||
}
|
||||
|
||||
|
||||
$loginHandler = new LoginHandler();
|
||||
new BdpVersionChecker();
|
||||
|
||||
#add_filter( 'plugins_api', array( $class, 'info' ), 20, 3 );
|
||||
require_once dirname(__FILE__) . '/action_caller.php';
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
class BdpVersionChecker
|
||||
{
|
||||
public $plugin_slug;
|
||||
@ -10,7 +11,7 @@ class BdpVersionChecker
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$plugin_data = get_plugin_data( BDP_LV_STARTUP_FILE );
|
||||
$plugin_data = get_plugin_data( BDP_LV_STARTUP_FILE, true, false );
|
||||
$this->plugin_slug = BDP_LV_PLUGIN_SLUG;
|
||||
$this->updateUrl = $plugin_data['UpdateURI'] . '/info.json';
|
||||
$this->version = $plugin_data['Version'];
|
||||
|
@ -4,7 +4,7 @@ SET time_zone = "+00:00";
|
||||
|
||||
CREATE TABLE `%tablename%` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`EVENTiD` int NOT NULL,
|
||||
`eventID` int NOT NULL,
|
||||
`teilnahme` ENUM('participant','volunteer','other','') NOT NULL,
|
||||
`vorname` varchar(128) NOT NULL,
|
||||
`nachname` varchar(128) NOT NULL,
|
||||
|
BIN
lib/mareike-theme/assets/logo.png
Normal file
BIN
lib/mareike-theme/assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 KiB |
7
lib/mareike-theme/footer.php
Normal file
7
lib/mareike-theme/footer.php
Normal file
@ -0,0 +1,7 @@
|
||||
<footer class="footer">
|
||||
<p>© <?php echo date('Y'); ?> mareike powered by BdP Bund der Pfadfinderinnen und Pfadfinderrt - LV Sachsen e.V </p>
|
||||
</footer>
|
||||
</div><!-- .container -->
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
58
lib/mareike-theme/functions.php
Normal file
58
lib/mareike-theme/functions.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
function custom_theme_setup() {
|
||||
// Unterstützung für Menüs hinzufügen
|
||||
add_theme_support('menus');
|
||||
|
||||
// Menüpositionen registrieren
|
||||
register_nav_menus(array(
|
||||
'primary' => __('Primary Menu')
|
||||
));
|
||||
}
|
||||
add_action('after_setup_theme', 'custom_theme_setup');
|
||||
|
||||
// Theme Customizer anpassen
|
||||
function custom_customize_register($wp_customize) {
|
||||
$wp_customize->add_section('custom_nav_settings', array(
|
||||
'title' => __('Navigation Settings', 'custom-nav-theme'),
|
||||
'priority' => 30,
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('custom_nav_pages', array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'absint',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'custom_nav_pages', array(
|
||||
'label' => __('Select Pages for Navigation', 'custom-nav-theme'),
|
||||
'section' => 'custom_nav_settings',
|
||||
'settings' => 'custom_nav_pages',
|
||||
'type' => 'dropdown-pages',
|
||||
'multiple' => true,
|
||||
)));
|
||||
}
|
||||
|
||||
add_action( 'admin_enqueue_scripts', 'mareike_theme_setup' );
|
||||
add_action('customize_register', 'custom_customize_register');
|
||||
add_action('wp_enqueue_scripts', 'mein_child_theme_enqueue_styles');
|
||||
|
||||
function mein_child_theme_enqueue_styles() {
|
||||
wp_enqueue_style('registerform', get_template_directory_uri() . '/style.css');
|
||||
}
|
||||
|
||||
|
||||
|
||||
function mareike_theme_setup() {
|
||||
wp_enqueue_style( 'custom-dashboard-styles', get_template_directory_uri() . '/mareike.css' );
|
||||
}
|
||||
|
||||
|
||||
function custom_registration_form() {
|
||||
wp_enqueue_style('registerform', get_template_directory_uri() . '/style.css');
|
||||
}
|
||||
|
||||
function login_style() {
|
||||
wp_enqueue_style('registerform', get_template_directory_uri() . '/style.css');
|
||||
}
|
||||
|
||||
add_action('register_form', 'custom_registration_form');
|
||||
add_action('login_enqueue_scripts', 'login_style');
|
48
lib/mareike-theme/header.php
Normal file
48
lib/mareike-theme/header.php
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php wp_title(); ?></title>
|
||||
<?php wp_head(); ?>
|
||||
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>">
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
|
||||
<div class="container" <?php if(!is_user_logged_in()) echo 'style="position: relative; top: 30px !important;"'; ?>>
|
||||
<header class="header">
|
||||
<div>
|
||||
<img style="width:250px; height: 150px;" src="<?= get_template_directory_uri(); ?>/assets/logo.png" />
|
||||
</div>
|
||||
<div style="position: relative; top: 10px; width: 305px;">
|
||||
<?php
|
||||
if (is_user_logged_in()) {
|
||||
?>
|
||||
|
||||
<a href="<?php echo esc_url(admin_url('users.php?page=mareike-profile')); ?>" style="position: relative;" class="theme_mareike_mainpage_button">Profil</a>
|
||||
<a href="<?php echo get_site_url() . '/wp-login.php?action=logout'; ?>" style="position: relative;" class="button theme_mareike_mainpage_button">Abmelden</a>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<a href="<?php echo get_site_url() . '/wp-login.php?action=register'; ?>" style="position: relative;" class="button theme_mareike_mainpage_button">Registrieren</a>
|
||||
<a href="<?php echo get_site_url() . '/wp-login.php'; ?>" style="position: relative;" class="button theme_mareike_mainpage_button">Anmelden</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</header>
|
||||
<div class="flex-container">
|
||||
<nav class="navbar">
|
||||
<div class="navcontainer">
|
||||
<?php
|
||||
wp_nav_menu(array(
|
||||
'theme_location' => 'primary',
|
||||
'container' => false,
|
||||
'menu_class' => 'navbar-nav'
|
||||
));
|
||||
?>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
21
lib/mareike-theme/index.php
Normal file
21
lib/mareike-theme/index.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<main>
|
||||
<div class="content">
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
<article <?php post_class(); ?>>
|
||||
<h2><?php the_title(); ?></h2>
|
||||
<div class="entry-content">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
<?php else : ?>
|
||||
<p>Es gibt keine Inhalte.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php get_footer(); ?>
|
BIN
lib/mareike-theme/screenshot.png
Normal file
BIN
lib/mareike-theme/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
255
lib/mareike-theme/style.css
Normal file
255
lib/mareike-theme/style.css
Normal file
@ -0,0 +1,255 @@
|
||||
/*
|
||||
Theme Name: mareike
|
||||
Theme URI: https://repos.contelli.de/mareike-theme/
|
||||
Author: Max Mustermann
|
||||
Author URI: https://contelli.de
|
||||
Description: Ein einfaches WordPress-Theme für den Einstieg.
|
||||
Version: 1.0
|
||||
Text Domain: mareike-theme
|
||||
*/
|
||||
|
||||
/* Hier kannst du deine Styles hinzufügen */
|
||||
body {
|
||||
font-family: Figtree, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji";
|
||||
background-color: #edf2f7;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
.container {
|
||||
position: relative;
|
||||
top: -40px;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
background-color: #e5e7eb;
|
||||
--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);
|
||||
--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
|
||||
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);
|
||||
}
|
||||
|
||||
.flex-container {
|
||||
display: flex;
|
||||
min-height: 250px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
h2 {
|
||||
position: absolute;
|
||||
top: 140px;
|
||||
background-color: #ffffff;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #e5e7eb;
|
||||
border-radius: 10px;
|
||||
padding: 0 60px 5px 20px;
|
||||
border-left-width: 40px;
|
||||
font-size: 12pt;
|
||||
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: rgb(255, 203, 4);
|
||||
color: #fff;
|
||||
height: 150px;
|
||||
padding: 10px 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background-color: #e5e7eb !important;
|
||||
width: 25rem;
|
||||
min-height: 100% !important;
|
||||
height: 100% !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.navcontainer {
|
||||
min-height: 100% !important;
|
||||
height: 100% !important;
|
||||
background-color: #ffffff;
|
||||
margin: 0 !important;
|
||||
|
||||
}
|
||||
|
||||
.navcontainer ul {
|
||||
margin: 0px;
|
||||
margin-left: -40px;
|
||||
|
||||
}
|
||||
|
||||
.navcontainer li {
|
||||
border-bottom-color: #e5e7eb;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
padding: 10px 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.navcontainer li:hover {
|
||||
background-color: #29c2f8;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.navcontainer li a {
|
||||
text-decoration: none;
|
||||
color: #374151;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.navcontainer li:hover a {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
main {
|
||||
background-color: #ffffff !important;
|
||||
width: 100%;
|
||||
padding-bottom: 650px;
|
||||
padding-right: 20px;
|
||||
padding-top: 50px;
|
||||
color: rgb(107, 114, 128);
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: #e5e7eb;
|
||||
color: #fff;
|
||||
padding: 1px !important;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#wpadminbar {
|
||||
display: none !important;
|
||||
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
button {
|
||||
background-color: #ffffff;
|
||||
padding: 7px;
|
||||
border-color: #e5e7eb;
|
||||
border-radius: 5px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
button,
|
||||
input[type="submit"]{
|
||||
cursor: pointer;
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
background-color: #ffffff;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
button:hover,
|
||||
input[type="submit"]:hover {
|
||||
background-color: #0d66c2;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
select {
|
||||
padding: 7px;
|
||||
border-color: #e5e7eb;
|
||||
border-radius: 5px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.theme_mareike_mainpage_button {
|
||||
background-color:#F3F4F6;
|
||||
padding: 5px 30px;
|
||||
border-radius: 10px;
|
||||
border-style: solid;
|
||||
border-width: 0px;
|
||||
width: 150px;
|
||||
font-size: 12pt;
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
.navbar {
|
||||
width: 20rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
position: absolute;
|
||||
top: 140px;
|
||||
background-color: #ffffff;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #e5e7eb;
|
||||
border-radius: 10px;
|
||||
padding: 0 40px 5px 20px;
|
||||
border-left-width: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Styling für das Registrierungsformular */
|
||||
.register {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background: #000000;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.message {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#registerform {
|
||||
position: relative;
|
||||
width: 768px;
|
||||
left: -200px !important;
|
||||
}
|
||||
|
||||
.login h1 {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#login #nav,
|
||||
#backtoblog,
|
||||
.language-switcher
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.register input[type="text"],
|
||||
.register input[type="password"],
|
||||
.register input[type="email"] {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.register input[type="submit"] {
|
||||
background: #0073aa;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.register input[type="submit"]:hover {
|
||||
background: #005177;
|
||||
}
|
@ -3,8 +3,73 @@
|
||||
namespace Bdp\Modules\KompassSettings\Controllers;
|
||||
|
||||
|
||||
use Bdp\Libs\WpConfigEditor;
|
||||
|
||||
class SettingsPage
|
||||
{
|
||||
public static function add_menu() {
|
||||
if (
|
||||
null !== get_option('bdp_calendar_source_url', null ) ||
|
||||
!file_exists(dirname(BDP_LV_STARTUP_FILE ) . '/../kronos/kronos.php')
|
||||
)
|
||||
{
|
||||
add_menu_page(
|
||||
'Kalender Installation',
|
||||
'Kalender Installation',
|
||||
'manage_options',
|
||||
'kompass-calendar',
|
||||
['Bdp\Modules\PluginInstaller\Controllers\InstallSingleplugin', 'install_calendar'],
|
||||
'dashicons-calendar-alt',
|
||||
2
|
||||
);
|
||||
|
||||
if ( file_exists(dirname(BDP_LV_STARTUP_FILE ) . '/../kronos/kronos.php') ) {
|
||||
add_action( 'admin_notices', array( 'Bdp\Modules\PluginInstaller\Controllers\OutdatedModule', 'calender' ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
!file_exists(dirname(BDP_LV_STARTUP_FILE ) . '/../solea/solea.php')
|
||||
)
|
||||
{
|
||||
add_menu_page(
|
||||
'Installiere solea (Veranstaltungen)',
|
||||
'Installiere solea (Veranstaltungen)',
|
||||
'manage_options',
|
||||
'kompass-events',
|
||||
['Bdp\Modules\PluginInstaller\Controllers\InstallSingleplugin', 'install_events'],
|
||||
'dashicons-tickets-alt',
|
||||
2
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
add_submenu_page('options-general.php',
|
||||
'kompass Einstellungen',
|
||||
'kompass Einstellungen',
|
||||
'manage_options',
|
||||
'kompass-settings',
|
||||
['Bdp\Modules\KompassSettings\Controllers\SettingsPage', 'kompass_settings_page_new']
|
||||
);
|
||||
|
||||
|
||||
add_submenu_page('options-general.php',
|
||||
'Mail',
|
||||
'Mail',
|
||||
'manage_options',
|
||||
'kompass-mail-settings',
|
||||
['Bdp\Modules\Mail\Controllers\MailSettingsController', 'settings_form']
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
add_options_page(
|
||||
@ -16,19 +81,42 @@ class SettingsPage
|
||||
}
|
||||
|
||||
|
||||
public static function kompass_settings_page_new() {
|
||||
if (isset($_POST['save'])) {
|
||||
|
||||
update_option('paged_used_for_state', false);
|
||||
update_option('user_can_register', false);
|
||||
update_option('use_mareike_theme', false);
|
||||
|
||||
if (isset($_POST['used_for_state'])) { update_option('paged_used_for_state', true); }
|
||||
if (isset($_POST['self_register'])) { update_option('user_can_register', true); }
|
||||
if (isset($_POST['use_mareike_theme'])) { update_option('use_mareike_theme', true); }
|
||||
if (isset($_POST['external_cronjobs'])) {
|
||||
WpConfigEditor::updateConfig('DISABLE_WP_CRON', true);
|
||||
} else {
|
||||
WpConfigEditor::deleteConfigKey('DISABLE_WP_CRON');
|
||||
}
|
||||
|
||||
kompass_print_message_box('Die Einstellungen wurden gespeichert.');
|
||||
}
|
||||
|
||||
require BDP_LV_PLUGIN_DIR . '/settings/views/settings.php';
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function option_page() {
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
$showMessage = null;
|
||||
$tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'tab1';
|
||||
if (isset($_REQUEST['update_options']) && $_REQUEST['update_options'] == true) {
|
||||
switch ($tab) {
|
||||
case 'tab1':
|
||||
update_option('bdp_calendar_categories', json_encode($_POST['category']));
|
||||
update_option('bdp_calendar_source_url', $_POST['bdp_calendar_source_url']);
|
||||
$showMessage = __('The settings were saved.', BDP_LV_PLUGIN_SLUG);
|
||||
break;
|
||||
|
||||
case 'tab2':
|
||||
kompass_print_message_box('Diese Funktion wird nicht mdehr unterstützt.', 'error');
|
||||
break;
|
||||
|
||||
case 'tab3':
|
||||
update_option('kompass_seo_google_verification', $_POST['kompass_seo_google_verification']);
|
||||
update_option('kompass_seo_bing_verification', $_POST['kompass_seo_bing_verification']);
|
||||
$showMessage = __('The settings were saved.', BDP_LV_PLUGIN_SLUG);
|
||||
@ -55,19 +143,19 @@ class SettingsPage
|
||||
<div class="tab-content">
|
||||
<?php
|
||||
switch ($tab) {
|
||||
case 'tab1':
|
||||
echo '<form action="admin.php?page=bdp-kompass-Kompass-settings&tab=tab1" method="post">';
|
||||
case 'tab2':
|
||||
echo '<form action="admin.php?page=bdp-kompass-Kompass-settings&tab=tab2" method="post">';
|
||||
do_settings_sections(BDP_LV_PLUGIN_SLUG . '-calendar-settings');
|
||||
require_once BDP_LV_PLUGIN_DIR . '/modules/calendar/Views/categories-partial.php';
|
||||
echo '<input type="hidden" name="tab" value="tab1" />';
|
||||
echo '<input type="hidden" name="tab" value="tab2" />';
|
||||
submit_button();
|
||||
echo '</form>';
|
||||
break;
|
||||
case 'tab2':
|
||||
case 'tab3':
|
||||
echo '<form action="admin.php?page=bdp-kompass-Kompass-settings" method="post">';
|
||||
do_settings_sections(BDP_LV_PLUGIN_SLUG . '-seo-settings');
|
||||
submit_button();
|
||||
echo '<input type="hidden" name="tab" value="tab2" />';
|
||||
echo '<input type="hidden" name="tab" value="tab3" />';
|
||||
echo '</form>';
|
||||
break;
|
||||
}
|
||||
|
@ -3,10 +3,15 @@
|
||||
{
|
||||
$baseUrl = 'admin.php?page=bdp-kompass-Kompass-settings&tab=';
|
||||
return '<h2 class="nav-tab-wrapper">'.
|
||||
'<a href="' . $baseUrl . 'tab1" class="nav-tab ' . ($activeTab == 'tab1' ? 'nav-tab-active' : '') . '">' .
|
||||
'<a href="' . $baseUrl . 'tab1" class="nav-tab ' . ($activeTab == 'tab1' ? 'nav-tab-active' : '') . '">' .
|
||||
__('Kompass Settings', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a>'.
|
||||
|
||||
|
||||
'<a href="' . $baseUrl . 'tab2" class="nav-tab ' . ($activeTab == 'tab2' ? 'nav-tab-active' : '') . '">' .
|
||||
__('Calendar Settings', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a>'.
|
||||
'<a href="' . $baseUrl . 'tab2" class="nav-tab ' . ($activeTab == 'tab2' ? 'nav-tab-active' : '') .'">' .
|
||||
'<a href="' . $baseUrl . 'tab3" class="nav-tab ' . ($activeTab == 'tab3' ? 'nav-tab-active' : '') .'">' .
|
||||
__('SEO', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a>'.
|
||||
'</h2>';
|
||||
|
@ -1,281 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\LimitLoginAttempts\Controllers;
|
||||
|
||||
use ProtectLogin\Modules\LimitLoginAttempts\Requests\IpAddress;
|
||||
|
||||
class LoginHandler {
|
||||
public const DIRECT_ADDR = 'REMOTE_ADDR';
|
||||
public const PROXY_ADDR = 'HTTP_X_FORWARDED_FOR';
|
||||
|
||||
public function onSuccessFullLogin($user, $password) {
|
||||
if (!is_wp_error($user) && $this->isLoginAllowedFromIp() ) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
global $limit_login_my_error_shown;
|
||||
$limit_login_my_error_shown = true;
|
||||
|
||||
$error = new \WP_Error();
|
||||
// This error should be the same as in "shake it" filter below
|
||||
$error->add('too_many_retries', $this->composeErrorMessage());
|
||||
return $error;
|
||||
}
|
||||
|
||||
public function onFailedLogin(string $username) {
|
||||
$ip = $this->getAddress();
|
||||
|
||||
/* if currently locked-out, do not add to retries */
|
||||
$lockouts = get_option('protect_login_limit_login_lockouts', []);
|
||||
|
||||
if(isset($lockouts[$ip]) && time() < $lockouts[$ip]) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the arrays with retries and retries-valid information */
|
||||
$retries = get_option('kompass_limit_login_retries', []);
|
||||
$valid = get_option('kompass_limit_login_retries_valid', []);
|
||||
|
||||
/* Check validity and add one to retries */
|
||||
if (isset($retries[$ip])) { //} && isset($valid[$ip]) && time() < $valid[$ip]) {
|
||||
$retries[$ip] ++;
|
||||
} else {
|
||||
$retries[$ip] = 1;
|
||||
}
|
||||
|
||||
update_option('kompass_limit_login_retries', $retries);
|
||||
|
||||
/* lockout? */
|
||||
if($retries[$ip] % get_option('kompass_limit_login_allowed_retries', 0) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$retries_long = get_option('kompass_limit_login_allowed_retries', 1)
|
||||
* get_option('kompass_limit_login_allowed_lockouts', 1);
|
||||
|
||||
if ($retries[$ip] >= $retries_long) {
|
||||
$lockouts[$ip] = time() + get_option('kompass_limit_login_long_duration', 86400);
|
||||
|
||||
} else {
|
||||
$lockouts[$ip] = time() + get_option('kompass_limit_login_lockout_duration', 900);
|
||||
}
|
||||
|
||||
update_option('kompass_limit_login_lockouts', $lockouts);
|
||||
|
||||
|
||||
/* do any notification */
|
||||
$this->notify($username);
|
||||
|
||||
}
|
||||
|
||||
private function notifyByEmail($user)
|
||||
{
|
||||
$ip = $this->getAddress();
|
||||
|
||||
$lockouts = get_option('kompass_limit_login_lockouts', []);
|
||||
if (!isset($lockouts[$ip])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$blocked_until = $lockouts[$ip];
|
||||
|
||||
$retries = get_option('kompass_limit_login_retries', []);
|
||||
$currentRetries = $retries[$ip];
|
||||
|
||||
$notify_after = get_option('kompass_limit_login_notify_email_after', 1);
|
||||
if ($currentRetries % $notify_after !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$blogname = get_option('blogname', 'none');
|
||||
|
||||
$subject = sprintf(__("[%s] Too many failed login attempts"
|
||||
, 'limit-login-attempts')
|
||||
, $blogname);
|
||||
|
||||
$message = 'Neue Sperrung auf deiner Webseite: ' . PHP_EOL .
|
||||
'IP-Adresse: ' . $ip . PHP_EOL .
|
||||
'Gesperrt bis: ' . date('d.m.Y H:i', $blocked_until);
|
||||
|
||||
$admin_email = get_option('admin_email');
|
||||
wp_mail($admin_email, $subject, $message);
|
||||
}
|
||||
|
||||
|
||||
/* Handle notification in event of lockout */
|
||||
private function notify($user) {
|
||||
$args = get_option('kompass_limit_login_lockout_notify', []);
|
||||
if (!is_array($args)) {
|
||||
$args = [$args];
|
||||
}
|
||||
foreach ($args as $mode) {
|
||||
switch (trim($mode)) {
|
||||
case 'email':
|
||||
$this->notifyByEmail($user);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private function composeErrorMessage() {
|
||||
$ip = $this->getAddress();
|
||||
$lockouts = get_option('protect_login_limit_login_lockouts');
|
||||
|
||||
$msg = __('Too many failed login attempts.', BDP_LV_PLUGIN_SLUG) . ' ';
|
||||
|
||||
if (!is_array($lockouts) || !isset($lockouts[$ip]) || time() >= $lockouts[$ip]) {
|
||||
/* Huh? No timeout active? */
|
||||
$msg .= __('Please try again later.', BDP_LV_PLUGIN_SLUG);
|
||||
return $msg;
|
||||
}
|
||||
|
||||
$when = ceil(($lockouts[$ip] - time()) / 60);
|
||||
if ($when > 60) {
|
||||
$when = ceil($when / 60);
|
||||
$msg .= sprintf(_n('Please try again in %d hour.', 'Please try again in %d hours.', $when, BDP_LV_PLUGIN_SLUG), $when);
|
||||
} else {
|
||||
$msg .= sprintf(_n('Please try again in %d minute.', 'Please try again in %d minutes.', $when, BDP_LV_PLUGIN_SLUG), $when);
|
||||
}
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
private static function getAddress($typeName = '') {
|
||||
global $limitLoginAttemptsSettings;
|
||||
|
||||
$typeOriginal = $typeName;
|
||||
if (empty($typeName)) {
|
||||
$typeName = get_option('kompass_limit_loginclient_type', self::DIRECT_ADDR);
|
||||
}
|
||||
|
||||
if (isset($_SERVER[$typeName]) && filter_var($_SERVER[$typeName], FILTER_VALIDATE_IP)) {
|
||||
return $_SERVER[$typeName];
|
||||
}
|
||||
|
||||
/*
|
||||
* Not found. Did we get proxy type from option?
|
||||
* If so, try to fall back to direct address.
|
||||
*/
|
||||
if ( empty($typeName) && $typeOriginal == self::PROXY_ADDR
|
||||
&& isset($_SERVER[self::DIRECT_ADDR])
|
||||
&& filter_var($_SERVER[self::DIRECT_ADDR], FILTER_VALIDATE_IP)) {
|
||||
|
||||
/*
|
||||
* NOTE: Even though we fall back to direct address -- meaning you
|
||||
* can get a mostly working plugin when set to PROXY mode while in
|
||||
* fact directly connected to Internet it is not safe!
|
||||
*
|
||||
* Client can itself send HTTP_X_FORWARDED_FOR header fooling us
|
||||
* regarding which IP should be banned.
|
||||
*/
|
||||
|
||||
return $_SERVER[self::DIRECT_ADDR];
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function isLoginAllowedFromIp() {
|
||||
$ip = $this->getAddress();
|
||||
|
||||
if (in_array($ip, get_option('kompass_limit_login_blocklist', []))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (in_array($ip, get_option('kompass_limit_login_allowlist', []))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* lockout active? */
|
||||
$lockouts = get_option('kompass_limit_login_lockouts', []);
|
||||
return (!is_array($lockouts) || !isset($lockouts[$ip]) || time() >= $lockouts[$ip]);
|
||||
}
|
||||
|
||||
public function checkFailedCookies($cookie_elements) {
|
||||
$this->clearAuthCookie();
|
||||
|
||||
/*
|
||||
* Invalid username gets counted every time.
|
||||
*/
|
||||
|
||||
$this->onFailedLogin($cookie_elements['username']);
|
||||
}
|
||||
|
||||
private function clearAuthCookie() {
|
||||
wp_clear_auth_cookie();
|
||||
|
||||
if (!empty($_COOKIE[AUTH_COOKIE])) {
|
||||
$_COOKIE[AUTH_COOKIE] = '';
|
||||
}
|
||||
if (!empty($_COOKIE[SECURE_AUTH_COOKIE])) {
|
||||
$_COOKIE[SECURE_AUTH_COOKIE] = '';
|
||||
}
|
||||
if (!empty($_COOKIE[LOGGED_IN_COOKIE])) {
|
||||
$_COOKIE[LOGGED_IN_COOKIE] = '';
|
||||
}
|
||||
}
|
||||
|
||||
public function onValidCookie($cookie_elements, $user) {
|
||||
/*
|
||||
* As all meta values get cached on user load this should not require
|
||||
* any extra work for the common case of no stored value.
|
||||
*/
|
||||
|
||||
if (get_user_meta($user->ID, 'kompass_limit_login_previous_cookie')) {
|
||||
delete_user_meta($user->ID, 'kompass_limit_login_previous_cookie');
|
||||
}
|
||||
}
|
||||
|
||||
function clearLoginCookie($cookie_elements) {
|
||||
$this->clearAuthCookie();
|
||||
|
||||
/*
|
||||
* Under some conditions an invalid auth cookie will be used multiple
|
||||
* times, which results in multiple failed attempts from that one
|
||||
* cookie.
|
||||
*
|
||||
* Unfortunately I've not been able to replicate this consistently and
|
||||
* thus have not been able to make sure what the exact cause is.
|
||||
*
|
||||
* Probably it is because a reload of for example the admin dashboard
|
||||
* might result in multiple requests from the browser before the invalid
|
||||
* cookie can be cleard.
|
||||
*
|
||||
* Handle this by only counting the first attempt when the exact same
|
||||
* cookie is attempted for a user.
|
||||
*/
|
||||
|
||||
extract($cookie_elements, EXTR_OVERWRITE);
|
||||
|
||||
// Check if cookie is for a valid user
|
||||
$user = get_user_by('login', $username);
|
||||
if (!$user) {
|
||||
// "shouldn't happen" for this action
|
||||
$this->onFailedLogin($username);
|
||||
return;
|
||||
}
|
||||
|
||||
$previous_cookie = get_user_meta($user->ID, 'kompass_limit_login_previous_cookie', true);
|
||||
if ($previous_cookie && $previous_cookie == $cookie_elements) {
|
||||
// Identical cookies, ignore this attempt
|
||||
return;
|
||||
}
|
||||
|
||||
// Store cookie
|
||||
if ($previous_cookie)
|
||||
update_user_meta($user->ID, 'kompass_limit_login_previous_cookie', $cookie_elements);
|
||||
else
|
||||
add_user_meta($user->ID, 'kompass_limit_login_previous_cookie', $cookie_elements, true);
|
||||
|
||||
$this->onFailedLogin($username);
|
||||
}
|
||||
|
||||
public function handleCookies() {
|
||||
if ($this->isLoginAllowedFromIp()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->clearAuthCookie();
|
||||
}
|
||||
}
|
@ -1,193 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\LimitLoginAttempts\Controllers;
|
||||
|
||||
class OptionsPage
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_options_page(
|
||||
__('Login-Protection', BDP_LV_PLUGIN_SLUG),
|
||||
__('Login-Protection', BDP_LV_PLUGIN_SLUG),
|
||||
'manage_options',
|
||||
BDP_LV_PLUGIN_SLUG . '-limit-login-attempts',
|
||||
[$this, 'limit_login_option_page'],2048);
|
||||
}
|
||||
|
||||
public function releaseIp($ip)
|
||||
{
|
||||
$allIps = get_option('kompass_limit_login_lockouts', []);
|
||||
unset($allIps[$ip]);
|
||||
update_option('kompass_limit_login_lockouts', $allIps);
|
||||
}
|
||||
|
||||
public static function addToBlocklist(string $ip)
|
||||
{
|
||||
$blockedIps = get_option('kompass_limit_login_blocklist', []);
|
||||
$blockedIps[] = $ip;
|
||||
update_option('kompass_limit_login_blocklist', $blockedIps);
|
||||
}
|
||||
|
||||
public static function addToAllowlist(string $ip)
|
||||
{
|
||||
$allowedIps = get_option('kompass_limit_login_allowlist', []);
|
||||
$allowedIps[] = $ip;
|
||||
update_option('kompass_limit_login_allowlist', $allowedIps);
|
||||
self::releaseIp($ip);
|
||||
}
|
||||
|
||||
public function removeFromList(string $listType, string $ip){
|
||||
update_option(
|
||||
'kompass_limit_login_' . $listType,
|
||||
array_diff(get_option('kompass_limit_login_' . $listType, []), [$ip])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function getBlockedIps()
|
||||
{
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
$ips = '';
|
||||
foreach (get_option('kompass_limit_login_lockouts', []) as $ip => $blockedUntil) {
|
||||
$ips .= '<tr style="vertical-align: top;">' .
|
||||
'<td style="padding-right: 50px;">' . $ip . '</td>';
|
||||
if (in_array($ip, get_option('protect_login_limit_login_blocklist', []))) {
|
||||
$ips .= '<td style="padding-right: 50px;">Dauerhaft blockiert</td>' .
|
||||
'<td>' .
|
||||
'Keine Aktion möglich' .
|
||||
'</td></tr>';
|
||||
} else {
|
||||
$ips .= '<td style="padding-right: 50px;">' . date('d.m.Y', $blockedUntil) . '<br />' . date('H:i', $blockedUntil) . ' Uhr</td>' .
|
||||
'<td>
|
||||
<a href="admin.php?page=bdp-kompass-limit-login-attempts&tab=tab4&action=release&ip=' .
|
||||
base64_encode($ip) . '">' . __('Release ip address', BDP_LV_PLUGIN_SLUG) . '</a><br />
|
||||
<a href="admin.php?page=bdp-kompass-limit-login-attempts&tab=tab4&action=toBlock&ip=' .
|
||||
base64_encode($ip) . '">' . __('Add ip address to blocklist', BDP_LV_PLUGIN_SLUG) . '</a><br />
|
||||
<a href="admin.php?page=bdp-kompass-limit-login-attempts&tab=tab4&action=toAllow&ip=' .
|
||||
base64_encode($ip) . '">' . __('Add ip address to allowlist and release', BDP_LV_PLUGIN_SLUG) . '</a><br /> ' .
|
||||
'</td></tr>';
|
||||
};
|
||||
}
|
||||
return $ips;
|
||||
}
|
||||
|
||||
public function limit_login_option_page() {
|
||||
global $errors;
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
$showMessage = null;
|
||||
|
||||
if (isset($_POST['update_options'])) {
|
||||
update_settings($_POST);
|
||||
$showMessage = __('The settings were saved.', BDP_LV_PLUGIN_SLUG);
|
||||
}
|
||||
if (isset($_GET['action']) && $_GET['action'] == 'release') {
|
||||
$showMessage = __('The ip address was released.', BDP_LV_PLUGIN_SLUG);
|
||||
}
|
||||
|
||||
if(isset($_POST['save_kompass_balist_list_type'])) {
|
||||
$showMessage = __('The list was saved.', BDP_LV_PLUGIN_SLUG);
|
||||
}
|
||||
|
||||
if (null !== $showMessage && $errors === false) {
|
||||
echo '<div class="notice notice-success" style="padding: 5px 10px;">';
|
||||
echo $showMessage;
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
echo '<div class="notice notice-error" style="padding: 5px 10px;">';
|
||||
echo __('An error occured.', BDP_LV_PLUGIN_SLUG);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
$tab = isset($_GET['tab']) ? $_GET['tab'] : 'tab1';
|
||||
|
||||
if (isset($_GET['action']) && $_GET['action'] == 'removeFromList') {
|
||||
$this->removeFromList($_GET['list'], base64_decode($_GET['ip']));
|
||||
if ($_GET['list'] == 'blocklist') {
|
||||
$tab = 'tab2';
|
||||
} else {
|
||||
$tab = 'tab3';
|
||||
}
|
||||
}
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="wp-heading-inline">
|
||||
<?= __('Login-Protection', BDP_LV_PLUGIN_SLUG); ?> - <?= __('Settings', BDP_LV_PLUGIN_SLUG); ?></h1>
|
||||
<hr class="wp-header-end">
|
||||
<?= kompass_print_tab_header($tab); ?>
|
||||
|
||||
<div class="tab-content">
|
||||
<?php
|
||||
switch ($tab) {
|
||||
case 'tab1':
|
||||
echo '<form action="admin.php?page=bdp-kompass-limit-login-attempts&tab=tab1" method="post">';
|
||||
do_settings_sections(BDP_LV_PLUGIN_SLUG . '-limit-login-attempts');
|
||||
submit_button();
|
||||
echo '</form>';
|
||||
break;
|
||||
case 'tab2':
|
||||
echo '<h2>Blocklist</h2>';
|
||||
echo '<form action="admin.php?page=bdp-kompass-limit-login-attempts&tab=tab2" method="post">';
|
||||
kompass_print_block_allow_form('blocklist');
|
||||
submit_button();
|
||||
echo '</form>';
|
||||
break;
|
||||
case 'tab3':
|
||||
echo '<h2>Allowlist</h2>';
|
||||
echo '<form action="admin.php?page=bdp-kompass-limit-login-attempts&tab=tab3" method="post">';
|
||||
kompass_print_block_allow_form('allowlist');
|
||||
submit_button();
|
||||
echo '</form>';
|
||||
break;
|
||||
case 'tab4':
|
||||
if (isset($_GET['action']) && $_GET['action'] == 'release') {
|
||||
$this->releaseIp(base64_decode($_GET['ip']));
|
||||
}
|
||||
|
||||
if (isset($_GET['action']) && $_GET['action'] == 'toBlock') {
|
||||
$this->addToBlocklist(base64_decode($_GET['ip']));
|
||||
}
|
||||
|
||||
if (isset($_GET['action']) && $_GET['action'] == 'toAllow') {
|
||||
$this->addToAllowlist(base64_decode($_GET['ip']));
|
||||
}
|
||||
$blockedIps = $this->getBlockedIps();
|
||||
echo '<h2>'. __('Blocked IP addresses', BDP_LV_PLUGIN_SLUG) .'</h2>';
|
||||
|
||||
if (strlen($blockedIps) == 0) {
|
||||
echo '<div class="bdp-kompass-no-blocked-ips">';
|
||||
echo __('There are no ip addresses blocked.', BDP_LV_PLUGIN_SLUG);
|
||||
echo '</div>';
|
||||
} else { ?>
|
||||
<p style="width: 100%; text-align: right">
|
||||
<input type="text" id="searchInput"
|
||||
onkeyup="searchTable('myTable', this)"
|
||||
placeholder="<?=__('Search for ip address', BDP_LV_PLUGIN_SLUG); ?>">
|
||||
</p>
|
||||
|
||||
<table class="wp-list-table widefat fixed striped table-view-list" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="manage-column column-name"><?= __('IP address', BDP_LV_PLUGIN_SLUG); ?></th>
|
||||
<th class="manage-column column-name"><?= __('Blocked until', BDP_LV_PLUGIN_SLUG); ?></th>
|
||||
<th class="manage-column column-name"><?= __('Actions', BDP_LV_PLUGIN_SLUG); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?= $blockedIps ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
function kompass_print_tab_header(string $activeTab = 'tab1')
|
||||
{
|
||||
$baseUrl = 'admin.php?page=bdp-kompass-limit-login-attempts&tab=';
|
||||
return '<h2 class="nav-tab-wrapper">'.
|
||||
'<a href="' . $baseUrl . 'tab1" class="nav-tab ' . ($activeTab == 'tab1' ? 'nav-tab-active' : '') . '">' .
|
||||
__('Options', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a>'.
|
||||
'<a href="' . $baseUrl . 'tab2" class="nav-tab ' . ($activeTab == 'tab2' ? 'nav-tab-active' : '') .'">' .
|
||||
__('Blocklist', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a>'.
|
||||
'<a href="' . $baseUrl . 'tab3" class="nav-tab ' . ($activeTab == 'tab3' ? 'nav-tab-active' : '') .'">' .
|
||||
__('Allowlist', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a>'.
|
||||
'<a href="' . $baseUrl . 'tab4" class="nav-tab ' . ($activeTab == 'tab4' ? 'nav-tab-active' : '') .'">' .
|
||||
__('Blocked IP addresses', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a></h2>';
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as LimitLoginAttemptsOptions;
|
||||
|
||||
function updateBlockOrAllowList(array $postVars)
|
||||
{
|
||||
$listType = $postVars['save_kompass_balist_list_type'];
|
||||
if (count($postVars['new_ips']) == 1) {
|
||||
foreach (explode(PHP_EOL, $postVars['new_ips'][0]) as $newIp) {
|
||||
$newIp = trim($newIp);
|
||||
if ('' !== $newIp) {
|
||||
if ($listType == 'blocklist') {
|
||||
LimitLoginAttemptsOptions::addToBlocklist($newIp);
|
||||
} else {
|
||||
LimitLoginAttemptsOptions::addToAllowlist($newIp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function kompass_print_block_allow_form(string $listType) {
|
||||
$elements = get_option('kompass_limit_login_' . $listType, []);
|
||||
?>
|
||||
|
||||
<input type="hidden" name="save_kompass_balist_list_type" value="<?= $listType; ?>" />
|
||||
<p style="width: 100%; text-align: right">
|
||||
<input type="text" id="searchInput"
|
||||
onkeyup="searchTable('myTable', this)"
|
||||
placeholder="<?=__('Search for ip address', BDP_LV_PLUGIN_SLUG); ?>">
|
||||
</p>
|
||||
<table class="wp-list-table widefat fixed striped table-view-list" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="manage-column column-name"><?= __('IP address', BDP_LV_PLUGIN_SLUG); ?></th>
|
||||
<th style="width: 100px;" class="manage-column column-name"><?= __('Actions', BDP_LV_PLUGIN_SLUG); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($elements as $currentIp) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $currentIp .'</td>';
|
||||
echo '<td><a href="admin.php?page=bdp-kompass-limit-login-attempts&action=removeFromList' .
|
||||
'&list=' . $listType . '&ip=' . base64_encode($currentIp) . '">'
|
||||
. __('Delete', BDP_LV_PLUGIN_SLUG) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="kompass_setting_box">
|
||||
<h3><?= __('IP-Adresse hinzufügen', BDP_LV_PLUGIN_SLUG); ?></h3>
|
||||
<p>
|
||||
<textarea
|
||||
placeholder="<?= __('Please use line breaks to enter multiple ips', BDP_LV_PLUGIN_SLUG); ?>"
|
||||
name="new_ips[]"
|
||||
style="width: 350px;" rows="5"></textarea>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
function _kompass_limit_logins_settings_radio_callback(array $args)
|
||||
{
|
||||
kompass_print_radio($args['setting']);
|
||||
}
|
||||
function _kompass_limit_logins_settings_checkbox_callback(array $args) {
|
||||
kompass_print_checkbox($args['setting']);
|
||||
}
|
||||
|
||||
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
add_settings_section(
|
||||
'custom_settings_section',
|
||||
__('Options', BDP_LV_PLUGIN_SLUG),
|
||||
'kompass_prepare_form',
|
||||
BDP_LV_PLUGIN_SLUG . '-limit-login-attempts'
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$settings_page = BDP_LV_PLUGIN_SLUG . '-limit-login-attempts';
|
||||
|
||||
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_1',
|
||||
__('Maximum reps until lockout', BDP_LV_PLUGIN_SLUG),
|
||||
'kompass_print_textbox',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_allowed_retries']);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_2',
|
||||
__('Duration of lockout (in minutes)', BDP_LV_PLUGIN_SLUG),
|
||||
'kompass_print_textbox',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_lockout_duration', 'unit_division' => 60 ]);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_3',
|
||||
__('Maximum number of lockouts', BDP_LV_PLUGIN_SLUG),
|
||||
'kompass_print_textbox',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_allowed_lockouts']);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_4',
|
||||
__('Long-term duration (in hours)', BDP_LV_PLUGIN_SLUG),
|
||||
'kompass_print_textbox',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_long_duration', 'unit_division' => 3600]);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_5',
|
||||
__('Minimum password strength', BDP_LV_PLUGIN_SLUG),
|
||||
'_kompass_limit_logins_settings_radio_callback',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_password_minimal_strength']);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_6',
|
||||
__('Page accessible via', BDP_LV_PLUGIN_SLUG),
|
||||
'_kompass_limit_logins_settings_radio_callback',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_client_type']);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_7',
|
||||
__('Handle cookies', BDP_LV_PLUGIN_SLUG),
|
||||
'_kompass_limit_logins_settings_radio_callback',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_cookies']);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_8',
|
||||
__('Notify if blocked', BDP_LV_PLUGIN_SLUG),
|
||||
'_kompass_limit_logins_settings_checkbox_callback',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_lockout_notify']);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_9',
|
||||
__('Failed attempts until notification', BDP_LV_PLUGIN_SLUG),
|
||||
'kompass_print_textbox',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_notify_email_after']);
|
||||
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
function check_for_integer(int $input) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
|
||||
function hours_to_seconds_converter(int $input) {
|
||||
// Hier kannst du die Eingabe validieren, z.B. sicherstellen, dass es sich um eine gültige E-Mail-Adresse handelt.
|
||||
return minutes_to_seconds_converter($input) * 60;
|
||||
}
|
||||
|
||||
function minutes_to_seconds_converter(int $input) {
|
||||
|
||||
return check_for_integer($input) * 60;
|
||||
}
|
||||
|
||||
function kompass_settings_validators()
|
||||
{
|
||||
$slug = BDP_LV_PLUGIN_SLUG . '-limit-login-attempts';
|
||||
|
||||
register_setting($slug,
|
||||
'kompass_limit_login_allowed_retries',
|
||||
'check_for_integer');
|
||||
|
||||
register_setting($slug,
|
||||
'kompass_limit_login_allowed_lockouts',
|
||||
'check_for_integer');
|
||||
|
||||
register_setting($slug,
|
||||
'kompass_limit_login_lockout_duration',
|
||||
'minutes_to_seconds_converter');
|
||||
|
||||
register_setting($slug,
|
||||
'kompass_limit_login_long_duration',
|
||||
'hours_to_seconds_converter');
|
||||
|
||||
register_setting($slug,
|
||||
'kompass_limit_login_notify_email_after',
|
||||
'check_for_integer');
|
||||
}
|
||||
|
||||
function update_settings(array $postParams) {
|
||||
$settings = ['kompass_limit_login_lockout_duration',
|
||||
'kompass_limit_login_allowed_retries',
|
||||
'kompass_limit_login_allowed_lockouts',
|
||||
'kompass_password_minimal_strength',
|
||||
'kompass_limit_login_client_type',
|
||||
'kompass_limit_login_long_duration',
|
||||
'kompass_limit_login_lockout_notify',
|
||||
'kompass_limit_login_notify_email_after',
|
||||
'kompass_limit_login_cookies'];
|
||||
|
||||
foreach ($settings as $curSetting) {
|
||||
if (isset($postParams[$curSetting])) {
|
||||
update_option($curSetting, $postParams[$curSetting]);
|
||||
} else {
|
||||
update_option($curSetting, '');
|
||||
}
|
||||
}
|
||||
}
|
@ -18,16 +18,6 @@ class MailController
|
||||
'dashicons-email',
|
||||
4
|
||||
);
|
||||
|
||||
/*$mailCompose = new MailCompose();
|
||||
add_submenu_page(
|
||||
'kompass-mail',
|
||||
__('Templates', BDP_LV_PLUGIN_SLUG),
|
||||
__('Templates', BDP_LV_PLUGIN_SLUG),
|
||||
'send_mails',
|
||||
'kompass-mail-compose',
|
||||
[$mailCompose, '__construct'],
|
||||
1);*/
|
||||
}
|
||||
|
||||
public function router()
|
||||
|
71
modules/Mail/Controllers/class-mailsettingscontroller.php
Normal file
71
modules/Mail/Controllers/class-mailsettingscontroller.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* File: class-mailsettingscontroller.php
|
||||
*
|
||||
*
|
||||
* @since 2024-07-31
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package mareike/
|
||||
*/
|
||||
|
||||
namespace Bdp\Modules\Mail\Controllers;
|
||||
|
||||
class MailSettingsController {
|
||||
public static function set_smtp_if_required() {
|
||||
|
||||
|
||||
$smtp_host = get_option('kompass_smtp_host', null); // SMTP-Host
|
||||
$smtp_port = get_option('kompass_smtp_port', null); // SMTP-Port
|
||||
$smtp_username = get_option('kompass_smtp_user', null); // SMTP-Benutzername
|
||||
$smtp_password = get_option('kompass_smtp_pass', null); // SMTP-Passwort
|
||||
$smtp_secure = 'tls'; // Verschlüsselung (tls oder ssl)
|
||||
|
||||
|
||||
if (false !== (bool)get_option('kompass_use_smtp', false) &&
|
||||
null !== $smtp_host &&
|
||||
null !== $smtp_port &&
|
||||
null !== $smtp_username &&
|
||||
null !== $smtp_password) {
|
||||
|
||||
add_action( 'phpmailer_init', function ( $phpmailer ) use ( $smtp_host, $smtp_port, $smtp_username, $smtp_password, $smtp_secure ) {
|
||||
$phpmailer->isSMTP();
|
||||
$phpmailer->Host = $smtp_host;
|
||||
$phpmailer->Port = $smtp_port;
|
||||
$phpmailer->SMTPAuth = true;
|
||||
$phpmailer->Username = $smtp_username;
|
||||
$phpmailer->Password = $smtp_password;
|
||||
|
||||
$sender = get_option('kompass_smtp_sender', null);
|
||||
$sender_name = get_option('kompass_smtp_sender-name', null);
|
||||
|
||||
if (null !== $sender && null !== $sender_name)
|
||||
$phpmailer->setFrom( $sender, $sender_name );
|
||||
#$phpmailer->SMTPSecure = $smtp_secure;
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function settings_form() {
|
||||
if (isset($_POST['save'])) {
|
||||
update_option('kompass_use_smtp', false);
|
||||
|
||||
if (isset($_POST['use_smtp'])) update_option('kompass_use_smtp', true);
|
||||
update_option('kompass_smtp_host', sanitize_text_field(wp_unslash($_POST['smtp-host'])));
|
||||
update_option('kompass_smtp_port', sanitize_text_field(wp_unslash($_POST['smtp-port'])));
|
||||
update_option('kompass_smtp_user', sanitize_text_field(wp_unslash($_POST['smtp-user'])));
|
||||
update_option('kompass_smtp_pass', sanitize_text_field(wp_unslash($_POST['smtp-pass'])));
|
||||
update_option('kompass_smtp_sender', sanitize_text_field(wp_unslash($_POST['smtp-sender'])));
|
||||
update_option('kompass_smtp_sender-name', sanitize_text_field(wp_unslash($_POST['smtp-sender-name'])));
|
||||
|
||||
kompass_print_message_box('Die Einstellungen wurden gespeichert.');
|
||||
}
|
||||
|
||||
|
||||
require BDP_LV_PLUGIN_DIR . '/settings/views/mail-settings.php';
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
function kompass_get_minimal_password_strength() {
|
||||
$minPasswordStrength = get_option('kompass_password_minimal_strength', 1);
|
||||
|
||||
$possibleStrengths = ['1' => 'short, bad, good, strong',
|
||||
'2' => 'good, strong',
|
||||
'3' => 'strong'];
|
||||
|
||||
return ' ' . $possibleStrengths[$minPasswordStrength];
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* File: class-extendregistrationform.php
|
||||
*
|
||||
*
|
||||
* @since 2024-07-30
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package mareike/
|
||||
*/
|
||||
|
||||
namespace Bdp\Modules\Registration\Controllers;
|
||||
|
||||
class ExtendRegistrationForm {
|
||||
public static function execute() {
|
||||
?>
|
||||
<p>
|
||||
<label for="first_name">Vorname<br />
|
||||
<input required style="width: 768px !important;" type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr(wp_unslash($_POST['first_name'] ?? '')); ?>" size="25" /></label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="last_name">Nachname<br />
|
||||
<input required style="width: 768px !important;" type="text" name="last_name" id="last_name" class="input" value="<?php echo esc_attr(wp_unslash($_POST['last_name'] ?? '')); ?>" size="25" /></label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
public static function error_messages($errors, $sanitized_user_login, $user_email) {
|
||||
if (empty($_POST['first_name']) || !empty($_POST['first_name']) && trim($_POST['first_name']) == '') {
|
||||
$errors->add('first_name_error', '<strong>FEHLER</strong>: Der Vorname ist erforderlich.');
|
||||
}
|
||||
if (empty($_POST['last_name']) || !empty($_POST['last_name']) && trim($_POST['last_name']) == '') {
|
||||
$errors->add('last_name_error', '<strong>FEHLER</strong>: DEr Nachname ist erforderlich.');
|
||||
}
|
||||
return $errors;
|
||||
|
||||
|
||||
}
|
||||
}
|
94
modules/Registration/Controllers/class-saveregistration.php
Normal file
94
modules/Registration/Controllers/class-saveregistration.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* File: class-saveregistration.php
|
||||
*
|
||||
*
|
||||
* @since 2024-07-30
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package mareike/
|
||||
*/
|
||||
|
||||
namespace Bdp\Modules\Registration\Controllers;
|
||||
|
||||
use WP_User;
|
||||
|
||||
class SaveRegistration {
|
||||
public static function execute($user_id) {
|
||||
if (!empty($_POST['first_name'])) {
|
||||
update_user_meta($user_id, 'first_name', sanitize_text_field($_POST['first_name']));
|
||||
}
|
||||
if (!empty($_POST['last_name'])) {
|
||||
update_user_meta($user_id, 'last_name', sanitize_text_field($_POST['last_name']));
|
||||
}
|
||||
|
||||
// Assign the 'Standarduser' role to the new user
|
||||
$user = new WP_User($user_id);
|
||||
$user->set_role('user');
|
||||
|
||||
// Send confirmation email
|
||||
$user = get_userdata($user_id);
|
||||
$code = sha1($user->user_registered);
|
||||
update_user_meta($user_id, 'activation_code', $code);
|
||||
|
||||
$activation_link = add_query_arg(array('key' => $code, 'user' => $user_id), get_site_url() . '/wp-login.php');
|
||||
|
||||
wp_mail($user->user_email, 'Bitte bestätige deine Anmeldung', 'Hallo, bitte bestätige deine Anmeldung über den folgenden Link: ' . $activation_link);
|
||||
|
||||
// Notify admin
|
||||
wp_mail(get_option('admin_email'), 'New User Registration', 'A new user has registered: ' . PHP_EOL .
|
||||
'Username: ' . $user->user_login . PHP_EOL .
|
||||
'First name: ' . $user->first_name . PHP_EOL .
|
||||
'Last name: ' . $user->last_name . PHP_EOL .
|
||||
'E-Mail: ' . $user->user_email);
|
||||
}
|
||||
|
||||
public static function activate_user() {
|
||||
if (isset($_GET['key']) && isset($_GET['user'])) {
|
||||
$user_id = intval($_GET['user']);
|
||||
$activation_code = get_user_meta($user_id, 'activation_code', true);
|
||||
|
||||
if ($activation_code === $_GET['key']) {
|
||||
delete_user_meta($user_id, 'activation_code');
|
||||
wp_redirect(home_url('/wp-login.php?checkemail=registered'));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function check_user_activation($user, $username, $password) {
|
||||
if (!is_a($user, 'WP_User')) {
|
||||
return null;
|
||||
}
|
||||
$user_id = $user->ID;
|
||||
$activation_code = get_user_meta($user_id, 'activation_code', true);
|
||||
|
||||
if ($activation_code) {
|
||||
return new WP_Error('not_activated', __('ERROR: You need to activate your account. Please check your email.', 'kompass'));
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public static function display_custom_message() {
|
||||
if (isset($_GET['checkemail']) && $_GET['checkemail'] === 'registered') {
|
||||
echo '<div class="custom-message" style="text-align:center; margin:20px auto; padding:10px; background-color:#e0f7fa; border:1px solid #00796b; border-radius:5px; max-width:600px;">
|
||||
<p style="font-size:16px; color:#00796b;">Vielen Dank für deine Registrierung. Bitte überprüfen deine E-Mails, um deine Registrierung zu bestätigen.</p>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if ((isset($_GET['action']) && $_GET['action'] === 'laostpassword') ||
|
||||
isset($_GET['checkemail']) && $_GET['checkemail'] === 'confirm'
|
||||
){
|
||||
echo '<div class="custom-message" style="text-align:center; margin:20px auto; padding:10px; background-color:#e0f7fa; border:1px solid #00796b; border-radius:5px; max-width:600px;">
|
||||
<p style="font-size:16px; color:#00796b;">Insofern der Account existiert, hast du soeben weitere Anweisungen per E-Mail erhalten.</p>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if (isset($_GET['action']) && $_GET['action'] === 'resetpass') {
|
||||
echo '<div class="custom-message" style="text-align:center; margin:20px auto; padding:10px; background-color:#e0f7fa; border:1px solid #00796b; border-radius:5px; max-width:600px;">
|
||||
<p style="font-size:16px; color:#00796b;">Dein Passwort wurde erfolgreich geändert.</p>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!defined('SECURE_AUTH_COOKIE') && !defined('AUTH_COOKIE')) {
|
||||
return;
|
||||
}
|
||||
add_settings_section(
|
||||
'custom_settings_section',
|
||||
__('Calendar settings', BDP_LV_PLUGIN_SLUG),
|
||||
|
@ -1,4 +1,3 @@
|
||||
/*******************************Calendar Top Navigation*********************************/
|
||||
div#calendar{
|
||||
margin:0px auto;
|
||||
padding:0px;
|
||||
@ -54,9 +53,6 @@ div#calendar div.header a.next{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************Calendar Content Cells*********************************/
|
||||
div#calendar div.box-content{
|
||||
border-top:none;
|
||||
width: 100%;
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
add_filter('the_content', ['Calendar', 'printCalendar']);
|
||||
wp_enqueue_style('bdp_calendar_css', BDP_LV_PLUGIN_URL . '/modules/calendar/assets/calendar.css');
|
||||
wp_enqueue_script( 'loadCalendar', BDP_LV_PLUGIN_URL . '/modules/calendar/assets/ajaxscript.js');
|
||||
|
||||
require_once dirname(__FILE__) . '/classes/Calendar.class.php';
|
||||
|
@ -5,29 +5,13 @@ class Calendar
|
||||
public $ical;
|
||||
private $categories = [];
|
||||
|
||||
public static function setup()
|
||||
{
|
||||
$pageName = 'Kalender';
|
||||
$page_exists = get_page_by_path($pageName, OBJECT, 'page');
|
||||
|
||||
// Wenn die Seite nicht existiert, erstelle sie
|
||||
if (!$page_exists) {
|
||||
$page_id = wp_insert_post(array(
|
||||
'post_title' => $pageName,
|
||||
'post_content' => '{{calendar}}',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
));
|
||||
|
||||
update_option('bdp_calendar_source_url', 'https://wiki.sachsen.pfadfinden.de/rest/calendar-services/1.0/calendar/export/subcalendar/private/ff69f5a689391ac0d7f78a70189cfde7c48cb923.ics');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function printCalendar($content) : string {
|
||||
// Der zu ersetzende String
|
||||
$original_string = '{{calendar}}';
|
||||
if (str_contains($content,$original_string)) {
|
||||
wp_enqueue_style('bdp_calendar_css', BDP_LV_PLUGIN_URL . '/modules/calendar/assets/calendar.css');
|
||||
wp_enqueue_script( 'loadCalendar', BDP_LV_PLUGIN_URL . '/modules/calendar/assets/ajaxscript.js');
|
||||
|
||||
$calendar = new Calendar();
|
||||
|
||||
// Der Ersatzstring
|
||||
@ -64,8 +48,10 @@ class Calendar
|
||||
}
|
||||
|
||||
|
||||
$calendarUrl = get_option('bdp_calendar_source_url', 'https://wiki.sachsen.pfadfinden.de/rest/calendar-services/1.0/calendar/export/subcalendar/private/ff69f5a689391ac0d7f78a70189cfde7c48cb923.ics');
|
||||
|
||||
$calendarUrl = get_option('bdp_calendar_source_url', null);
|
||||
if (null === '') {
|
||||
return;
|
||||
}
|
||||
$this->ical = new \ICal('', array(
|
||||
'defaultSpan' => 2, // Default value
|
||||
'defaultTimeZone' => '',
|
||||
|
@ -38,6 +38,10 @@ class AjaxRouterController {
|
||||
new PrintParticipantListPhotoPdfController();
|
||||
break;
|
||||
|
||||
case 'print_invoice_data':
|
||||
new PrintParticipantListInvoicePdfController();
|
||||
die();
|
||||
|
||||
default:
|
||||
echo 'No "method" specified.';
|
||||
}
|
||||
|
@ -40,38 +40,52 @@ class MainController
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
global $dbHandler;
|
||||
global $dbHandler, $wpdb;
|
||||
|
||||
add_menu_page(
|
||||
__('Events', BDP_LV_PLUGIN_SLUG),
|
||||
__('Events', BDP_LV_PLUGIN_SLUG),
|
||||
'send_mails',
|
||||
'kompass-events',
|
||||
[$this, 'router'],
|
||||
'dashicons-tickets-alt',
|
||||
3
|
||||
);
|
||||
$no_events = true;
|
||||
|
||||
foreach ($dbHandler->readFromDb( self::KOMPASS_EVENTS_EVENTS, ['archived' => false]) as $currentEvent) {
|
||||
add_submenu_page(
|
||||
'kompass-events',
|
||||
$currentEvent->event_name,
|
||||
$currentEvent->event_name,
|
||||
'show_groups',
|
||||
'kompass-events&action=show-event&event-id=' . $currentEvent->id,
|
||||
[ $this, 'router' ]);
|
||||
}
|
||||
foreach ( [ self::KOMPASS_EVENTS_EVENTS ] as $table ) {
|
||||
$sqlTable = $wpdb->prefix . $table;
|
||||
$sql = "SHOW TABLES LIKE '$sqlTable'";
|
||||
|
||||
add_submenu_page(
|
||||
'kompass-events',
|
||||
__('New Event', BDP_LV_PLUGIN_SLUG),
|
||||
__('New Event', BDP_LV_PLUGIN_SLUG),
|
||||
'show_groups',
|
||||
'kompass-events&action=new-event',
|
||||
[ $this, 'router' ]);
|
||||
$result = $wpdb->get_var( $sql );
|
||||
if ( $result == $sqlTable ) {
|
||||
|
||||
$no_events = 0 === $dbHandler->countSqlRows( self::KOMPASS_EVENTS_EVENTS, [ 'archived' => false ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$no_events ) {
|
||||
wp_admin_notice(
|
||||
'Mit dem kommenden Update von BdP Kompass ist der Zugriff auf Legacy-Veranstaltungen nicht mehr möglich. <br />' .
|
||||
'Das Update wird voraussichtlich am <strong>06.01.2025</strong> bereitgestellt werden.<br /><br />' .
|
||||
'Insofern du weiterhin Zugriff auf diese Veranstaltungen benötigst, kontaktiere den LB IT.', ['type' => 'warning']);
|
||||
|
||||
add_menu_page(
|
||||
__( 'Events (legacy)', BDP_LV_PLUGIN_SLUG ),
|
||||
__( 'Events (legacy)', BDP_LV_PLUGIN_SLUG ),
|
||||
'send_mails',
|
||||
'kompass-events',
|
||||
[ $this, 'router' ],
|
||||
'dashicons-tickets-alt',
|
||||
3
|
||||
);
|
||||
|
||||
foreach ( $dbHandler->readFromDb( self::KOMPASS_EVENTS_EVENTS, [ 'archived' => false ] ) as $currentEvent ) {
|
||||
add_submenu_page(
|
||||
'kompass-events',
|
||||
$currentEvent->event_name,
|
||||
$currentEvent->event_name,
|
||||
'show_groups',
|
||||
'kompass-events&action=show-event&event-id=' . $currentEvent->id,
|
||||
[ $this, 'router' ] );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function router()
|
||||
{
|
||||
if (isset($_REQUEST['action'])) {
|
||||
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\AnwesenheitRequest;
|
||||
|
||||
class PrintParticipantListInvoicePdfController {
|
||||
|
||||
private function get_table_header(string $event_name) : string {
|
||||
return '<h1>Teili-Liste für ' . $event_name . '</h1><br /><br /><br /><br /><table style="border-spacing: 0; width: 100%;page-break-after: always">' .
|
||||
'<tr>' .
|
||||
'<td>Vorname</td>' .
|
||||
'<td>Nachname</td>' .
|
||||
'<td>Teili-Gruppe</td>' .
|
||||
'<td>Stamm</td>' .
|
||||
'<td>Geburtsdatum</td>' .
|
||||
'<td>Beitrag</td>' .
|
||||
'<td>Tage</td>' .
|
||||
'<td>Notizen</td>';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$group_name = ['participant' => 'Teili', 'volunteer' => 'Teami', 'other' => 'Sonstige'];
|
||||
|
||||
$event = Event::loadById( $_REQUEST['event-id'] );
|
||||
$output = '';
|
||||
|
||||
$i = 0;
|
||||
foreach ( $event->tribes as $tribe => $participants ) {
|
||||
if ( count( $participants ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $participants as $participant ) {
|
||||
if ($participant->beitrag == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $i == 0 ) {
|
||||
$output .= $this->get_table_header( $event->event_name );
|
||||
}
|
||||
$i ++;
|
||||
|
||||
$output .= '<tr style="min-height: 80px; height: 80px; border-style: solid; border-width: 1px;">' .
|
||||
'<td style="min-height: 40px; height: 40px; width: 150px; border-style: solid; border-width: 1px;">' . $participant->vorname .
|
||||
('' != $participant->pfadiname ? '<br /> (' . $participant->pfadiname . ')' : '') . '</td>' .
|
||||
'<td style="width: 150px; border-style: solid; border-width: 1px;">' . $participant->nachname . '</td>' .
|
||||
'<td style="padding-right: 100px; border-style: solid; border-width: 1px;">' . $group_name[$participant->teilnahme] . '</td>' .
|
||||
'<td style="padding-right: 100px; border-style: solid; border-width: 1px;">' . $tribe . '</td>' .
|
||||
'<td style="padding-right: 50px; border-style: solid; border-width: 1px;">' . \DateTime::createFromFormat( 'Y-m-d', $participant->geburtsdatum )->format( 'd.m.Y' ) . '</td>' .
|
||||
'<td style="padding-right: 50px; border-style: solid; border-width: 1px;">' . str_replace('.', ',', $participant->beitrag) . ' Euro</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' . AnwesenheitRequest::send($participant) . '</td>' .
|
||||
'<td style="padding-right: 150px; border-style: solid; border-width: 1px;"></td></tr>';
|
||||
if ( $i == 12 ) {
|
||||
$output .= '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '</table></body></html>';
|
||||
kompass_create_pdf($output,$event->event_name . ' Beitragsliste.pdf', 'landscape');
|
||||
}
|
||||
}
|
@ -72,6 +72,7 @@
|
||||
<a href="#" onclick="kompass_load_ajax_nw('EventParticipants', 'print_kitchen_data', 'event-id=<?= $event->id; ?>');" class="button">Küchenliste</a>
|
||||
<a href="#" onclick="kompass_load_ajax_nw('EventParticipants', 'print_kitchen_allergies_data', 'event-id=<?= $event->id; ?>');" class="button">Küchenliste (Allergien)</a>
|
||||
<a href="#" onclick="kompass_load_ajax_nw('EventParticipants', 'print_medical_data', 'event-id=<?= $event->id; ?>');" class="button">Sani-Liste</a>
|
||||
<a href="#" onclick="kompass_load_ajax_nw('EventParticipants', 'print_invoice_data', 'event-id=<?= $event->id; ?>');" class="button">Beitrags-Liste</a>
|
||||
<a href="<?= $admin_link . 'send-mail-to-all&event-id=' . $event->id ?>" class="button">Rundmail an alle</a>
|
||||
</div>
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* File: class-installsingleplugin.php
|
||||
*
|
||||
*
|
||||
* @since 2024-08-12
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
|
||||
namespace Bdp\Modules\PluginInstaller\Controllers;
|
||||
|
||||
use Plugin_Upgrader;
|
||||
use WP_Ajax_Upgrader_Skin;
|
||||
|
||||
class InstallSingleplugin
|
||||
{
|
||||
public static function install_calendar ()
|
||||
{
|
||||
if ( isset( $_REQUEST[ 'install' ] ) ) {
|
||||
if ( !file_exists( dirname( BDP_LV_STARTUP_FILE ) . '/../kronos/kronos.php' ) ) {
|
||||
$pageName = 'Kalender';
|
||||
$page_exists = get_page_by_path( $pageName, OBJECT, 'page' );
|
||||
if ( is_object( $page_exists ) ) {
|
||||
wp_delete_post( $page_exists->ID, false );
|
||||
}
|
||||
$calendar_connection = get_option( 'bdp_calendar_source_url',
|
||||
'https://wiki.sachsen.pfadfinden.de/rest/calendar-services/1.0/calendar/export/subcalendar/private/ff69f5a689391ac0d7f78a70189cfde7c48cb923.ics' );
|
||||
if ( 'https://wiki.sachsen.pfadfinden.de/rest/calendar-services/1.0/calendar/export/subcalendar/private/ff69f5a689391ac0d7f78a70189cfde7c48cb923.ics' !== $calendar_connection ) {
|
||||
update_option( 'kronos_calendar_url', $calendar_connection );
|
||||
}
|
||||
delete_option( 'bdp_calendar_source_url' );
|
||||
|
||||
|
||||
kompass_install_plugin( 'https://repos.contelli.de/plugins/kronos/download', 'kronos' );
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
$install_link = admin_url( 'admin.php?page=kompass-calendar&install=true' );
|
||||
require dirname( __FILE__ ) . '/../views/install-item.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function install_events ()
|
||||
{
|
||||
if ( isset( $_REQUEST[ 'install' ] ) ) {
|
||||
if ( !file_exists( dirname( BDP_LV_STARTUP_FILE ) . '/../solea/solea.php' ) ) {
|
||||
kompass_install_plugin( 'https://repos.contelli.de/plugins/solea/download', 'solea' );
|
||||
}
|
||||
} else {
|
||||
$install_link = admin_url( 'admin.php?page=kompass-events&install=true' );
|
||||
require dirname( __FILE__ ) . '/../views/install-item.php';
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* File: class-outdatedmodule.php
|
||||
*
|
||||
*
|
||||
* @since 2024-08-12
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
|
||||
namespace Bdp\Modules\PluginInstaller\Controllers;
|
||||
|
||||
class OutdatedModule
|
||||
{
|
||||
public static function calender() {
|
||||
$module = 'Kalender';
|
||||
$install_url = admin_url('admin.php?page=kompass-calendar');
|
||||
require dirname(__FILE__) . '/../views/outdated-component.php';
|
||||
}
|
||||
}
|
20
modules/plugin-installer/views/install-item.php
Normal file
20
modules/plugin-installer/views/install-item.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* File: install-item.php
|
||||
*
|
||||
*
|
||||
* @since 2024-08-12
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div style="width: 80%; margin: 50px auto; border-style: solid; border-width: 2px; border-color: #1d4899; padding: 10px;">
|
||||
Um die gewünschte Komponente zu aktivieren, klicke bitte hier auf aktivieren.<br />
|
||||
kompass führt dabei die Installation im Hintergrund durch.
|
||||
<div style="text-align: center">
|
||||
<a href="<?php echo $install_link; ?>" class="button bdp-newplugin-button">Jetzt installieren</a>
|
||||
</div>
|
||||
</div>
|
18
modules/plugin-installer/views/outdated-component.php
Normal file
18
modules/plugin-installer/views/outdated-component.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* File: outdated-component.php
|
||||
*
|
||||
*
|
||||
* @since 2024-08-12
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div style="padding: 10px 10px; font-size: 15pt; margin-top: 20px; line-height: 30px; background-color: #fafafa; border-left: #f10905 10px solid;">
|
||||
kompass hat festgestellt, dass du die Komponente <?php echo esc_html($module); ?> nutzt, die nicht weiterentwickelt wird.<br />
|
||||
Es steht eine neue Version bereit, bitte klicke <a href="<?php echo esc_url($install_url); ?>">hier</a>, um die Aktualisierung durchzuführen.
|
||||
</div>
|
||||
|
@ -11,7 +11,6 @@ class Security
|
||||
public const delete_plugins = [
|
||||
'akismet/akismet.php',
|
||||
'hello.php',
|
||||
'wps-hide-login/wps-hide-login.php',
|
||||
'limit-login-attempts-reloaded'
|
||||
];
|
||||
|
||||
@ -23,13 +22,8 @@ class Security
|
||||
self::installSecurityPlugin($pluginSlug, $pluginData['downloadUrl']);
|
||||
}
|
||||
}
|
||||
$loginUrl = get_option('kompass_sec_rewrite_login', null);
|
||||
if (null == $loginUrl) {
|
||||
$loginUrl = get_option('whl_page', null) ?? 'bdp-login';
|
||||
}
|
||||
|
||||
enable_option_rewrite_url($loginUrl);
|
||||
enable_option_disable_xmlrpc();
|
||||
enable_option_disable_xmlrpc();
|
||||
enable_option_block_authorscan();
|
||||
enable_option_block_execution_in_uploads();
|
||||
enable_option_prohibit_special_files();
|
||||
@ -39,7 +33,7 @@ class Security
|
||||
enable_option_prohibit_bot_access();
|
||||
enable_option_block_directory_listing();
|
||||
self::resetLimitLoginAttempts();
|
||||
delete_option('whl_page');
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -83,22 +77,21 @@ class Security
|
||||
public static function SetPageFilters() {
|
||||
global $wp;
|
||||
|
||||
if (str_contains($_SERVER['REQUEST_URI'], 'wp-login.php?action=logout')) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action('template_redirect', [Security::class, 'protectAuthorScan']);
|
||||
Security::protectLoginSecurity();
|
||||
Security::protectLoginSecurity();
|
||||
}
|
||||
|
||||
public static function protectLoginSecurity() {
|
||||
$hideLogin = is_login_rewritten();
|
||||
|
||||
if (null === $hideLogin) {
|
||||
return;
|
||||
}
|
||||
update_option('whl_page', get_option(get_option('kompass_sec_rewrite_login', null)));
|
||||
delete_option('kompass_sec_rewrite_login');
|
||||
kompass_install_plugin( 'https://downloads.wordpress.org/plugin/wps-hide-login.1.9.17.1.zip', 'wps-hide-login' );
|
||||
|
||||
if ( str_contains( $_SERVER['REQUEST_URI'], 'wp-login.php' ) && ! isset( $_POST['redirect_to'] ) && $_POST['redirect_to'] !== 'interner-bereich' ) {
|
||||
|
||||
if ( str_contains( $_SERVER['REQUEST_URI'], 'wp-login.php' ) && ! isset( $_POST['redirect_to'] ) && $_POST['redirect_to'] !== 'interner-bereich' ) {
|
||||
wp_redirect( home_url() );
|
||||
die();
|
||||
}
|
||||
|
@ -86,18 +86,6 @@ function disable_option_disable_wp_debug() {
|
||||
WpConfigEditor::updateConfig('WP_DEBUG', 'true');
|
||||
}
|
||||
|
||||
function enable_option_rewrite_url(?string $url = null) {
|
||||
global $_POST;
|
||||
$saveUrl = $url ?? $_POST['rewrite_login'];
|
||||
update_option('kompass_sec_rewrite_login', $saveUrl);
|
||||
}
|
||||
|
||||
function disable_option_rewrite_url() {
|
||||
update_option('kompass_sec_rewrite_login', null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function kompass_sec_save_settings($settings) {
|
||||
$allPossibleSettings = [
|
||||
'option_disable_xmlrpc',
|
||||
@ -110,7 +98,6 @@ function kompass_sec_save_settings($settings) {
|
||||
'option_prohibit_bot_access',
|
||||
'option_block_directory_listing',
|
||||
'option_disable_wp_debug',
|
||||
'option_rewrite_url',
|
||||
];
|
||||
|
||||
$enableSettings = array_intersect($allPossibleSettings, $settings);
|
||||
|
@ -98,20 +98,6 @@
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (null !== is_login_rewritten()) {echo ' checked';} ?> type="checkbox" id="sec_mod_11" name="security_settings[]" value="option_rewrite_url" />
|
||||
<label for="sec_mod_11">
|
||||
<?= __('Change Login URL', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('Changing the default login URL of WordPress is advisable to enhance the security of your website. By default, WordPress login URLs is /wp-admin or /wp-login.php, which are easily guessed by hackers and facilitate attacks such as brute-force attacks. Changing the login URL to something unique and difficult to guess increases security since potential attackers will struggle to find the correct URL. This can help protect your website from unauthorized access and other malicious activities.', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<label style="font-weight: bold;">
|
||||
<?= __('Login-URL', BDP_LV_PLUGIN_SLUG) ?>: <?= get_site_url(); ?>/<input style="width: 100px;" class="long_text" type="text" name="rewrite_login" id="rewrite_login" value="<?= is_login_rewritten(); ?>">
|
||||
</label>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br /><br />
|
||||
<input type="submit" class="button" value="<?= __('Save changes', BDP_LV_PLUGIN_SLUG); ?>" />
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!defined('SECURE_AUTH_COOKIE') && !defined('AUTH_COOKIE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_settings_section(
|
||||
'custom_settings_section',
|
||||
|
147
settings/views/mail-settings.php
Normal file
147
settings/views/mail-settings.php
Normal file
@ -0,0 +1,147 @@
|
||||
<form action="<?php echo esc_url(admin_url('options-general.php?page=kompass-mail-settings')); ?>" method="post">
|
||||
<input type="hidden" name="save" value="1">
|
||||
<h2>E-Mail Einstellungen</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">SMTP zum senden Verwenden</td>
|
||||
<td>
|
||||
<div class="switch-container">
|
||||
<input name="use_smtp" <?php if (false !== (bool)get_option( 'kompass_use_smtp', false )) echo ' checked ';?> type="checkbox" id="use_smtp" class="switch">
|
||||
<label for="use_smtp" class="switch-label">
|
||||
<span class="switch-inner" data-on="ON" data-off="OFF"></span>
|
||||
<span class="switch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table id="smtp_settings" <?php if (false === (bool)get_option( 'kompass_use_smtp', false )) echo ' style="display: none;" ';?>>
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">SMTP-Host</td>
|
||||
<td>
|
||||
<input style="width: 500px;" type="text" name="smtp-host" value="<?php echo esc_html(get_option('kompass_smtp_host', '')); ?>" /> :
|
||||
<input style="width: 50px;" type="text" name="smtp-port" value="<?php echo esc_html(get_option('kompass_smtp_port', '25')); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">SMTP-User</td>
|
||||
<td>
|
||||
<input style="width: 562px;" type="text" name="smtp-user" value="<?php echo esc_html(get_option('kompass_smtp_user', '')); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">SMTP-Passwort</td>
|
||||
<td>
|
||||
<input style="width: 562px;" type="text" name="smtp-pass" value="<?php echo esc_html(get_option('kompass_smtp_pass', '')); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">SMTP-Sender email</td>
|
||||
<td>
|
||||
<input style="width: 562px;" type="text" name="smtp-sender" value="<?php echo esc_html(get_option('kompass_smtp_sender', '')); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">SMTP-Sender name</td>
|
||||
<td>
|
||||
<input style="width: 562px;" type="text" name="smtp-sender-name" value="<?php echo esc_html(get_option('kompass_smtp_sender-name', '')); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br /><br />
|
||||
<input type="submit" class="button-primary" value="Speichern">
|
||||
</form>
|
||||
<style>
|
||||
.switch-container {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.switch {
|
||||
visibility: hidden; /* Checkbox unsichtbar machen */
|
||||
}
|
||||
|
||||
.switch-label {
|
||||
display: block;
|
||||
width: 70px;
|
||||
height: 34px;
|
||||
background-color: #ccc;
|
||||
border-radius: 34px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.switch-inner {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 10px;
|
||||
font-size: 12px;
|
||||
color: white;
|
||||
box-sizing: border-box;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.switch-inner::before,
|
||||
.switch-inner::after {
|
||||
content: attr(data-off);
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.switch-inner::after {
|
||||
content: attr(data-on);
|
||||
right: 10px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.switch-switch {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background-color: #fff;
|
||||
border-radius: 50%;
|
||||
transition: transform 0.3s ease, background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.switch:checked + .switch-label {
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
|
||||
.switch:checked + .switch-label .switch-inner::before {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.switch:checked + .switch-label .switch-inner::after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.switch:checked + .switch-label .switch-switch {
|
||||
transform: translateX(36px);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// script.js
|
||||
document.getElementById('use_smtp').addEventListener('change', function() {
|
||||
if (this.checked) {
|
||||
document.getElementById('smtp_settings').style.display='block';
|
||||
} else {
|
||||
document.getElementById('smtp_settings').style.display='none';
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
153
settings/views/settings.php
Normal file
153
settings/views/settings.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
use Bdp\Libs\WpConfigEditor;
|
||||
?>
|
||||
<form action="<?php echo esc_url(admin_url('options-general.php?page=kompass-settings')); ?>" method="post">
|
||||
<input type="hidden" name="save" value="1">
|
||||
<h2>Kompass Einstellungen</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">Seite wird für LV genutzt</td>
|
||||
<td>
|
||||
<div class="switch-container">
|
||||
<input name="used_for_state" <?php if (false !== (bool)get_option( 'paged_used_for_state', false )) echo ' checked ';?> type="checkbox" id="switch_lv" class="switch">
|
||||
<label for="switch_lv" class="switch-label">
|
||||
<span class="switch-inner" data-on="ON" data-off="OFF"></span>
|
||||
<span class="switch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">Externe Cron-Ausführung</td>
|
||||
<td>
|
||||
<div class="switch-container">
|
||||
<input name="external_cronjobs"
|
||||
<?php
|
||||
if (WpConfigEditor::getConfigValue('DISABLE_WP_CRON') )
|
||||
echo ' checked ';?> type="checkbox" id="external_cronjobs" class="switch">
|
||||
<label for="external_cronjobs" class="switch-label">
|
||||
<span class="switch-inner" data-on="ON" data-off="OFF"></span>
|
||||
<span class="switch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">Nutzer können sich selbst anmelden</td>
|
||||
<td>
|
||||
<div class="switch-container">
|
||||
<input <?php if (false !== (bool)get_option( 'user_can_register', false )) echo ' checked ';?> name="self_register" type="checkbox" id="switch_register" class="switch">
|
||||
<label for="switch_register" class="switch-label">
|
||||
<span class="switch-inner" data-on="ON" data-off="OFF"></span>
|
||||
<span class="switch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="font-weight: bold; padding: 10px;">mareike Theme</td>
|
||||
<td>
|
||||
<div class="switch-container">
|
||||
<input name="use_mareike_theme" <?php if (false !== (bool)get_option( 'use_mareike_theme', false )) echo ' checked ';?>type="checkbox" id="switch_mareike" class="switch">
|
||||
<label for="switch_mareike" class="switch-label">
|
||||
<span class="switch-inner" data-on="ON" data-off="OFF"></span>
|
||||
<span class="switch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="submit" class="button-primary" value="Speichern">
|
||||
</form>
|
||||
<style>
|
||||
.switch-container {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.switch {
|
||||
visibility: hidden; /* Checkbox unsichtbar machen */
|
||||
}
|
||||
|
||||
.switch-label {
|
||||
display: block;
|
||||
width: 70px;
|
||||
height: 34px;
|
||||
background-color: #ccc;
|
||||
border-radius: 34px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.switch-inner {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 10px;
|
||||
font-size: 12px;
|
||||
color: white;
|
||||
box-sizing: border-box;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.switch-inner::before,
|
||||
.switch-inner::after {
|
||||
content: attr(data-off);
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.switch-inner::after {
|
||||
content: attr(data-on);
|
||||
right: 10px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.switch-switch {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background-color: #fff;
|
||||
border-radius: 50%;
|
||||
transition: transform 0.3s ease, background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.switch:checked + .switch-label {
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
|
||||
.switch:checked + .switch-label .switch-inner::before {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.switch:checked + .switch-label .switch-inner::after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.switch:checked + .switch-label .switch-switch {
|
||||
transform: translateX(36px);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// script.js
|
||||
document.getElementById('switch').addEventListener('change', function() {
|
||||
if (this.checked) {
|
||||
console.log('Switch is ON');
|
||||
} else {
|
||||
console.log('Switch is OFF');
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
Reference in New Issue
Block a user