mirror of
https://github.com/waytotheweb/scripts.git
synced 2026-03-29 15:37:06 +00:00
GPL v3 Release
This commit is contained in:
31
cmq/da/admin/index.html
Normal file
31
cmq/da/admin/index.html
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
print "<iframe scrolling='auto' name='myiframe' id='myiframe' src='index.raw' frameborder='0' width='100%' onload='resizeIframe(this);'></iframe>\n";
|
||||
print "<script>\n";
|
||||
print "function setupObserver(iframe) {\n";
|
||||
print " const body = iframe.contentDocument.body;\n";
|
||||
print " const updateDimensions = () => {\n";
|
||||
print " iframe.style.height = iframe.contentDocument.body.offsetHeight + 'px';\n";
|
||||
print " };\n";
|
||||
print " const observer = new MutationObserver(updateDimensions);\n";
|
||||
print " observer.observe(body, {\n";
|
||||
print " attributes: true,\n";
|
||||
print " childList: true,\n";
|
||||
print " characterData: true,\n";
|
||||
print " subtree: true,\n";
|
||||
print " });\n";
|
||||
print "}\n";
|
||||
print "function resizeIframe(obj) {\n";
|
||||
print " if (!obj) return;\n";
|
||||
print " setupObserver(obj);\n";
|
||||
print " obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';\n";
|
||||
if ($ENV{SKIN_NAME} eq "enhanced") {
|
||||
print " obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';\n";
|
||||
} else {
|
||||
print " obj.style.width = '98vw';\n";
|
||||
}
|
||||
print " window.scrollTo(0,0);\n";
|
||||
print " window.parent.scrollTo(0,0);\n";
|
||||
print " window.parent.parent.scrollTo(0,0);\n";
|
||||
print "}\n";
|
||||
print "</script>\n";
|
||||
7
cmq/da/admin/index.raw
Normal file
7
cmq/da/admin/index.raw
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
$| = 1;
|
||||
|
||||
print "HTTP/1.1 200 OK\n";
|
||||
print "Content-type: text/html\r\n\r\n";
|
||||
system ("/usr/local/directadmin/plugins/cmq/exec/cmq");
|
||||
147
cmq/da/exec/da_cmq.cgi
Normal file
147
cmq/da/exec/da_cmq.cgi
Normal file
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# Copyright (C) 2006-2025 Jonathan Michaelson
|
||||
#
|
||||
# https://github.com/waytotheweb/scripts
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, see <https://www.gnu.org/licenses>.
|
||||
###############################################################################
|
||||
# start main
|
||||
use strict;
|
||||
use File::Find;
|
||||
use Fcntl qw(:DEFAULT :flock);
|
||||
use Sys::Hostname qw(hostname);
|
||||
use IPC::Open3;
|
||||
use File::Copy;
|
||||
use Digest::MD5;
|
||||
|
||||
use lib '/etc/cmq/Modules';
|
||||
use ConfigServer::cmqUI;
|
||||
|
||||
our ($script, $script_da, $images, %FORM, $myv, %daconfig, %ajaxsubs, %fullsubs);
|
||||
|
||||
my %session;
|
||||
if ($ENV{SESSION_ID} =~ /^\w+$/) {
|
||||
open (my $SESSION, "<", "/usr/local/directadmin/data/sessions/da_sess_".$ENV{SESSION_ID}) or die "Security Error: No valid session key for [$ENV{SESSION_ID}]";
|
||||
flock ($SESSION, LOCK_SH);
|
||||
my @data = <$SESSION>;
|
||||
close ($SESSION);
|
||||
chomp @data;
|
||||
foreach my $line (@data) {
|
||||
my ($name, $value) = split(/\=/,$line);
|
||||
$session{$name} = $value;
|
||||
}
|
||||
}
|
||||
if (($session{key} eq "") or ($session{ip} eq "") or ($session{key} ne $ENV{SESSION_KEY})) {
|
||||
&loginfail("Security Error: No valid session key");
|
||||
exit;
|
||||
}
|
||||
|
||||
my ($ppid, $pexe) = &getexe(getppid());
|
||||
if ($pexe ne "/usr/local/directadmin/directadmin") {
|
||||
print "Security Error: Invalid parent";
|
||||
exit;
|
||||
}
|
||||
|
||||
$script = "/CMD_PLUGINS_ADMIN/cmq/index.raw";
|
||||
$script_da = "/CMD_PLUGINS_ADMIN/cmq/index.raw";
|
||||
$images = "/CMD_PLUGINS_ADMIN/cmq/images";
|
||||
my $buffer = $ENV{'QUERY_STRING'};
|
||||
if ($buffer eq "") {$buffer = $ENV{POST}}
|
||||
my @pairs = split(/&/, $buffer);
|
||||
foreach my $pair (@pairs) {
|
||||
my ($name, $value) = split(/=/, $pair);
|
||||
$value =~ tr/+/ /;
|
||||
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
|
||||
$FORM{$name} = $value;
|
||||
}
|
||||
|
||||
my $bootstrapcss = "<link rel='stylesheet' href='$images/bootstrap/css/bootstrap.min.css'>";
|
||||
my $jqueryjs = "<script src='$images/jquery.min.js'></script>";
|
||||
my $bootstrapjs = "<script src='$images/bootstrap/js/bootstrap.min.js'></script>";
|
||||
my $fontawesome = "<link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.0.10/css/all.css'>";
|
||||
|
||||
my $versionfile = "/etc/cmq/cmqversion.txt";
|
||||
open (my $IN, "<", $versionfile) or die $!;
|
||||
flock ($IN, LOCK_SH);
|
||||
$myv = <$IN>;
|
||||
close ($IN);
|
||||
chomp $myv;
|
||||
|
||||
unless ($FORM{action} eq "tailcmd" or $FORM{action} eq "tracking_detail" or $FORM{format} ne "" or $FORM{action} eq "help") {
|
||||
print <<EOF;
|
||||
<!doctype html>
|
||||
<html lang='en'>
|
||||
<head>
|
||||
<title>ConfigServer Mail Queues</title>
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
$bootstrapcss
|
||||
$fontawesome
|
||||
<link href='$images/configserver.css' rel='stylesheet' type='text/css'>
|
||||
$jqueryjs
|
||||
$bootstrapjs
|
||||
</head>
|
||||
<body>
|
||||
<div id="loader"></div>
|
||||
<div class='container-fluid'>
|
||||
<br>
|
||||
<div class='panel panel-default'>
|
||||
<h4><img src='$images/cmq.png' style='padding-left: 10px'> ConfigServer Mail Queues - cmq v$myv</h4>
|
||||
</div>
|
||||
EOF
|
||||
} else {
|
||||
print <<EOF;
|
||||
<!doctype html>
|
||||
<html lang='en'>
|
||||
<head>
|
||||
$bootstrapcss
|
||||
<link href='$images/configserver.css' rel='stylesheet' type='text/css'>
|
||||
$jqueryjs
|
||||
$bootstrapjs
|
||||
</head>
|
||||
<body>
|
||||
<div class='container-fluid'>
|
||||
<style>
|
||||
pre {
|
||||
overflow: initial;
|
||||
}
|
||||
</style>
|
||||
EOF
|
||||
}
|
||||
|
||||
ConfigServer::cmqUI::displayUI(\%FORM,$script,$script_da,$images,$myv);
|
||||
|
||||
print <<EOF;
|
||||
<script>
|
||||
\$("#loader").hide();
|
||||
window.parent.parent.scrollTo(0,0);
|
||||
parent.resizeIframe(parent.document.getElementById("myiframe"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
|
||||
sub getexe {
|
||||
my $thispid = shift;
|
||||
open (my $STAT, "<", "/proc/".$thispid."/stat");
|
||||
my $stat = <$STAT>;
|
||||
close ($STAT);
|
||||
chomp $stat;
|
||||
$stat =~ /\w\s+(\d+)\s+[^\)]*$/;
|
||||
my $ppid = $1;
|
||||
my $exe = readlink("/proc/".$ppid."/exe");
|
||||
return ($ppid, $exe);
|
||||
}
|
||||
1;
|
||||
4
cmq/da/hooks/admin_img.html
Normal file
4
cmq/da/hooks/admin_img.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<a class=button href="/CMD_PLUGINS_ADMIN/cmq/index.html">
|
||||
<img border="0" src="/CMD_PLUGINS_ADMIN/cmq/images/cmq.png"><br>
|
||||
ConfigServer Mail Queues
|
||||
</a>
|
||||
1
cmq/da/hooks/admin_txt.html
Normal file
1
cmq/da/hooks/admin_txt.html
Normal file
@@ -0,0 +1 @@
|
||||
<a href="/CMD_PLUGINS_ADMIN/cmq/index.html">ConfigServer Mail Queues</a>
|
||||
8
cmq/da/plugin.conf
Normal file
8
cmq/da/plugin.conf
Normal file
@@ -0,0 +1,8 @@
|
||||
active=yes
|
||||
author=WTTW
|
||||
id=cmq
|
||||
installed=yes
|
||||
name=ConfigServer Mail Queues
|
||||
update_url=
|
||||
version=1.0
|
||||
version_url=
|
||||
5
cmq/da/scripts/install.sh
Normal file
5
cmq/da/scripts/install.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "This plugin is installed by installing csf from the root shell"
|
||||
|
||||
exit 0;
|
||||
5
cmq/da/scripts/uninstall.sh
Normal file
5
cmq/da/scripts/uninstall.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "This plugin is uninstalled by uninstalling csf from the root shell"
|
||||
|
||||
exit 0;
|
||||
5
cmq/da/scripts/update.sh
Normal file
5
cmq/da/scripts/update.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "This plugin is updated by updating csf from the root shell"
|
||||
|
||||
exit 0;
|
||||
Reference in New Issue
Block a user