Exemplo n.º 1
0
<?php

include "ckan.php";
//error_reporting(0);
$ckan = new CKAN();
$sets = $ckan->getSearch($_REQUEST["q"]);
if ($_REQUEST["show"]) {
    $show = $_REQUEST["show"];
} else {
    $show = 5;
}
$count_sets = $sets->count;
$count_resources = 0;
$sets->results = array_reverse($sets->results);
foreach ($sets->results as $set) {
    $count_resources += count($set->res_description);
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>CKAN Widget - <?php 
echo $_REQUEST["q"];
?>
</title>
<link rel="stylesheet" type="text/css" href="widget.css">
</head>
<body>
<div id='widget'>
    <div class='padding'>
Exemplo n.º 2
0
<?php

include "ckan.php";
include "../../AODS/AODS.php";
include dirname(__FILE__) . "/settings.php";
$ckan = new CKAN();
$ckan->getDatasets();
$ckan->saveToCSV(true, DATA_FOLDER . "data-datasets.csv");
$ckan->saveToCSV(false, DATA_FOLDER . "data-onderwerpen.csv");
$AODS = new AODS();
$AODS->upload(DATA_FOLDER . "data-datasets.csv");
$AODS->upload(DATA_FOLDER . "data-onderwerpen.csv");
Exemplo n.º 3
0
<html>
<head>
<title>AODS Link-checker</title>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
<body>
<h1>URLS met een andere response-code dan 200</h1>
<p>Let op: indien niet lokaal uitgevoerd, kunnen bestanden op amsterdamopendata.nl onterecht als 404 gezien worden.</p>
    <table>
        <thead>
            <tr><th>status</th><th>url</th><th>dataset</th><th>beschijving url</th></tr>
        </thead>
        <tbody>
    <?php 
$count = 0;
$ckan = new CKAN();
$ckan->getDatasets();
foreach ($ckan->datasets as $key => $set) {
    foreach ($set->res_url as $i => $url) {
        $count++;
        $code = is_available($url);
        if ($code != 200) {
            print "<TR><TD><a onClick='\$(\".row\").hide(); \$(\"#row" . $count . "\").show();'>&gt;</a></TD><TD>" . $code . "</TD><TD><a href='" . $url . "' target='_blank'>" . max_length($url, 60) . "</a></TD><TD>" . $set->name . "</TD><TD>" . $set->res_description[$i] . "</TR>";
            print "<TR id='row" . $count . "' class='row' style='display:none'><TD colspan = 5>";
            print "<form onSubmit='\$.post(\"setresource.php\", {name: \"" . $key . "\", res: " . $i . ", url: this.url" . $count . ".value, desc: this.desc" . $count . ".value}, function(data){\n                 \$(\"#feedback" . $count . "\").html(data);});return false; '>";
            print "URL: <input type='text' id='url" . $count . "' value='" . $url . "' SIZE=80><BR/>";
            print "DESC: <input type='text' id='desc" . $count . "' value='" . addslashes($set->res_description[$i]) . "' SIZE=80><BR/>";
            print "<input type='submit' value='Change'><br/>";
            print "</form>";
            print "<div id='feedback" . $count . "'></div>";
            print "</TD></TR>";
Exemplo n.º 4
0
    if (strtolower(substr($txt, 0, strlen($begin))) == strtolower($begin)) {
        return true;
    }
    return false;
}
//error_reporting(0);
?>
<html>
<head>
<title>AODS Link-updater</title>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
<body>

    <?php 
$count = 0;
$ckan = new CKAN("");
$ckan->getDatasets();
foreach ($ckan->datasets as $key => $set) {
    foreach ($set->res_url as $i => $url) {
        if (beginsWith($url, "http://os.amsterdam")) {
            $ckan->changeResource($set->name, $i, str_replace("http://os.amsterdam", "http://ois.amsterdam", $url), $set->res_description[$i]);
        }
    }
}
?>
  
</body>
</html>

Exemplo n.º 5
0
<?php

include "ckan.php";
function matchCKAN($ckan, $url)
{
    foreach ($ckan->datasets as $key => $dataset) {
        foreach ($dataset->res_url as $res_url) {
            if (stripos($res_url, $url) > 0) {
                return $dataset->title;
            }
        }
    }
    return "-";
}
$ckan = new CKAN("");
$ckan->getDatasets();
$odk = file_get_contents("https://kaart.amsterdam.nl/datasets");
preg_match_all("/<li class=\"text\">\\s*<a href=\"datasets\\/datasets-item(.*)\">(.*)<\\/a>\\s*<\\/li>/i", $odk, $matches, PREG_SET_ORDER);
?>

<table>
    <tr>
        <th>Dataset</th>
        <th>Link</th>
        <th>CKAN Match</th>
    </tr>

    <?php 
foreach ($matches as $match) {
    print "<tr>";
    print "<td>" . $match[2] . "</td>";
Exemplo n.º 6
0
<?php

include "ckan.php";
$count_niet_meetellen = 64;
//error_reporting(0);
$ckan = new CKAN();
$sets = $ckan->getSearch();
$count_sets = $sets->count;
$count_resources = -1 * $count_niet_meetellen;
$sets->results = array_reverse($sets->results);
foreach ($sets->results as $set) {
    $count_resources += count($set->res_description);
}
$f = fopen("/home/amsterdam/domains/tools.amsterdamopendata.nl/public_html/numbers.json", "w");
fwrite($f, json_encode(array("sets" => $count_sets, "resources" => $count_resources)));
fclose($f);
Exemplo n.º 7
0
<?php

function getIP()
{
    if (getenv("HTTP_CLIENT_IP")) {
        $ip = getenv("HTTP_CLIENT_IP");
    } else {
        if (getenv("HTTP_X_FORWARDED_FOR")) {
            $ip = getenv("HTTP_X_FORWARDED_FOR");
        } else {
            if (getenv("REMOTE_ADDR")) {
                $ip = getenv("REMOTE_ADDR");
            } else {
                $ip = "UNKNOWN";
            }
        }
    }
    return $ip;
}
if (getIP() == "92.254.0.239" || getIP() == "46.226.58.62" || getIP() == "::1") {
    include "ckan.php";
    $ckan = new CKAN();
    //$ckan->getDatasets();
    ob_start();
    $result = $ckan->changeResource($_POST["name"], $_POST["res"], $_POST["url"], $_POST["desc"]);
    ob_end_clean();
    print "OK!";
} else {
    print "Niet geautoriseerd. (" . getIP() . ")";
}
Exemplo n.º 8
0
<?php

include "ckan.php";
$ckan = new CKAN();
$ckan->deleteDataset("dynamisch_route-informatiepanelen_drips");
//$ckan->deleteDataset("gezondheid-zorg-en-welzijn-in-stadsdeel-west");
//$ckan->displayDetails("vloeroppervlakte-naar-buurtcombinaties-en-soort-gebruik");
// $ckan->changeOwner("vloeroppervlakte-naar-buurtcombinaties-en-soort-gebruik","Jos van Aert","*****@*****.**");