Skip to content

Commit

Permalink
v1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
coax committed Oct 15, 2024
1 parent 7dbc074 commit dcfd2bc
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hMailAdmin/hm_securityranges.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<thead>
<tr>
<th data-sort="string"><?php EchoTranslation("Name")?></th>
<th style="width:20%;" data-sort="string"><?php EchoTranslation("IP address") ?></th>
<th style="width:20%;" data-sort="ipaddress"><?php EchoTranslation("IP address") ?></th>
<th style="width:10%;" data-sort="int"><?php EchoTranslation("Priority") ?></th>
<th style="width:20%;" data-sort="int"><?php EchoTranslation("Expires") ?></th>
<th style="width:32px;" class="no-sort">&nbsp;</th>
Expand Down
6 changes: 3 additions & 3 deletions hMailAdmin/hm_smtp_antivirus.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
<div class="hidden">
<?php
PrintCheckboxRow("clamwinenabled", "Enabled", $clamwinenabled);
PrintPropertyEditRow("clamwinexecutable", "ClamScan executable", $clamwinexecutable);
PrintPropertyEditRow("clamwindbfolder", "Path to ClamScan database", $clamwindbfolder);
PrintPropertyEditRow("clamwinexecutable", "ClamScan executable", $clamwinexecutable, 255);
PrintPropertyEditRow("clamwindbfolder", "Path to ClamScan database", $clamwindbfolder, 255);
?>
<div class="buttons bottom"><input type="button" value="<?php EchoTranslation("Test")?>" onclick="return TestScanner('ClamWin');"></div>
<div id="ClamWinTestResult" class="bottom"></div>
Expand All @@ -93,7 +93,7 @@
<div class="hidden">
<?php
PrintCheckboxRow("customscannerenabled", "Enabled", $customscannerenabled);
PrintPropertyEditRow("customscannerexecutable", "Scanner executable", $customscannerexecutable);
PrintPropertyEditRow("customscannerexecutable", "Scanner executable", $customscannerexecutable, 255);
PrintPropertyEditRow("customscannerreturnvalue", "Return value", $customscannerreturnvalue, 5, "number");
?>
<div class="buttons bottom"><input type="button" value="<?php EchoTranslation("Test")?>" onclick="return TestScanner('External');"></div>
Expand Down
100 changes: 99 additions & 1 deletion hMailAdmin/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ jQuery(document).ready(function() {

// init "stupidtable" plugin
if ($('.tablesort').length) {
$('.tablesort').stupidtable();
$('.tablesort').stupidtable({
'ipaddress': function(a,b) {
aIP = ip_address_pre(a);
//console.log(aIP)
bIP = ip_address_pre(b);
//console.log(bIP)
return aIP - bIP;
}
});
}

// init "facebox" plugin
Expand Down Expand Up @@ -420,6 +428,96 @@ jQuery(document).ready(function() {
*/
});

function ip_address_pre(ip){
var i, item;
var m, n, t;
var x, xa;

if (!ip) {
return 0
}

ip = ip.replace(/<[\s\S]*?>/g, "");
//IPv4:Port
t = ip.split(":");
if (t.length == 2){
m = t[0].split(".");
}
else {
m = ip.split(".");
}
n = ip.split(":");
x = "";
xa = "";

if (m.length == 4) {
// IPV4
for(i = 0; i < m.length; i++) {
item = m[i];

if(item.length == 1) {
x += "00" + item;
}
else if(item.length == 2) {
x += "0" + item;
}
else {
x += item;
}
}
}
else if (n.length > 0) {
// IPV6
var count = 0;
for(i = 0; i < n.length; i++) {
item = n[i];

if (i > 0) {
xa += ":";
}

if(item.length === 0) {
count += 0;
}
else if(item.length == 1) {
xa += "000" + item;
count += 4;
}
else if(item.length == 2) {
xa += "00" + item;
count += 4;
}
else if(item.length == 3) {
xa += "0" + item;
count += 4;
}
else {
xa += item;
count += 4;
}
}

// Padding the ::
n = xa.split(":");
var paddDone = 0;

for (i = 0; i < n.length; i++) {
item = n[i];

if (item.length === 0 && paddDone === 0) {
for (var padding = 0 ; padding < (32-count) ; padding++) {
x += "0";
paddDone = 1;
}
}
else {
x += item;
}
}
}
return x;
}

// confirm delete
function Confirm(question, yes, no, action) {
$.facebox('<div class="center bottom"><p>' + question + '</p><button id="yes">' + yes + '</button><button onclick="$.facebox.close();" style="margin-left:30px;">' + no + '</button></div>');
Expand Down

0 comments on commit dcfd2bc

Please sign in to comment.