Basic release
This commit is contained in:
assets
bdp-kompass.phpbuena
404.phpcomments.phpcontent.phpeditor-style.css
font
functions.phpimg
BDP001_Icon_Empfehlen.pngbleistift.pngbriefumschlag.pngbundeszeichen.pngbundeszeichen@2x.pngdeutschlandkarte.pngfavicon.icohamburger.pngholz.jpgicon-drucken.pngicon-favoriten.pngicon-impressum.pngicon-kontakt.pngklufthemd.pngleitbild_Kontakt_low.jpgleitbild_Kontakt_low_klein.jpgleitbild_aktionen_low.jpgleitbild_aktionen_low_klein.jpgleitbild_bund.jpgleitbild_bund_crop.jpgleitbild_bund_crop_klein.jpgleitbild_ihs.jpgleitbild_ihs_klein.jpgleitbild_int2_low.jpgleitbild_int2_low_klein.jpgleitbild_pfadfinden_low.jpgleitbild_pfadfinden_low_klein.jpgloeffel-topf.pnglupe.svgschatten.svgstreichholzschachtel.png
index.phpreadme.txtscreenshot.pngsearchform.phpsrc
style.cssuse
shy-wordpress
core
holz.jpgicon.icoicon.pngicon.svglib/ics-parser
modules
about
internal
calendar
depency-checker
firstusage
index.phpsecurity
seo
plugins/pfadfinden-theme-updater
languages
pfadfinden-theme-updater.phpphpunit.xml.distreadme.txtsrc
startup.phptests
use
shy-wordpress
75
modules/security/classes/Security.class.php
Normal file
75
modules/security/classes/Security.class.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\Security;
|
||||
|
||||
|
||||
use ZipArchive;
|
||||
|
||||
|
||||
|
||||
class Security
|
||||
{
|
||||
public const required_security_plugins = [
|
||||
'wps_hide_login' => ['downloadUrl' => 'https://downloads.wordpress.org/plugin/wps-hide-login.1.9.10.zip'],
|
||||
'limit-login-attempts-reloaded' => ['downloadUrl' => 'https://downloads.wordpress.org/plugin/limit-login-attempts-reloaded.2.25.27.zip']];
|
||||
|
||||
|
||||
public const delete_plugins = [
|
||||
'akismet/akismet.php',
|
||||
'hello.php'
|
||||
];
|
||||
|
||||
public static function setup()
|
||||
{
|
||||
self::deletePlugins();
|
||||
foreach (self::required_security_plugins as $pluginSlug => $pluginData) {
|
||||
if (!is_dir(WP_PLUGIN_DIR . '/' . $pluginSlug)) {
|
||||
self::installSecurityPlugin($pluginSlug, $pluginData['downloadUrl']);
|
||||
}
|
||||
}
|
||||
|
||||
$loginUrl = get_option('whl_page', 'bdp_login');
|
||||
update_option('whl_page', $loginUrl);
|
||||
|
||||
}
|
||||
|
||||
public static function deletePlugins() {
|
||||
deactivate_plugins(self::delete_plugins);
|
||||
delete_plugins(self::delete_plugins);
|
||||
}
|
||||
|
||||
|
||||
public static function installSecurityPlugin(string $pluginSlug, string $downloadUrl) : bool
|
||||
{
|
||||
$ch = curl_init();
|
||||
$source = $downloadUrl;
|
||||
curl_setopt($ch, CURLOPT_URL, $source);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$data = curl_exec ($ch);
|
||||
curl_close ($ch);
|
||||
|
||||
$destination = WP_PLUGIN_DIR . '/' . $pluginSlug . '.zip';
|
||||
$file = fopen($destination, "w+");
|
||||
fputs($file, $data);
|
||||
fclose($file);
|
||||
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($destination);
|
||||
$zip->extractTo(WP_PLUGIN_DIR);
|
||||
$zip->close();
|
||||
unlink($destination);
|
||||
|
||||
$pluginInfos = get_plugins( '/'.$pluginSlug );
|
||||
$installfile = $pluginSlug . '/';
|
||||
if( ! empty( $pluginInfos ) ) {
|
||||
foreach ($pluginInfos as $file => $info) :
|
||||
$installfile .= $file;
|
||||
endforeach;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$result = activate_plugin($installfile);
|
||||
|
||||
return $result === null;
|
||||
}
|
||||
}
|
32
modules/security/internal/index.php
Normal file
32
modules/security/internal/index.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
echo '<div class="health-check-body health-check-debug-tab hide-if-no-js">';
|
||||
echo '<h1>Erweiterte Sicherheitseinstellungen</h1>';
|
||||
if (isset($_POST['submit'])) {
|
||||
echo '<div id="bdp_success">Die Einstellungen wurden gespeichert.</div>';
|
||||
update_option('whl_page', $_POST['login_url']);
|
||||
}
|
||||
?>
|
||||
|
||||
<form method="post" action="admin.php?page=bdp-kompass%2Fmodules%2Findex.php&loadmodule=security">
|
||||
<div class="bdp_security_outer">
|
||||
<fieldset class="bdp_security_inner">
|
||||
<legend>Wordpress-Login</legend>
|
||||
|
||||
<table>
|
||||
<tr style="vertical-align: top;">
|
||||
<td>Login-URL:</td>
|
||||
<td> <label><?php echo get_site_url(); ?>/</label><input style="width: 100px;" class="long_text" type="text" name="login_url" id="login_url" required
|
||||
value = "<?php echo get_option('whl_page', 'bdp_login'); ?>"
|
||||
>/<br />
|
||||
<label style="font-weight: normal; color: #a0a0a0; font-style: italic">
|
||||
Du erreichst das Dashboard deiner Seite zukünftig nur noch unter dieser URL
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<input class="bdp_submit" type="submit" name="submit" value="Einstellungen speichern">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
25
modules/security/security.php
Normal file
25
modules/security/security.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
function wp_example_site_health_navigation_tabs( $tabs ) {
|
||||
// translators: Tab heading for Site Health navigation.
|
||||
$tabs['loginurl'] = esc_html_x( 'Login-URL', 'Site Health', 'text-domain' );
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
add_filter( 'site_health_navigation_tabs', 'wp_example_site_health_navigation_tabs' );
|
||||
|
||||
|
||||
function wp_example_site_health_tab_content($tab)
|
||||
{
|
||||
// Do nothing if this is not our tab.
|
||||
if ('loginurl' === $tab) {
|
||||
require_once dirname(__FILE__) . '/internal/index.php';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
add_action('site_health_tab_content', 'wp_example_site_health_tab_content');
|
||||
|
||||
require_once dirname(__FILE__) . '/classes/Security.class.php';
|
||||
|
||||
|
Reference in New Issue
Block a user