Exemplo n.º 1
0
function printGraphDeclarations($filename = "/var/www/html/d3test/dat/large_data_set.txt")
{
    global $srcNodes, $destNodes, $edges;
    if (!file_exists($filename)) {
        print "//Error: No file given!";
    } else {
        readDataFile($filename);
        print "//###########BEGIN srcNodes declarations###########//\n";
        addNodes($srcNodes, 0);
        print "//#############END srcNodes declarations###########//\n";
        print "\n\n//###########BEGIN destNodes declarations###########//\n";
        addNodes($destNodes, 1);
        print "//#############END destNodes declarations###########//\n";
        print "\n\n\n\n//###########BEGIN edges declarations###########//\n";
        addEdges($edges);
        print "//#############END edges declarations###########//\n";
    }
}
 * @param string $className A class to autoload
 */
function __autoload($className)
{
    ezcBase::autoload($className);
}
// *************************************************************************
echo "eZ Components feed creator\n";
if (count($argv) < 3) {
    echo "\tFirst parameter: feed type (rss1, rss2 or atom)\n";
    echo "\tSecond parameter: text file name\n";
    die;
}
$feedType = $argv[1];
$sourceFile = $argv[2];
$data = readDataFile($sourceFile);
$xml = createFeed($feedType, $data);
$destFile = substr($sourceFile, 0, strrpos($sourceFile, '.')) . '.xml';
echo "Creating xml file {$destFile} with contents:\n\n";
file_put_contents($destFile, $xml);
echo $xml . "\n\n";
// *************************************************************************
/**
 * Reads data from a file and returns an array to be used with the function
 * createFeed().
 *
 * The format of the returned array is:
 * <code>
 * array( 'title' => 'Feed title',
 *        'link' => 'Feed link',
 *        'published' => 'Feed published date',
Exemplo n.º 3
0
        case 'testing':
            $active = 3;
            break;
        default:
            $active = 0;
    }
} else {
    $active = 0;
}
if ($active == 0) {
    echo "This ist the cluster watchdog of the Gemeinschaft project \n", "- it should not be started directly by the user\n", "Please read the documentation for usage instructions.\n";
    exit(1);
}
$starttime = time();
$endtime = $starttime + 60 - SLEEP_SECONDS * 2;
readDataFile(DATAFILE);
$node[0]['pid'] = getMyPid();
for ($node_id = 1; $node_id < count($node); $node_id++) {
    if ($node[$node_id]['status'] == STAT_FAILED && $node[$node_id]['timestamp'] < time() - REC_PERIOD * 60) {
        $node[$node_id]['status'] = STAT_NORMAL;
    }
}
$ips = getListenToIPs();
while (time() < $endtime) {
    for ($node_id = 1; $node_id < count($node); $node_id++) {
        $node_status = checkIfNodeAlive($node_id);
        if ($node_status > STAT_NORMAL) {
            if ($node_status == STAT_NORMAL) {
                $node[$node_id]['status'] = STAT_FAILED;
                $node[$node_id]['timestamp'] = time();
            }
Exemplo n.º 4
0
function getMacAndActionFromPost(&$action, $postVal)
{
    $nc = strlen($postVal);
    $actLen = $nc - 12;
    $action = substr($postVal, 0, $actLen);
    $mac = substr($postVal, $actLen);
    return $mac;
}
require_once ORVFMS_PATH . "orvfms.php";
$myUrl = htmlspecialchars($_SERVER["PHP_SELF"]);
$daysOfWeek = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
$months = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
if (isset($_SESSION["s20Table"])) {
    $s20Table = $_SESSION["s20Table"];
} else {
    $s20Table = readDataFile();
}
// $s20Table = readDataFile(); // DELETE THIS LINE
$ndummy = 0;
if (isset($s20Table)) {
    foreach ($s20Table as $mac => $data) {
        if (array_key_exists('off', $s20Table[$mac])) {
            $ndummy++;
        }
    }
}
//
// Refresh/update only S20 data if $s20Table was initialized before
// Refresh also if "inactive" S20s exists and last refressh was more than 5m away.
//
// Otherwise, reinitialize all $s20Table structure
Exemplo n.º 5
0
function initS20Data()
{
    //
    // Search all sockets in the network, and returns
    // an associative array with all collected data,
    // including names
    //
    $s20TableOld = readDataFile();
    $s20Table = searchS20($s20TableOld);
    $s20Table = updNamesAndTimerAfterOn($s20Table);
    updTableTimers($s20Table);
    foreach ($s20Table as $mac => $data) {
        if (is_array($s20TableOld) && array_key_exists($mac, $s20TableOld)) {
            $s20Table[$mac]['next'] = $s20TableOld[$mac]['next'];
        }
    }
    $_SESSION['s20Table'] = $s20Table;
    writeDataFile($s20Table);
    return $s20Table;
}