/**
  * @test
  */
 public function it_retrieves_all_airports()
 {
     $this->soapClient->request('AirportService', 'All');
     $results = $this->soapClient->results();
     $this->assertNotEmpty($results);
     print_results($results);
     $this->assertTrue(is_array($results->AllResult->AirportDTO));
 }
Example #2
0
function onCategory($category)
{
    global $zip;
    global $network;
    $count = 5;
    if ($network == 'SMS') {
        $count == 1;
    }
    $resultset = fetchYahoo($category, $zip, $count);
    print_results($resultset, $channel, $network);
}
Example #3
0
    case "launch":
        if ((string) $page == "") {
            $_SESSION["CURRENT"] = count($_SESSION["session_history"]);
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["URI"] = "./catalog.php?categ=search&mode=8";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["POST"] = $_POST;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["GET"] = $_GET;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["GET"]["sub"] = "";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["POST"]["sub"] = "";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["HUMAN_QUERY"] = $sc->make_human_query();
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["HUMAN_TITLE"] = $msg["search_exemplaire"];
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["SEARCH_TYPE"] = "EXPL";
            $_POST["page"] = 0;
            $page = 0;
        }
        $table = $sc->get_results("./catalog.php?categ=search&mode=8&sub=launch", "./catalog.php?categ=search&mode=8&option_show_notice_fille={$option_show_notice_fille}&option_show_expl={$option_show_expl}", true);
        print_results($sc, $table, "./catalog.php?categ=search&mode=8&sub=launch&option_show_notice_fille={$option_show_notice_fille}&option_show_expl={$option_show_expl}", "./catalog.php?categ=search&mode=8&option_show_notice_fille={$option_show_notice_fille}&option_show_expl={$option_show_expl}", true);
        if ($_SESSION["CURRENT"] !== false) {
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["URI"] = "./catalog.php?categ=search&mode=8";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["POST"] = $_POST;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["GET"] = $_GET;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["PAGE"] = $page + 1;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["HUMAN_QUERY"] = $sc->make_human_query();
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["SEARCH_TYPE"] = "expl";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["TEXT_QUERY"] = "";
        }
        break;
    default:
        print $sc->show_form("./catalog.php?categ=search&mode=8&option_show_notice_fille={$option_show_notice_fille}&option_show_expl={$option_show_expl}", "./catalog.php?categ=search&mode=8&sub=launch");
        break;
}
function print_results($sc, $table, $url, $url_to_search_form, $hidden_form = true, $search_target = "")
Example #4
0
        $restaurant['distance'] = computeDistance($restaurant['geometry']['location']['lat'], $restaurant['geometry']['location']['lng'], $latitude, $longitude);
        $response['no_menu'][] = $restaurant;
    }
    if ($row = $tomorrow_statement->fetch()) {
        $restaurant['menu']['valid_from'] = $row['valid_from'];
        $restaurant['menu']['valid_to'] = $row['valid_to'];
        $restaurant['menu']['valid_from_hour'] = $row['valid_from_hour'];
        $restaurant['menu']['valid_to_hour'] = $row['valid_to_hour'];
        $restaurant['menu']['hours'] = $row['valid_from_hour'] . ' - ' . $row['valid_to_hour'];
        $restaurant['menu']['description'] = $row['description'];
        $restaurant['menu']['price'] = $row['price'];
        $restaurant['distance'] = computeDistance($restaurant['geometry']['location']['lat'], $restaurant['geometry']['location']['lng'], $latitude, $longitude);
        $response['tomorrows_menus'][] = $restaurant;
    }
}
if ($response['todays_menus'] !== null) {
    usort($response['todays_menus'], 'sort_by_distance');
}
if ($response['tomorrows_menus'] !== null) {
    usort($response['tomorrows_menus'], 'sort_by_distance');
}
if ($response['no_menu'] !== null) {
    usort($response['no_menu'], 'sort_by_distance');
}
//echo var_dump($response);
$response['status'] = 'OK';
$response['lat'] = $latitude;
$response['lng'] = $longitude;
$response['address'] = $address;
print_results($response, $ajax);
        echo "], ";
    }
    //end if-else num_rows people
    return $matches;
}
//end function print_results
$n = explode(' ', $_GET['q']);
$nickname = mysql_real_escape_string($_GET['q'], $db);
$given_name = mysql_real_escape_string(array_shift($n), $db);
$family_name = mysql_real_escape_string(array_pop($n), $db);
$additional_name = mysql_real_escape_string(implode(' ', $n), $db);
$results = 0;
if ($_GET['pov']) {
    require 'normalize_url.php';
    $pov = @mysql_fetch_assoc(mysql_query("SELECT person_id FROM urls WHERE url='" . mysql_real_escape_string(normalize_url($_GET['pov']), $db) . "'"));
    $pov = intval($pov['person_id']);
    $people = mysql_query("SELECT people.person_id,people.fn,urls.url FROM contacts,urls,people WHERE contacts.person_id={$pov} AND contacts.url=urls.url AND urls.person_id=people.person_id AND people.fn LIKE '%{$nickname}%'", $db) or die(mysql_error());
    $results += print_results($people, $db, 'Matches from Contacts');
}
//end if pov
$people = mysql_query("SELECT person_id,fn FROM people WHERE `given-name` LIKE '%{$given_name}%' AND `family-name` LIKE '%{$family_name}%' AND `additional-name` LIKE '%{$additional_name}%'" . ($_GET['count'] ? ' LIMIT ' . intval($_GET['count']) : ''), $db) or die(mysql_error());
$results += print_results($people, $db, 'Exact matches');
$people = mysql_query("SELECT person_id,value AS fn FROM fields WHERE value LIKE '%{$nickname}%' AND (type='nickname' OR type='email')" . ($_GET['count'] ? ' LIMIT ' . intval($_GET['count'] - $results) : ''), $db) or die(mysql_error());
$results += print_results($people, $db, 'Nickname matches');
$people = mysql_query("SELECT person_id,fn FROM people WHERE fn LIKE '%{$nickname}%'" . ($_GET['count'] ? ' LIMIT ' . intval($_GET['count'] - $results) : ''), $db) or die(mysql_error());
$results += print_results($people, $db, 'Fuzzy matches');
echo '}';
if ($_GET['callback']) {
    echo ')';
}
mysql_close($db);
Example #6
0
            } else {
                $observat = $observat . '-' . $t_instrum['WAVEMIN'][$key];
            }
            $observat = $observat . ' | ' . $t_instrum['CODE'][$key];
            foreach ($tabmonths as $month) {
                $dt = $year . '-' . $month;
                date_default_timezone_set('UTC');
                $starttime = strtotime($dt . '-01');
                $endtime = strtotime('+ 1 month', $starttime);
                $bid = getstat_2dates2($feat_type, $id_observatory, $starttime, $endtime);
                $tab_results[$feat_type][$observat][] = $bid;
            }
        }
        echo '<h4>' . $year . ' ' . $tab_id[$feat_type] . ' ' . $observat . ' Total = ' . $total_year . '</h4>';
        if ($total_year != 0) {
            print_results($feat_type, $observat, $tab_results, $year);
        }
        flush();
        //echo "<br>\n";
    }
}
date_default_timezone_set('Europe/Paris');
echo date("c") . ' ' . $global['MYSQL_HOST'] . ' ' . $global['TBSP'];
function print_results($feat_type, $observat, $tab_results, $year)
{
    ?>
<script type="text/javascript">
$(function(){
	   $('#tab_data<?php 
    echo $observat . $year;
    ?>
<?php

$q = @$_GET['q'];
$target = @$_GET['target'];
$results = get_suggestions($q);
echo !empty($results) ? print_results($results) : "";
function print_results($results)
{
    global $target, $q;
    $response = "<ul>";
    for ($i = 0; $i < count($results); $i++) {
        $url = @str_ireplace("%s", urlencode($results[$i]), $_GET['url']);
        $response .= '<li><a href="' . $url . '" target="' . $target . '">' . str_ireplace($q, $q . '<strong>', $results[$i]) . '</strong></a></li>';
    }
    $response .= "</ul>";
    return $response;
}
function get_suggestions($q)
{
    $request_uri = 'http://google.com/complete/search?output=toolbar&q=' . urlencode($q);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $request_uri);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $xml = json_decode(json_encode(new SimplexmlElement(curl_exec($ch))), true);
    curl_close($ch);
    $results = @$xml['CompleteSuggestion'];
    $result = array();
    if (@$results['suggestion']) {
Example #8
0
">Login with Facebook</a>
      </div>
    <?php 
}
?>

    <?php 
if ($user) {
    ?>
      <h3>You</h3>
      <img src="https://graph.facebook.com/<?php 
    echo $user;
    ?>
/picture">
    <?php 
} else {
    ?>
      <strong><em>You are not Connected.</em></strong>
    <?php 
}
?>

<pre>
<?php 
print_results($friends);
?>
</pre>
		
  </body>
</html>
Example #9
0
<?php

$q = @$_GET['q'];
$request_uri = "http://ajax.googleapis.com/ajax/services/search/web?hl=en&v=1.0&key=ABQIAAAAT6lV7pDvZ3GvlMTTF6LUgBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQwM--ieg_0fQ_8s2kfKMcZRslt0g&q=" . urlencode($q);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_uri);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$json = json_decode(curl_exec($ch), true);
curl_close($ch);
$results = $json['responseData']['results'];
echo !$q ? "" : (!empty($results) ? print_results($results) : "No results found for: <strong>{$q}</strong>");
function print_results($results)
{
    global $q;
    $response = '<ul>';
    for ($i = 0; $i < count($results); $i++) {
        $response .= '<li><a href="' . $results[$i]['url'] . '">' . $results[$i]['title'] . '</a><span>' . $results[$i]['content'] . '</span><em>' . $results[$i]['visibleUrl'] . '</em></li>';
    }
    $response .= '</ul><a href="http://google.com/search?q=' . urlencode($q) . '" target="_blank">More results...</a>';
    return $response;
}
$input_params = ['wakeuptime', 'officetime', 'backhometime', 'dinnertime', 'bedtime'];
for ($i = 0; $i < count($input_params); $i++) {
    if (isset($_GET[$input_params[$i]])) {
        $value = $_GET[$input_params[$i]];
        if (is_numeric($value)) {
            $times[$i + 1] = $value;
        } else {
            $msg = $value . " is not a number. Please enter a valid " . $input_params[$i];
            print_results($msg);
            return;
        }
    } else {
        $msg = "Please provide time for " . $input_params[$i];
        print_results($msg);
        return;
    }
}
require "HeatSettingsClass.php";
$x = new HeatSettings();
// Provide time input to the object
$x->set_times($times);
// Validate times
$validate = $x->validate_times();
if (strlen($validate) < 5) {
    // Create Schedule and print
    $result = $x->create_schedule();
    print_results($result);
} else {
    // On Validation Error
    print_results($validate);
}
Example #11
0
		<th rowspan="3" class="sized"><img src="<?echo $path;?>images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="<?echo $path;?>images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td>
		<div id="content-table-inner">	
		<!--  start content-table-inner ...................................................................... START -->
		<table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td width="50%">	
					<?	
						print_results($oresults);
					?>
				</td>
				<td width="50%">
					<?	
						include ('say.php');
					?>
				</td>		
			</tr>
		</table>
		<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
			<tr>
				<th class="table-header-repeat line-left minwidth-1"><a href="">Quick links</a>	</th>
				<th class="table-header-repeat line-left minwidth-1"><a href="">Actions log</a></th>
			</tr>
			<tr>
Example #12
0
$splQueue = new \SplPriorityQueue();
benchmark($numIterations, $splQueue);
$times['spl'] = microtime(true) - $start;
$start = microtime(true);
$fastQueue = new FastPriorityQueue();
benchmark_random($numIterations, $fastQueue);
$times['fast'] = microtime(true) - $start;
$start = microtime(true);
$zendSplQueue = new ZendSplPriorityQueue();
benchmark_random($numIterations, $zendSplQueue);
$times['zend_spl'] = microtime(true) - $start;
$start = microtime(true);
$zendPriorityQueue = new ZendPriorityQueue();
benchmark_random($numIterations, $zendPriorityQueue);
$times['zend_priority'] = microtime(true) - $start;
print_results($times);
printf("\n* The PHP SplPriorityQueue with the order issue (https://bugs.php.net/bug.php?id=60926)\n");
// insert and extract $tot elements with priority 1
function benchmark($tot, $queue)
{
    for ($i = 0; $i < $tot; $i++) {
        $queue->insert("This is a test!", 1);
    }
    for ($i = 0; $i < $tot; $i++) {
        if ("This is a test!" !== $queue->extract()) {
            printf("ERROR: the extracted value is wrong!\n");
            exit;
        }
    }
}
// insert and extract $tot elements with priority rand(1,100)
Example #13
0
/**
 * Gets the requested chart.
 * @author Ben Dodson
 * @since 6/21/08
 */
function chart()
{
    // todo: use common code for charts in blocks.php and here.
    $chart = $_REQUEST['chart'];
    $limit = 25;
    $results = array();
    if (isset($_REQUEST['jz_path'])) {
        $root = new jzMediaNode($_REQUEST['jz_path']);
    } else {
        $root = new jzMediaNode();
    }
    switch ($chart) {
        case 'newalbums':
            $results = $root->getRecentlyAdded('nodes', distanceTo('album', $root), $limit);
            break;
        case 'recentlyplayedalbums':
            $results = $root->getRecentlyPlayed('nodes', distanceTo('album', $root), $limit);
            break;
        case 'randomalbums':
            $results = $root->getSubnodes('nodes', distanceTo('album', $root), true, $limit);
            break;
    }
    print_results($results, getFormatFromRequest());
}
Example #14
0
    setcookie("ltrLoginAs", "", time() + 2592000);
    $HTTP_COOKIE_VARS['ltrLoginAs'] = "";
    page_close();
    header("Location: " . $PHP_SELF);
    exit;
}
if ($dologin == "1") {
    Header("Location: " . $sess->url("/?dologin=1"));
    exit;
}
include "dbapi/comutils.inc";
//die("b");
if (isset($sq)) {
    print print_results($sq);
} elseif (isset($aq)) {
    print print_results($aq, true);
} else {
    echo "Advanced form not implemneted yet";
}
page_close();
function print_results($query, $advanced = false)
{
    global $perm, $sess, $HTTP_GET_VARS, $glob_userdata, $glob_search_words;
    $glob_search_words = array();
    if (!defined("SEARCH_INC")) {
        include "search/search2.inc";
    }
    if (!defined("LAY_DIRECTORY_INC")) {
        include "layout/lay_directory.inc";
    }
    if (!defined("LAY_SEARCH_INC")) {
Example #15
0
                $error = true;
                $msg_errors[] = _("File type \"" . $_FILES['file_csv']['type'] . "\" not allowed");
            }
            if (@move_uploaded_file($_FILES["file_csv"]["tmp_name"], $file_csv) == false && !$error) {
                $error = true;
                $msg_errors[] = empty($msg_errors) ? _("Unable to upload file") : $msg_errors;
            }
        }
        if ($error == false) {
            $res = import_assets_csv($file_csv);
        }
        @unlink($file_csv);
    } else {
        $msg_errors[] = _("Filename is empty");
    }
}
if (isset($res['status']) && !empty($res['file_errors'])) {
    $msg_errors[] = $res['file_errors'];
}
print_form($msg_errors);
if (isset($res['status']) && empty($res['file_errors'])) {
    print_results($res);
}
?>
	
	</div>
	
</body>
</html>

Example #16
0
function test_accuracy($bloom_file, $words_file)
{
    printf("\n* test accuracy\n");
    $results = array("true_positives" => 0, "false_negatives" => 0, "false_positives" => 0, "true_negatives" => 0);
    if ($fp = @fopen($bloom_file, "r")) {
        fclose($fp);
        unlink($bloom_file);
    }
    if (!($bloom = new Dablooms\ScalingBloom(DABLOOMS_CAPACITY, DABLOOMS_ERROR_RATE, $bloom_file))) {
        printf("ERROR: Could not create bloom filter\n");
        return -1;
    }
    if (!($fp = @fopen($words_file, "r"))) {
        printf("ERROR: Could not open words file\n");
        return -1;
    }
    for ($i = 0; $word = fgets($fp, 8192); $i++) {
        if ($i % 2 == 0) {
            $word = trim($word);
            $bloom->add($word, $i);
        }
    }
    fseek($fp, 0, SEEK_SET);
    for ($i = 0; $word = fgets($fp, 8192); $i++) {
        if ($i % 2 == 1) {
            $word = trim($word);
            bloom_check_and_score($bloom, $word, 0, $results);
        }
    }
    fclose($fp);
    printf("Elements added:   %6d" . "\n" . "Elements checked: %6d" . "\n" . "Total size: %d KiB" . "\n\n", ($i + 1) / 2, $i / 2, (int) $bloom->getSize() / 1024);
    unset($bloom);
    print_results($results);
    return 0;
}
Example #17
0
        }
        print_table($data);
    }
}
function print_table($data)
{
    $gqs = array('gq_online', 'gq_address', 'gq_port', 'gq_prot', 'gq_type');
    if (!$data['gq_online']) {
        printf("<p>The server did not respond within the specified time.</p>\n");
        return;
    }
    print "<table><thead><tr><td>Variable</td><td>Value</td></tr></thead><tbody>\n";
    foreach ($data as $key => $val) {
        if (is_array($val)) {
            continue;
        }
        $cls = empty($cls) ? ' class="uneven"' : '';
        if (substr($key, 0, 3) == 'gq_') {
            $kcls = in_array($key, $gqs) ? 'always' : 'normalise';
            $key = sprintf("<span class=\"key-%s\">%s</span>", $kcls, $key);
        }
        printf("<tr%s><td>%s</td><td>%s</td></tr>\n", $cls, $key, $val);
    }
    print "</tbody></table>\n";
    echo '<hr><h2>Current Players</h2>';
    foreach ($data['players'] as $player) {
        echo '<div>' . $player['gq_name'] . ' [SCORE:' . $player['gq_score'] . '] [PING:' . $player['gq_ping'] . ']</div>';
    }
}
print_results($gamequery);