Exemplo n.º 1
0
Arquivo: index.php Projeto: bruno/twfy
<?php

include_once '../../includes/easyparliament/init.php';
include_once '../../includes/postcode.inc';
include_once 'api_functions.php';
# XXX: Need to override error handling! XXX
if ($q_method = get_http_var('method')) {
    if (get_http_var('docs')) {
        $key = 'DOCS';
    } else {
        if (!get_http_var('key')) {
            api_error('No API key provided. Please see http://www.openaustralia.org/api/key for more information.');
            exit;
        }
        $key = get_http_var('key');
        if ($key && !api_check_key($key)) {
            api_error('Invalid API key.');
            exit;
        }
    }
    $match = 0;
    foreach ($methods as $method => $data) {
        if (strtolower($q_method) == strtolower($method)) {
            api_log_call($key);
            $match++;
            if (get_http_var('docs')) {
                $_GET['verbose'] = 1;
                ob_start();
            }
            foreach ($data['parameters'] as $parameter) {
                if ($q_param = trim(get_http_var($parameter))) {
Exemplo n.º 2
0
<?php

include_once '../../includes/easyparliament/init.php';
include_once '../../includes/postcode.inc';
include_once 'api_functions.php';
# XXX: Need to override error handling! XXX
if ($q_method = get_http_var('method')) {
    if (get_http_var('docs')) {
        $key = 'DOCS';
    } else {
        $key = get_http_var('key');
        if (!$key) {
            api_error('No API key provided. Please see http://www.theyworkforyou.com/api/key for more information.');
            exit;
        }
        $check = api_check_key($key);
        if (!$check) {
            api_error('Invalid API key.');
            exit;
        } elseif ($check === 'disabled') {
            api_error('Your API key has been disabled.');
            exit;
        }
    }
    $match = 0;
    foreach ($methods as $method => $data) {
        if (strtolower($q_method) == strtolower($method)) {
            if (isset($data['superuser']) && $data['superuser']) {
                $super_check = api_is_superuser_key($key);
                if (!$super_check) {
                    if (get_http_var('docs')) {