$request = isset($_REQUEST['action']) ? $_REQUEST['action'] : "";
G::LoadClass('serverConfiguration');
$oServerConf =& serverConf::getSingleton();
$oServerConf->setHeartbeatProperty('HB_BEAT_URL', 'http://heartbeat.processmaker.com/syspmLicenseSrv/en/green/services/beat', 'HEART_BEAT_CONF');
switch ($request) {
    case 'processInformation':
        try {
            $heartBeatUrl = $oServerConf->getHeartbeatProperty('HB_BEAT_URL', 'HEART_BEAT_CONF');
            //Test connection
            if (!validateConnectivity($heartBeatUrl)) {
                $oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE', strtotime("+1 day"), 'HEART_BEAT_CONF');
                throw new Exception("Heartbeat::No connection");
            }
            //Build Data to be sent
            $params = buildData();
            //Send the information
            postHeartBeat($params);
        } catch (Exception $e) {
            G::pr($e->getMessage());
        }
        break;
}
function validateConnectivity($url)
{
    ini_set('allow_url_fopen', 1);
    $sContent = file_get_conditional_contents($url);
    $sw_connect = true;
    //if ($sContent == '' || $sContent === false || strpos ( $sContent, 'address location' ) === false ) {    		4
    if ($sContent == '' || $sContent === false) {
        $sw_connect = false;
Пример #2
0
    } else {
        $doc = DOMDocument::loadHtml($altSource);
    }
    $ignoreQuotes = isset($_POST['ignore_quotes']) && $_POST['ignore_quotes'];
    $posts = $doc->getElementById("posts");
    $completePosts = collectPosts($posts);
    if ($ignoreQuotes) {
        echo 'Quotes worden <font style="color: red">NIET</font> geteld.<br />';
    } else {
        echo 'Quotes worden <font style="color: green">WEL</font> geteld.<br />';
    }
    echo '<br />';
    $parsed = array();
    foreach ($completePosts as $post) {
        $parsed[] = parseInfo($post, $ignoreQuotes, $deadline);
    }
    prettyOutput(buildData($parsed), $wordsNeeded);
} else {
    echo 'plak hier de "print" url van je speculatie topic:<br />';
    echo '<form method="post" action="">';
    echo '<input type="text" name="source" /><br />';
    echo 'Of plak hier de source (control+U als de pagina open is, alles kopieren+plakken) van de print-url je speculatie topic, als die niet publiekelijk toegankelijk is:<br />';
    echo '<textarea name="altsource" style="width: 100%; height: 500px;"></textarea><br />';
    echo 'geef hier op hoeveel woorden per dag nodig zijn:<br />';
    echo '<input type="text" name="words" /><br />';
    echo '<input type="checkbox" name="ignore_quotes" id="ignore_quotes" /><label for="ignore_quotes">Negeer quotes bij tellen</label><br />';
    echo 'geef hier aan hoe laat je deadline is<br />';
    echo '<input type="text" name="time" value="22:00" /><br />';
    echo '<input type="submit" value="analyseer" />';
    echo '</form>';
}