public function maybeFetchGvizDataSource()
 {
     if (!isset($_GET[$this->prefix . 'get_datasource_nonce']) || !$this->isValidNonce($_GET[$this->prefix . 'get_datasource_nonce'], $this->prefix . 'get_datasource_nonce')) {
         return;
     }
     $url = rawurldecode($_GET['url']);
     $http_response = $this->doHttpRequest($url, false);
     if (isset($_GET['chart'])) {
         $http_response['body'] = $this->setGVizCsvDataTypes($http_response['body']);
     }
     require_once dirname(__FILE__) . '/lib/vistable.php';
     $vt = new csv_vistable(isset($_GET['tqx']) ? $_GET['tqx'] : '', isset($_GET['tq']) ? $_GET['tq'] : '', isset($_GET['tqrt']) ? $_GET['tqrt'] : '', isset($_GET['tz']) ? $_GET['tz'] : 'PDT', get_locale(), array());
     $vt->setup_table($http_response['body']);
     print @$vt->execute();
     exit;
 }
Esempio n. 2
0
<?php

#ob_start("ob_gzhandler");
require_once "../lib/vistable.php";
$tqx = isset($_GET['tqx']) ? $_GET['tqx'] : "";
$tq = isset($_GET['tq']) ? $_GET['tq'] : "";
$tqrt = isset($_GET['tqrt']) ? $_GET['tqrt'] : "";
$tz = isset($_GET['tz']) ? $_GET['tz'] : "PDT";
$locale = isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : "en_US";
if (isset($_GET['locale'])) {
    $locale = $_GET['locale'];
}
$file = '../data/data.csv';
$extra = array();
if (isset($_GET['debug']) && $_GET['debug']) {
    header('Content-type: text/plain; charset="UTF-8"');
    $extra['debug'] = 1;
}
$vt = new csv_vistable($tqx, $tq, $tqrt, $tz, $locale, $extra);
$data = file_get_contents($file);
if ($file === FALSE) {
    die("Couldnt read `{$file}'");
}
$vt->setup_table($data);
$result = $vt->execute();
echo $result;
#ob_end_flush();