'; print_r($arr); echo ''; } //-------------------------------------------------------------- listboxen voor datum maken function listbox_date ($name, $default=0) { $result="\n"; return $result; } function listbox_month ($name, $default=0) { $result="\n"; return $result; } function listbox_year ($name, $start, $end, $default=0) { $result="\n"; return $result; } function getDateFromWeek($iWeek, $iYear) { // Get a random monday in the requested year $iRandomDate = mktime(0, 0, 0, 3, 1, $iYear); // What's the first monday before this random date? $iMonday = mktime(0, 0, 0, date('n', $iRandomDate), date('j', $iRandomDate)-(date('w', $iRandomDate)-1), $iYear); // Get the date of week 1 $iFirstWeek = mktime(0, 0, 0, date('n', $iMonday), date('j', $iMonday) - 7*(date('W', $iMonday)-1), $iYear); return mktime(0, 0, 0, date('n', $iFirstWeek), date('j', $iFirstWeek) + 7*($iWeek-1), date('Y', $iFirstWeek)); } function CountryDrop($cntr_id) { echo ''; } function getCountry($id,$lng) { $sql = 'SELECT * FROM tblCountry WHERE cntr_id='.$id.' LIMIT 1'; $res = mysql_query($sql) or die('Error while executing the query
MYSQL:' .$sql. mysql_error()); $list = mysql_fetch_array($res); $lng == 1 ? $str = $list['country'] : $str = $list['country']; return $str; } //-------------------------------------------------------------------------------------// function timestamp ($timestamp){ $year = substr($timestamp,0,4); $month = substr($timestamp,4,2); $day = substr($timestamp,6,2); $datum = $day.'-'.$month.'-'.$year; return $datum; } //returns goedzetten en url en email actief maken function ShowText($str) { $str = stripslashes($str); $str = nl2br($str); $str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1', $str); $str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1\\2', $str); $str = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','\\1', $str); //$str = eregi_replace("\[url\][[:space:]]*(http://)?([^\\[]*)[[:space:]]*\[/url\]","http://\\2",$str); //$str = eregi_replace("\\[url=(http://)?([^\\[]*)\\][[:space:]]*([^\\[]*)[[:space:]]*\\[/url\\]","\\3",$str); //$str = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','\\1', $str); //$str = eregi_replace('','"',$str); //$str = eregi_replace('','"',$str); $str = eregi_replace('','´',$str); $str = eregi_replace('','´',$str); return $str; }; function HowLongAgo($d) { if($_SESSION['lang']==99) { $s = array('zojuist geplaatst','1 seconde geleden',' seconden geleden','1 minuut geleden',' minuten geleden',' uur geleden','gisteren','eergisteren',' dagen geleden','1 week geleden',' weken geleden','meer dan een maand geleden'); }else{ $s = array('just added','1 second ago',' seconds ago','1 minute ago',' minutes ago',' hours ago','yesterday','day before yesterday',' days ago','1 week ago',' weeks ago','more than a month ago'); } $t = (time()+1) - $d; switch($t) { case $t<2 : $w = $s[0]; break; case $t<60 : // seconden $t==1 ? $w = $s[1] : $w = $t.$s[2]; break; case $t>60 && $t<3600 : // minuten $t = round($t/60); $t==1 ? $w = $s[3] : $w = $t.$s[4]; break; case $t>3600 && $t<86400 : // uren $t = round($t/3600); $w = $t.$s[5]; break; case $t>86400 && $t<604800 : // dagen $t = round($t/86400); if($t==1) { $w = $s[6]; }elseif($t==2) { $w = $s[7]; }else{ $w = $t.$s[8]; } break; case $t>604800 && $t<3024000 : // tot 5 weken $t = round($t/604800); $t==1 ? $w = $s[9] : $w = $t.$s[10]; break; case $t>3024000 : // tot 5 weken $w = $s[11]; break; } return $w; } //---------------------------------------- ALGEMENE CLEAN FUNCTIES ----- function clearText($str) { $str = htmlentities(strip_tags($str)); //$str = eregi_replace('','"',$str); //$str = eregi_replace('','"',$str); $str = eregi_replace('','´',$str); $str = eregi_replace('','´',$str); return $str; } function clearAjaxString ($str) { $str = htmlentities(strip_tags($str)); //$str = eregi_replace('','"',$str); //$str = eregi_replace('','"',$str); $str = eregi_replace('','´',$str); $str = eregi_replace('','´',$str); $str = urldecode(stripslashes($str)); return $str; } function clearAjaxMsg ($str) { $str = urldecode($str); return $str; } function clearTextMail($str) { return htmlentities(strip_tags(urldecode(stripslashes($str)))); } function clearURL($str) { return htmlentities(strip_tags(ereg_replace('http://','',$str))); } function clearPrice($price) { $price = str_replace(",", ".", trim($price," ")); return $price; } //---------------------------------------- TINY_MCE EDITOR ----- function clearMCE($str) { $allowedTags='

'; $allowedTags.='

      • '; $allowedTags.=''; $str = strip_tags($str,$allowedTags); $str = addslashes($str); return $str; } function showMCE($str) { //--- deze wordt bijv gebruikt voor output text met TinyMCE-editor $str = stripslashes($str); //$str = nl2br($str); //$str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1', $str); //$str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1\\2', $str); //$str = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','\\1', $str); //--- url forum style $str = eregi_replace("\[url\][[:space:]]*(http://)?([^\\[]*)[[:space:]]*\[/url\]","http://\\2",$str); $str = eregi_replace("\\[url=(http://)?([^\\[]*)\\][[:space:]]*([^\\[]*)[[:space:]]*\\[/url\\]","\\3",$str); //$str = eregi_replace('"','"',$str); //$str = eregi_replace('','"',$str); //$str = eregi_replace('','´',$str); //$str = eregi_replace('','´',$str); return $str; }; function showMCEAdmin($str) { //--- deze wordt bijv gebruikt voor output text met TinyMCE-editor $str = stripslashes($str); return $str; }; //--------------------------------------------------------- //afkappen van zinnen op karakters function strcut($string, $lenght, $end = '...') { if (strlen($string) > $lenght) { return rtrim(substr($string, 0, $lenght - strlen($end))) . $end; } return $string; }; //afkappen van zinnen op woorden function strwcut($string, $lenght, $end = '...', $offset = 8) { if (strlen($string) > $lenght) { $lenght -= strlen($end); $last = strrpos(substr($string, 0, $lenght + 1), ' '); return substr($string, 0, ($last < $lenght - $offset)? $lenght: $last) . $end; } return $string; }; function GetFileSize($size) { if ($size > 1048576){ $filesize = round((($size / 1024) / 1024),2)." mb";} elseif ($size > 1024){ $filesize = round(($size / 1024))." kb";} return $filesize; } //---------------------------------------- DATUM CONVERSIES ----- function getdatum($datum,$lng=1,$type=1) { switch($type) { case 1: $maand = substr($datum,5,2); if($maand < 10) { $maand = substr($maand,1,1);} if($lng==2){ $maanden = array( 1 => "January","February","March","April","May","June","Juli","August","September","October","November","December"); $day = substr($datum,8,2); switch($day){ case 1: $day = '1st'; break; case 2: $day = '2nd'; break; case 3: $day = '3rd'; break; case 21: $day = '21st'; break; case 22: $day = '22nd'; break; case 23: $day = '23rd'; break; default: $day = $day.'th'; break; } $datum = $maanden [$maand].' '.$day.' '.substr($datum,0,4); }else{ $maanden = array( 1 => "Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"); $datum = substr($datum,8,2).' '.$maanden [$maand].' '.substr($datum,0,4); } return $datum; break; case 2: $d = substr($datum,8,2); $m = substr($datum,5,2); $y = substr($datum,2,2); $datum = $d.'.'.$m.'.'.$y; return $datum; break; } } function getShortDate($datum) { $maand = substr($datum,5,2); if($maand < 10) { $maand = substr($maand,1,1);} $maanden = array( 1 => "jan","feb","mrt","apr","mei","jun","jul","aug","sept","oct","nov","dec"); $dag = substr($datum,8,2); if ($dag{0} == 0) { $dag = $dag{1}; if($dag<10) $dag = '0'.$dag; } $year = substr($datum,2,2); $datum = ''.$dag.''.$maanden [$maand].'\''.$year; return $datum; } function getShortDate2($datum) { $maand = substr($datum,5,2); if($maand < 10) { $maand = substr($maand,1,1);} $maanden = array( 1 => "jan","feb","mrt","apr","mei","jun","jul","aug","sept","oct","nov","dec"); $dag = substr($datum,8,2); if ($dag{0} == 0) { $dag = $dag{1}; if($dag<10) $dag = '0'.$dag; } $year = substr($datum,2,2); $datum = ''.$dag.' '.$maanden [$maand].' '.$year.' '; return $datum; } function ConvertWeekDay ($datum,$lng) { $cal = explode('-',$datum); $m = GetMonth($cal[2],$lng); $w = GetWeekDay($cal[0],$lng); if($lng==2){ $wd = substr($w,0,3); }else{ $wd = substr($w,0,2); } return '• '.$wd .' '. $cal[1] .' '. $m; } function ConvertDay ($datum,$lng) { $c = explode('-',$datum); $t = date("w", mktime(0, 0, 0, $c[1], $c[2], $c[0])); $m = GetMonth($c[1],$lng); $w = GetWeekDay($t,$lng); $lng == 1 ? $d = $w .' '. $c[2] .' '. $m : $d = $w .' '. $m .' '. $c[2] ; return $d; } function GetMonth ($a,$lng=1) { substr($a,0,1) == '0' ? $a = substr($a,1) : ''; if($lng==2){ $m = array( 1 => "january","february","march","april","may","june","july","august","september","october","november","december"); }else{ $m = array( 1 => "januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"); } return $m[$a]; } function GetWeekDay ($a,$lng=1) { if($lng==2){ $w = array("sunday","monday","thuesday","wednesday","thursday","friday","saturday"); }else{ $w = array("zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"); } return $w[$a]; } function ValidDate ($d) { $pattern = '#(19|20)\d\d[- \/.](0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])#'; return preg_match($pattern,$d); } //******** EMAILCHECKER *******\\ function checkEmail($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("[^@]{1,64}@[^@]{1,255}", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } function check_email_mx($email) { if( (preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email)) || (preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/',$email)) ) { $host = explode('@', $email); if(checkdnsrr($host[1].'.', 'MX') ) return true; if(checkdnsrr($host[1].'.', 'A') ) return true; if(checkdnsrr($host[1].'.', 'CNAME') ) return true; } return false; } function countRows($sql) { $res = mysql_query($sql) or die('Fout met de query:'.$sql.'

        MYSQL:' . mysql_error()); $count = mysql_num_rows($res); return $count; } //-------------------------------- ERROR HANDLING --------------------------// function showWarning($msg) { echo '
        '.$msg.'
        '; } function showError($msg,$img=0) { $img==0 ? $addclwrap = '' : $addclwrap = ' errimgwr'; if (!empty($msg)) { $message = '
        Het nieuwe item kon niet geplaats worden omdat:'; $message .= '
          '.$msg.'
        '; $message .= 'Ga terug en probeer het nogmaals'; $message .= '
        '; catchError(1,clearText($msg)); return $message; } } function showUploadError($msg,$img=0) { $img==0 ? $addclwrap = '' : $addclwrap = ' errimgwr'; if (!empty($msg)) { $message = '
        Er is een fout opgetreden tijdens het uploaden'; $message .= '
          '.$msg.'
        '; $message .= 'Ga terug en probeer het nogmaals of stuur een email naar fuel@d-engine.nl'; $message .= '
        '; catchError(1,clearText($msg)); return $message; } } function SqlError($sql) { if (!empty($sql)) { $message = '
        ::::: MySQL QUERY ERROR :::::'; $message .= '
        SQL = '.$sql.'
        '; $message .= '
        '.mysql_error().'
        '; $message .= '::::: END OF ERROR REPORT :::::'; $message .= '
        '; $msg = mysql_error().' - '.$sql; catchError(2,clearText($msg)); echo $message; } } function catchError($type,$msg) { } //-------------------------------------------------------------// function checkLevel($level,$e_mssg='Het level een getal moet zijn.') { if (!empty($level)) { if (!is_numeric($level)) { $ERR = $e_mssg; } } return $ERR; } function moneyConvert($price,$pre=1) { if ($pre == 1) { $pre = '€ '; $pst = ''; } elseif ($pre == 2) { $pre = ''; $pst = ' €'; } else { $pre = ''; $pst = ''; } $price = $pre.number_format($price, 2, ',', '.').$pst; return $price; } function makeNumber($num) { $newnum = number_format($num, 0, '', '.'); return $newnum; } function CountImages($ref,$id) { $Sql = 'SELECT * FROM tblPhotos WHERE ph_ref = "'.$ref.'" AND ph_ref_id = "'.$id.'" '; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $cnt = mysql_num_rows($Res); if ($cnt<1) {$cnt=''; } echo $cnt; } function CountFiles($ref,$id) { $Sql = 'SELECT * FROM tblFiles WHERE fl_ref = "'.$ref.'" AND fl_ref_id = "'.$id.'" '; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $cnt = mysql_num_rows($Res); if ($cnt<1) {$cnt=''; } echo $cnt; } function checkFiles($table,$what) { $sql_cnt = 'SELECT * FROM '.$table.' WHERE '.$what ; $res_cnt = mysql_query($sql_cnt) or die('Error while executing the query
        MYSQL:' .$sql_cnt. mysql_error()); $cnt = mysql_num_rows($res_cnt); if ($cnt<1) {$cnt=''; } echo $cnt; } function checkActive($act) { if ($act == 1) { $active = 'yes'; }else{ $active = 'no'; } return $active; } function checkBool($i) { if ($i == 0) { $state = 'no'; }else{ $state = 'yes'; } return $state; } function checkIsFile ($file) { if (is_file($file)) { $isfile = 'yes'; }else{ $isfile = 'no'; } return $isfile; } function makeDate($thisdate,$starty) { if (empty($starty)) { $starty = date('Y')-3; } if (!empty($thisdate)) { echo listbox_date('day', substr($thisdate,8,2)) ; echo listbox_month('month', substr($thisdate,5,2)); echo listbox_year('year', $starty, date('Y')+4 , substr($thisdate,0,4)); }else{ echo listbox_date('day', date('d')); echo listbox_month('month', date('m')); echo listbox_year('year', $starty, date('Y')+4 , date('Y')); } } function CreateDateList($thisdate,$starty,$add) { if (empty($starty)) { $starty = date('Y')-3; } if (!empty($thisdate)) { echo listbox_date ('day'.$add, substr($thisdate,8,2)) ; echo listbox_month('month'.$add, substr($thisdate,5,2)); echo listbox_year ('year'.$add, $starty, date('Y')+4 , substr($thisdate,0,4)); }else{ echo listbox_date ('day'.$add, date('d')); echo listbox_month('month'.$add, date('m')); echo listbox_year ('year'.$add, $starty, date('Y')+4 , date('Y')); } } function gotoUrl($url) { mysql_close(); echo ''; } function alertThis($msg) { echo ''; } function closeThis() { echo ''; } //-------------------------------------------------------------- escapen van get waardes function getCleanNumm($value,$url) { if (!is_numeric($value)) { alertThis('Value not permitted. You will be redirected now.'); gotoUrl($url); }else{ return $value; } } function getClean($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number or a numeric string if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } //-------------------------------------------------------------- FUNCTIONS MENU function getDefaultLang() { $Sql = 'SELECT * FROM tblLanguage WHERE lng_default=1 LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['lng_id']; } function getLangProperties($id,$p=0) { $Sql = 'SELECT * FROM tblLanguage WHERE lng_id='.$id.' LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); switch($p) { case 1: return $list['language']; break; case 2: return $list['lng_cnt']; break; case 3: return $list['lng_abr']; break; default: return $list; break; } } function getLanguage($id) { $Sql = 'SELECT * FROM tblLanguage WHERE lng_id='.$id.' LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['language']; } //------------------------------------- widget checkbox for rightcolum function ChkBoxModWidgets($m,$lng) { $Sql = 'SELECT * FROM tblMenu, tblModules WHERE mod_id=m_mod_id AND mod_active=1 AND mod_widget!="" GROUP BY mod_id'; //$Sql = 'SELECT * FROM tblModules WHERE mod_widget!=""'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $i=0; while ($list = mysql_fetch_array($Res)) { $arr = explode(',',$m); in_array($list['mod_id'],$arr) ? $act = ' checked="checked"' : $act = '' ; $i==0 ? $t = 'Module widgets' : $t=''; echo '
      • '.$t.'
      • '."\n"; $i++; } } function ChkBoxMnuWidgets($m,$lng) { $Sql = 'SELECT * FROM tblMenu WHERE m_news=1 AND m_mod_id=0'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $i=0; while ($list = mysql_fetch_array($Res)) { $ttl = getMenuTitle($list['m_id'],$lng); $arr = explode(',',$m); in_array($list['m_id'],$arr) ? $act = ' checked="checked"' : $act = '' ; $i==0 ? $t = 'Menuitem widgets' : $t=''; echo '
      • '.$t.'
      • '."\n"; $i++; } } function GetArtWidgets($mid,$lng,$cl,$imgcl,$path) { $Sql = 'SELECT * FROM tblArticle WHERE art_m_id='.$mid.' AND lang='.$lng.' AND art_type_id=4 AND art_active=1 ORDER BY art_level'; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } while ($list = mysql_fetch_array($Res) ) { echo '
        '; if (!empty($list['art_title'])) echo '

        '.$list['art_title'].'

        '; echo '

        '; //echo GetFirstImage('aid',$list['art_id'],$ImgPathS,'frstimg'); echo showMCE($list['art_msg']); echo '

        '; GetWidgetImages($imgcl,'aid',$list['art_id'],$path); echo '
        '; } } } function GetMenuWidgets($mnu,$wgds,$lng) { if(!empty( $wgds )) { $arr = explode(',',$wgds); foreach ($arr as $val) { $Sql = 'SELECT * FROM tblArticle WHERE art_m_id IN ('.$val.') AND lang='.$lng.' AND art_type_id=1 AND art_active=1 ORDER BY art_m_id, art_level LIMIT 3'; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $w=0; $t_wdg_old = ''; while ($list = mysql_fetch_array($Res) ){ $t_wdg = $mnu[$list['art_m_id']][$lng]; if($t_wdg != $t_wdg_old ) { if($w!=0) echo ''; echo '

        '.$t_wdg.'

        '; $w++; } if (!empty($list['art_title'])) echo '

        '.$list['art_title'].'

        '; echo '

        '; //echo GetFirstImage('aid',$list['art_id'],$ImgPathS,'frstimg'); echo strwcut(showMCE($list['art_msg']),150); echo '» '.READ_MORE.''; echo '

        '; $t_wdg_old = $t_wdg; } //--- end while loop echo '
        '; } //--- end cnt>0 } //--- end foreach loop } //--- end !empty } function GetModWidgets($mnu,$wgds,$lng,$path) { if(!empty( $wgds )) { $arr = explode(',',$wgds); foreach ($arr as $val) { $Sql = 'SELECT m_id, mod_widget FROM tblMenu, tblModules WHERE mod_id=m_mod_id AND m_active=1 AND mod_active=1 AND mod_id="'.$val.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); $t_wdg = $mnu[$list['m_id']][$lng]; //echo 'JAHOOORRR'; if (!empty($list['mod_widget'])) { require($path.$list['mod_widget']); } } //--- end foreach loop } //--- end !empty } //------------------------------------- function GetSitePrefs() { $Sql = 'SELECT * FROM tblSitePrefs LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list; } //------------------------------------- function getMenuTitleId($mid,$lng) { $Sql = 'SELECT * FROM tblMenuLang WHERE ml_m_id="'.$mid.'" AND ml_lang="'.$lng.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['ml_id']; } //------------------------------------- function getMenuTitle($mid,$lng) { $Sql = 'SELECT * FROM tblMenuLang WHERE ml_m_id="'.$mid.'" AND ml_lang="'.$lng.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['ml_title']; } //------------------------------------- function UptMenuLang ($m_id, $lng, $ml_title) { $ml_id = getMenuTitleId($m_id,$lng); if ( $ml_id < 1 ) { $sql = 'INSERT INTO tblMenuLang ( ml_m_id, ml_lang, ml_title ) VALUES ( "'.$m_id.'", "'.$lng.'", "'.$ml_title.'" ) '; }else{ $sql = ' UPDATE tblMenuLang SET ml_m_id = "'.$m_id.'", ml_lang = "'.$lng.'", ml_title = "'.$ml_title.'" WHERE ml_id = "'.$ml_id.'" LIMIT 1 '; } if(!$add = mysql_query($sql)) { SqlError($sql); } } //------------------------------------- function GetMenuArray() { $mnu = array(); $Sql = 'SELECT * FROM tblMenuLang ORDER BY ml_m_id, ml_lang'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $oldmid = ''; while ($list = mysql_fetch_array($Res)) { $mid = $list['ml_m_id']; if ($oldmid != $mid) { $mnu[$mid] = array(); } $mnu[$mid][$list['ml_lang']] = $list['ml_title']; $oldmid = $mid; } return $mnu; } //----------------------------------------- function GetMenuAdmin($site=1,$mnu,$lng, $drag) { $sql = 'SELECT * FROM tblMenu WHERE m_site = '.$site.' ORDER BY m_level'; $cnt = countRows($sql); if ($cnt > 0) { $drag == 1 ? $id = 'id="m_drag"' : $id = ''; echo ''."\n"; } } function GoToStartMenu() { $sql = 'SELECT * FROM tblMenu LEFT JOIN tblModules ON (mod_id=m_mod_id) WHERE m_active=1 ORDER BY m_level LIMIT 1'; if(!$res = mysql_query($sql)) { SqlError($$sql); } $list = mysql_fetch_array($res); empty($list['mod_front_link']) ? $url = 'content.php?mnu='. $list['m_id'] : $url = $list['mod_front_link'].'?mnu='. $list['m_id']; gotoUrl($url); } function GetRedirect($path='') { $sql = 'SELECT * FROM tblMenu LEFT JOIN tblModules ON (mod_id=m_mod_id) WHERE m_active=1 ORDER BY m_level LIMIT 1'; if(!$res = mysql_query($sql)) { SqlError($$sql); } $list = mysql_fetch_array($res); empty($list['mod_front_link']) ? $url = 'content.php?mnu='. $list['m_id'] : $url = $list['mod_front_link'].'?mnu='. $list['m_id']; return $path.$url; } function GetMenuFront($site,$mnu,$lng,$ul,$act=0,$lnk='index.php?mnu=') { $sql = 'SELECT * FROM tblMenu LEFT JOIN tblModules ON (mod_id=m_mod_id) WHERE m_site = '.$site.' AND m_show=1 AND m_active=1 ORDER BY m_level'; $cnt = countRows($sql); if ($cnt > 0) { !empty($ul) ? $uli = ' '.$ul : $uli = ''; echo ''."\n"; if(!$res = mysql_query($sql)) { SqlError($$sql); } $f=true; $sub=''; $i=1; while ($mlist = mysql_fetch_array($res)) { $mid = $mlist['m_id']; $mid == $act ? $actcl = 'class="act"' : $actcl = ''; //--- menutitel ophalen isset($mnu[$mid][$lng]) ? $m = $mnu[$mid][$lng] : $m = 'nog niet gedefinieerd' ; if($mlist['m_depth'] > 0) { if ($sub==1) { echo ''."\n"; }else{ echo "\n"."\t".'
          '."\n"; } $sub=1; }else{ if ($sub==1) { echo ''."\n"."\t".'
        '."\n".''."\n"; }elseif($f===false){ echo ''."\n"; } $sub=0; } //-- als er een ID is dan deze toevoegen empty($mlist['m_add_id']) ? $id = '' : $id = ' id="'.$mlist['m_add_id'].'"'; //-- als er een CLASS is dan deze toevoegen empty($mlist['m_add_class']) ? $cls = '' : $cls = ' class="'.$mlist['m_add_class'].'"'; //-- als er een REL is dan deze toevoegen empty($mlist['m_add_rel']) ? $rel = '' : $rel = 'rel="'.$mlist['m_add_rel'].'"'; //-- als er een FRONTLINK is dan deze toevoegen empty($mlist['m_front_lnk']) ? $url = $lnk . $mlist['m_id'] : $url = $mlist['m_front_lnk']; echo "\t".''. $m .''; $f=false; $i++; } //--------------- deze is voor het juist afsluiten van een submenu als deze nog open staat if ($sub==1) { echo "\t".''."\n"."\t".'
      '."\n"; } echo "\t".''."\n".''."\n"; } } //----------- Submenufunctie voor Voskamp function GetCatMenu($ref,$lng,$lnk) { $Sql = 'SELECT cat_id,itm_title FROM tblCategories, tblItemTitles WHERE cat_id=itm_ref_id AND itm_ref="cat" AND itm_lang='.$lng.' AND cat_ref="'.$ref.'" ORDER BY cat_level'; $cnt = countRows($Sql); if ($cnt > 0) { echo '
        '."\n"; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } while($list = mysql_fetch_array($Res)) { echo "\t".'
      • › '. $list['itm_title'] .'
      • '."\n"; } echo '
      '."\n"; } } //----------------------------------------- function GetDropListModules($id=0) { echo ''."\n"; } function getModule($id) { $Sql = 'SELECT * FROM tblModules WHERE mod_id='.$id.' LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['module']; } //----------------------------------------- function GetDropListMenu($site=1,$adm,$mnu,$lng,$dis,$mod=true,$frm='',$id=false,$m_id='',$wdg=0) { $Sql = 'SELECT * FROM tblMenu WHERE m_site = '.$site.' AND m_id > 0'; $wdg == 1 ? $Sql .= ' AND m_widget_art=1' : $Sql .= ''; $adm == 1 ? '' : $Sql .= ' AND m_user_edit=1'; $mod === true ? '' : $Sql .= ' AND m_mod_id=0'; $Sql .= ' ORDER BY m_level'; $cnt = countRows($Sql); if ($cnt > 0) { $sel = ''; $id === true ? $name = 'm_id' : $name = 'level'; $dis == 1 ? $dis = ' disabled="disabled"' : $dis = '' ; !empty($frm) ? $subm = ' onchange="document.'.$frm.'.submit()"' : $subm = '' ; echo ''."\n"; } } function getFirstArtMenuId($site=1) { $Sql = 'SELECT * FROM tblMenu WHERE m_site='.$site.' AND m_mod_id=0 AND m_active=1 ORDER BY m_level LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['m_id']; } function getFirstAdminArtMenuId($site=1,$adm) { $Sql = 'SELECT * FROM tblMenu WHERE m_site='.$site.' AND m_mod_id=0 AND m_active=1'; $adm == 1 ? '' : $Sql .= ' AND m_user_edit=1'; $Sql .= ' ORDER BY m_level LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['m_id']; } function getMenuSpecs($id) { $Sql = 'SELECT * FROM tblMenu WHERE m_id="'.$id.'" AND m_active=1 LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list; } //----------------------------------------- function GetFirstImage($ref,$id,$path,$cl='') { if(!empty($id)) { $Sql = 'SELECT * FROM tblPhotos WHERE ph_ref = "'.$ref.'" AND ph_ref_id = "'.$id.'" ORDER BY ph_level, ph_date LIMIT 1'; $cnt = countRows($Sql); !empty($cl) ? $addclass = 'class="'.$cl.'"': $addclass = ''; if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); $img = $path.$list['ph_name'].$list['ph_ext']; list($width, $height, $type, $attr) = getimagesize($img); return ''; } } } function GetImgName($ref,$id,$path) { if(!empty($id)) { $Sql = 'SELECT * FROM tblPhotos WHERE ph_ref = "'.$ref.'" AND ph_ref_id = "'.$id.'" ORDER BY ph_level, ph_date LIMIT 1'; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $path.$list['ph_name'].$list['ph_ext']; } } } function GetImages($cl,$ref,$id,$pathl,$paths,$lng,$nofrst=0,$zoom=true,$size=false) { $Sql = 'SELECT * FROM tblPhotos WHERE ph_ref="'.$ref.'" AND ph_ref_id='.$id.' ORDER BY ph_level, ph_date'; $cnt = countRows($Sql); if ($cnt > 0) { if ($nofrst == 1 && $cnt == 1) { return; } echo '
        '."\n"; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $li=1; $comm=''; if($nofrst==1) { mysql_data_seek($Res, 1); } while($list = mysql_fetch_array($Res)) { $img_l = $pathl.$list['ph_name'].$list['ph_ext']; $img_s = $paths.$list['ph_name'].$list['ph_ext']; if($size==true) { list($width, $height, $type, $attr) = getimagesize($img_s); }else{ $attr = ''; } //$lang == 1 ? $comm = $list['comment'] : $comm = $list['comment_eng'] ; if($zoom==true) { echo '
      1. '."\n"; }else{ echo '
      2. '."\n"; } } echo '
      '."\n"; } } function GetCaption($ref,$id) { $Sql = 'SELECT * FROM tblItemTitles WHERE itm_ref="'.$ref.'" AND itm_ref_id="'.$id.'" '; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $arr = array(); while ($list = mysql_fetch_array($Res)) { $lng = $list['itm_lang']; $arr[$lng] = $list['itm_msg']; } return $arr; } function GetWidgetImages($cl,$ref,$id,$path,$r='',$q=0,$mid='',$url='') { $q==0 ? $lim = '' : $lim = ' LIMIT '.$q; empty($mid) ? $menu = 'mnu='.$mid.'&' : $mid = ''; $Sql = 'SELECT * FROM tblPhotos WHERE ph_ref="'.$ref.'" AND ph_ref_id='.$id.' ORDER BY ph_level, ph_date'.$lim; $cnt = countRows($Sql); if ($cnt > 0) { echo '
        '."\n"; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $li=1; while($list = mysql_fetch_array($Res)) { $img = $path.$list['ph_name'].$list['ph_ext']; if ($li==$r) { $liclass=' class="no_r_marg"'; $li=1; }else{ $liclass='' ; $li++; } if(!empty($url)) { echo ''."\n"; }else{ echo ''."\n"; } } echo '
      '."\n"; } } //-------------------------------------------------------------- FILE STUFFF function GetFileList($cl='',$ref,$id,$path) { $Sql = 'SELECT * FROM tblFiles WHERE fl_ref = "'.$ref.'" AND fl_ref_id = "'.$id.'" ORDER BY fl_level,fl_date'; $cnt = countRows($Sql); if ($cnt > 0) { echo '

      Downloads

      '."\n"; echo '
        '."\n"; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $sw=''; while ($list = mysql_fetch_array($Res)) { $sw == 1 ? $sw = 0 : $sw = 1; $myfile = $list ['fl_name'] . $list ['fl_ext']; if (file_exists($path.$myfile)) { $size = GetFileSize(filesize($path.$myfile)); echo '
      1. '; echo $list ['fl_name']; echo ''.$size.''; echo '
      2. '."\n"; } } echo '
      '."\n"; } } //-------------------------------------------------------------- COMMENT STUFFF function GetComments($add='',$ref,$id) { $Sql = 'SELECT *,DATE_FORMAT(comm_date, "%d.%m.%Y %H:%i") AS cdate FROM tblComments WHERE comm_ref = "'.$ref.'" AND comm_ref_id = "'.$id.'" ORDER BY comm_date DESC'; $cnt = countRows($Sql); $sw = 0; echo ''."\n"; if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } while ($list = mysql_fetch_array($Res)) { $sw == 1 ? $sw = 0 : $sw = 1; echo '
    1. '."\n"; echo ''.$list['cdate'].''.$list['comm_name'].''."\n"; echo '

      '.ShowText($list['comm_msg']).'

      '."\n"; echo '
    2. '."\n"; } } echo ''."\n"; } function GetLastComment($id) { $Sql = 'SELECT *,DATE_FORMAT(comm_date, "%d.%m.%Y %H:%i") AS cdate FROM tblComments WHERE comm_id = "'.$id.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); echo ''.$list['cdate'].''.$list['comm_name'].''."\n"; echo '

      '.ShowText($list['comm_msg']).'

      '."\n"; } function CountComments($ref,$id) { $Sql = 'SELECT comm_id FROM tblComments WHERE comm_ref = "'.$ref.'" AND comm_ref_id = "'.$id.'" '; $cnt = countRows($Sql); return $cnt; } //-------------------------------------------------------------- FUNCTIONS EDIT BAR function AddImg() { echo ''; } function AddFile() { echo ''; } function AddCrop() { echo ''; } function AddSingleImg($get,$id,$url) { echo ''; echo ''; echo ''; } function AddSingleFile($get,$id,$url) { echo ''; echo ''; echo ''; } function EditItem($url,$id) { echo ''; } function DelItem($url,$id) { echo ''; } function AddCropOLD($imgid,$get,$id,$url) { echo ''; echo ''; echo ''; } //-------------------------------------------------------------- ITEM TITLES PER MODULE PER LANGUAGE function GetTitleArray($ref) { $arr = array(); $Sql = 'SELECT * FROM tblItemTitles WHERE itm_ref="'.$ref.'" ORDER BY itm_ref_id, itm_lang'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $oldid = ''; while ($list = mysql_fetch_array($Res)) { $id = $list['itm_ref_id']; if ($oldid != $id) { $arr[$id] = array(); } $arr[$id][$list['itm_lang']] = $list['itm_title']; $oldid = $id; } return $arr; } //------------------------------------- function SetFormTitleFields($arr='',$id,$title='',$s='i') { $Sql = 'SELECT * FROM tblLanguage WHERE lng_active=1 ORDER BY lng_level'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } while ($list = mysql_fetch_array($Res)) { if (!empty($arr)) { $t = $arr[$id][$list['lng_id']]; } !empty($title) ? $n = $title : $n = 'Titel'; echo '<'.$s.'>'. $n .' '.$list['language'] .''."\n"; } } function SetFormTextFields($id='',$ref,$title,$cl) { $Sql = 'SELECT * FROM tblLanguage WHERE lng_active=1 ORDER BY lng_level'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } while ($list = mysql_fetch_array($Res)) { if(!empty($id)) { $msg = showMCE(GetItemMsg($ref,$id,$list['lng_id'])); }else{ $msg = ''; } echo '
    3. '.$title.' '.$list['language'].''; echo '
    4. '."\n"; } } //------------------------------------- function GetItemTitleId($ref,$id,$lng) { $Sql = 'SELECT itm_id FROM tblItemTitles WHERE itm_ref="'.$ref.'" AND itm_ref_id="'.$id.'" AND itm_lang="'.$lng.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['itm_id']; } //------------------------------------- function GetItemTitle($ref,$id,$lng) { $Sql = 'SELECT itm_title FROM tblItemTitles WHERE itm_ref="'.$ref.'" AND itm_ref_id="'.$id.'" AND itm_lang="'.$lng.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['itm_title']; } function GetItemMsg($ref,$id,$lng) { $Sql = 'SELECT itm_msg FROM tblItemTitles WHERE itm_ref="'.$ref.'" AND itm_ref_id="'.$id.'" AND itm_lang="'.$lng.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['itm_msg']; } function GetFullItem($ref,$id,$lng) { $Sql = 'SELECT * FROM tblItemTitles WHERE itm_ref="'.$ref.'" AND itm_ref_id="'.$id.'" AND itm_lang="'.$lng.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list; } //------------------------------------- function UptItemTitle ($ref, $id, $lng, $title) { $itm_id = GetItemTitleId($ref,$id,$lng); if ( $itm_id < 1 ) { $sql = 'INSERT INTO tblItemTitles ( itm_ref, itm_ref_id, itm_lang, itm_title ) VALUES ( "'.$ref.'", "'.$id.'", "'.$lng.'", "'.$title.'" ) '; }else{ $sql = ' UPDATE tblItemTitles SET itm_title = "'.$title.'" WHERE itm_id = "'.$itm_id.'" LIMIT 1 '; } if(!$add = mysql_query($sql)) { SqlError($sql); } } function UptItemMsg ($ref, $id, $lng, $msg) { $itm_id = GetItemTitleId($ref,$id,$lng); if ( $itm_id < 1 ) { $sql = 'INSERT INTO tblItemTitles ( itm_ref, itm_ref_id, itm_lang, itm_msg ) VALUES ( "'.$ref.'", "'.$id.'", "'.$lng.'", "'.$msg.'" ) '; }else{ $sql = ' UPDATE tblItemTitles SET itm_msg = "'.$msg.'" WHERE itm_id = "'.$itm_id.'" LIMIT 1 '; } if(!$add = mysql_query($sql)) { SqlError($sql); } } function DelDateTime ($ref, $id) { $sqldel = 'DELETE FROM tblDateTime WHERE date_ref="'.$ref.'" AND date_ref_id="'. $id .'" '; $del = mysql_query($sqldel); } function InsDateTime ($ref, $id, $when, $time) { $sql = 'INSERT INTO tblDateTime ( date_when, date_time, date_ref, date_ref_id ) VALUES ( "'.$when.'", "'.$time.'", "'.$ref.'", "'.$id.'" ) '; if(!$add = mysql_query($sql)) { SqlError($sql); } } function GetItemDates ($ref, $id, $lng, $date1='', $date2='') { $Sql = "SELECT *,DATE_FORMAT(date_when,'%e/%c/%Y') as dt FROM tblDateTime WHERE date_ref='".$ref."' AND date_ref_id=".$id; !empty($date1) && empty($date2) ? $Sql .= " AND date_when > '".$date1."' " : '' ; !empty($date1) && !empty($date2) ? $Sql .= " AND date_when BETWEEN '".$date1."' AND '".$date2."' " : '' ; $Sql .= " ORDER BY date_when ASC"; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } while($list = mysql_fetch_array($Res)) { $dt = explode('/',$list['dt']); $m = GetMonth($dt[1],$lng); $om != $m ? $d.= $om.', ' : '' ; $d .= $dt[0].' '; $om = $m; } $d.= $m; return substr($d,1); } function GetDateArray ($ref) { $Sql = "SELECT DISTINCT date_when,DATE_FORMAT(date_when,'%e/%c/%Y') as dt FROM tblDateTime WHERE date_ref='".$ref."' ORDER BY date_when"; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $d = ''; while($list = mysql_fetch_array($Res)) { $d .= ",'".$list['dt']."'"; } return substr($d,1); } function DelConnections ($ref1, $id1, $ref2) { $sqldel = 'DELETE FROM tblConnect WHERE con_ref1="'.$ref1.'" AND con_ref_id1="'. $id1 .'" AND con_ref2="'.$ref2.'" '; $del = mysql_query($sqldel); } function InsConnection ($ref1, $id1, $ref2, $id2) { $sql = 'INSERT INTO tblConnect ( con_ref1, con_ref_id1, con_ref2, con_ref_id2 ) VALUES ( "'.$ref1.'", "'.$id1.'", "'.$ref2.'", "'.$id2.'" ) '; if(!$add = mysql_query($sql)) { SqlError($sql); } } function GetParticipants($ref1,$id1,$ref2,$url='',$getid=false) { $Sql = 'SELECT * FROM tblParticipants, tblConnect WHERE prt_id = con_ref_id2 AND con_ref1="'.$ref1.'" AND con_ref_id1="'. $id1 .'" AND con_ref2="'.$ref2.'" ORDER BY prt_name '; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } if($getid==true) { $p=array(); while($list = mysql_fetch_array($Res)) { $p[] = $list['prt_id']; } }else{ $p=''; while($list = mysql_fetch_array($Res)) { if(!empty($url)) { $p .= ''. $list ['prt_name'] .''; }else{ $p .= ', '.$list ['prt_name']; } } empty($url)? $p = substr($p,1) :''; } return $p; } } function getFolder($s) { if($s==1) { $add = 'fld_level, fld_added DESC'; }else{ $add = 'RAND()'; } $Sql = 'SELECT * FROM tblFolder WHERE fld_active=1 ORDER BY '.$add.' LIMIT 1'; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list; } } function DeleteImages($ref,$id,$path_s,$path_m,$path_l) { $SqlImgDel = 'SELECT * FROM tblPhotos WHERE ph_ref="'.$ref.'" AND ph_ref_id="'.$id.'" '; if(!$ResImg = mysql_query($SqlImgDel)) { SqlError($SqlImgDel); } while ( $ListImg = mysql_fetch_array($ResImg) ) { $lg = $path_l . $ListImg['ph_name'] . $ListImg['ph_ext']; $md = $path_m . $ListImg['ph_name'] . $ListImg['ph_ext']; $sm = $path_s . $ListImg['ph_name'] . $ListImg['ph_ext']; //verwijderen van images if (file_exists($lg)) { unlink($lg); } if (file_exists($md)) { unlink($md); } if (file_exists($sm)) { unlink($sm); } } $imgSqlDel = 'DELETE FROM tblPhotos WHERE ph_ref="'.$ref.'" AND ph_ref_id="'.$id.'" '; $boolimage = mysql_query($imgSqlDel); } function GetCompanyEmail() { $Sql = 'SELECT * FROM tblContactPrefs LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['cnt_frm_sendto']; } //-------------------------------------------------------------- ARRANGEMENTEN HOTEL function GetModCodeList($modcode,$adm,$mnu,$lng,$dis,$frm='',$m_id='') { $Sql = 'SELECT * FROM tblMenu, tblModules WHERE m_mod_id=mod_id AND mod_code = "'.$modcode.'"'; $adm == 1 ? '' : $Sql .= ' AND m_user_edit=1'; $Sql .= ' ORDER BY m_level'; $cnt = countRows($Sql); if ($cnt > 0) { $sel = ''; $dis == 1 ? $dis = ' disabled="disabled"' : $dis = '' ; !empty($frm) ? $subm = ' onchange="document.'.$frm.'.submit()"' : $subm = '' ; echo ''."\n"; } } function GetHeadlines($id,$lang,$cl,$chrs) { if (!empty($id)) { $Sql = 'SELECT art_id, art_title FROM tblArticle WHERE lang='.$lang.' AND art_m_id='.$id.' AND art_active=1 ORDER BY art_date DESC, art_level'; $limit > 0 ? $Sql .= ' LIMIT '.$limit : ''; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $cnt = mysql_num_rows($Res); if ($cnt > 0) { !empty($cl) ? $addclass = ' class="'.$cl.'"' : $addclass= ''; echo ''."\n"; while ($list = mysql_fetch_array($Res)){ echo '
    5. '.strcut($list['art_title'],$chrs).' »
    6. '."\n"; } echo ''."\n"; } } } //-------------------------------------------------------------- CATEGORIEN function GetDropListCat( $site=1 , $ref , $itms , $lng , $cat_id='' , $name , $cl, $frm='' , $dis=false , $all='', $active=false) { $Sql = 'SELECT * FROM tblCategories WHERE cat_site = '.$site.' AND cat_ref="'.$ref.'"'; $active==true ? $Sql .= ' AND cat_active=1' : '' ; $Sql .= ' ORDER BY cat_level'; $cnt = countRows($Sql); if ($cnt > 0) { $sel = ''; $dis == 1 ? $dis = ' disabled="disabled"' : $dis = '' ; !empty($frm) ? $subm = ' onchange="document.'.$frm.'.submit()"' : $subm = '' ; echo ''."\n"; } } function GetDropListSubCat( $site=1 , $ref , $itms , $lng , $cat_id='' , $name , $cl, $frm='', $artcnt=false) { $Sql = 'SELECT * FROM tblCategories WHERE cat_site = '.$site.' AND cat_ref="'.$ref.'" AND cat_parent=0 AND cat_active=1 ORDER BY cat_level'; $cnt = countRows($Sql); if ($cnt > 0) { !empty($frm) ? $subm = ' onchange="document.'.$frm.'.submit()"' : $subm = '' ; echo ''."\n"; } } function CountProducts($id,$lng) { $Sql = 'SELECT prod_id FROM tblProducts WHERE prod_cat_id = '.$id.' AND prod_lang="'.$lng.'"'; $cnt = countRows($Sql); return $cnt; } function GetParentCat($id) { $Sql = 'SELECT cat_parent FROM tblCategories WHERE cat_id = '.$id.' LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['cat_parent']; } function GetSubCats($par,$ref,$arr,$lng) { $Sql = 'SELECT * FROM tblCategories WHERE cat_parent = '.$par.' AND cat_ref="'.$ref.'"'; $cnt = countRows($Sql); if ($cnt > 0) { $c = ''; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } while($list = mysql_fetch_array($Res)) { $c .= '| '.$arr[$list['cat_id']][$lng].''."\n"; } return substr($c,1); } } function getFirstCatId( $site=1 , $ref) { $Sql = 'SELECT cat_id FROM tblCategories WHERE cat_site = '.$site.' AND cat_ref="'.$ref.'" ORDER BY cat_level LIMIT 1'; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list['cat_id']; } } function GetDropListPart( $name, $cl, $prts, $mlt=false, $act=false) { $Sql = 'SELECT * FROM tblParticipants'; $act ==true ? $Sql .= ' AND prt_active=1' : '' ; $Sql .= ' ORDER BY prt_name'; $cnt = countRows($Sql); if ($cnt > 0) { $sel = ''; $mlt == true ? $xm = ' multiple="multiple"' : $xm = '' ; echo ''."\n"; } } function NewsDatumTitel($datum,$t,$lng) { $maand = substr($datum,5,2); if($maand < 10) { $maand = substr($maand,1,1);} if($lng==2) { $maanden = array( 1 => "jan","feb","mrch","apr","may","jun","jul","aug","sept","oct","nov","dec"); }else{ $maanden = array( 1 => "jan","feb","mrt","apr","mei","jun","jul","aug","sept","okt","nov","dec"); } $dag = substr($datum,8,2); if ($dag{0} == 0) { $dag = $dag{1}; if($dag<10) $dag = '0'.$dag; } $year = substr($datum,0,4); $datum = $t .' '.$maanden [$maand].' '.$year.''; return $datum; } function GetArticle($id,$lng) { $Sql = 'SELECT * FROM tblArticle WHERE art_m_id = '.$id.' AND lang='.$lng.' AND art_active=1 ORDER BY art_date DESC, art_level LIMIT 1'; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $art = mysql_fetch_array($Res); return $art; } } //---- MAILER FUNCTIONS ------------------------------------------------------------------------------------// function CheckMailerClient($mlr, $umd, $url, $lng) { if (!is_numeric($mlr)) { $lng==1 ? $err = 'Geen geldige waarde. U wordt nu doorverwezen.' : $err = 'Value not permitted. You will be redirected now.' ; alertThis($err); gotoUrl($url); }else{ $Sql = 'SELECT * FROM tblMailer WHERE mlr_id = "'.$mlr.'" AND mlr_usr_md="'.$umd.'" LIMIT 1'; $cnt = countRows($Sql); if ($cnt > 0) { return $mlr; }else{ $lng==1 ? $err = 'Deze mailer hoort niet bij u. U wordt nu doorverwezen.' : $err = 'This mailer is not yours. You will be redirected now.' ; alertThis($err); gotoUrl($url); } } } function cntMailItems($id) { $Sql = 'SELECT * FROM tblMailItems WHERE item_mlr_id = "'.$id.'" '; $cnt = countRows($Sql); return $cnt; } function getMailHead($id,$uid) { if(!empty($id)) { $Sql = 'SELECT * FROM tblMailer WHERE mlr_id = "'.$id.'" AND mlr_usr_id="'.$uid.'" LIMIT 1'; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list; } } } function getMailPrefs($md) { if(!empty($md)) { $Sql = 'SELECT * FROM tblMailPrefs WHERE pr_usr_md = "'.$md.'" LIMIT 1'; $cnt = countRows($Sql); if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list; } } } function CountImg ($ref,$id) { $Sql = 'SELECT * FROM tblPhotos WHERE ph_ref = "'.$ref.'" AND ph_ref_id = "'.$id.'" ORDER BY ph_level, ph_date LIMIT 1'; $cnt = countRows($Sql); return $cnt; } function GetMailerImage($ref,$id,$path,$cl='',$icon,$wrapcl,$type) { if(!empty($id)) { $Sql = 'SELECT * FROM tblPhotos WHERE ph_ref = "'.$ref.'" AND ph_ref_id = "'.$id.'" ORDER BY ph_level, ph_date LIMIT 1'; $cnt = countRows($Sql); !empty($cl) ? $addclass = 'class="'.$cl.'"': $addclass = ''; if ($cnt > 0) { if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); $img = $path.$list['ph_name'].$list['ph_ext']; return ''; } } } function countEmail($mail) { $Sql = 'SELECT subscr_email FROM tblSubscriptions WHERE (subscr_email LIKE "%'.$mail.'%")'; //echo $Sql; $cnt = countRows($Sql); return $cnt; } function ClearEmailAddress($mail) { $mail = trim($mail); return $mail; } function DeleteAddress($mail) { $Sql = 'DELETE FROM tblSubscriptions WHERE (subscr_email LIKE "%'.$mail.'%") LIMIT 1'; $Del= mysql_query($Sql); } //-------------------------------------- FILE UPLOAD CHECKS ----------------------------------- >>>>> function CleanFileName($str) { $n = explode('.',$str); $str = $n[0]; $str = preg_replace('/[^a-zA-Z0-9\-\_\ ]/', '', $str); $str = str_replace(' ','_', $str); return $str . '.' . $n[1]; } function checkFileExt($ft,$fn) { if ($ft == 'application/zip' || $ft == 'application/pdf' || $ft == 'application/msword' || $ft == 'application/vnd.ms-excel' || $ft == 'image/pjpeg' || $ft == 'image/jpg' || $ft == 'image/jpeg' || $ft == 'image/gif' || $ft == 'image/png') { $typecheck1 = true; }else{ $typecheck1 = false; } $ext = strrchr($fn,'.'); $extallowed = array(".zip",".pdf",".doc",".xls",".gif",".jpg",".png",".jpeg"); if (in_array($ext,$extallowed)) { $typecheck2 = true; }else{ $typecheck2 = false; } if ($typecheck1 != true && $typecheck2 != true) { $ERR = '
      - Het bestand is niet van het juiste type. Alleen ZIP, PDF, DOC, XLS, GIF, JPG of PNG files zijn toegestaan.
      '; } return $ERR; } function chFileName ($name,$id) { $n = explode('.',$name); $name = $n[0]; $Sql = 'SELECT fl_id FROM tblFiles WHERE fl_name="'.$name.'" '; $cnt = countRows($Sql); if($cnt>0) { $name = $name . '_' . $id; } return $name; } //------------------------------------------------------------------------------------------------- >>>>> //-------------------------------------- IMAGE UPLOAD FUNCTIONS ----------------------------------- >>>>> //------------------------------------------------------------------------------------------------- >>>>> function GetImgSizes($id) { $Sql = 'SELECT m_img_s_w,m_img_s_h,m_img_m_w,m_img_m_h,m_img_l_w,m_img_l_h FROM tblMenu, tblArticle WHERE m_id=art_m_id AND art_id="'.$id.'" LIMIT 1'; if(!$Res = mysql_query($Sql)) { SqlError($Sql); } $list = mysql_fetch_array($Res); return $list; } function checkImgExt($ft,$picname) { if ($ft == 'image/pjpeg' || $ft == 'image/jpg' || $ft == 'image/jpeg' || $ft == 'image/gif' || $ft == 'image/png') { $typecheck1 = true; }else{ $typecheck1 = false; } $ext = strrchr($picname,'.'); $extallowed = array(".gif",".jpg",".png",".jpeg"); if (in_array($ext,$extallowed)) { $typecheck2 = true; }else{ $typecheck2 = false; } if ($typecheck1 != true && $typecheck2 != true) { $ERR = '
    7. - Het bestand is niet van het juiste type. Alleen GIF JPG of PNG files zijn toegestaan.
    8. '; } return $ERR; } function getExt($file) { $ext = strrchr(strtolower($file),'.'); return $ext; } function checkSize($filesize,$maxsize) { $size = GetFileSize($filesize); $max = GetFileSize($maxsize); if ($filesize > $maxsize) { $ERR .= "
    9. - Het geselecteerde bestand is te groot, nl ".$size.". Max. filesize is ".$max.".
      Selecteer a.u.b een ander bestand
    10. \n"; } return $ERR; } function checkImage ($img,$name) { if(!is_file($img)) { $ERR .= '
    11. New '.$name.' could not be created.
    12. '; } return $ERR; } function chImgName ($name,$id) { $n = explode('.',$name); $name = $n[0]; $Sql = 'SELECT ph_id FROM tblPhotos WHERE ph_name="'.$name.'" '; $cnt = countRows($Sql); if($cnt>0) { $name = $name . '_' . $id; } return $name; } //****************** FOTO RESIZE VIA CROPFUNCTIE ******************\\ function CropImage ($from_x, $from_y, $crop_w, $crop_h, $src, $dir, $name, $ext, $qlt, $r, $max_w) { if ($ext == ".jpg" || $ext == ".jpeg") { $src_img = imagecreatefromjpeg ($src); }elseif ($ext == ".gif") { $src_img = imagecreatefromgif ($src); }elseif ($ext == ".png") { $src_img = imagecreatefrompng ($src); } if ($r > 0) { $src_img = imagerotate($src_img, $r, 0); } // verhoudingen en afmetingen bepalen if( $crop_w > $max_w ) { $scl = $max_w / $crop_w; $dest_h = ceil($crop_h * $scl); $dest_w = $max_w; } else { $dest_w = $crop_w; $dest_h = $crop_h; } // blanco image maken $new_img= imagecreatetruecolor ($dest_w, $dest_h); imagecopyresampled ($new_img, $src_img, 0, 0, $from_x, $from_y, $dest_w, $dest_h, $crop_w, $crop_h); $new_file = $dir . $name . $ext; if ($ext == ".jpg" || $ext == ".jpeg") { imagejpeg($new_img,$new_file,$qlt); }elseif ($ext == ".gif") { imagegif($new_img,$new_file); }elseif ($ext == ".png") { imagepng($new_img,$new_file); } //imagedestroy($photo); //imagedestroy($source); } //****************** FOTO RESIZE MET 1 WAARDE ******************\\ // $maxIMG is nieuwe max waarde voor breedte of hoogte // $imgFILE waar het plaatje van gemaakt wordt, het orgineel dus (bijv $_FILES['image']['tmp_name']) // $imgDIR waar het plaatje naartoe verhuisd als ie gemaakt is // $imgNAME nieuwe naam voor plaatje (bijv. mysql_insert_id () ) // $imgEXT jpg of gif of PNG // $quality getal tussen de 0 en 100 waarbij 100 beste kwaliteit is function createNewImageOne ($maxIMG, $imgFILE, $imgDIR, $imgNAME, $imgEXT, $quality, $degr) { if ($imgEXT == ".jpg" || $imgEXT == ".jpeg") { $photo = imagecreatefromjpeg ($imgFILE); }elseif ($imgEXT == ".gif") { $photo = imagecreatefromgif ($imgFILE); }elseif ($imgEXT == ".png") { $photo = imagecreatefrompng ($imgFILE); } if ($degr>0) { $photo = imagerotate($photo, $degr, 0); } //afmetingen bepalen $photo_width = imagesx($photo); $photo_height = imagesy($photo); if ($photo_width > $maxIMG OR $photo_height > $maxIMG) { if ($photo_width == $photo_height) { $new_width = $maxIMG; $new_height = $maxIMG; } elseif ($photo_width > $photo_height) { $value = $photo_width / $maxIMG; $new_width = $maxIMG; $new_height = round ($photo_height / $value); } else { $value = $photo_height / $maxIMG; $new_height = $maxIMG; $new_width = round ($photo_width / $value); } } else { $new_width = $photo_width; $new_height = $photo_height; } //nieuwe image maken en wegschrijven naar dir $create_blank = imagecreatetruecolor ($new_width, $new_height); imagecopyresampled ($create_blank, $photo, 0, 0, $from_x, $from_y, $new_width, $new_height, $photo_width, $photo_height); $new_filename = $imgDIR . $imgNAME . $imgEXT; if ($imgEXT == ".jpg" || $imgEXT == ".jpeg") { imagejpeg($create_blank,$new_filename,$quality); }elseif ($imgEXT == ".gif") { imagegif($create_blank,$new_filename); }elseif ($imgEXT == ".png") { imagepng($create_blank,$new_filename); } imagedestroy($photo); } //****************** END foto resize met 1 waarde ***************\\ //****************** FOTO RESIZE MET 2 WAARDEN ******************\\ // $breedte is nieuwe breedte // $hoogte is nieuwe hoogte // $imgFILE waar het plaatje van gemaakt wordt, het orgineel dus (bijv $_FILES['image']['tmp_name']) // $imgDIR waar het plaatje naartoe verhuisd als ie gemaakt is // $imgNAME nieuwe naam voor plaatje (bijv. mysql_insert_id () ) // $imgEXT jpg of gif of PNG // $quality getal tussen de 0 en 100 waarbij 100 beste kwaliteit is function createNewImageTwo ($breedte, $hoogte, $imgFILE, $imgDIR, $imgNAME, $imgEXT, $quality, $degr) { if ($imgEXT == ".jpg" || $imgEXT == ".jpeg") { $photo = imagecreatefromjpeg ($imgFILE); }elseif ($imgEXT == ".gif") { $photo = imagecreatefromgif ($imgFILE); }elseif ($imgEXT == ".png") { $photo = imagecreatefrompng ($imgFILE); } if ($degr>0) { $photo = imagerotate($photo, $degr, 0); } //afmetingen bepalen $photo_width = imagesx($photo); $photo_height = imagesy($photo); $new_width = $breedte; $new_height = $hoogte; //als foto te hoog is if (($photo_width/$new_width) < ($photo_height/$new_height)) { $from_y = ceil(($photo_height - ($new_height * $photo_width / $new_width))/2); $from_x = '0'; $photo_y = ceil(($new_height * $photo_width / $new_width)); $photo_x = $photo_width; } //als foto te breed is if (($photo_height/$new_height) < ($photo_width/$new_width)) { $from_x = ceil(($photo_width - ($new_width * $photo_height / $new_height))/2); $from_y = '0'; $photo_x = ceil(($new_width * $photo_height / $new_height)); $photo_y = $photo_height; } //als verhoudingen gelijk zijn if (($photo_width/$new_width) == ($photo_height/$new_height)) { $from_x = ceil(($photo_width - ($new_width * $photo_height / $new_height))/2); $from_y = '0'; $photo_x = ceil(($new_width * $photo_height / $new_height)); $photo_y = $photo_height; } //nieuwe image maken en wegschrijven naar dir $create_blank = imagecreatetruecolor ($new_width, $new_height); imagecopyresampled ($create_blank, $photo, 0, 0, $from_x, $from_y, $new_width, $new_height, $photo_x, $photo_y); $new_filename = $imgDIR . $imgNAME . $imgEXT; if ($imgEXT == ".jpg" || $imgEXT == ".jpeg") { imagejpeg($create_blank,$new_filename,$quality); }elseif ($imgEXT == ".gif") { imagegif($create_blank,$new_filename); }elseif ($imgEXT == ".png") { imagepng($create_blank,$new_filename); } imagedestroy($photo); } //****************** END foto resize met 2 waarden ******************\\ //afkappen text met readmore (gemaakt voor FAST) function ReadMoreText ($str, $lnth, $more, $less) { $rm = '... '.$more.' »'; $rl = '« '.$less.''; $cnt = strlen($str); if ($cnt > $lnth) { $t1 = trim(substr($str, 0, $lnth)) . $rm; $t2 = trim(substr($str, $lnth, $cnt)) . $rl; $str = $t1 . ''. $t2 .''; } return $str; }; function ReadMoreFast ($str, $lnth, $slidelnth, $more, $less) { $cnt = strlen($str); if ($cnt > $lnth) { $cnt < $slidelnth ? $addclass = ' slidedouble' : $addclass = ' slidesquare'; $rm = ' » '.$more.''; $rl = ' « '.$less.''; $t1 = '

      '. $str . $rl .'

      '; $t2 = '

      '.truncate( $str,$lnth ) . $rm .'

      '; $str = ''. $t1 . $t2 .''; }else{ $str = '

      '. $str .'

      '; } return $str; }; /** * Truncates text. * * Cuts a string to the length of $length and replaces the last characters * with the ending if the text is longer than length. * * @param string $text String to truncate. * @param integer $length Length of returned string, including ellipsis. * @param string $ending Ending to be appended to the trimmed string. * @param boolean $exact If false, $text will not be cut mid-word * @param boolean $considerHtml If true, HTML tags would be handled correctly * @return string Trimmed string. */ function Snippet($text, $length = 120, $ending = ' ...', $exact = false, $considerHtml = true) { if ($considerHtml) { // if the plain text is shorter than the maximum length, return the whole text if (strlen(preg_replace('/<.*?>/', '', $text)) <= $length) { return $text; } // splits all html-tags to scanable lines preg_match_all('/(<.+?>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); $total_length = strlen($ending); $open_tags = array(); $truncate = ''; foreach ($lines as $line_matchings) { // if there is any html-tag in this line, handle it and add it (uncounted) to the output if (!empty($line_matchings[1])) { // if it's an "empty element" with or without xhtml-conform closing slash (f.e.
      ) if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { // do nothing // if tag is a closing tag (f.e. ) } else if (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { // delete tag from $open_tags list $pos = array_search($tag_matchings[1], $open_tags); if ($pos !== false) { unset($open_tags[$pos]); } // if tag is an opening tag (f.e. ) } else if (preg_match('/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) { // add tag to the beginning of $open_tags list array_unshift($open_tags, strtolower($tag_matchings[1])); } // add html-tag to $truncate'd text $truncate .= $line_matchings[1]; } // calculate the length of the plain text part of the line; handle entities as one character $content_length = strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); if ($total_length+$content_length> $length) { // the number of characters which are left $left = $length - $total_length; $entities_length = 0; // search for html entities if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) { // calculate the real length of all entities in the legal range foreach ($entities[0] as $entity) { if ($entity[1]+1-$entities_length <= $left) { $left--; $entities_length += strlen($entity[0]); } else { // no more characters left break; } } } $truncate .= substr($line_matchings[2], 0, $left+$entities_length); // maximum lenght is reached, so get off the loop break; } else { $truncate .= $line_matchings[2]; $total_length += $content_length; } // if the maximum length is reached, get off the loop if($total_length>= $length) { break; } } } else { if (strlen($text) <= $length) { return $text; } else { $truncate = substr($text, 0, $length - strlen($ending)); } } // if the words shouldn't be cut in the middle... if (!$exact) { // ...search the last occurance of a space... $spacepos = strrpos($truncate, ' '); if (isset($spacepos)) { // ...and cut the text in this position $truncate = substr($truncate, 0, $spacepos); } } // add the defined ending to the text $truncate .= $ending; if($considerHtml) { // close all unclosed html-tags foreach ($open_tags as $tag) { $truncate .= ''; } } return $truncate; } ?>