function storeData($ip, $fileName)
{
	if (false == file_exists($fileName))
	{
		echo "$fileName,这个文件不存在\n";
		exit(1);
	}
	$services = getServices($ip);
	$pollerOutputs = makePollerOutputs($services, $fileName);
	insertPollerOutput($pollerOutputs);
	exit(0);
}
示例#2
0
$f->addButton("bpolicy", _T("Save"));
$f->display();
print '<br />';
// Rules list display
$ajax = new AjaxFilter(urlStrRedirect("shorewall/shorewall/ajax_" . $page));
$ajax->display();
$t = new TitleElement(_T("Port forwarding rules"), 2);
$t->display();
$ajax->displayDivToUpdate();
// Add rule form
print '<script type="text/javascript" src="modules/shorewall/includes/functions.js"></script><br />';
$t = new TitleElement(_T("Add port forwarding rule"), 2);
$t->display();
$f = new ValidatingForm(array("id" => "rule"));
$f->push(new Table());
$macros = getServices();
$services = array("", _T("Custom...")) + $macros;
$servicesVals = array("", "custom") + $macros;
$serviceTpl = new SelectItem("service", "toggleCustom");
$serviceTpl->setElements($services);
$serviceTpl->setElementsVal($servicesVals);
$f->add(new TrFormElement(_T("Service"), $serviceTpl));
$f->pop();
$customDiv = new Div(array("id" => "custom"));
$customDiv->setVisibility(false);
$f->push($customDiv);
$f->push(new Table());
$protoTpl = new SelectItem("proto");
$protoTpl->setElements(array("", "TCP", "UDP"));
$protoTpl->setElementsVal(array("", "tcp", "udp"));
$f->add(new TrFormElement(_T("Protocol"), $protoTpl));
示例#3
0
function updateFirewallRules($firstrun = false)
{
    // Signature validation and firewall driver
    global $v, $driver, $services, $thissvc;
    // Flush cache, read what the system thinks the firewall rules are.
    $driver->refreshCache();
    // Delete our safemode flag if it exists.
    if (file_exists("/var/run/firewalld.safemode")) {
        unlink("/var/run/firewalld.safemode");
    }
    // Make sure the rules haven't been disturbed, and aren't corrupt
    if (!$firstrun && !$driver->validateRunning()) {
        // This is bad.
        wall("Firewall Rules corrupted! Restarting in 5 seconds");
        Lock::unLock($thissvc);
        // Wait 4 seconds to give incron a chance to catch up
        sleep(4);
        // Restart me.
        fclose(fopen("/var/spool/asterisk/incron/firewall.firewall", "a"));
        exit;
    }
    $getservices = getServices();
    // Make sure we actually received stuff..
    if (!isset($getservices['smartports'])) {
        return false;
    }
    // Root-only updates:
    //   SSH is only readable by root
    $ssh = $services->getService("ssh");
    if ($ssh['guess'] == true) {
        throw new \Exception("Root user unable to retrieve sshd port! This is a bug!");
    }
    $getservices['services']['ssh']['fw'] = $ssh['fw'];
    $zones = array("reject" => "reject", "external" => "external", "other" => "other", "internal" => "internal", "trusted" => "trusted");
    // This is the list of services we should have.
    $validservices = array();
    foreach ($getservices['services'] as $s => $settings) {
        // Keep this service for later
        $validservices[$s] = $s;
        // Make sure the service is configured correctly
        if (isset($settings['fw'])) {
            $driver->updateService($s, $settings['fw']);
        } else {
            $driver->updateService($s, false);
        }
        // Assign the service to the required zones
        $myzones = array("addto" => array(), "removefrom" => $zones);
        if (!empty($settings['zones']) && is_array($settings['zones'])) {
            foreach ($settings['zones'] as $z) {
                unset($myzones['removefrom'][$z]);
                $myzones['addto'][$z] = $z;
            }
        }
        $driver->updateServiceZones($s, $myzones);
    }
    // Update RTP rules
    $rtp = $getservices['smartports']['rtp'];
    // UDPTL is T38.
    $udptl = $getservices['smartports']['udptl'];
    $driver->setRtpPorts($rtp, $udptl);
    // Update our knownhosts targets
    $driver->updateTargets($getservices);
    // And permit our registrations through
    $driver->updateRegistrations($getservices['smartports']['registrations']);
    // Update blacklist
    $driver->updateBlacklist($getservices['blacklist']);
    // Update our custom ports
    $custrules = $getservices['custom'];
    foreach ($custrules as $id => $rule) {
        // Keep this service for later
        $validservices[$id] = $id;
        $c = $rule['custfw'];
        // If it has a comma, it's multiple ports.
        $requestedports = explode(",", $c['port']);
        $realports = array();
        // Have we been given a range? (eg, "1234:5678")
        foreach ($requestedports as $port) {
            if (strpos($port, ":") !== false) {
                // Sanity check that the numbers are in the correct order, and are, in fact,
                // numbers.
                $range = explode(":", $c['port']);
                if (!isset($range[1])) {
                    // This is invalid, we need two digits
                    continue;
                }
                $start = (int) $range[0];
                $end = (int) $range[1];
                if ($start > $end) {
                    $lowest = $end;
                    $highest = $start;
                } else {
                    $lowest = $start;
                    $highest = $end;
                }
                if ($lowest < 1 || $highest > 65534) {
                    // Invalid
                    continue;
                }
                $realports[] = "{$lowest}:{$highest}";
            } else {
                // It should just be a number.
                $realnum = (int) $port;
                if ($realnum > 65534 || $realnum < 1) {
                    continue;
                }
                $realports[] = $realnum;
            }
        }
        // Create our '$ports' array for the driver.
        $ports = array();
        if ($c['protocol'] == "both" || $c['protocol'] == "tcp") {
            foreach ($realports as $p) {
                $ports[] = array("protocol" => "tcp", "port" => $p);
            }
        }
        if ($rule['custfw']['protocol'] == "both" || $rule['custfw']['protocol'] == "udp") {
            foreach ($realports as $p) {
                $ports[] = array("protocol" => "udp", "port" => $p);
            }
        }
        $driver->updateService($id, $ports);
        // Assign the service to the required zones
        $myzones = array("addto" => array(), "removefrom" => $zones);
        foreach ($rule['zones'] as $z) {
            unset($myzones['removefrom'][$z]);
            $myzones['addto'][$z] = $z;
        }
        $driver->updateServiceZones($id, $myzones);
    }
    // Update the Host DDNS entries.
    $driver->updateHostZones($getservices['hostmaps']);
    // Now, purge any services that no longer exist
    $active = $driver->getActiveServices();
    foreach ($active as $as) {
        if (!isset($validservices[$as])) {
            // This should be removed
            $driver->removeService($as);
        }
    }
    // Set the firewall to drop or reject mode.
    if ($getservices['dropinvalid']) {
        $driver->setRejectMode(true, false);
    } else {
        $driver->setRejectMode(false, false);
    }
}
function getAllServices()
{
    $serv = getServices();
    return $serv;
}
<?php

require_once dirname(__FILE__) . "/../../core/globalSettings.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_wfs.php";
include_once dirname(__FILE__) . "/../extensions/JSON.php";
//db connection
$con = db_connect(DBSERVER, OWNER, PW);
db_select_db(DB, $con);
$json = new Services_JSON();
$obj = $json->decode(stripslashes($_REQUEST['obj']));
//workflow:
switch ($obj->action) {
    case 'getServices':
        $obj->services = getServices($obj);
        sendOutput($obj);
        break;
    case 'getWfsConfData':
        $obj->wfsConf = getWfsConfData($obj->wfs);
        sendOutput($obj);
        break;
    case 'getAssignedGuis':
        $obj->assignedGuis = getAssignedGuis($obj);
        sendOutput($obj);
        break;
    case 'deleteSelectedConfs':
        deleteWfsConf($obj);
        sendOutput($obj);
        break;
    default:
        sendOutput("no action specified...");
示例#6
0
//saveService
if ($task == "saveCustomer") {
    $customerid = $request->customerid;
    $weeklyid = $request->weeklyid;
    $data = saveCustomer("", $customerid, $weeklyid, $userid);
    echo $data;
}
//saveCustomer
if ($task == "getNewWeeklyID") {
    $data = getNewWeeklyID($userid);
    $data = array("message" => "", "weeklyid" => $data, "success" => true);
    return json_encode($data);
}
//getNewWeeklyID
if ($task == "getServices") {
    $data = getServices($userid);
    echo $data;
}
//getServices
if ($task == "lookupService") {
    $service = $request->service;
    $data = lookupService($userid, $service);
    echo $data;
}
//lookupService
if ($task == "getTasks") {
    echo getTasks();
}
//task getTimes
if ($task == "addTask") {
    $description = $request->taskdescription;
示例#7
0
                    }
                }
            }
        }
    }
    return $ipaddress;
}
function getServices($services)
{
    $services = "";
    foreach ($_POST as $param_name => $param_val) {
        $services .= " -e " . $param_val;
    }
    exec("ps -e | grep" . $services . " | awk '{print \$4}' | sort | uniq 2>&1", $result);
    echo json_encode($result);
}
$file = true;
$myfile = fopen("restrictedIP.file", "r") or $file = false;
if ($file) {
    //$ip = fread($myfile,filesize("webdictionary.txt"));
    fclose($myfile);
    // DNS Resolution may take from 0.5 to 4 seconds, thats why I check the GIV-OCT ip directly
    if (exec('grep ' . get_client_ip() . ' restrictedIP.file')) {
        //if (get_client_ip()===$ip){
        getServices($services);
    } else {
        echo "[]";
    }
} else {
    getServices($services);
}
示例#8
0
                                    setServiceParam($result, "due", $_POST['due']);
                                    setServiceParam($result, "price", $_POST['price']);
                                    $message = "Database service has been setup successfully. Note that the database settings and tables are not automatically configured and created. Create the database manually, set the database settings by clicking on the service and setting parameters, and then setup the tables there as well.";
                                } else {
                                    header("Location: account.php?id={$account_id}&message=" . urlencode("Error occurred while setting up database."));
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if ($_POST['action'] == "delete" && isset($_POST['delete_id'])) {
                removeService($_POST['delete_id']);
                $message = "The service has been removed. Note that no service-related files or databases have been erased.";
            }
        }
        if (!isset($_SESSION['noredirect'])) {
            header("Location: account.php?id={$account_id}&message=" . urlencode($message));
        }
    }
    //account info
    $info = adminGetAccount($account_id);
    //services
    $services = getServices($account_id);
    $serviceExtra = getServiceExtra($services);
    //display
    get_page("account", "admin", array('id' => $account_id, 'info' => $info, 'services' => $services, 'serviceExtra' => $serviceExtra, 'message' => $message));
} else {
    header("Location: ./");
}
示例#9
0
文件: index.php 项目: benoitlesp/igo
function getLabelNameInformation($data)
{
    $filter = new \Phalcon\Filter();
    $services = getServices();
    if (isset($data["layer"])) {
        $layer = $filter->sanitize($data["layer"], array("string"));
        if (!isset($services[$layer])) {
            throw new Exception("Le service {$layer} n'est pas disponible.");
        }
        $srv = $services[$layer];
    }
    return $srv->getLabelName();
}
示例#10
0
    foreach ($orders as $order) {
        saveOrder($order);
        /*if(!saveOrder($order));
          return false;*/
    }
    return true;
}
/*==========================================================*/
/*=================================================================================================
-------------------      DOWNLOAD CONTENT FOR VIEWS AND SWITCH FUNCTIONS      ---------------------
===================================================================================================*/
switch ($view) {
    // homepage
    case 'home':
        $bigButtonsMenu = getMenu('big_buttons');
        $services = getServices();
        $page = getPageContent($view);
        if (!$page) {
            $page = '';
        }
        break;
        // edit templates group list
    // edit templates group list
    case 'vizitka_edit_group_list':
        $bigButtonsMenu = getMenu('big_buttons');
        $group_templates = getGroupTemplates();
        $page = getPageContent($view);
        if (!$page) {
            $page = '';
        }
        break;
示例#11
0
<!-- Service Panels -->
<?php 
if (!defined('MyConst')) {
    die('Direct access not permitted');
}
getServices();
if ($servicesNumRows > 0) {
    echo "<div class='row' id='services'>";
    if (!empty($servicesHeading)) {
        echo "<div class='col-lg-12'>";
        echo "<h2 class='page-header services'>" . $servicesHeading . "</h2>";
        echo "</div>";
    }
    if (!empty($servicesBlurb)) {
        echo "<div class='col-lg-12'>";
        echo "<p class='text-center'>" . $servicesBlurb . "</p>";
        echo "</div>";
    }
    while ($rowServices = mysql_fetch_array($sqlServices)) {
        echo "<div class='col-md-" . $servicesColWidth . " text-center'>";
        echo "<div class='panel panel-default text-center'>";
        echo "<div class='panel-heading'>";
        echo "<span class='fa-stack fa-5x'>";
        if (!empty($rowServices['icon'])) {
            echo "<i class='fa fa-circle fa-stack-2x text-primary'></i>";
            echo "<i class='fa fa-" . $rowServices['icon'] . " fa-stack-1x fa-inverse' title='" . $rowServices['title'] . "'></i>";
        }
        if (!empty($rowServices['image'])) {
            echo "<img class='img-responsive img-circle' style='padding:8px;' src='uploads/" . $rowServices['image'] . "' alt='" . $rowServices['title'] . "' title='" . $rowServices['title'] . "'>";
        }
        echo "</span>";
function syncServicesIPTV(mysqli $link)
{
    $servicesAdd = array();
    $servicesMB = getServices($link);
    $servicesIPTV = getServicesIPTV();
    $IPTVnames = array();
    foreach ($servicesIPTV as $service) {
        $IPTVnames[$service[1]] = $service[0];
    }
    foreach ($servicesMB as $service) {
        if (!isset($IPTVnames[$service['servicename']])) {
            $servicesAdd[] = $service;
        }
    }
    servicesAdd($servicesAdd);
}
示例#13
0
         }
         echo json_encode($files);
     }
     break;
 }
 if ($_GET['id'] == 'services') {
     $files['id'] = 'services';
     $files['title'] = 'Web Services';
     if (isset($config['jukeboxConnector'])) {
         $files['parent'] = 'filesystem_' . base64_encode($config['mediaLocation']);
     } else {
         $files['parent'] = 'home';
     }
     $files['files'][] = array("name" => "Media Service Portal", "type" => "service", "icon" => "service", "path" => "http://www.mspportal.com/nmt/");
     $files['files'][] = array("name" => "MSP Community", "type" => "service", "icon" => "service", "path" => "http://www.mspportal.com/community/");
     $files['files'] = array_merge($files['files'], getServices());
     echo json_encode($files);
     break;
 }
 list($type, $directory) = explode('_', $_GET['id']);
 $directory = base64_decode($directory);
 if ($root && $normal) {
     if (isNetworkShare($directory)) {
         $root = false;
     }
 }
 if ($root) {
     if ($type == 'filesystem') {
         if ($directory == $config['mediaLocation']) {
             $files = getDirectory($directory);
             $network = getDirectory($directory . "NETWORK_SHARE/");
示例#14
0
<?php

include "../include/common.php";
include "../config.php";
include "../include/session.php";
include "../include/dbconnect.php";
include "../include/account.php";
if (isset($_SESSION['account_id'])) {
    //get array of services, elements are array(service id, name, description, type)
    $services = getServices($_SESSION['account_id']);
    //get additional service parameters for each service
    $serviceExtra = getServiceExtra($services);
    //display
    get_page("services", "panel", array('services' => $services, 'serviceExtra' => $serviceExtra));
} else {
    header("Location: ../");
}
示例#15
0
function services()
{
    $row = getServices();
    return $row;
}
示例#16
0
文件: index.php 项目: nbtetreault/igo
function transaction($data)
{
    $filter = new \Phalcon\Filter();
    $results = array();
    $services = getServices();
    if (isset($data["layer"])) {
        $layer = $filter->sanitize($data["layer"], array("string"));
        $srv = $services[$layer];
    }
    $connection = $srv->getConnection();
    $connection->begin();
    try {
        $errors = array();
        $warnings = array();
        if (isset($data["features"])) {
            $featureCollection = json_decode($data["features"]);
            foreach ($featureCollection->features as $feature) {
                if ($feature->action === "create") {
                    $result = $srv->createFeature($feature);
                } else {
                    if ($feature->action === "update") {
                        $result = $srv->updateFeature($feature);
                    } else {
                        if ($feature->action === "delete") {
                            $result = $srv->deleteFeature($feature);
                        } else {
                            throw new Exception("Action invalide ou indéfinit: " . $feature->action);
                        }
                    }
                }
                if ($result["result"] === "failure" && isset($result["error"])) {
                    $errors[$feature->no_seq] = $result["error"];
                } else {
                    if ($result["result"] === "failure" && isset($result["errors"])) {
                        $errors[$feature->no_seq] = $result["errors"];
                    } else {
                        if ($result["result"] === "warning") {
                            $warnings[$feature->no_seq] = $result["warning"];
                        }
                    }
                }
                $srv->reset();
            }
        }
        if (count($errors) > 0 || count($warnings) > 0) {
            $connection->rollback();
            return array("result" => "failure", "errors" => $errors, "warnings" => $warnings);
        }
        $connection->commit();
    } catch (\Exception $e) {
        $connection->rollback();
        throw $e;
    }
    return array("result" => "success");
}