* @version 5.0 * @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing * @license GNU General Public License version 2 or later; see LICENSE.txt * @donate PayPal: iesien22@yahoo.com / Bank Mandiri: 130.00.1024957.4 **/ session_start(); function r2($to,$ntype='e',$msg=''){ if($msg==''){ header("location: $to"); exit; } $_SESSION['ntype']=$ntype; $_SESSION['notify']=$msg; header("location: $to"); exit; } if (file_exists('system/config.php')) { require('system/config.php'); } else { r2('system/install'); } function safedata($value){ $value = trim($value); return $value; } function _post($param,$defvalue = '') { if(!isset($_POST[$param])) { return $defvalue; } else { return safedata($_POST[$param]); } } function _get($param,$defvalue = ''){ if(!isset($_GET[$param])) { return $defvalue; } else { return safedata($_GET[$param]); } } require('system/orm.php'); ORM::configure("mysql:host=$db_host;dbname=$db_name"); ORM::configure('username', $db_user); ORM::configure('password', $db_password); ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); ORM::configure('return_result_sets', true); ORM::configure('logging', true); $result = ORM::for_table('tbl_appconfig')->find_many(); foreach($result as $value){ $config[$value['setting']]=$value['value']; } date_default_timezone_set($config['timezone']); $_c = $config; function _notify($msg,$type='e'){ $_SESSION['ntype']=$type ; $_SESSION['notify']=$msg ; } require_once('system/vendors/smarty/libs/Smarty.class.php'); $_theme = APP_URL.'/ui/theme/'.$config['theme']; $lan_file = 'system/lan/' . $config['language'] . '/common.lan.php'; require($lan_file); $ui = new Smarty(); $ui->setTemplateDir('ui/theme/' . $config['theme'] . '/'); $ui->setCompileDir('ui/compiled/'); $ui->setConfigDir('ui/conf/'); $ui->setCacheDir('ui/cache/'); $ui->assign('app_url', APP_URL); define('U', APP_URL.'/index.php?_route='); $ui->assign('_url', APP_URL.'/index.php?_route='); $ui->assign('_theme', $_theme); $ui->assign('_c', $config); $ui->assign('_L', $_L); $ui->assign('_system_menu', 'dashboard'); $ui->assign('_title', $config['CompanyName']); function _msglog($type,$msg){ $_SESSION['ntype'] = $type; $_SESSION['notify'] = $msg; } if (isset($_SESSION['notify'])) { $notify = $_SESSION['notify']; $ntype = $_SESSION['ntype']; if ($ntype == 's') { $ui->assign('notify','