function progression_quarantine()
{
    if (is_file("/usr/share/artica-postfix/ressources/logs/mailarchive-quarantine-progress.ini")) {
        $file = "/usr/share/artica-postfix/ressources/logs/mailarchive-quarantine-progress.ini";
    } else {
        if (is_file("/usr/share/artica-postfix/ressources/mailarchive-quarantine-progress.ini")) {
            $file = "/usr/share/artica-postfix/ressources/mailarchive-quarantine-progress.ini";
        }
    }
    if ($file == null) {
        $total = 0;
        $current = 0;
        $pourc = 100;
    }
    $ini = new Bs_IniHandler($file);
    $tot = $ini->get("PROGRESS", "total");
    $cur = $ini->get("PROGRESS", "current");
    $pid = $ini->get("PROGRESS", "pid");
    $quarantine_type = $ini->get("PROGRESS", "quarantine");
    if ($tot > 0) {
        $pourc = round($cur / $tot, 2);
        $pourc = $pourc * 100;
        $img = "<img src='img/wait.gif'>";
    } else {
        $pourc = 100;
    }
    if ($pourc == 100) {
        $img = "&nbsp;";
    }
    $color = "#5DD13D";
    $html = "<table style='width:100%'>\n\t<tr>\n\t\t<td align='center' colspan=2><strong style='font-size:13px'>&laquo;{$quarantine_type}&raquo;&nbsp;{$cur}/{$tot} (pid:{$pid}) </td>\n\t</tr>\n\t\t\n\t<tr>\n\t\t<td width=1%><span id='wait'>{$img}</span>\n\t\t</td>\n\t\t<td width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<div style='width:100%;background-color:white;padding-left:0px;border:1px solid {$color}'>\n\t\t\t\t\t<div id='progression_postfix'>\n\t\t\t\t\t\t<div style='width:{$pourc}%;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:{$color}'>\n\t\t\t\t\t\t\t<strong style='color:#BCF3D6;font-size:12px;font-weight:bold'>{$pourc}%</strong></center>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\t\t\n\t\t</td>\n\t</tr>\n\t</table>";
    return $html;
}
Beispiel #2
0
function ParseEvents()
{
    $path = "/var/log/artica-postfix/events";
    $f = new filesClasses();
    $hash = $f->DirListTable($path);
    if (!is_array($hash)) {
        return null;
    }
    echo date('Y-m-d h:i:s') . " " . count($hash) . " file(s) notifications...\n";
    $mysql = new mysql();
    while (list($num, $file) = each($hash)) {
        $text = null;
        $processname = null;
        $date = null;
        $context = null;
        $subject = null;
        $recipient = null;
        $bigtext = @file_get_contents($path . '/' . $file);
        echo date('Y-m-d h:i:s') . " Parsing {$file} " . strlen($bigtext) . " bytes text\n";
        $ini = new Bs_IniHandler();
        if (preg_match("#<text>(.+?)</text>#is", $bigtext, $re)) {
            $text = $re[1];
            if (strlen($text) > 0) {
                $bigtext = str_replace($re[0], '', $bigtext);
            }
        }
        if (preg_match("#<attachedfiles>(.+?)</attachedfiles>#is", $bigtext, $re)) {
            $files_text = addslashes($re[1]);
        }
        $ini->loadString($bigtext);
        $processname = $ini->_params["LOG"]["processname"];
        $date = $ini->_params["LOG"]["date"];
        $context = $ini->_params["LOG"]["context"];
        $context = addslashes($context);
        if (strlen($text) < 2) {
            $text = $ini->_params["LOG"]["text"];
        }
        $text = addslashes($text);
        $subject = $ini->_params["LOG"]["subject"];
        $recipient = $ini->_params["LOG"]["recipient"];
        $subject = addslashes($subject);
        echo date('Y-m-d h:i:s') . " Parsing subject {$subject} " . strlen($text) . " bytes text\n";
        writelogs("New notification: {$subject} (" . strlen($text) . " bytes)", __FUNCTION__, __FILE__, __LINE__);
        $sql = "INSERT INTO events (zDate,hostname,\n        \tprocess,text,context,content,attached_files,recipient) VALUES(\n        \t'{$date}',\n        \t'{$mysql->hostname}',\n        \t'{$processname}',\n        \t'{$subject}',\n        \t'{$context}','{$text}','{$files_text}','{$recipient}')";
        echo date('Y-m-d h:i:s') . " run mysql query\n";
        if ($mysql->QUERY_SQL($sql, 'artica_events')) {
            unlink($path . '/' . $file);
        } else {
            error_log("Mysql error keep {$path}/{$file};");
            error_log("{$mysql->mysql_error}");
            if (preg_match("#Unknown column#", $mysql->mysql_error)) {
                error_log("->BuildTables()");
                $mysql->BuildTables();
            }
        }
    }
    if (count($hash) > 0) {
        events(count($hash) . " events queue parsed...");
    }
}
function watchdog()
{
    $ini = new Bs_IniHandler("/etc/artica-postfix/smtpnotif.conf");
    $PostfixQueueEnabled = $ini->get("SMTP", "PostfixQueueEnabled");
    $PostfixQueueMaxMails = $ini->get("SMTP", "PostfixQueueMaxMails");
    if ($PostfixQueueEnabled == null) {
        $PostfixQueueEnabled = 1;
    }
    if ($PostfixQueueMaxMails == null) {
        $PostfixQueueMaxMails = 20;
    }
    if ($PostfixQueueEnabled != 1) {
        return;
    }
    $postfix_system = new postfix_system();
    $array = $postfix_system->getQueuesNumber();
    while (list($num, $val) = each($array)) {
        $logs[] = "{$num}={$val} message(s)";
        if (intval($val) > $PostfixQueueMaxMails) {
            if (is_file("/etc/artica-postfix/croned.1/postfix.{$num}.exceed")) {
                if (file_time_min("/etc/artica-postfix/croned.1/postfix.{$num}.exceed") < 30) {
                    continue;
                }
            }
            @file_put_contents("/etc/artica-postfix/croned.1/postfix.{$num}.exceed", "#");
            $subject = "Postfix queue {$num} exceed limit";
            $text = "The {$num} storage queue contains {$val} messages\nIt exceed the maximum {$PostfixQueueMaxMails} messages number...";
            send_email_events($subject, $text, 'system');
        }
    }
    $logs[] = "{$num}={$val} message(s)";
    RTMevents(implode(" ", $logs));
}
Beispiel #4
0
function lighttpd_status()
{
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $tpl = new templates();
    $page = CurrentPageName();
    $ini->loadString(base64_decode($sock->getFrameWork('services.php?lighttpd-status=yes')));
    $LIGHTTPD = DAEMON_STATUS_ROUND("LIGHTTPD", $ini, null, 1);
    $LIGHTTPD_PID = $ini->_params["LIGHTTPD"]["master_pid"];
    $FRAMEWORK = DAEMON_STATUS_ROUND("FRAMEWORK", $ini, null, 1);
    $FRAMEWORK_PID = $ini->_params["FRAMEWORK"]["master_pid"];
    $php_cgi_array = unserialize(base64_decode($sock->getFrameWork('services.php?php-cgi-array=yes')));
    $LIGHTTPD_AR[] = "<table style='width:99%' class=form>";
    while (list($pid, $array) = each($php_cgi_array[$LIGHTTPD_PID])) {
        $RSS = FormatBytes($array["RSS"]);
        $VM = FormatBytes($array["VM"]);
        $TTL = $array["TTL"];
        $LIGHTTPD_AR[] = "<tr>\n\t\t<td><strong style='font-size:12px'>PID:{$pid}</strong></td>\n\t\t<td><strong style='font-size:12px'>RSS:{$RSS}</strong></td>\n\t\t<td><strong style='font-size:12px'>VM:{$VM}</strong></td>\n\t\t<td><strong style='font-size:12px'>TTL:{$TTL}</strong></td>\n\t\t</tr>\n\t\t";
    }
    $LIGHTTPD_AR[] = "</table>";
    $LIGHTTPDF_AR[] = "<table style='width:99%' class=form>";
    while (list($pid, $array) = each($php_cgi_array[$FRAMEWORK_PID])) {
        $RSS = FormatBytes($array["RSS"]);
        $VM = FormatBytes($array["VM"]);
        $TTL = $array["TTL"];
        $LIGHTTPDF_AR[] = "<tr>\n\t\t<td><strong style='font-size:12px'>PID:{$pid}</strong></td>\n\t\t<td><strong style='font-size:12px'>RSS:{$RSS}</strong></td>\n\t\t<td><strong style='font-size:12px'>VM:{$VM}</strong></td>\n\t\t<td><strong style='font-size:12px'>TTL:{$TTL}</strong></td>\n\t\t</tr>\n\t\t";
    }
    $LIGHTTPDF_AR[] = "</table>";
    $html = "<table style='width:99%' class=form>\n\t<tr>\n\t\t<td>{$LIGHTTPD} " . @implode("\n", $LIGHTTPD_AR) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td><hr></td>\n\t</tr>\n\t<tr>\n\t\t<td>{$FRAMEWORK}" . @implode("\n", $LIGHTTPDF_AR) . "</td>\n\t</tr>\n\t</table>\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function statusof()
{
    $appname = $_GET["statusof"];
    $file = dirname(__FILE__) . "/ressources/install/{$appname}.ini";
    $ini = new Bs_IniHandler();
    if (file_exists($file)) {
        $data = file_get_contents($file);
        $ini->loadString($data);
        $pourc = $ini->_params["INSTALL"]["STATUS"];
        $text_info = $ini->_params["INSTALL"]["INFO"];
        if (strlen($text_info) > 0) {
            $text_info = "<span style='color:white;font-size:10px'>{$text_info}...</span>";
        }
    } else {
        $pourc = 0;
    }
    $color = "#5DD13D";
    if ($pourc == "110") {
        $color = "#CC4B1C";
        $pourc = "100";
    }
    $html = "\n\t<input type='hidden' id='int-progress' value='{$pourc}'>\n\t<div style='width:{$pourc}%;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:{$color}'>\n\t\t<strong style='color:#BCF3D6;font-size:12px;font-weight:bold'>{$pourc}%&nbsp;{$text_info}</strong></center>\n\t</div>\n";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
function export_ou_http($ou, $session)
{
    $sock = new sockets();
    $ldap = new clladp();
    $path = "/root";
    echo "Exporting meta informations session {$session} for ou=`{$ou}`\n";
    export($ou, $path);
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    echo "Reading session {$session} for ou=`{$ou}`\n";
    if ($ou == null) {
        echo "Failed, no such ou set....\n";
        die;
    }
    $ini->loadString($sock->GET_INFO($session));
    $filepath = "{$path}/{$ou}.gz";
    if (!is_file($filepath)) {
        echo "{$filepath} no such file";
    }
    echo "Uploading to https://{$ini->_params["CONF"]["servername"]}:{$ini->_params["CONF"]["port"]}\n";
    $uri = "https://{$ini->_params["CONF"]["servername"]}:{$ini->_params["CONF"]["port"]}/cyrus.murder.listener.php";
    $command = "?export-ou=yes&admin={$ini->_params["CONF"]["username"]}&pass={$ini->_params["CONF"]["password"]}&original-suffix={$ldap->suffix}";
    //lic.users.import.php
    $http = new httpget();
    $http->uploads["EXPORT-OU"] = "{$filepath}";
    $body = $http->send("https://{$ini->_params["CONF"]["servername"]}:{$ini->_params["CONF"]["port"]}/cyrus.murder.listener.php", "post", array("AUTH" => base64_encode(serialize($ini->_params["CONF"])), "ORG" => $ou));
    @unlink($filepath);
    echo $body;
}
Beispiel #7
0
function popup_status(){
	$ini=new Bs_IniHandler();
	$sock=new sockets();
	$ini->loadString(base64_decode($sock->getFrameWork('cmd.php?backuppc-ini-status=yes')));
	$status=DAEMON_STATUS_ROUND("APP_BACKUPPC",$ini);
	$page=CurrentPageName();
	$html="
	<table style='width:100%'>
	<tr>
		<td valign='top'>
			<img src='img/backuppc-128.png'>
			<hr>
		</td>
		<td valign='top'>
			$status		
		</td>			
	</tr>
	</table>
	
				<div style='font-size:14px'>
			{APP_BACKUPPC_TEXT}
			</div>
	
	<div id='users-backuppc-table'></div>
	
	<script>
		//LoadAjax('users-backuppc-table','$page?popup-users=yes');
	</script>
	
	";
	
	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body($html);
	
}
Beispiel #8
0
function refresh_service_status()
{
    if (!$GLOBALS["VERBOSE"]) {
        if (GET_CACHED(__FILE__, __FUNCTION__, md5($_GET["refresh-service-status"]), false, 1)) {
            return;
        }
    }
    $refresh["C-ICAP"] = "APP_C_ICAP";
    if (preg_match("#SERVICE-STATUS-ROUND-(.+)#", $_GET["refresh-service-status"], $re)) {
        $tpl = new templates();
        $key = $re[1];
        if ($GLOBALS["VERBOSE"]) {
            echo "Prod: {$key}\n<br>";
        }
        $content = GetIniContent($key);
        if ($content == null) {
            if (!is_file("ressources/logs/global.status.ini")) {
                return;
            }
            $bsini = new Bs_IniHandler("ressources/logs/global.status.ini");
        } else {
            $bsini = new Bs_IniHandler();
            $bsini->loadString($content);
        }
        if ($bsini->_params[$key]["service_name"] == null) {
            return null;
        }
        $prod = $bsini->_params[$key]["service_name"];
        $status = DAEMON_STATUS_ROUND($key, $bsini);
        $html = $tpl->_ENGINE_parse_body($status);
        SET_CACHED(__FILE__, __FUNCTION__, md5($_GET["refresh-service-status"]), $html);
        echo $html;
    }
}
Beispiel #9
0
function iscsi_status(){
	$sock=new sockets();
	$tpl=new templates();
	$ini=new Bs_IniHandler();
	$ini->loadString(base64_decode($sock->getFrameWork("cmd.php?iscsi-status=yes")));
	$status=DAEMON_STATUS_ROUND("APP_IETD",$ini,null,0);
	echo $tpl->_ENGINE_parse_body($status);		
}
Beispiel #10
0
function PROXY()
{
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $ini->loadString($sock->GET_INFO("ArticaProxySettings"));
    $ArticaProxyServerEnabled = $ini->_params["PROXY"]["ArticaProxyServerEnabled"];
    $ArticaProxyServerName = $ini->_params["PROXY"]["ArticaProxyServerName"];
    $ArticaProxyServerPort = $ini->_params["PROXY"]["ArticaProxyServerPort"];
    $ArticaProxyServerUsername = $ini->_params["PROXY"]["ArticaProxyServerUsername"];
    $ArticaProxyServerUserPassword = $ini->_params["PROXY"]["ArticaProxyServerUserPassword"];
    $ArticaCompiledProxyUri = $ini->_params["PROXY"]["ArticaCompiledProxyUri"];
    if (trim($ArticaProxyServerEnabled) != "yes") {
        PROXY_DELETE();
        return;
    }
    if (trim($ArticaProxyServerName == null)) {
        PROXY_DELETE();
        return;
    }
    if (trim($ArticaProxyServerPort == null)) {
        $ArticaProxyServerPort = 80;
    }
    if (!is_numeric($ArticaProxyServerPort)) {
        $ArticaProxyServerPort = 80;
    }
    if ($ArticaProxyServerUsername != null) {
        $pattern = "{$ArticaProxyServerUsername}";
        if ($ArticaProxyServerUserPassword != null) {
            $pattern = $pattern . ":{$ArticaProxyServerUserPassword}";
        }
        $pattern = $pattern . "@";
    }
    echo "Starting......: " . date("H:i:s") . " Using proxy {$ArticaProxyServerName}:{$ArticaProxyServerPort}\n";
    $proxypattern = "http://{$pattern}{$ArticaProxyServerName}:{$ArticaProxyServerPort}";
    $f = explode("\n", @file_get_contents("/etc/environment"));
    while (list($key, $line) = each($f)) {
        if (preg_match("#^HTTP_PROXY#i", $line)) {
            unset($f[$key]);
        }
    }
    $f[] = "http_proxy={$proxypattern}";
    if (is_dir("/etc/profile.d")) {
        $t[] = "#!/bin/sh";
        $t[] = "HTTP_PROXY={$proxypattern}";
        $t[] = "for i in NEWSPOST_PROXY NEWSREPLY_PROXY NEWS_PROXY WAIS_PROXY SNEWSREPLY_PROXY FINGER_PROXY HTTPS_PROXY FTP_PROXY CSO_PROXY SNEWSPOST_PROXY NNTP_PROXY GOPHER_PROXY SNEWS_PROXY; do";
        $t[] = "export \$i=\$HTTP_PROXY; done";
        $t[] = "unset i";
        @file_put_contents("/etc/profile.d/proxy-mycompany.sh", @implode("\n", $t));
        @chmod("/etc/profile.d/proxy-mycompany.sh", 0755);
    }
    @file_put_contents("/root/.wgetrc", @implode("\n", $f));
    @file_put_contents("/etc/profile.local", @implode("\n", $f));
    @file_put_contents("/etc/environment", @implode("\n", $f));
    if (is_dir("/etc/apt/apt.conf.d")) {
        echo "Starting......: " . date("H:i:s") . " Using proxy with apt-get, apt-mirror...\n";
        @file_put_contents("/etc/apt/apt.conf.d/proxy", "Acquire::http::Proxy \"{$proxypattern}\";");
    }
}
function page()
{
    $users = new usersMenus();
    $ini = new Bs_IniHandler();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $ini->loadString($sock->getFrameWork("cmd.php?SmtpNotificationConfigRead=yes"));
    if ($ini->_params["SMTP"]["smtp_server_port"] == null) {
        $ini->_params["SMTP"]["smtp_server_port"] = 25;
    }
    if ($ini->_params["SMTP"]["smtp_sender"] == null) {
        $users = new usersMenus();
        $ini->_params["SMTP"]["smtp_sender"] = "artica@{$users->fqdn}";
    }
    $t = time();
    $UfdbguardSMTPNotifs = unserialize(base64_decode($sock->GET_INFO("UfdbguardSMTPNotifs")));
    if (!isset($UfdbguardSMTPNotifs["ENABLED"])) {
        $UfdbguardSMTPNotifs["ENABLED"] = 0;
    }
    if (!is_numeric($UfdbguardSMTPNotifs["ENABLED"])) {
        $UfdbguardSMTPNotifs["ENABLED"] = 0;
    }
    $UseRemoteUfdbguardService = $sock->GET_INFO("UseRemoteUfdbguardService");
    if (!is_numeric($UseRemoteUfdbguardService)) {
        $UseRemoteUfdbguardService = 0;
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_server_name"])) {
        $UfdbguardSMTPNotifs["smtp_server_name"] = $ini->_params["SMTP"]["smtp_server_name"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_server_port"])) {
        $UfdbguardSMTPNotifs["smtp_server_port"] = $ini->_params["SMTP"]["smtp_server_port"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_sender"])) {
        $UfdbguardSMTPNotifs["smtp_server_port"] = $ini->_params["SMTP"]["smtp_sender"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_dest"])) {
        $UfdbguardSMTPNotifs["smtp_dest"] = $ini->_params["SMTP"]["smtp_dest"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_auth_user"])) {
        $UfdbguardSMTPNotifs["smtp_dest"] = $ini->_params["SMTP"]["smtp_auth_user"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_auth_passwd"])) {
        $UfdbguardSMTPNotifs["smtp_auth_passwd"] = $ini->_params["SMTP"]["smtp_auth_passwd"];
    }
    if (!isset($UfdbguardSMTPNotifs["tls_enabled"])) {
        $UfdbguardSMTPNotifs["tls_enabled"] = $ini->_params["SMTP"]["tls_enabled"];
    }
    if (!isset($UfdbguardSMTPNotifs["ssl_enabled"])) {
        $UfdbguardSMTPNotifs["ssl_enabled"] = $ini->_params["SMTP"]["ssl_enabled"];
    }
    if (!is_numeric($UfdbguardSMTPNotifs["smtp_server_port"])) {
        $UfdbguardSMTPNotifs["smtp_server_port"] = 25;
    }
    //Switchdiv
    $html = "\n\t<div class=explain style='font-size:14px'>{smtp_ufdbguard_notifications_text}</div>\n\t<div id='notif1-{$t}'></div>\n\n\t<table style='width:99%' class=form id='main-form-{$t}'>\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{smtp_enabled}:</strong></td>\n\t\t<td>" . Field_checkbox("ENABLED", 1, $UfdbguardSMTPNotifs["ENABLED"], "SMTPNotifArticaEnableSwitch{$t}()") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{smtp_server_name}:</strong></td>\n\t\t<td>" . Field_text('smtp_server_name', trim($UfdbguardSMTPNotifs["smtp_server_name"]), 'font-size:14px;padding:3px;width:250px') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{smtp_server_port}:</strong></td>\n\t\t<td>" . Field_text('smtp_server_port', trim($UfdbguardSMTPNotifs["smtp_server_port"]), 'font-size:14px;padding:3px;width:40px') . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{smtp_sender}:</strong></td>\n\t\t<td>" . Field_text('smtp_sender', trim($UfdbguardSMTPNotifs["smtp_sender"]), 'font-size:14px;padding:3px;width:290px') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{smtp_dest}:</strong></td>\n\t\t<td>" . Field_text('smtp_dest', trim($UfdbguardSMTPNotifs["smtp_dest"]), 'font-size:14px;padding:3px;width:290px') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{smtp_auth_user}:</strong></td>\n\t\t<td>" . Field_text('smtp_auth_user', trim($UfdbguardSMTPNotifs["smtp_auth_user"]), 'font-size:14px;padding:3px;width:200px') . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{smtp_auth_passwd}:</strong></td>\n\t\t<td>" . Field_password("smtp_auth_passwd-{$t}", trim($UfdbguardSMTPNotifs["smtp_auth_passwd"]), 'font-size:14px;padding:3px;width:100px') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{tls_enabled}:</strong></td>\n\t\t<td>" . Field_checkbox("tls_enabled", 1, $UfdbguardSMTPNotifs["tls_enabled"]) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td nowrap class=legend style='font-size:14px'>{UseSSL}:</strong></td>\n\t\t<td>" . Field_checkbox("ssl_enabled", 1, $UfdbguardSMTPNotifs["ssl_enabled"]) . "</td>\n\t</tr>\t\t\t\t\t\n\t<tr>\n\t\t<td align='right' colspan=2>" . button('{apply}', "SaveArticaSMTPNotifValues{$t}();", 16) . "</td>\n\t</tr>\n\n\t</tr>\n</table>\n<script>\n\tvar x_SaveArticaSMTPNotifValues{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tdocument.getElementById('notif1-{$t}').innerHTML='';\n\t\tif(results.length>0){alert(results);}\n\t\tRefreshTab('main_ufdbguard_config');\n\t}\n\n\tfunction SaveArticaSMTPNotifValues{$t}(){\n\t\tvar UseRemoteUfdbguardService={$UseRemoteUfdbguardService};\n\t\tif(UseRemoteUfdbguardService==1){return;}\n\t\tvar XHR = new XHRConnection();\n\t\tvar pp=encodeURIComponent(document.getElementById('smtp_auth_passwd-{$t}').value);\n\t\tif(document.getElementById('ENABLED').checked){XHR.appendData('ENABLED',1);}else {XHR.appendData('ENABLED',0);}\n\t\tif(document.getElementById('tls_enabled').checked){XHR.appendData('tls_enabled',1);}else {XHR.appendData('tls_enabled',0);}\n\t\tif(document.getElementById('ssl_enabled').checked){XHR.appendData('ssl_enabled',1);}else {XHR.appendData('ssl_enabled',0);}\n\t\tXHR.appendData('smtp_server_name',document.getElementById('smtp_server_name').value);\n\t\tXHR.appendData('smtp_server_port',document.getElementById('smtp_server_port').value);\n\t\tXHR.appendData('smtp_sender',document.getElementById('smtp_sender').value);\n\t\tXHR.appendData('smtp_dest',document.getElementById('smtp_dest').value);\n\t\tXHR.appendData('smtp_auth_user',document.getElementById('smtp_auth_user').value);\n\t\tXHR.appendData('smtp_auth_passwd',pp);\n\t\tXHR.appendData('smtp_notifications','yes');\n\t\tAnimateDiv('notif1-{$t}');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveArticaSMTPNotifValues{$t});\n\t}\n\t\n\tfunction SMTPNotifArticaEnableSwitch{$t}(){\n\t\tdocument.getElementById('smtp_auth_passwd-{$t}').disabled=true;\n\t\tdocument.getElementById('smtp_auth_user').disabled=true;\n\t\tdocument.getElementById('smtp_dest').disabled=true;\n\t\tdocument.getElementById('smtp_sender').disabled=true;\n\t\tdocument.getElementById('smtp_server_port').disabled=true;\n\t\tdocument.getElementById('smtp_server_name').disabled=true;\n\t\tdocument.getElementById('tls_enabled').disabled=true;\n\t\tdocument.getElementById('ssl_enabled').disabled=true;\n\t\t\n\t\t\n\t\t\n\t\tif(!document.getElementById('ENABLED').checked){return;}\n\t\t\n\t\tdocument.getElementById('smtp_auth_passwd-{$t}').disabled=false;\n\t\tdocument.getElementById('smtp_auth_user').disabled=false;\n\t\tdocument.getElementById('smtp_dest').disabled=false;\n\t\tdocument.getElementById('smtp_sender').disabled=false;\n\t\tdocument.getElementById('smtp_server_port').disabled=false;\n\t\tdocument.getElementById('smtp_server_name').disabled=false;\n\t\tdocument.getElementById('tls_enabled').disabled=false;\n\t\tdocument.getElementById('ssl_enabled').disabled=false;\t\n\t\tvar UseRemoteUfdbguardService={$UseRemoteUfdbguardService};\n\t\tif(UseRemoteUfdbguardService==1){\n\t\t\tDisableFieldsFromId('main-form-{$t}');\t\n\t\t}\t\t\n\t\t\n\t}\n\tSMTPNotifArticaEnableSwitch{$t}();\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
Beispiel #12
0
function fetchmail_status()
{
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $ini->loadString($sock->getfile('fetchmailstatus'));
    $status = DAEMON_STATUS_ROUND("FETCHMAIL", $ini, null);
    return $tpl->_ENGINE_parse_body($status);
}
Beispiel #13
0
function MailGraphStatus()
{
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $ini->loadFile("ressources/logs/global.status.ini");
    $status = DAEMON_STATUS_ROUND("MAILGRAPH", $ini, null);
    return $tpl->_ENGINE_parse_body($status);
}
Beispiel #14
0
function FetchMailStatus(){
	$tpl=new templates();
	$ini=new Bs_IniHandler();
	$sock=new sockets();
	$datas=implode("\n",unserialize(base64_decode($sock->getFrameWork('cmd.php?fetchmail-status=yes'))));
	$ini->loadString($datas);
	$status=DAEMON_STATUS_ROUND("FETCHMAIL",$ini,null)."<br>".DAEMON_STATUS_ROUND("FETCHMAIL_LOGGER",$ini,null);
	echo $tpl->_ENGINE_parse_body($status);
	}
function mysql_syslogs_service_status()
{
    $tpl = new templates();
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString(base64_decode($sock->getFrameWork('system.php?syslogdb-status=yes')));
    $APP_SQUID_DB = DAEMON_STATUS_ROUND("APP_SYSLOG_DB", $ini, null, 1);
    echo $tpl->_ENGINE_parse_body($APP_SQUID_DB);
}
Beispiel #16
0
function cntlm_status()
{
    $sock = new sockets();
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $ini->loadString(base64_decode($sock->getFrameWork('cmd.php?cntlm-ini-status=yes')));
    $APP_CNTLM = DAEMON_STATUS_ROUND("APP_CNTLM_PARENT", $ini, null, 0);
    echo $tpl->_ENGINE_parse_body($APP_CNTLM);
}
Beispiel #17
0
function update(){
	$page=CurrentPageName();
	$tpl=new templates();
	$t=time();
	$sock=new sockets();
	$zpush_version=base64_decode($sock->getFrameWork("zarafa.php?zpush-version=yes"));
	$ini=new Bs_IniHandler();
	$ini->loadFile("ressources/index.ini");
	$couldversion=$ini->_params["NEXT"]["z-push"];
	
	$html="
	<div style='font-size:22px;text-align:center;margin:10px' id='title$t'></div>
	<div style='margin:10px;min-height:75px' id='Status$t'></div>
	<div id='start-$t'></div>	
	<center style='margin:50px'>		
	<hr>". button("{update} v.$couldversion","Restore$t()",32)."</center>
	<script>
		var x_Restore$t= function (obj) {
	      var tempvalue=obj.responseText;
	      if(tempvalue.length>3){alert(tempvalue);}
		  document.getElementById('start-$t').innerHTML='';
		  LoadAjax('start-$t','$page?logs-starter=yes&t=$t');
		}		
		
		function Restore$t(){
			var XHR = new XHRConnection();
			XHR.appendData('install-zpush','yes');
			XHR.sendAndLoad('$page', 'POST',x_Restore$t);	
		}
		
		
		
		
		var x_GetLogs$t= function (obj) {
	      var tempvalue=obj.responseText;
	      if(tempvalue.length>3){
	      	document.getElementById('textToParseCats-$t').innerHTML=tempvalue;
	       }

	      }	

	      
		function GetLogs$t(){
			var XHR = new XHRConnection();
			XHR.appendData('restore-logs','yes');
			XHR.appendData('t','$t');
			XHR.setLockOff();
			XHR.sendAndLoad('$page', 'POST',x_GetLogs$t);		
		
		}
		$('#Status$t').progressbar({ value: 1 });
	</script>				
			
	";
	
	echo $tpl->_ENGINE_parse_body($html);
}
Beispiel #18
0
function GetUpdates()
{
    @mkdir("/usr/share/artica-postfix/ressources/logs/web", 755, true);
    @unlink("/usr/share/artica-postfix/ressources/logs/web/debian.update.html");
    if (COUNT_REPOS() == 0) {
        INSERT_DEB_PACKAGES();
    }
    $unix = new unix();
    $tmpf = $unix->FILE_TEMP();
    CheckSourcesList();
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $configDisk = trim($sock->GET_INFO('ArticaAutoUpdateConfig'));
    $ini->loadString($configDisk);
    $AUTOUPDATE = $ini->_params["AUTOUPDATE"];
    if (trim($AUTOUPDATE["auto_apt"]) == null) {
        $AUTOUPDATE["auto_apt"] = "no";
    }
    shell_exec("{$_GET["APT-GET"]} update >/dev/null 2>&1");
    shell_exec("{$_GET["APT-GET"]} -f install --force-yes >/dev/null 2>&1");
    shell_exec("{$_GET["APT-GET"]} upgrade -s >{$tmpf} 2>&1");
    $datas = @file_get_contents($tmpf);
    $tbl = explode("\n", $datas);
    writelogs("Found " . strlen($datas) . " bytes for apt", __FUNCTION__, __FILE__, __LINE__);
    @unlink($tmpf);
    while (list($num, $val) = each($tbl)) {
        if ($val == null) {
            continue;
        }
        if (preg_match("#^Inst\\s+(.+?)\\s+#", $val, $re)) {
            $packages[] = $re[1];
            writelogs("Found {$re[1]} new package", __FUNCTION__, __FILE__, __LINE__);
            //dpkg_configure_a();
        } else {
            if (preg_match("#dpkg was interrupted.+?dpkg --configure -a#", $val)) {
                writelogs("Error found ", __FUNCTION__, __FILE__, __LINE__);
            }
            writelogs("Garbage \"{$val}\"", __FUNCTION__, __FILE__, __LINE__);
        }
    }
    $count = count($packages);
    if ($count > 0) {
        @file_put_contents("/etc/artica-postfix/apt.upgrade.cache", implode("\n", $packages));
        $text = "You can perform upgrade of linux packages for\n" . @file_get_contents("/etc/artica-postfix/apt.upgrade.cache");
        send_email_events("new upgrade {$count} packages(s) ready", $text, "system");
        $paragraph = ParagrapheTEXT('32-infos.png', "{$count} {system_packages}", "{$count} {system_packages_can_be_upgraded}", "javascript:Loadjs('artica.repositories.php');\n\t\t", "{system_packages_can_be_upgraded}", 300, 80);
        @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/debian.update.html", $paragraph);
        shell_exec("/bin/chmod 777 /usr/share/artica-postfix/ressources/logs/web/debian.update.html");
        if ($AUTOUPDATE["auto_apt"] == "yes") {
            UPGRADE();
        }
    } else {
        writelogs("No new packages...", __FUNCTION__, __FILE__, __LINE__);
        @unlink("/etc/artica-postfix/apt.upgrade.cache");
    }
}
Beispiel #19
0
function GetUpdates(){
if(COUNT_REPOS()==0){INSERT_DEB_PACKAGES();}	
$unix=new unix();
$tmpf=$unix->FILE_TEMP();
CheckSourcesList();
$sock=new sockets();	
$ini=new Bs_IniHandler();
$configDisk=trim($sock->GET_INFO('ArticaAutoUpdateConfig'));	
$ini->loadString($configDisk);	
$AUTOUPDATE=$ini->_params["AUTOUPDATE"];
if(trim($AUTOUPDATE["auto_apt"])==null){$AUTOUPDATE["auto_apt"]="no";}

shell_exec("{$_GET["APT-GET"]} update >/dev/null 2>&1");
shell_exec("{$_GET["APT-GET"]} -f install --force-yes >/dev/null 2>&1");
shell_exec("{$_GET["APT-GET"]} upgrade -s >$tmpf 2>&1");
	
$datas=@file_get_contents($tmpf);
$tbl=explode("\n",$datas);
writelogs("Found ". strlen($datas)." bytes for apt",__FUNCTION__,__FILE__,__LINE__);
@unlink($tmpf);

	while (list ($num, $val) = each ($tbl) ){
		if($val==null){continue;}
		if(preg_match("#^Inst\s+(.+?)\s+#",$val,$re)){
			$packages[]=$re[1];
			writelogs("Found {$re[1]} new package",__FUNCTION__,__FILE__,__LINE__);
			//dpkg_configure_a();
			
		}else{
			if(preg_match("#dpkg was interrupted.+?dpkg --configure -a#",$val)){
				writelogs("Error found ",__FUNCTION__,__FILE__,__LINE__);
			}
			writelogs("Garbage \"$val\"",__FUNCTION__,__FILE__,__LINE__);
		}
		
	}

	$count=count($packages);
	if($count>0){
		@file_put_contents("/etc/artica-postfix/apt.upgrade.cache",implode("\n",$packages));
		$text="You can perform upgrade of linux packages for\n".@file_get_contents("/etc/artica-postfix/apt.upgrade.cache");
		send_email_events("new upgrade $count packages(s) ready",$text,"system");
		
		THREAD_COMMAND_SET(LOCATE_PHP5_BIN()." /usr/share/artica-postfix/exec.admin.status.postfix.flow.php --services");
		
		if($AUTOUPDATE["auto_apt"]=="yes"){
			UPGRADE();
		}
	}else{
		writelogs("No new packages...",__FUNCTION__,__FILE__,__LINE__);
		@unlink("/etc/artica-postfix/apt.upgrade.cache");
	}



}
Beispiel #20
0
function status()
{
    $sock = new sockets();
    $datas = base64_decode($sock->getFrameWork("cmd.php?squidguard-status=yes"));
    $ini = new Bs_IniHandler();
    $ini->loadString($datas);
    $tpl = new templates();
    $status = DAEMON_STATUS_ROUND("APP_SQUIDGUARD", $ini);
    echo $tpl->_ENGINE_parse_body($status);
}
Beispiel #21
0
function status()
{
    $page = CurrentPageName();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $ini->loadString(base64_decode($sock->getFrameWork('cmd.php?ocsagntlnx-status=yes')));
    $status = DAEMON_STATUS_ROUND("APP_OCSI_LINUX_CLIENT", $ini);
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($status);
}
function newtsamba()
{
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    if ($GLOBALS["INDEXFF"] == null) {
        $GLOBALS["INDEXFF"] = @file_get_contents(dirname(__FILE__) . '/ressources/index.ini');
    }
    $ini->loadString($GLOBALS["INDEXFF"]);
    return $ini->_params["NEXT"]["samba"];
}
Beispiel #23
0
function services_status()
{
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString(base64_decode($sock->getFrameWork('cmd.php?syncthing-ini-status=yes')));
    $APP_SYNCTHING = DAEMON_STATUS_ROUND("APP_SYNCTHING", $ini, null, 0);
    $tr[] = $APP_SYNCTHING;
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body(@implode("<p>&nbsp;</p>", $tr));
}
Beispiel #24
0
function vsftpd_status()
{
    $tpl = new templates();
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $page = CurrentPageName();
    $ini->loadString(base64_decode($sock->getFrameWork('vsftpd.php?status=yes')));
    $html = DAEMON_STATUS_ROUND("APP_VSFTPD", $ini, null, 0) . "\n\t<div style='margin-top:15px;text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjax('vsftpd-status','{$page}?vsftpd-status=yes');") . "</div>";
    echo $tpl->_ENGINE_parse_body($html);
}
Beispiel #25
0
function FetchMailStatus()
{
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $datas = implode("\n", unserialize(base64_decode($sock->getFrameWork('cmd.php?fetchmail-status=yes'))));
    $ini->loadString($datas);
    $status = "\n\t<div style='width:98%' class=form>\n\t<table style='width:90%'>\n\t<tr>\n\t<td>" . DAEMON_STATUS_ROUND("FETCHMAIL", $ini, null) . "</td>\n\t</tr>\n\t<tr>\n\t<td>" . DAEMON_STATUS_ROUND("FETCHMAIL_LOGGER", $ini, null) . "</td>\n\t</tr>\t\n\t</table></div>";
    echo $tpl->_ENGINE_parse_body($status);
}
Beispiel #26
0
function status_service()
{
    $sock = new sockets();
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $page = CurrentPageName();
    $ini->loadString(base64_decode($sock->getFrameWork("cmd.php?sabnzbdplus-ini-status=yes")));
    $status = DAEMON_STATUS_ROUND("APP_SABNZBDPLUS", $ini, null, 0);
    echo $tpl->_ENGINE_parse_body($status);
}
Beispiel #27
0
function service_status()
{
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString(base64_decode($sock->getFrameWork('cmd.php?kav4fs-ini-status=yes')));
    $APP_KAV4FS = DAEMON_STATUS_ROUND("APP_KAV4FS", $ini);
    $APP_KAV4FS_AVS = DAEMON_STATUS_ROUND("APP_KAV4FS_AVS", $ini);
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body("{$APP_KAV4FS}<br>{$APP_KAV4FS_AVS}");
}
function page()
{
    //APP_SQUIDGUARD_HTTP --squidguard-http
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $ini->loadString(base64_decode($sock->getFrameWork('squidguardweb.php?status=yes')));
    $APP_SQUIDGUARD_HTTP = DAEMON_STATUS_ROUND("APP_SQUIDGUARD_HTTP", $ini, null);
    echo $tpl->_ENGINE_parse_body($APP_SQUIDGUARD_HTTP);
}
function stunnel4_status()
{
    $users = new usersMenus();
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $datas = base64_decode($sock->getFrameWork("cmd.php?stunnel-ini-status=yes"));
    $ini->loadString($datas);
    $status = DAEMON_STATUS_ROUND("STUNNEL", $ini);
    echo $tpl->_ENGINE_parse_body($status);
}
Beispiel #30
0
function status_service()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $ini->loadString(base64_decode($sock->getFrameWork('cmd.php?virtualbox-ini-all-status=yes')));
    $tpl = new templates();
    $status = DAEMON_STATUS_ROUND("APP_VIRTUALBOX_WEBSERVICE", $ini, null, 1) . "<br>" . DAEMON_STATUS_ROUND("APP_TFTPD", $ini, null, 1) . "<br>" . DAEMON_STATUS_ROUND("DHCPD", $ini, null, 1);
    return $tpl->_ENGINE_parse_body($status);
}