function popup() { $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $TB_HEIGHT = 400; $TB_WIDTH = 710; $q = new mysql_mimedefang_builder(); $attachments_storage = $q->COUNT_ROWS("storage"); $sql = "SELECT SUM(filesize) as tcount FROM `storage`"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $size = FormatBytes($ligne["tcount"] / 1024); $t = time(); $new_entry = $tpl->_ENGINE_parse_body("{new_rule}"); $filename = $tpl->_ENGINE_parse_body("{filename}"); $date = $tpl->_ENGINE_parse_body("{date}"); $title = $tpl->_ENGINE_parse_body("{$attachments_storage} {items}: «{$size}»"); $filessize = $tpl->_ENGINE_parse_body("{filesize}"); $ask_delete_file = $tpl->javascript_parse_text("{ask_delete_file}"); $enable = $tpl->_ENGINE_parse_body("{enable}"); $compile_rules = $tpl->_ENGINE_parse_body("{compile_rules}"); $online_help = $tpl->_ENGINE_parse_body("{online_help}"); $options = $tpl->_ENGINE_parse_body("{options}"); $items = $tpl->_ENGINE_parse_body("{items}"); $buttons = "\n\tbuttons : [\n\t{name: '{$new_entry}', bclass: 'Add', onpress : NewGItem{$t}},\n\t{name: '{$compile_rules}', bclass: 'Reconf', onpress : MimeDefangCompileRules},\n\t{name: '{$options}', bclass: 'Settings', onpress : Options{$t}},\n\t{name: '{$items}', bclass: 'Db', onpress : ShowTable{$t}},\n\t{name: '{$online_help}', bclass: 'Help', onpress : ItemHelp{$t}},\n\t\n\t],\t"; $buttons = null; $explain = $tpl->_ENGINE_parse_body("{mimedefang_filehosting_items_explain}"); $html = "\n\t<div class=explain style='font-size:14px'>{$explain}</div>\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:99%'></table>\n<script>\nvar mem{$t}='';\n\$(document).ready(function(){\n\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?items=yes&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$date}', name : 'filetime', width :152, sortable : true, align: 'left'},\t\n\t\t{display: '{$filename}', name : 'filename', width :379, sortable : true, align: 'left'},\n\t\t{display: '{$filessize}', name : 'filesize', width :77, sortable : true, align: 'left'},\n\t\t{display: ' ', name : 'action', width :31, sortable : false, align: 'center'},\n\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t\t{display: '{$filename}', name : 'filename'},\n\t\t{display: '{$to}', name : 'mailto'},\n\n\t],\n\tsortname: 'filetime',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$title}',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: {$TB_WIDTH},\n\theight: {$TB_HEIGHT},\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200,500]\n\t\n\t}); \n});\n\nfunction ItemHelp{$t}(){\n\ts_PopUpFull('http://www.mail-appliance.org/index.php?cID=339','1024','900');\n}\n\nfunction ShowTable{$t}(){\n\tLoadjs('mimedefang.filehosting.table.php');\n}\n\nvar x_DeleteFileNameHosting{$t}=function(obj){\n\tvar tempvalue=obj.responseText;\n if(tempvalue.length>3){alert(tempvalue);return;}\n \$('#rowD'+mem{$t}).remove();\n}\nfunction DeleteFileNameHosting{$t}(filename,md5){\n\tif(confirm('{$ask_delete_file}')){\n\t\tmem{$t}=md5;\n \t\tvar XHR = new XHRConnection();\n \tXHR.appendData('delete-item',filename);\n \tXHR.appendData('filename',filename);\n \tXHR.sendAndLoad('{$page}', 'POST',x_DeleteFileNameHosting{$t});\t\t\n\t\n\t}\n\n}\n\n</script>"; echo $html; }
function status() { $t = $_GET["t"]; $ini = new Bs_IniHandler(); $sock = new sockets(); $page = CurrentPageName(); $ini->loadString(base64_decode($sock->getFrameWork('mimedefang.php?status=yes'))); $APP_MIMEDEFANG = DAEMON_STATUS_ROUND("APP_MIMEDEFANG", $ini, null); $APP_MIMEDEFANGX = DAEMON_STATUS_ROUND("APP_MIMEDEFANGX", $ini, null); $Param = unserialize(base64_decode($sock->GET_INFO("MimeDefangServiceOptions"))); if (!is_numeric($Param["MX_TMPFS"])) { $Param["MX_TMPFS"] = 0; } $tpl = new templates(); if ($Param["MX_TMPFS"] > 5) { $array = unserialize(base64_decode($sock->getFrameWork("mimedefang.php?getramtmpfs=yes"))); if (!is_numeric($array["PURC"])) { $array["PURC"] = 0; } if (!isset($array["SIZE"])) { $array["SIZE"] = "0M"; } $tmpfs[] = "\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:16px' align='left'>tmpfs:</td>\n\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valing='middle'>" . pourcentage($array["PURC"]) . "</td>\n\t\t\t\t<td style='font-size:14px'>{$array["PURC"]}%/{$array["SIZE"]}</td>\n\t\t\t</tr>\n\n\t\t\t"; } $q = new mysql_mimedefang_builder(); $attachments_storage = $q->COUNT_ROWS("storage"); if ($attachments_storage > 0) { $sql = "SELECT SUM(filesize) as tcount FROM `storage`"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $size = FormatBytes($ligne["tcount"] / 1024); $tmpfs[] = "\n\t<tr>\n\t\t<td colspan=2>\n\t\t<hr>\n\t<table>\n\t\t<tr>\n\t\t\t<td style='font-size:16px' align='left'>{attachments_storage}:</td>\n\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('mimedefang.filehosting.table.php');\"\n\t\t\t\tstyle='font-size:16px;text-decoration:underline'>{$attachments_storage} {items} ({$size})</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t</tr>\n\t\n\n\t\t\t"; } if (count($tmpfs) > 0) { $tmpfs_builded = "<table style='width:30%;margin-top:15px' class=form>" . @implode("\n", $tmpfs) . "</table>"; } $html = "<table style='width:99%' class=form>\n\t<tr>\n\t<td>{$APP_MIMEDEFANG}{$APP_MIMEDEFANGX}\n\t\t<center style='margin-top:10px;margin-bottom:10px;width:95%' class=form>\n\t\t<table style='width:70%'>\n\t\t<tbody>\n\t\t<tr>\n\t\t\t<td width=10% align='center;'>" . imgtootltip("32-stop.png", "{stop}", "Loadjs('{$page}?service-cmds=stop')") . "</td>\n\t\t\t<td width=10% align='center'>" . imgtootltip("restart-32.png", "{stop} & {start}", "Loadjs('{$page}?service-cmds=restart')") . "</td>\n\t\t\t<td width=10% align='center'>" . imgtootltip("32-run.png", "{start}", "Loadjs('{$page}?service-cmds=start')") . "</td>\n\t\t</tr>\n\t\t</tbody>\n\t\t</table>\n\t\t</center>\t\n\t\n\t</td>\n\t</tr>\n\t</table>\n\t<center>\n\t\t{$tmpfs_builded}\n\t</center>\n\t<div style='text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjax('status-{$t}','{$page}?status=yes&t={$t}');") . "</div>"; echo $tpl->_ENGINE_parse_body($html); }
function CleanDatabase() { $sock = new sockets(); $unix = new unix(); $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; if ($unix->file_time_min($pidtime) < 120) { return; } $MimeDefangFileMaxDaysStore = $sock->GET_INFO("MimeDefangFileMaxDaysStore"); if (!is_numeric($MimeDefangFileMaxDaysStore)) { $MimeDefangFileMaxDaysStore = 5; } if ($MimeDefangFileMaxDaysStore == 0) { return; } $q = new mysql_mimedefang_builder(); $filesStart = $q->COUNT_ROWS("storage"); if ($filesStart == 0) { return; } $sql = "DELETE FROM storage WHERE filetime<DATE_SUB(NOW(),INTERVAL {$MimeDefangFileMaxDaysStore} DAY)"; $q->QUERY_SQL($sql); if (!$q->ok) { system_admin_events("Fatal: {$q->mysql_error}.", __FUNCTION__, __FILE__, __LINE__, "postfix"); return; } $filesEND = $q->COUNT_ROWS("storage"); $diff = $filesStart - $filesEND; if ($diff > 0) { system_admin_events("Success cleaned {$diff} files from attachments storage.", __FUNCTION__, __FILE__, __LINE__, "postfix"); } @unlink($pidtime); @file_put_contents($pidtime, time()); }