File: /var/www/vhosts/creativefellows.nl/test.creativefellows.nl/oudlondon.nl/includes/config.ini.php
<?php
if($security_key != 'akz2TaXRfaZ4dAqEeugt') die(":(");
/* Set locale to Dutch */
setlocale(LC_NUMERIC, 'en_GB');
/* define root directory */
define('ROOT_DIR', substr(dirname(__FILE__),0,-8));
define('IMAGE_DIR', "content/th/");
class config{
protected $security_key = "akz2TaXRfaZ4dAqEeugt";
public $lbl_click_edit = "Dubbel klik om te wijzigen";
public $userTypes = array("gebruiker","administrator");
public $defaultSections = array("bestellingen","klanten");
public $items_per_page = 30;
public $statussen = array("Bestelling","Verzonden","Geannuleerd");
public $betaalmethoden = array("Ideal","Overboeking");
public $company_short = "oudlondon";
public $sorts = array("Positie (standaard)","Nieuwste eerst","Oudste eerst");
public $positions = array("Header","Navigatie","Footer");
public $section_htmlwrapper = '<section class="container {element-class}" style="{style}" id="{element-id}"><div class="hrzntl-spacer"><div class="container-wrapper colfix">{section_htmlwrapper}</div></div></section>';
public $defaultImage = "https://s3.eu-central-1.amazonaws.com/testcassette/oudlondon/images/hotel-restaurant-oud-london.jpg";
public function __construct(){
$this->lang_id = 0;
$this->link_base = "";
$this->locale = "nl";
$this->header404 = 'Pagina niet gevonden (404)';
$this->text404 = 'Excuses, de pagina die je aangeklikt hebt bestaat niet meer.';
$this->btn_check = 'Check beschikbaarheid';
$this->book_msg = 'Direct boeken bij Hotel Restaurant Oud London garandeert u altijd de laagste prijs tov andere boekingswebsites zoals bijvoorbeeld booking.com, hotels.com of trivago.nl. <a href="Over-Oud-London/Laagste-Prijs-Garantie-40">» Lees meer</a>';
$this->contact_us = "Neem contact op";
$this->contact_url = "contact";
$this->tripadvisor = '<div id="TA_percentRecommended816" class="TA_percentRecommended"><ul id="A7oBQP" class="TA_links WfNqJpQbIW3W"><li id="lulTIJ8oO" class="7504FfW"><a target="_blank" href="https://www.tripadvisor.nl/"><img src="https://www.tripadvisor.nl/img2/widget/logo_shadow_109x26.png" alt="TripAdvisor" class="widPERIMG" id="CDSWIDPERLOGO"/></a></li></ul></div><script src="https://www.jscache.com/wejs?wtype=percentRecommended&uniq=816&locationId=231429&lang=nl&border=true&backgroundColor=white&display_version=2"></script>';
$this->upload_dir = ROOT_DIR . "content/upload/";
$this->checkLanguage();
switch($_SERVER['SERVER_NAME']){
case "localhost":
$this->base = "http://localhost:8888/oudlondon.nl/";
$this->base_str = "/oudlondon.nl";
$this->mysql_user = "root";
$this->mysql_pass = "root";
$this->mysql_host = "localhost";
$this->mysql_db = "cassette3_oudlondon";
$this->save_images = false;
error_reporting(E_ALL);
ini_set('display_errors', 0);
break;
case "test.creativefellows.nl":
$this->base = "http://test.creativefellows.nl/oudlondon.nl/";
$this->base_str = "/oudlondon.nl";
$this->mysql_user = "Fellows_oudlondontest";
$this->mysql_pass = "fSnl315?";
$this->mysql_host = "localhost";
$this->mysql_db = "cassette_oudlondon_test";
$this->save_images = true;
error_reporting(E_ALL);
ini_set('display_errors', 0);
break;
default:
$this->base = "/";
$this->base_str = "";
$this->mysql_user = "oudlndn_user";
$this->mysql_pass = "_nb0Z25s";
$this->mysql_host = "localhost";
$this->mysql_db = "cassette3_oudlondon";
$this->save_images = true;
error_reporting(E_ALL);
ini_set('display_errors', 0);
break;
}
}
/*
* check allow cookies
*/
function getCookieNote()
{
$html = "";
if(!isset($_COOKIE[$this->company_short."_allow_cookies"]))
{
$html .= '<section class="cookies" id="cookies">';
$html .= '<div class="row row-default text-center"><div class="small-12 columns">';
$html .= '<p>De website www.oudlondon.nl gebruikt cookies om de gebruikerservaring te kunnen verbeteren. Door gebruik te maken van deze website gaat u hiermee akkoord.<a id="acceptCookie" href="#" class="button primary">Accepteren</a> <a href="https://www.oudlondon.nl/281-Cookies" class="button secondary">Meer informatie</a></p>';
$html .= '</div></div>';
$html .= '</section>';
}
return $html;
}
function checkLanguage()
{
$language = (isset($_REQUEST["lang"])) ? $_REQUEST["lang"] : null;
if(file_exists(ROOT_DIR."languages/config.". $language .".php")) include_once ROOT_DIR."languages/config.". $language .".php";
elseif(file_exists(ROOT_DIR."languages/config.nl.php")) include_once ROOT_DIR."languages/config.nl.php";
}
function checkDirectories()
{
if(file_exists(IMAGE_DIR) == false){
mkdir("content", 0777, true);
chmod("content", 0777);
mkdir("content/th/", 0777, true);
chmod("content/th/", 0777);
}
}
function wrapAsSection($html,$id=null,$class=null,$style=null){
return preg_replace(array("/{section_htmlwrapper}/","/{element-id}/","/{style}/","/{element-class}/"),array($html,$id,$style,$class),$this->section_htmlwrapper);
}
function uploadFile($postname)
{
$allowedExts = array("pdf","doc","docx");
$extension = end(explode(".", strtolower($postname["name"])));
$newfilename = $this->random_string(25) .".". end(explode(".",$postname["name"]));
if( ($postname["size"] < 5000000) && in_array($extension, $allowedExts)){
//d($_FILES[$postname]);
if ($postname["error"] > 0)
{
$return = "Fout bij uplodaen: " . $postname["error"] . "<br>";
}
else
{
move_uploaded_file($postname["tmp_name"], $this->upload_dir . $newfilename);
$return = $newfilename;
}
return $return;
}
else return "-";
}
function random_string($length) {
$key = '';
$keys = array_merge(range(0, 9), range('a', 'z'));
for ($i = 0; $i < $length; $i++) {
$key .= $keys[array_rand($keys)];
}
return $key;
}
}
/*
connect to DB
*/
class dbConnect extends config
{
public $connection;
public function connectDB()
{
$con = mysqli_connect($this->mysql_host, $this->mysql_user, $this->mysql_pass, $this->mysql_db);
mysqli_set_charset($con,"utf8");
$con->query("SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION'");
if($con) $this->connection = $con;
else die('Could not connect to database!');
return $this->connection;
}
public function getDBLink()
{
return $this->connection;
}
public function closeDB()
{
mysqli_close($this->connection);
}
public function esc($escape)
{
return mysqli_real_escape_string($this->connection,$escape);
}
public function run($query, $return_as_array = true,$debug = false)
{
if($debug == true) echo ">".$query."<";
$data = array();
$result = mysqli_query($this->connection, $query) or die( "Error:". mysqli_error($this->connection)." | Query : ". $query);
if(!$result) return null;
while($row = mysqli_fetch_assoc($result)){
array_push($data,$row);
}
if($return_as_array == true) return $data;
elseif($data) return $data[0];
else return null;
}
public function get($table,$column,$value,$return=null,$debug=false)
{
$r = $this->run("SELECT * FROM `$table` WHERE `$column` = '$value'",$debug);
if($return != null) return $r[$return];
else return $r;
}
public function insert($table,$columns,$values,$debug=false)
{
$sql = "INSERT INTO $table (`".implode("`,`",$columns)."`) VALUES ('".implode("','",$values)."')";
$query = mysqli_query($this->connection, $sql) or die( "Error:". mysqli_error($this->connection)." | Query : ". $query);
return mysqli_insert_id($this->connection);
}
}
?>