// Let's display what's been provided for Form data so we can see what will be passed
    //	to the HTTP client interface
    echo "<fieldset><legend>Response Data</legend>\r\n\t\t\t<table border=1 width=80%>\r\n\t\t\t<tr><td colspan=2>Submitted Data</td></tr>\r\n\t\t\t<tr><td>App ID</td><td>{$appId}</td></tr>\r\n\t\t\t<tr><td>App Key</td><td>{$appKey}</td></tr>\r\n\t\t\t<tr><td>Device ID</td><td>{$deviceId}</td></tr>\r\n\t\t\t<tr><td>Language</td><td>{$language}</td></tr>\r\n\t\t\t<tr><td>Codec</td><td>{$codec}</td></tr>\r\n\t\t\t<tr><td>Language Model</td><td>{$languageModel}</td></tr>\r\n\t\t\t<tr><td>Results Format</td><td>{$resultsFormat}</td></tr>\r\n\t\t\t<tr><td>Audio File</td><td>" . implode("<br>", $audioFile) . "</td></tr>\r\n\t\t\t</table><br>";
    // If an audio file was submitted, get it's size so we can set the Content-Length header property
    $contentLength = strlen($audioFilename) > 0 ? $audioFile['size'] : 0;
    if (!$contentLength) {
        echo "<br><br>Please provide an audio file<br><br>";
    } else {
        // Get the audio data contained in the uploaded file
        $audio = $contentLength > 0 ? file_get_contents($audioFile['tmp_name']) : null;
        // Build our HTTP Request
        $url = buildRequestString($appId, $appKey, $deviceId);
        $header = buildHttpHeader($codec, $resultsFormat, $language, $languageModel, $contentLength);
        // Submit our Dictation or WebSearch Request
        $m = executeAsrRequest($url, $header, $audio);
        // For the purposes of this sample/demo, we're just dumping the response to the web page.
        //	In practice, you'll be parsing the Response Code, Response Status, Session Id, and message body (dictation text results)
        //	to determine your application's specific business logic
        processResults($m);
        //echo "<br><br>Response: " . var_export($m, true);
    }
    echo "</fieldset>";
}
?>

</div>
</center>
</form>
</body>
</html>
$fleet = getFleet($players, $weapons);
if (DEBUG) {
    print "Pre news<br>";
}
hofTracker($players, $port);
// Take off the 3 turns for attacking
$player->take_turns(3);
$player->update();
// fire shots
if (DEBUG) {
    print "Pre Shots<br>";
}
portFires($fleet, $port, $players);
fleetFires($fleet, $port, $players, $weapons);
//get results in a way we want them
$results = processResults($players, $port, $fleet, $weapons);
//post on alliances MB or send to player
portDowngrade($results, $port);
sendReport($results, $port);
//log player
doLog($results);
//insert into combat logs
$finalResults = $results[0] . '<br /><img src="images/portAttack.jpg" width="480px" height="330px" alt="Port Attack" title="Port Attack"><br />' . $results[1];
$db->query('INSERT INTO combat_logs VALUES("",' . SmrSession::$game_id . ',"PORT",' . $player->sector_id . ',' . time() . ',' . SmrSession::$old_account_id . ',' . $player->alliance_id . ',0,0,"' . mysql_real_escape_string(gzcompress($finalResults)) . '", "FALSE")');
if (DEBUG) {
    print "Pre Forward/Display<br>";
}
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "port_attack_new.php";
$container["results"] = $results;
<?php 
if (isset($_POST['appKey'])) {
    // Let's display what's been provided for Form data so we can see what will be passed
    //	to the HTTP client interface
    echo "<fieldset><legend>Response Data</legend>\r\n\t\t\t<table border=1 width=80%>\r\n\t\t\t<tr><td colspan=2>Submitted Data</td></tr>\r\n\t\t\t<tr><td>App ID</td><td>{$appId}</td></tr>\r\n\t\t\t<tr><td>App Key</td><td>{$appKey}</td></tr>\r\n\t\t\t<tr><td>Device ID</td><td>{$deviceId}</td></tr>\r\n\t\t\t<tr><td>Voice</td><td>{$voice}</td></tr>\r\n\t\t\t<tr><td>Language</td><td>{$language}</td></tr>\r\n\t\t\t<tr><td>Selection</td><td>{$selection}</td></tr>\r\n\t\t\t<tr><td>Codec</td><td>{$codec}</td></tr>\r\n\t\t\t<tr><td>Text</td><td>{$text}</td></tr>\r\n\t\t\t</table><br>";
    /*
     * If 'Test All Voices' or 'Test All Languages' is selected, call testAll to loop through the list
     */
    if ($selection == 'voice' && $voice == 'Test All Voices' || $selection == 'language' && $language == 'Test All Languages') {
        testAll($selection, $appId, $appKey, $deviceId, $codec, $text);
    } else {
        if ($selection == 'voice') {
            // We want to make sure we grab the correct language so we build the audio
            // filename properly.
            $language = findLanguageCode($voice);
        }
        $url = buildRequestString($selection, $appId, $appKey, $deviceId, $voice, $language, $codec, $text);
        $m = executeTtsRequest($url);
        processResults($m, $language, $voice);
    }
    echo "</fieldset>";
}
?>

</div>
</center>
</form>
</body>
</html>
예제 #4
0
//       'pizza'     => array(
//          'size'      => array(
//             'cols'   => array(
//                array('label'),
//             ),
//             'rows'   =>
//          ),
//          'toppings'  => array(
//             'cols'   => array(
//                array('label'),
//             ),
//             'rows'   =>
//          )
//       ),
//       'languages' => array(
//          'cols'   => array(
//             array('label'),
//          ),
//          'rows'   =>
//       )
//    );
//
//
//
// }
$path = "submissions.json";
if (file_exists($path)) {
    echo json_encode(processResults(file_get_contents($path)));
} else {
    echo "No data file was found.";
}
예제 #5
0
         $sql = 'UPDATE `' . $db_prefix . 'twitter_requests` SET `cycle` = "start", `time` = "' . $result_since[4] . '", `since_id` = "' . $result_since[0] . '", `last` = ' . $g . ', `overall` = ' . (intval($g) + intval($overall)) . ' WHERE id = ' . $request_id;
         $update = query_mysql($sql, $link);
         $next = "start";
     } else {
         //Most likely there were too much tweets since our last request so we need to fill the gap on our next run
         //We will store our entry tweet id as the next since_id in temp_since_id
         //We will also store the biggest current id as our max_id
         $sql = 'UPDATE `' . $db_prefix . 'twitter_requests` SET `cycle` = "active", `time` = "' . $result_since[4] . '", `temp_since_id` = "' . $result_since[0] . '", `max_id` = "' . $result_since[1] . '", `last` = ' . $g . ', `overall` = ' . (intval($g) + intval($overall)) . ' WHERE id = ' . $request_id;
         $update = query_mysql($sql, $link);
         $next = "active";
     }
 } elseif ($cycle == "active") {
     $r = $requests[$db_request_id];
     $r['max_id'] = $max_id;
     $reply = $cb->search_tweets($r);
     $result_since = processResults($reply, $link, $request_id, $db_request_id);
     $g += $result_since[2];
     if ($result_since[1] < $since_id) {
         //When we receive less then 100 we have closed the gap, so we can start over from the beginning of the gap,
         //stored in our temp_since_id variable
         $sql = 'UPDATE `' . $db_prefix . 'twitter_requests` SET `cycle` = "start", `since_id` = "' . $temp_since_id . '", `last` = ' . $g . ', `overall` = ' . (intval($g) + intval($overall)) . ' WHERE id = ' . $request_id;
         $update = query_mysql($sql, $link);
         $next = "start";
     } else {
         //It seems we haven't reached the end of our gap yet, so we need to do it over again
         $sql = 'UPDATE `' . $db_prefix . 'twitter_requests` SET `cycle` = "active", `max_id` = "' . $result_since[1] . '", `last` = ' . $g . ', `overall` = ' . (intval($g) + intval($overall)) . ' WHERE id = ' . $request_id;
         $update = query_mysql($sql, $link);
         $next = "active";
     }
 }
 //echo 'tweets:'.$_GET["request"].':'.$g.'/'.$result_since[3].':'.$cycle."=>".$next." (".$result_since[0]."/".$result_since[1]." = ".($result_since[1]-$since_id).")\n";
// For one job?
if ($jobId) {
    $q = Doctrine_Query::create()->from('WPTResult r')->where('r.WPTJobId= ?', $jobId);
    $results = $q->fetchArray();
    $q->free(true);
    processResults($results);
} else {
    // Loop through all jobs and clean up everything
    $q = Doctrine_Query::create()->from('WPTJob j');
    $jobs = $q->fetchArray();
    $q->free(true);
    foreach ($jobs as $job) {
        $q = Doctrine_Query::create()->from('WPTResult r')->where('r.WPTJobId= ?', $job['Id']);
        $results = $q->fetchArray();
        $q->free(true);
        processResults($results);
    }
}
function processResults($results)
{
    // TODO: Restrict user to their own cleanup
    foreach ($results as $result) {
        if ($result['AvgFirstViewLoadTime'] == 0 && $result['AvgFirstViewFirstByte'] == 0 && $result['AvgFirstViewStartRender'] == 0 && $result['AvgFirstViewDocCompleteTime'] == 0 && $result['AvgFirstViewDocCompleteRequests'] == 0 && $result['AvgFirstViewDocCompleteBytesIn'] == 0 && $result['AvgFirstViewDomTime'] == 0 && $result['AvgFirstViewFullyLoadedTime'] == 0 && $result['AvgFirstViewFullyLoadedRequests'] == 0 && $result['AvgFirstViewFullyLoadedBytesIn'] == 0) {
            removeResult($result['Id']);
        }
    }
}
function removeResult($id)
{
    $q = Doctrine_Query::create()->delete('WPTResult r')->where('r.Id= ?', $id);
    $rows = $q->execute();
예제 #7
0
<?php

$title = "results";
include "header.php";
?>
		
<p>Thanks for filling out the poll! We'll get back to you shortly. Below are your responses:</p>
<?php 
include "pollinator/question_viewer.php";
// Process the results
processResults();
?>
		

<?php 
include "footer.php";
예제 #8
0
    //As we are running a couple of other queries at the
    //same time, we can only do it once
    for ($i = 0; $i < 3; $i++) {
        //Create the user-id string
        $users = "";
        $sql = 'SELECT `id` FROM `' . $db_prefix . 'twitter_users` WHERE done = 0 LIMIT 100';
        $result = query_mysql($sql, $link);
        while ($row = mysql_fetch_assoc($result)) {
            if ($users != "") {
                $users .= ",";
            }
            $users .= $row["id"];
        }
        mysql_free_result($result);
        $reply = $cb->users_lookup(array('user_id' => $users, 'include_entities' => 'true'));
        $g += processResults($reply, $link);
    }
    //echo 'users:'.$_GET["request"].':'.$g;
} else {
    //echo 'pause';
}
function processResults($results, $link)
{
    global $db_prefix;
    $c = 0;
    foreach ($results as $result) {
        if (isset($result->id_str)) {
            //Store all values of the object as metadata, beside the user-object
            foreach ($result as $key => $value) {
                goDeeper("", $key, $value, $link, $result);
            }