Skip to content

Commit

Permalink
* Configuration update
Browse files Browse the repository at this point in the history
* Gettext
  • Loading branch information
ivanlanin committed Dec 8, 2011
1 parent a710494 commit f6a7e7f
Show file tree
Hide file tree
Showing 5 changed files with 1,153 additions and 12 deletions.
11 changes: 7 additions & 4 deletions config.sample.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
define('LF', "\r\n");
define('DATA_DIR', dirname(__FILE__) . '/data/');
define('CSV_SEP', ';');

define('APP_ID' , 'gdi');
define('DEFAULT_DATA' , 'propinsi');
define('DEFAULT_OUTPUT' , 'html');
define('LF' , "\r\n");
define('CSV_SEP' , ';');
define('APP_DIR' , dirname(__FILE__));
define('DATA_DIR' , APP_DIR . '/data/');
?>
20 changes: 12 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@
* @last_update Wida Sari <[email protected]> 2011-10-05 11:18
*/
if (!file_exists('config.php'))
die('config.php tidak ditemukan. Buat config.php dari config.sample.php');
die(__('config.php tidak ditemukan. Buat config.php dari config.sample.php'));

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 get
if(isset($_GET['q']))
{

$default_data = 'propinsi';
$default_output = 'html';

$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;
$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;
$result = $gdi->get_data($data, $output);

// Tampilkan hasil
Expand Down Expand Up @@ -77,4 +81,4 @@
?>
<hr>

&copy; <?php echo date('Y'); ?> id-php@yahoogroups.com
&copy; <?php echo date('Y'); ?> <a href="http://id-php.org/GDI">http://id-php.org/GDI</a>
Loading

0 comments on commit f6a7e7f

Please sign in to comment.