require_once 'config.php'; require_once 'lib/php/catalog.class.php'; require_once 'lib/php/output.class.php'; require_once 'lib/php/gdi.class.php'; require_once 'lib/gettext/gettext.inc'; // Locale $locale = 'id'; T_setlocale(LC_MESSAGES, $locale); T_bindtextdomain(APP_ID, APP_DIR . '/assets/locale'); T_textdomain(APP_ID); // Process query or get catalog $TITLE = 'Gudang Data Indonesia'; $query = $_GET['q']; $output = $_GET['o']; if (isset($query)) { $gdi = new gdi(); $query = file_exists(DATA_DIR . $query . '.txt') ? $query : DEFAULT_DATA; $output = class_exists($output) ? $output : DEFAULT_OUTPUT; $data = $gdi->get_data($query, $output); $o = new $output(); $CONTENT = $o->out($data); if (in_array($output, array('meta', 'html', 'graph'))) { $meta = $gdi->get_meta($query, $output); if ($output == 'meta') { $CONTENT = json_encode($meta); } $TITLE = $meta['deskripsi']; $types = json_decode('{"html":"","meta":"","graph":"","csv":"","json":"","xml":""}', true); foreach ($types as $key => $val) { $ACTION .= sprintf('<li><a href="./%1$s?q=%2$s&o=%3$s">%4$s</a></li>', $val, $query, $key, $key); }
<?php /** * Gudang Data Indonesia * * @author Ivan Lanin <*****@*****.**> * @author Agastiya S. Mohammad <*****@*****.**> * @since 2010-11-13 23:35 */ require_once 'gdi.class.php'; $gdi = new gdi(); $gdi->import_from('kecamatan.txt');
<?php if (isset($_GET['q'])) { $default_data = 'propinsi'; $default_output = 'graph'; $q = ucwords(str_replace("_", " ", $_GET['q'])); $gdi = new gdi(); $data = isset($_GET['q']) && file_exists(DATA_DIR . $_GET['q'] . '.txt') ? $_GET['q'] : $default_data; $output = isset($_GET['o']) && class_exists($_GET['o']) ? $_GET['o'] : $default_output; $columns = explode(";", isset($_GET['cols']) && file_exists(DATA_DIR . $_GET['q'] . '.txt') ? $_GET['cols'] : ""); if (sizeof($columns) == 1 and empty($columns[0])) { $columns = ""; } $result = $gdi->get_data($data, $output); $o = new $output(); if ($output == 'graph') { $apiData = $o->out($result); $first_key = ""; foreach ($apiData as $index => $data) { $counter = 0; foreach ($data as $i => $d) { if ($counter == sizeof($data)) { $counter = 0; } if ($first_key == "") { $first_key = $i; } if ($i == $first_key) { $ticks[] = $d; } else { if (is_array($columns)) {