/*
mysql_connect("localhost","root","root");
mysql_select_db("test");
*/
$dbhost = "db.harsanders.nl";
$dbuser = "md131176db79889";
$dbpass = "TLpEWnlf";
$dbname = "md131176db79889";
// PHP SCRIPT GENAAMD getData.php
mysql_connect($dbhost,$dbuser,$dbpass);
//select the database
mysql_select_db($dbname);
?>
$siteTitle="Har Sanders // Website Beheer";
$baseURL="http://www.harsanders.nl/";
$front_end_link=$baseURL;
$tabel="HAR_pages";
$pageTabel="HAR_pages";
$topTabel= $pageTabel;
$itemTabel='HAR_multi';
$contentTabel="HAR_multi_content";
$shopTabel="HAR_beeld_items";
if (!function_exists('htmlspecialchars_decode')) {
function htmlspecialchars_decode($text) {
return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
}
}
function is_leap_year($year) {
if ((($year % 4) == 0 and ($year % 100)!=0) or ($year % 400) == 0) {
return 1;
} else {
return 0;
}
}
function iso_week_days($yday, $wday) {
return $yday - (($yday - $wday + 382) % 7) + 3;
}
function get_week_number($timestamp) {
$d = getdate($timestamp);
$days = iso_week_days($d["yday"], $d["wday"]);
if ($days < 0) {
$d[ "yday"] += 365 + is_leap_year(--$d["year"]);
$days = iso_week_days($d["yday"], $d["wday"]);
} else {
$d["yday"] -= 365 + is_leap_year($d["year"]);
$d2 = iso_week_days($d["yday"], $d["wday"]);
if (0 <= $d2) $days = $d2;
}
return (int)($days / 7) + 1;
}
function GetMonthString($n) {
$timestamp = mktime(0, 0, 0, $n, 1, 2005);
return date("F", $timestamp);
}
function doLineBreaks($text) {
// Paragraphs and line breaks *** VAN ONZICHTBAAR NAAR HTML IN TEXTBOX ***
//Convert Windows
$text = ereg_replace("\r\n", "\n", $text);
//Convert Macintosh
$text = ereg_replace("\r", "\n", $text);
//HANDLE PARAGRAPHS
$text = ereg_replace("\n\n", "
", $text);
//HANDLE LINEBREAKS
$text = ereg_replace("\n", "
", $text);
return $text;
}
function removePtags($text) {
// Filter out HTML code
$text = str_replace(array('
', '
'), '', $text); $text = str_replace(array('
', ''), '', $text);
// CONTACT FORM
$text = str_replace('[FORM]', '', $text);
$text = str_replace('[/FORM]', '', $text);
//SPECIALE TEKENS...
$text = str_replace('', 'é', $text);
$text = str_replace('', 'è', $text);
$text = str_replace('', 'ë', $text);
$text = str_replace('', 'ï', $text);
$text = str_replace('', '€', $text);
$text = str_replace('', '“', $text);
$text = str_replace('', '”', $text);
$text = str_replace('', '‘', $text);
$text = str_replace('', '’', $text);
//$text = convert_smart_quotes($text);
// Hyperlinks STIJL // Hyperlinks STIJL [L][E] // DOEL [URL=xxx]eee[/URL]
$text = eregi_replace(
'\\[LINK]([-_./a-z0-9!&%#?+,\'=:;@~]+)\\[/LINK]', '\\1', $text);
$text = eregi_replace(
'\\[LINK=([-_./a-z0-9!&%#?+,\'=:;@~]+)]([^\\[]+)\\[/LINK]', '\\2', $text);
// MAIL LINKS STIJL // Hyperlinks STIJL [L][E] // DOEL [MAIL=xxx]eee[/MAIL]
$text = eregi_replace(
'\\[MAIL]([-_./a-z0-9!&%#?+,\'=:;@~]+)\\[/MAIL]', '\\1', $text);
$text = eregi_replace(
'\\[MAIL=([-_./a-z0-9!&%#?+,\'=:;@~]+)]([^\\[]+)\\[/MAIL]', '\\2', $text);
// EXTERNAL LINKS STIJL // DOEL [XLINK=xxx]eee[/XLINK]
$text = eregi_replace(
'\\[XLINK]([-_./a-z0-9!&%#?+,\'=:;@~]+)\\[/XLINK]', '\\1', $text);
$text = eregi_replace(
'\\[XLINK=([-_./a-z0-9!&%#?+,\'=:;@~]+)]([^\\[]+)\\[/XLINK]', '\\2', $text);
// Paragraphs and line breaks *** VAN ONZICHTBAAR NAAR HTML IN TEXTBOX ***
//Convert Windows
$text = ereg_replace("\r\n", "\n", $text);
//Convert Macintosh
$text = ereg_replace("\r", "\n", $text);
//HANDLE PARAGRAPHS
$text = ereg_replace("\n\n", "
", $text);
//HANDLE LINEBREAKS
$text = ereg_replace("\n", "
", $text);
return $text;
}
////// FILE RENAME FUNCTIONS ///////
function getExtension($document) {
// Get the extension & name before the extension
$extension = substr( $document, ( strrpos($document, '.') + 1 ) ) ;
$extension = strtolower( $extension );
return $extension;
}
function getFileName($fileN) {
$pieces = explode("_uploaded/", $fileN);
$docName=$pieces[1];
return $docName;
}
function fileName ($title) {
// komma's vervangen
$title = str_replace("'", "", $title);
$title = str_replace('"', '', $title);
// Replace dots in the name with underscores (only one dot can be there... security issue).
$title = preg_replace( '/\\.(?![^.]*$)/', '_', $title ) ;
// Get the extension & name before the extension
$sExtension = substr( $title, ( strrpos($title, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
$pieces = explode(".$sExtension", $title);
$title=$pieces[0];
$title = ereg_replace("[^A-Za-z0-9_\-\./, ]", "", $title); // remove special characters
$title = str_replace(array('.','-','/',','), " ", $title); // replace legal characters with spaces
$title = trim($title); // remove leading and trailing whitespace
$title = ereg_replace(" {1,}", "_", $title); // convert one or more consecutive spaces to a single underscore
$title = ereg_replace("_{2,}", "_", $title); // convert two or more consecutive underscores to a single underscore
$title = stripslashes($title);
return $title;
}
////// UNIQUE FILENAME ////////
function getUniqueFilename($fileName, $dir) {
$i=0;
$newName = "";
$fullPath=$dir.$fileName;
if (file_exists($fullPath)) {
// Get the extension & name before the extension
$sExtension = substr( $fileName, ( strrpos($fileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
$pieces = explode(".$sExtension", $fileName);
$nameClean=$pieces[0];
$newName=$nameClean;
while (file_exists($dir.$newName.'.'.$sExtension)) {
$i++;
$newName = $nameClean.'_'.$i;
}
$uniqFileName=$newName.'.'.$sExtension;
} else {
$uniqFileName=$fileName;
}
return $uniqFileName;
}
function getUniquePicNames($fileName, $extension, $dir) {
$i=0;
$newName = "";
$fullPath=$dir.$fileName.$extension;
if (file_exists($fullPath)) {
$newName=$fileName;
while (file_exists($dir.$newName.$extension)) {
$i++;
$newName = $fileName.'_'.$i;
}
$uniqFileName=$newName;
} else {
$uniqFileName=$fileName;
}
return $uniqFileName;
}
//replace quotes enzow:
function convert_smart_quotes($string) {
/**
* 8216 curly left single quote
* 8217 apostrophe, curly right single quote
* 8220 curly left double quote
* 8221 curly right double quote
* 8212 em dash
* 8211 en dash
* 8230 ellipsis
*/
$search = array(
chr(145), //
chr(146), //
chr(147), //
chr(148), //
chr(151), //
chr(150), //
chr(133) //
);
$replace = array(
'‘',
'’',
'“',
'”',
'–',
'—',
'…'
);
return str_replace($search, $replace, $string);
}
?>