예제 #1
0
 public static function Template()
 {
     if (!fs_director::CheckForEmptyValue(ctrl_options::GetSystemOption('server_ip'))) {
         return ctrl_options::GetSystemOption('server_ip');
     } else {
         return sys_monitoring::ServerIPAddress();
     }
 }
예제 #2
0
 function GetPortStatus()
 {
     $request_data = $this->RawXMWSToArray($this->wsdata);
     $contenttags = $this->XMLDataToArray($this->wsdata);
     if (sys_monitoring::LocalPortStatus($contenttags['xmws']['content']['port'])) {
         $port_response = 1;
     } else {
         $port_response = 0;
     }
     $response_xml = ws_xmws::NewXMLContentSection('portstatus', array('port' => $contenttags['xmws']['content']['port'], 'status' => $port_response));
     $dataobject = new runtime_dataobject();
     $dataobject->addItemValue('response', '');
     $dataobject->addItemValue('content', $response_xml);
     return $dataobject->getDataObject();
 }
 static function DisplayDNSConfig()
 {
     global $zdbh;
     global $controller;
     $line = "<style>.active {color: #333;}</style>";
     $line .= "<h2>" . ui_language::translate("Configure your DNS Settings") . "</h2>";
     $line .= "<div style=\"display: block; margin-right:20px;\">";
     $line .= "<div class=\"ui-tabs ui-widget ui-widget-content ui-corner-all\" id=\"dnsTabs\">";
     $line .= "<ul class=\"domains nav nav-tabs\">";
     $line .= "<li class=\"active\"><a href=\"#general\" data-toggle=\"tab\">" . ui_language::translate("General") . "</a></li>";
     $line .= "<li><a href=\"#tools\" data-toggle=\"tab\">" . ui_language::translate("Tools") . "</a></li>";
     $line .= "<li><a href=\"#services\" data-toggle=\"tab\">" . ui_language::translate("Services") . "</a></li>";
     $line .= "<li><a href=\"#logs\" data-toggle=\"tab\">" . ui_language::translate("Logs") . "</a></li>";
     $line .= "</ul>";
     //Tabs Panel Wrap
     $line .= '<div class="tab-content">';
     //general
     $line .= "<div class=\"tab-pane active\" id=\"general\">";
     $line .= "<form action=\"./?module=dns_admin&action=UpdateDNSConfig\" method=\"post\">";
     $line .= "<table class=\"table table-striped\">";
     $count = 0;
     $sql = "SELECT COUNT(*) FROM x_settings WHERE so_module_vc=:moduleName AND so_usereditable_en = 'true'";
     $numrows = $zdbh->prepare($sql);
     $GetModuleName = ui_module::GetModuleName();
     $numrows->bindParam(':moduleName', $GetModuleName);
     if ($numrows->execute()) {
         if ($numrows->fetchColumn() != 0) {
             $sql = $zdbh->prepare("SELECT * FROM x_settings WHERE so_module_vc=:moduleName AND so_usereditable_en = 'true' ORDER BY so_cleanname_vc");
             $GetModuleName = ui_module::GetModuleName();
             $sql->bindParam(':moduleName', $GetModuleName);
             $sql->execute();
             while ($row = $sql->fetch()) {
                 $count++;
                 if (ctrl_options::CheckForPredefinedOptions($row['so_defvalues_tx'])) {
                     $fieldhtml = ctrl_options::OuputSettingMenuField($row['so_name_vc'], $row['so_defvalues_tx'], $row['so_value_tx']);
                 } else {
                     $fieldhtml = ctrl_options::OutputSettingTextArea($row['so_name_vc'], $row['so_value_tx']);
                 }
                 $line .= "<tr valign=\"top\"><th nowrap=\"nowrap\">" . ui_language::translate($row['so_cleanname_vc']) . "</th><td>" . $fieldhtml . "</td><td>" . ui_language::translate($row['so_desc_tx']) . "</td></tr>";
             }
             $line .= "<tr><th colspan=\"3\"><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inSaveSystem\">" . ui_language::translate("Save Changes") . "</button>  <button class=\"button-loader btn btn-default\" type=\"button\" onclick=\"window.location.href='./?module=moduleadmin';return false;\">" . ui_language::translate("Cancel") . "</button></tr>";
         }
     }
     $line .= "</table>";
     $line .= "</form>";
     $line .= "</div>";
     //tools
     $line .= "<div class=\"tab-pane\" id=\"tools\">";
     $line .= "<form action=\"./?module=dns_admin&action=UpdateTools\" method=\"post\">";
     $line .= "<table class=\"table table-striped\">";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Reset all Records to Default") . "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inResetAll\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Reset Records to Default on Single Domain") . " ";
     $line .= "<select name=\"inResetDomainID\">";
     $line .= "<option value=\"\">--- " . ui_language::translate("Select Domain") . " ---</option>";
     $sql = "SELECT COUNT(*) FROM x_vhosts WHERE vh_deleted_ts IS NULL";
     if ($numrows = $zdbh->query($sql)) {
         if ($numrows->fetchColumn() != 0) {
             $sql = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_deleted_ts IS NULL");
             $sql->execute();
             while ($row = $sql->fetch()) {
                 $line .= " <option value=\"" . $row['vh_id_pk'] . "\">" . $row['vh_name_vc'] . "</option>";
             }
         }
     }
     $line .= "</select>";
     $line .= "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inResetDomain\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<th>" . ui_language::translate("Add Default Records to Missing Domains") . "";
     $line .= "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inAddMissing\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Delete Record Type from ALL Records") . " ";
     $line .= "<select name=\"inType\" id=\"inType\">";
     $line .= "<option value=\"A\">A</option>";
     $line .= "<option value=\"AAAA\">AAAA</option>";
     $line .= "<option value=\"CNAME\">CNAME</option>";
     $line .= "<option value=\"MX\">MX</option>";
     $line .= "<option value=\"TXT\">TXT</option>";
     $line .= "<option value=\"SRV\">SRV</option>";
     $line .= "<option value=\"SPF\">SPF</option>";
     $line .= "<option value=\"NS\">NS</option>";
     $line .= "</select>";
     $line .= "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inDeleteType\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Purge Deleted Zone Records From Database") . "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inPurge\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Delete ALL Zone Records") . "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inDeleteAll\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<th>" . ui_language::translate("Force Records Update on Next Daemon Run") . "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inForceUpdate\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "</table>";
     $line .= "</form>";
     $line .= "</div>";
     //Services
     $line .= "<div class=\"tab-pane\" id=\"services\">";
     $line .= "<form action=\"./?module=dns_admin&action=UpdateService\" method=\"post\">";
     $line .= "<table class=\"none\" border=\"0\" cellpading=\"0\" cellspacing=\"0\" width=\"85%\"><tr valign=\"top\"><td width=\"100%\">";
     $line .= "<table class=\"table table-striped\">";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Start Service") . "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inStartService\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Stop Service") . "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inStopService\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Reload BIND") . "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inReloadService\" value=\"1\">" . ui_language::translate("GO") . "</button></td>";
     $line .= "</tr>";
     $line .= "<th>" . ui_language::translate("Service Port Status") . "</th>";
     if (fs_director::CheckForEmptyValue(sys_monitoring::PortStatus(53))) {
         $line .= "<td><font color=\"red\">" . ui_language::translate("STOPPED") . "</font></td>";
     } else {
         $line .= "<td><font color=\"green\">" . ui_language::translate("RUNNING") . "</font></td>";
     }
     $line .= "</tr>";
     $line .= "</table>";
     $line .= "</td><td>";
     if (fs_director::CheckForEmptyValue(sys_monitoring::PortStatus(53))) {
         $line .= "<img src=\"/modules/" . $controller->GetControllerRequest('URL', 'module') . "/assets/down.png\" border=\"0\"/>";
     } else {
         $line .= "<img src=\"/modules/" . $controller->GetControllerRequest('URL', 'module') . "/assets/up.png\" border=\"0\"/>";
     }
     $line .= "</td></tr></table>";
     $line .= "</form>";
     $line .= "</div>";
     //logs
     self::ViewErrors();
     $line .= "<div class=\"tab-pane\" id=\"logs\">";
     $line .= "<form action=\"./?module=dns_admin&action=Updatelogs\" method=\"post\">";
     $line .= "<table class=\"table table-striped\">";
     $line .= "<tr>";
     $line .= "<th style=\"width:350px;\">" . self::CheckLogReadable(ctrl_options::GetSystemOption('bind_log')) . " " . self::CheckLogWritable(ctrl_options::GetSystemOption('bind_log')) . "</th>";
     $line .= "<td><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inSetPerms\" value=\"1\">" . ui_language::translate("Set Permissions") . "</button></td>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Clear errors") . "</th>";
     $line .= "<td><button class=\"delete btn btn-danger\" type=\"submit\" id=\"button\" name=\"inClearErrors\" value=\"1\">" . ui_language::translate("Clear") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Clear warnings") . "";
     $line .= "</th>";
     $line .= "<td><button class=\"delete btn btn-danger\" type=\"submit\" id=\"button\" name=\"inClearWarnings\" value=\"1\">" . ui_language::translate("Clear") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("Clear logs") . "";
     $line .= "</th>";
     $line .= "<td><button class=\"delete btn btn-danger\" type=\"submit\" id=\"button\" name=\"inClearLogs\" value=\"1\">" . ui_language::translate("Clear") . "</button></td>";
     $line .= "</tr>";
     $line .= "</table>";
     $line .= "</form>";
     $line .= "<form name=\"launchbindlog\" action=\"modules/dns_admin/code/getbindlog.php\" target=\"bindlogwindow\" method=\"post\" onsubmit=\"window.open('', 'bindlogwindow', 'scrollbars=yes,menubar=no,height=525,width=825,resizable=no,toolbar=no,location=no,status=no')\">";
     $line .= "<table class=\"table table-striped\">";
     $line .= "<tr>";
     if (count(self::$logerror) > 0) {
         $logerrorcolor = "red";
     } else {
         $logerrorcolor = NULL;
     }
     $line .= "<th style=\"width:350px;\">" . ui_language::translate("View Errors") . " (<font color=\"" . $logerrorcolor . "\">" . count(self::$logerror) . "</font>)</th>";
     $line .= "<td><button class=\"btn btn-primary\" type=\"submit\" id=\"logerror_a\" name=\"inViewErrors\" value=\"1\">" . ui_language::translate("View") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     if (count(self::$logwarning) > 0) {
         $logwarningcolor = "red";
     } else {
         $logwarningcolor = NULL;
     }
     $line .= "<th>" . ui_language::translate("View warnings") . " (<font color=\"" . $logwarningcolor . "\">" . count(self::$logwarning) . "</font>)</th>";
     $line .= "<td><button class=\"btn btn-primary\" type=\"submit\" id=\"logwarning_a\" name=\"inViewWarnings\" value=\"1\">" . ui_language::translate("View") . "</button></td>";
     $line .= "</tr>";
     $line .= "<tr>";
     $line .= "<th>" . ui_language::translate("View logs") . " (" . count(self::$getlog) . ")</th>";
     $line .= "<td><input type=\"hidden\" name=\"inBindLog\" value=\"" . ctrl_options::GetSystemOption('bind_log') . "\" /><button class=\"btn btn-primary\" type=\"submit\" id=\"button\" name=\"inViewLogs\" value=\"1\">" . ui_language::translate("View") . "</button></td>";
     $line .= "</tr>";
     $line .= "</table>";
     $line .= "</form>";
     $line .= "</div>";
     $line .= "</div>";
     $line .= "</div>";
     $line .= "</div>";
     //CHARTS
     $line .= "<table class=\"none\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td>";
     $line .= self::DisplayDNSUsagepChart();
     $line .= "</td><td>";
     $line .= self::DisplayRecordsUsagepChart();
     $line .= "</td></tr></table>";
     return $line;
 }
 public static function Template()
 {
     return sys_monitoring::ServerUptime();
 }
예제 #5
0
 static function getUptime()
 {
     return sys_monitoring::ServerUptime();
 }
 static function CheckCreateForErrors($username, $database, $access)
 {
     global $zdbh;
     // Check to make sure the user name is not blank before we go any further...
     if ($username == '') {
         self::$blank = true;
         return false;
     }
     // Check to make sure the user name is not blank before we go any further...
     if ($username == 'root') {
         self::$rootabuse = true;
         return false;
     }
     // Check to make sure the user name is not blank before we go any further...
     if ($database == '') {
         self::$blank = true;
         return false;
     }
     // Check to make sure the user name is not a duplicate...
     $sql = "SELECT COUNT(*) FROM x_mysql_users WHERE mu_name_vc=:username AND mu_deleted_ts IS NULL";
     $numrows = $zdbh->prepare($sql);
     $numrows->bindParam(':username', $username);
     if ($numrows->execute()) {
         if ($numrows->fetchColumn() != 0) {
             self::$alreadyexists = true;
             return false;
         }
     }
     // Check to make sure the user name is not a duplicate (checks actual mysql table)...
     $sql = "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = :username)";
     $numrows = $zdbh->prepare($sql);
     $numrows->bindParam(':username', $username);
     if ($numrows->execute()) {
         if ($numrows->fetchColumn() != 0) {
             self::$alreadyexists = true;
             return false;
         }
     }
     // Check for invalid username
     if (!self::IsValidUserName($username)) {
         self::$badname = true;
         return false;
     }
     // Check for invalid IP address
     if ($access != "%" && strtolower($access) != "localhost") {
         if (!sys_monitoring::IsAnyValidIP($access)) {
             self::$badIP = true;
             return false;
         }
     }
     return true;
 }
예제 #7
0
 public static function Template()
 {
     return sys_monitoring::ClientIPAddress();
 }