예제 #1
0
 public function authApiKey($user, $key)
 {
     global $postgisdb;
     $postgisdb = $user;
     $settings_viewer = new Settings_viewer();
     $res = $settings_viewer->get();
     $apiKey = $res['data']['api_key'];
     if ($apiKey == $key && $key != false) {
         return true;
     } else {
         return false;
     }
 }
예제 #2
0
<?php

//include("../../header.php");
include "../server_header.inc";
include "../../inc/oauthcheck.php";
$settings_viewer = new Settings_viewer();
if ($HTTP_RAW_POST_DATA) {
    $obj = json_decode($HTTP_RAW_POST_DATA);
}
//print_r($parts);
//print_r($obj);
switch ($parts[4]) {
    case "get":
        // All tables
        $response = $settings_viewer->get();
        break;
    case "update":
        // All tables
        $response = $settings_viewer->update($_POST);
        break;
    case "updatepw":
        // All tables
        $response = $settings_viewer->updatePw($_POST['pw']);
        break;
    case "updateapikey":
        // All tables
        $response = $settings_viewer->updateApiKey();
        break;
}
include_once "../server_footer.inc";
예제 #3
0
<?php

include "../conf/main.php";
include "../libs/functions.php";
include "../model/databases.php";
include "../model/dbchecks.php";
include '../model/settings_viewer.php';
$dbList = new databases();
try {
    $arr = $dbList->listAllDbs();
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
    die;
}
$postgisdb = "mygeocloud";
$postgis = new postgis();
$i = 1;
foreach ($arr['data'] as $db) {
    if ($db != "template1" and $db != "template0" and $db != "postgres" and $db != "postgis_template") {
        $postgisdb = $db;
        //$dbc = new dbcheck();
        $viewer = new Settings_viewer();
        $arr = $viewer->get();
        $sql = "INSERT INTO users(screenname,pw) VALUES('{$db}','{$arr['data']['pw']}')";
        $postgis->execQuery($sql);
        echo $sql . "\n";
        $i++;
    }
    //if ($i>10) die();
}
예제 #4
0
<?php

set_time_limit(0);
include_once '../server_header.inc';
include_once 'libs/PEAR/Cache_Lite/Lite.php';
include_once 'libs/SQL_Tokenizer.php';
$_REQUEST['q'] = rawurldecode($_REQUEST['q']);
$settings_viewer = new Settings_viewer();
$res = $settings_viewer->get();
$apiKey = $res['data']['api_key'];
$callback = $_GET['jsonp_callback'];
//$array = preg_split("/(\r\n|\n|\r)/", $string);
$response = transaction($_REQUEST['q']);
// Check if $data is set in SELECT section
if (!$data) {
    $data = json_encode($response);
}
if ($callback) {
    echo $callback . '(' . $data . ');';
} else {
    echo $data;
}
/**/
function transaction($sql)
{
    global $response, $apiKey, $data, $basePath;
    $parsedSQL = SqlParser::ParseString($sql)->getArray();
    //$tokens = SqlParser::Tokenize($sql, true);
    if (strpos($sql, ';') !== false) {
        $response['success'] = false;
        $response['message'] = "You can't use ';'. Use the bulk transaction API instead";