- Adding SM2 panel [SME: 13004] - Upgrade to phpsysinfo 3.4.4 - Add code to delete inline styles and add css to make it look better. - version saved / built uses the static version, which means no drops downs and choices.
52 lines
2.1 KiB
Perl
52 lines
2.1 KiB
Perl
package SrvMngr::Controller::Phpsysinfo;
|
|
|
|
#----------------------------------------------------------------------
|
|
# heading : Legacy
|
|
# description : System Information
|
|
# navigation : 4000 600
|
|
#----------------------------------------------------------------------
|
|
#----------------------------------------------------------------------
|
|
# name : phpsysinfo, method : get, url : /phpsysinfo, ctlact : Phpsysinfo#main
|
|
#
|
|
# routes : end
|
|
#----------------------------------------------------------------------
|
|
use strict;
|
|
use warnings;
|
|
use Mojo::Base 'Mojolicious::Controller';
|
|
use Locale::gettext;
|
|
use SrvMngr::I18N;
|
|
use SrvMngr qw(theme_list init_session);
|
|
use Mojo::UserAgent;
|
|
my $ua = Mojo::UserAgent->new;
|
|
$ua->insecure(1);
|
|
sub main {
|
|
my $c = shift;
|
|
my $title = $c->l('psi_phpsysinfo_panel');
|
|
my $php_url = 'https://sme11.thereadclan.me.uk/phpsysinfo/index.php?disp=static';
|
|
#my $first_line = q{<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline' 'unsafe-eval' 'self'" />};
|
|
#my $second_line = q{<meta name="Description" content="phpSysInfo is a customizable PHP script that displays information about your system nicely" />};
|
|
$ua->get($php_url => sub {
|
|
my ($ua, $tx) = @_;
|
|
if ($tx->res->is_success) {
|
|
my $php_content = $tx->res->body;
|
|
my ($phpsysinfo_html) = $php_content =~ m{<body[^>]*>(.*?)</body>}si;
|
|
$phpsysinfo_html =~ s/^( SME Server|<BR>Copyright \(c\)).*\n//gmi;
|
|
# Insert $first_line before $second_line - supressing CSP
|
|
#$phpsysinfo_html =~ s/(\Q$second_line\E)/$first_line\n$1/;
|
|
$c->stash(title => $title, phpsysinfo => $phpsysinfo_html, php_url => $php_url);
|
|
$c->render(template => 'phpsysinfo');
|
|
} else {
|
|
my $code = $tx->res->code // 'No code';
|
|
my $redirect = $code eq '302' ? $tx->res->headers->location : '';
|
|
$c->render(text => "Failed to fetch PHP content: $code $redirect", status => 500);
|
|
}
|
|
});
|
|
# Do not render here; rendering happens in the callback
|
|
}
|
|
|
|
#sub main {
|
|
# my $c = shift;
|
|
# $c->proxy_to('https://sme11.thereadclan.me.uk/phpsysinfo/index.php?disp=static');
|
|
#}
|
|
|
|
1; |