mirror of
https://github.com/unraid/webgui.git
synced 2026-01-26 19:48:55 -06:00
Created new general purpose Secure.php module
This commit is contained in:
@@ -16,16 +16,9 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = 'docker';
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
require_once "$docroot/webGui/include/Secure.php";
|
||||
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
|
||||
function unscript($text) {
|
||||
return preg_replace('#<script(.*?)>(.+?)</script>#','',html_entity_decode($text));
|
||||
}
|
||||
function unhook($text) {
|
||||
return preg_replace("/['\"](.*)?['\"];?.+$/",'',unscript($text));
|
||||
}
|
||||
|
||||
$DockerClient = new DockerClient();
|
||||
$action = unscript($_REQUEST['action']);
|
||||
$container = unscript($_REQUEST['container']);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<?
|
||||
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/Secure.php";
|
||||
|
||||
// Helper functions
|
||||
function my_scale($value, &$unit, $decimals=NULL, $scale=NULL, $kilo=1000) {
|
||||
@@ -263,10 +264,4 @@ function my_explode($split,$text,$count=2) {
|
||||
function my_preg_split($split,$text,$count=2) {
|
||||
return array_pad(preg_split($split,$text,$count),$count,'');
|
||||
}
|
||||
function unscript($text) {
|
||||
return preg_replace('#<script(.*?)>(.+?)</script>#','',html_entity_decode($text));
|
||||
}
|
||||
function unhook($text) {
|
||||
return preg_replace("/['\"](.*)?['\"];?.+$/",'',unscript($text));
|
||||
}
|
||||
?>
|
||||
|
||||
20
plugins/dynamix/include/Secure.php
Normal file
20
plugins/dynamix/include/Secure.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2021, Lime Technology
|
||||
* Copyright 2012-2021, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
function unscript($text) {
|
||||
return preg_replace('#<script(.*?)>(.+?)</script>#','',html_entity_decode($text));
|
||||
}
|
||||
function unhook($text) {
|
||||
return preg_replace("/['\"](.*)?['\"];?.+$/",'',unscript($text));
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user