<?php

/*
 * awframework from aw.inc present aw config
 * it will help you develop easy and fast with secure tools
 * you can edit and add what you feel right
 * don't change in strucure of file
 */

ini_set("display_errors", "off");

//here the hosturl
$hosturl = get_base_url();
define("Host_URL", $hosturl);

/* //here is name for submitted
  $site_name_uniqe = "fly_app4_gt4";
  define("site_name_uniqe", $site_name_uniqe); */

function get_base_url() {
    if (isset($_SERVER['HTTPS'])) {
        $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
    } else {
        $protocol = 'http';
    }
    return $protocol . "://" . $_SERVER['HTTP_HOST'];
}

//main vars
$path = $hosturl . "/views/default";

// to connect files from in
if (empty($ab_path)) {
    $ab_path = '../';
}

//connection with main db
//require_once($ab_path . '_stone_lib/db_main/rb.php');
require_once($ab_path . 'library/db_main/rb.php');

//db connection
$db_host = 'localhost';
$db_name = 'erp';
$db_user = 'root';
$db_password = '';

/* //setup system
  require_once($ab_path . '_stone_lib/plugins/setup/setup.php'); */

//connect to database 
R::setup('mysql:host=' . $db_host . ';dbname=' . $db_name . '', '' . $db_user . '', '' . $db_password . '');
//so I can use underscore in table's name
R::ext('xdispense', function ($type) {
    return R::getRedBean()->dispense($type);
});

/* #here smarty library
  //use smarty template , it will found in public folder
  require_once($ab_path . '_stone_lib/smarty_plg/libs/Smarty.class.php');
  //use smarty paginate to paging the records from db
  require_once($ab_path . '_stone_lib/smarty_plg/libs/SmartyPaginate.class.php');
  //use trucate method to munipliate the restore data
  require_once($ab_path . '_stone_lib/smarty_plg/libs/modifier.mb_truncate.php');


  //use smarty as instance
  $smarty = new Smarty();
  $smarty->template_dir = '../views/default';
  $smarty->compile_dir = '../_per_files/temp';


  #end variable path and hosturl to views
  //main vars
  $smarty->assign("path", $path);
  $smarty->assign("hosturl", $hosturl);


  define("HASH_COST_FACTOR", "10"); */

define("DB_HOST", $db_host);
define("DB_NAME", $db_name);
define("DB_USER", $db_user);
define("DB_PASS", $db_password);

/*define('Smarty_int_tpl', serialize($smarty));*/
