File: /var/www/vhosts/creativefellows.nl/test.creativefellows.nl/ergatis/src/class.config.php
<?php
if($security_key != 'akz2TaXRfaZ4dAqEeugt') die(":(");
class config{
protected $security_key = "akz2TaXRfaZ4dAqEeugt";
public $company_short = "ergatis";
public $items_per_page = 12;
public $betaalmethoden = array("ideal","overboeking","creditcard","sofort");
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 $google_captcha = false;
public $secret_google_key = false;
/*
* Init
*/
public function __construct()
{
// Check language
$this->checkLanguage();
// Check versions
switch($_SERVER['SERVER_NAME'])
{
case "ergatis.test":
$this->base = "http://ergatis.test:8888/";
$this->mysql_user = "root";
$this->mysql_pass = "root";
$this->mysql_host = "localhost";
$this->mysql_db = "cassette3_ergatis";
$this->save_images = true;
error_reporting(E_ALL);
ini_set('display_errors', 1);
break;
case "test.creativefellows.nl":
$this->base = "http://test.creativefellows.nl/ergatis/";
$this->mysql_user = "Fellows_admin_ergatis";
$this->mysql_pass = "csQd04@8";
$this->mysql_host = "localhost";
$this->mysql_db = "Fellows_ergatis";
$this->save_images = true;
error_reporting(E_ALL);
ini_set('display_errors', 0);
break;
default:
$this->base = "https://www.ergatis.nl/";
$this->mysql_user = "ergatis";
$this->mysql_pass = "u&z#O5pX43)buQvq";
$this->mysql_host = "localhost";
$this->mysql_db = "ergatis";
$this->save_images = true;
error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('display_errors', 0);
break;
}
}
/*
* Check languages
*/
public function checkLanguage()
{
$language = (isset($_REQUEST["lang"])) ? $_REQUEST["lang"] : "nl";
if(file_exists(ROOT_DIR."languages/config.". $language .".php")) include_once ROOT_DIR."languages/config.". $language .".php";
}
/*
* Check directories for thumbs
*/
public function checkDirectories()
{
if(file_exists(IMAGE_DIR) == false){
mkdir("content", 0777, true);
chmod("content", 0777);
mkdir("content/th/", 0777, true);
chmod("content/th/", 0777);
}
}
/*
* Safe html output for form data etc
*/
public function getHash($str)
{
return hash("sha256",$str);
}
/*
* Wrap a section as a HTML5 wrapper
*/
public 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);
}
/*
* check allow cookies
*/
public function getCookieNote()
{
$html = "";
if(!isset($_COOKIE[$this->company_short."_allow_cookies"]))
{
$html .= '<section class="cookies" id="cookies">';
$html .= '<div class="hrzntl-spacer"><div class="container-wrapper colfix">';
$html .= '<div class="col18"><p>'. $this->cookie_text .'</p></div>';
$html .= '<div class="col6 buttons"><p><a id="acceptCookie" href="#" class="button primary">Accepteren</a> <a id="moreCookie" href="'. $this->cookie_link .'" class="button secondary">Meer informatie</a></p></div>';
$html .= '</div></div>';
$html .= '</section>';
}
return $html;
}
/*
* validate link
*/
public function vl($url){
return preg_replace("/[-]+/","-",preg_replace("/[^0-9a-zA-Z-#\/]/",'-', trim($url)));
}
/*
* decode post, replace - by space
*/
public function dp($post)
{
return preg_replace("/-/"," ",strtolower($post));
}
/*
* decode post with caps, replace - by space
*/
public function dp_cap($post)
{
return ucfirst( $this->dp(strtolower($post)) );
}
/*
* Make intro bases on input
*/
public function makeIntro($text,$length=null,$addParagraphtags=null,$sign=null){
$text = preg_replace('/<(h1|h2|h3|h4)[^>]*>([\s\S]*?)<\/(h1|h2|h3|h4)[^>]*>/', '', $text);
$sign = ($sign == null) ? " [..]" : $sign;
$textlen = strlen(strip_tags($text));
if($textlen < $length && $length!=null) $return = strip_tags($text);
else{
$cropAfter = ($length != null) ? $length : 115;
$intro = substr(strip_tags($text), 0, $cropAfter);
$ls = strrpos($intro, " ");
$return = substr($intro, 0, $ls).$sign;
}
$return = ($addParagraphtags == null) ? $return : "<p>".$return."</p>";
return $return;
}
/*
* Safe html output for form data etc
*/
public function outputSafe($string){
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
}
/*
* get inline svg
*/
public function getSVG($type){
switch($type){
case "close":
return '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<path class="st0" d="M14.1,12l6.4-6.4c0.6-0.6,0.6-1.5,0-2.1c-0.6-0.6-1.5-0.6-2.1,0L12,9.9L5.6,3.4C5,2.9,4,2.9,3.4,3.4
C2.9,4,2.9,5,3.4,5.6L9.9,12l-6.4,6.4c-0.6,0.6-0.6,1.5,0,2.1c0.6,0.6,1.5,0.6,2.1,0l6.4-6.4l6.4,6.4c0.6,0.6,1.5,0.6,2.1,0
c0.6-0.6,0.6-1.5,0-2.1L14.1,12z M14.1,12"/>
</svg>';
break;
case "search":
return '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<path class="st0" d="M10.6,5.8c1.3,0,2.5,0.5,3.4,1.4c0.9,0.9,1.4,2.1,1.4,3.4c0,1.3-0.5,2.5-1.4,3.4c-0.9,0.9-2.1,1.4-3.4,1.4
c-1.3,0-2.5-0.5-3.4-1.4c-0.9-0.9-1.4-2.1-1.4-3.4c0-1.3,0.5-2.5,1.4-3.4C8.1,6.2,9.3,5.8,10.6,5.8 M5.2,16c0.7,0.7,1.5,1.2,2.4,1.6
c0.9,0.4,1.9,0.6,3,0.6c1.6,0,3-0.4,4.3-1.3l3.7,3.7c0.3,0.3,0.6,0.4,1,0.4c0.4,0,0.7-0.1,1-0.4c0.3-0.3,0.4-0.6,0.4-1
c0-0.4-0.1-0.7-0.4-1l-3.7-3.7c0.9-1.3,1.3-2.7,1.3-4.3c0-1-0.2-2-0.6-3c-0.4-0.9-0.9-1.8-1.6-2.4S14.5,4,13.6,3.6
c-0.9-0.4-1.9-0.6-3-0.6c-1,0-2,0.2-3,0.6C6.7,4,5.9,4.5,5.2,5.2S4,6.7,3.6,7.7C3.2,8.6,3,9.6,3,10.6c0,1,0.2,2,0.6,3
C4,14.5,4.5,15.3,5.2,16"/>
</svg>';
break;
}
}
/*
* get column width based on count
*/
public function colWidth($count)
{
switch($count){
default:
case 4:
$col_width = "col6";
break;
case 1:
$col_width = "col24";
break;
case 2:
$col_width = "col12";
break;
case 3:
$col_width = "col8";
break;
case 5:
$col_width = "col4-5";
break;
case 6:
$col_width = "col4";
break;
}
return $col_width;
}
/*
* count number of items in array
*/
public function countArrayDimension($navigation_array,$dimension,$value=0){
$count = 0;
foreach ($navigation_array as $section){
$section[$dimension] == $value ? $count++ : 0;
}
return $count;
}
}
?>