1
0
Fork 0
template/site-settings.php

62 lines
1.8 KiB
PHP
Executable file

<?php session_start();
require_once 'site-config.php';
ini_set('display_errors', ($debugging == false ? 0 : 1));
ini_set('display_startup_errors', ($debugging == false ? 0 : 1));
error_reporting(E_ALL);
date_default_timezone_set($config_timezone);
$host = $_SERVER['HTTP_HOST'];
$uri = $_SERVER['REQUEST_URI'];
$is_local = (($host == 'localhost' OR strpos($host, '192.168') !== false) ? true : false);
$filename = basename($_SERVER['PHP_SELF']);
$filename_get = (!empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null);
$google = ['notranslate','nositelinkssearchb'];
$robots = ['nofollow','nosnippet','noarchive','noimageindex'];
$dir_files = $config_root.'/files/'.$config_folder;
$dir_css = 'css';
$dir_functions = 'functions';
$dir_images = 'images';
$dir_js = 'js';
$dir_languages = 'languages';
if(file_exists('vendor/autoload.php')) {
require_once 'vendor/autoload.php';
$Parsedown = new Parsedown();
$oldmask = umask(0);
mkdir($dir_files, 0777, true);
umask($oldmask);
if(!file_exists($dir_files.'/encryption.key')) {
$enckey = KeyFactory::generateEncryptionKey();
KeyFactory::save($enckey, $dir_files.'/encryption.key');
}
}
require_once 'site-functions.php';
require_once 'languages/'.(isset($_GET['lang']) ? safetag($_GET['lang']) : 'se').'.php';
if(!empty($database_host) AND !empty($database_port) AND !empty($database_name) AND !empty($database_user) AND !empty($database_pass)) {
try {
$sql = null;
if($sql === null) {
$sql = new PDO('pgsql:host='.$database_host.';port='.$database_port.';dbname='.$database_name.';user='.$database_user.';password='.$database_pass);
$sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
}
catch(PDOException $e) {
echo $e;
exit;
}
}
?>