Ejemplo n.º 1
0
    try {
        $user = $userinfoService->userinfo->get();
        renderJson($app, $user);
    } catch (Exception $ex) {
        renderEx($app, $ex);
    }
});
/**
 * Gets the information about the current user along with Drive API settings.
 * Requires login.
 */
$app->get('/about', function () use($app, $client, $service) {
    checkUserAuthentication($app);
    try {
        $about = $service->about->get();
        renderJson($app, $about);
    } catch (Exception $ex) {
        renderEx($app, $ex);
    }
});
/**
 * The start page, also handles the OAuth2 callback.
 */
$app->get('/', function () use($app, $client, $user) {
    // handle OAuth2 callback if code is set.
    if ($code = $app->request()->get('code')) {
        // handle code, retrieve credentials.
        $client->authenticate();
        $tokens = $client->getAccessToken();
        set_user($tokens);
        $app->redirect('/');
Ejemplo n.º 2
0
 public function m4()
 {
     $Data["aa"] = "aaaa";
     $Data["bb"] = "bbbb";
     renderJson($Data);
 }
Ejemplo n.º 3
0
 function testApi()
 {
     $res = DemoApiCenterFacade::getApi('DemoApi', 'NOWFirstPageImagesQuery', array('Page' => 1, 'PageSize' => '5', 'NOWFirstPageImagesID' => null));
     renderJson($res);
 }
Ejemplo n.º 4
0
 public function check_alias()
 {
     if ($this->input->method() != 'post') {
         show_404();
     }
     $data = file_get_contents("php://input");
     $data = json_decode($data, true);
     $alias = $data['alias'];
     $respond = array('status' => false);
     if ($this->blog->checkAliasUnique($alias)) {
         $respond['status'] = true;
     }
     renderJson($respond);
 }
Ejemplo n.º 5
0
<?php

// Juha's Hack. :-D
ini_alter('date.timezone', 'Europe/Helsinki');
$today = date('Y-m-d');
$filename = "tmp/{$today}-dax.log";
if (isset($_GET['data'])) {
    $data = null;
    if ($_GET['data'] === 'short') {
        $data = shell_exec("tail -n301 {$filename}");
    } else {
        if ($_GET['data'] === 'long') {
            $data = file_get_contents($filename);
        }
    }
    renderJson($data);
}
require_once 'long-n-short-charts.html';
die;
function renderJson($output)
{
    header('Content-Type: application/json');
    echo json_encode(explode("\n", $output));
    die;
}