Beispiel #1
0
 protected static function _build($is_prod)
 {
     $databases = databases::get_databases($is_prod);
     foreach ($databases as $database => $params) {
         $conn = mysql_connect($params['host'], $params['user'], $params['password'], $new_link = true);
         mysql_select_db($database, $conn);
         $tables = self::get_tables($conn);
         $tables_info = array();
         foreach ($tables as $table) {
             $tables_info[$table] = self::get_table_info($conn, $table);
         }
         if (!empty($tables_info)) {
             self::add_param($database, $tables_info);
         }
     }
 }
<?php

include "../server_header.inc";
//include("../../inc/oauthcheck.php");
$table = new databases();
if ($HTTP_RAW_POST_DATA) {
    $obj = json_decode($HTTP_RAW_POST_DATA);
}
//print_r($obj);
switch ($parts[4]) {
    case "addschema":
        $response = $table->createSchema($_POST['schema']);
        break;
    case "getschemas":
        $response = $table->listAllSchemas($_POST['schema']);
        break;
}
include_once "../server_footer.inc";
<?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();
}
include 'conf/main.php';
session_name($sessionName);
session_set_cookie_params($sessionLifeTime, '/', "." . $domain);
session_start();
include 'libs/functions.php';
include 'inc/user_name_from_uri.php';
include 'model/users.php';
include 'model/databases.php';
include 'model/classes.php';
include 'model/wmslayers.php';
include 'model/settings_viewer.php';
// we need to get pw for http authentication
include 'libs/FirePHPCore/FirePHP.class.php';
include 'libs/FirePHPCore/fb.php';
if ($parts[1] == "store" || $parts[1] == "editor") {
    $db = new databases();
    if (!$parts[2]) {
        die("<script>window.location='/?db=false'</script>");
    }
    if ($db->doesDbExist(postgis::toAscii($parts[2], NULL, "_"))) {
        $postgisdb = $parts[2];
    } else {
        die("<script>window.location='/?db=false'</script>");
    }
    include "inc/oauthcheck.php";
}
?>
<!DOCTYPE html>
<html>
<head>
    <title>MapCentia GeoCloud</title>
<?php

include "../server_header.inc";
//include("../../inc/oauthcheck.php");
$db = new databases();
if ($HTTP_RAW_POST_DATA) {
    $obj = json_decode($HTTP_RAW_POST_DATA);
}
switch ($parts[4]) {
    case "addschema":
        $response = $db->createSchema($_POST['schema']);
        break;
    case "getschemas":
        $response = $db->listAllSchemas($_POST['schema']);
        break;
    case "doesdbexist":
        $response = $db->doesDbExist($parts[5]);
        break;
}
include_once "../server_footer.inc";
// Start HTML doc
include "html_header.php";
?>
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen" />
</head>
<body>
<div id="outercontainer">
<div id="innercontainer">
<div id='stylized' class="myform">
<?php 
if (!$_REQUEST['name']) {
    echo "<h1>Need a name!</h1>";
    echo "<p></p>";
} else {
    $name = postgis::toAscii($_REQUEST['name'], NULL, "_");
    $db = new databases();
    $dbObj = $db->createdb($name, $databaseTemplate, "LATIN1");
    // databaseTemplate is set in conf/main.php
    if ($dbObj) {
        echo "<h1>Your geocloud \"{$name}\" was created!</h1>";
        echo "<p>When asked type in \"{$name}\" and use \"1234\" for password. Remember to change it!</p>";
        echo "<button onclick=\"window.location.href='/store/{$name}'\">Take me to my cloud</button>";
    } else {
        echo "<h1>Sorry, something went wrong. Try again</h1>";
    }
}
?>
<div class="spacer"></div>
</div>
</div>
</div>
Beispiel #7
0
// Check if user is logged in - and redirect if this is not the case
if (!$_SESSION['auth'] || !$_SESSION['screen_name']) {
    die("<script>window.location='/user/login'</script>");
}
include '../header.html';
include '../../conf/main.php';
include '../../libs/functions.php';
include 'model/databases.php';
//print_r($_SESSION);
?>
<!--<p>Hi <?php 
echo $_SESSION['screen_name'];
?>
</p>-->
<?php 
$db = new databases();
if ($db->doesDbExist(postgis::toAscii($_SESSION['screen_name'], NULL, "_"))) {
    echo "<a style='margin-top:40px' href='/store/{$_SESSION['screen_name']}' class='btn btn-large btn-info'>Start MyGeoCloud</a>";
} else {
    echo "<a style='margin-top:40px' href='/createstore' class='btn btn-large btn-info'>Create MyGeoCloud</a>";
    echo "<p>It will take a minute.</p>";
}
?>
</div>
<div class="span4" style="border-left:4px solid #F1F1F1;display: block;height: 250px;margin-top: 0px;padding-left: 40px;padding-top: 40px">
	<h1></h1>
</div>
</div>
</div>
</body>
</html>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>
    <div class="container">
		<div class="row">
			<div class="span4">&nbsp;</div>
			<div class="span4">
				<div class="box">
				<?php 
if (!$_SESSION['screen_name']) {
    echo "<h2>Need a name!</h2>";
    echo "<div class='inner'><a href='/' class='btn btn-danger'>Go back</a></div>";
} else {
    $name = postgis::toAscii($_SESSION['screen_name'], NULL, "_");
    $db = new databases();
    echo "<div class='inner'>";
    $dbObj = $db->createdb($name, $databaseTemplate, "UTF8");
    // databaseTemplate is set in conf/main.php
    echo "</div>";
    if ($dbObj) {
        echo "<h2>Your geocloud \"{$name}\" was created!</h2>";
        echo "<div class='inner'><p> </p>";
        echo "<p><button class='btn btn-warning' onclick=\"window.location.href='/store/{$name}'\">Take me to my cloud</button></p></div>";
    } else {
        echo "<h2>Sorry, something went wrong. Try again</h2>";
        echo "<div class='inner'><a href='/user/signup' class='btn btn-danger'>Go back</a></div>";
    }
}
?>
				</div>
<?php

include_once "../model/database.php";
//echo $_GET['date'];
$database = new databases();
//get date and trainer id from GET
$dateValue = $_GET['date'];
//$dateValue = $dateValue.rtrim("0");
$trainerIdValue = $_GET['trainerId'];
//read trainer details for the specified day
////echo $trainerIdValue;
//echo $dateValue;
$result = $database->getTrainerDaySchedule($trainerIdValue, $dateValue);
$count = mysqli_num_rows($result);
$arrOfRes = array();
$str = "";
while ($row = $result->fetch_assoc()) {
    $res = implode(",", $row);
    $str .= $res . "/";
}
echo rtrim($str, "/");