%PDF- %PDF-
| Direktori : /www/varak.net/losik.varak.net/ |
| Current File : /www/varak.net/losik.varak.net/bootstrap.php |
<?php
/**
* Created by PhpStorm.
* User: waritko
* Date: 3.5.16
* Time: 20:36
*/
// require_once "vendor/Dibi/dibi.php";
require_once "vendor/autoload.php";
require_once "lib/smarty/Smarty.class.php";
//require_once "lib/nette.phar";
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
function url()
{
$url = "http" . (($_SERVER['SERVER_PORT'] == 443) ? "s://" : "://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$pu = parse_url($url);
return $pu["scheme"] . "://" . $pu["host"] . ":" . $pu["port"];
}
dibi::connect([
'driver' => 'postgre',
'string' => 'host=127.0.0.1 port=5432 dbname=losik user=practiscore password=Veverka33',
'charset' => 'utf8',
'profiler' => [
'run' => TRUE,
'file' => __DIR__ . '/log/log-' . date('Y-m-d') . '.txt',
]
]);
$smarty = new Smarty();
$smarty->setTemplateDir( __DIR__ . '/templates/');
$smarty->setCompileDir( __DIR__ . '/templates_c/');
$smarty->setConfigDir( __DIR__ . '/configs/');
$smarty->setCacheDir( __DIR__ . '/cache/');
$smarty->debugging = false;
$userId = false;
$isAdmin = false;
ini_set('session.gc_maxlifetime', 14*24*3600);
session_set_cookie_params(14*24*3600);
session_start();
if(isset($_SESSION['userId']))
{
$userId = $_SESSION['userId'];
$isAdmin = $_SESSION['isAdmin'];
}
$smarty->assign('userId', $userId);
$smarty->assign('queryString', $_SERVER['QUERY_STRING']);
$smarty->assign('baseUrl', 'https://' . $_SERVER['SERVER_NAME']);
//$smarty->assign('baseUrl', url() . "/losik/www");
function array_copy($arr) {
$newArray = array();
foreach($arr as $key => $value) {
if(is_array($value)) $newArray[$key] = array_copy($value);
else if(is_object($value)) $newArray[$key] = clone $value;
else $newArray[$key] = $value;
}
return $newArray;
}