50) { $description = substr($description,0,50)."..."; } return $description; } function f_print_crumbpath($page, $subpage, $divname, $admin) { if($admin) { $adminpath = 'admin/'; } if(isset($page)) { $sql = "SELECT page_id, page_linkname, page_name FROM pages WHERE page_linkname = '".$page."'"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); $total = mysql_num_rows($result); $pagerow = mysql_fetch_assoc($result); if($total > 0) { if(isset($subpage)) { $sql = "SELECT page_linkname, page_name FROM pages WHERE page_linkname = '".$subpage."' AND page_subpageof = '".$pagerow['page_id']."'"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); $total = mysql_num_rows($result); $subpagerow = mysql_fetch_assoc($result); $path .= ' > '.$pagerow['page_name'].' > '.$subpagerow['page_name']; } else { $path .= ' > '.$pagerow['page_name']; } $crumbpath = '
'; $crumbpath .= ''.$_SERVER['SERVER_NAME'].''; $crumbpath .= $path; $crumbpath .= '
'; } } print($crumbpath); } function f_print_menu($currentpage) { $sql = "SELECT page_linkname, page_name FROM pages WHERE page_inmenu = '1' AND page_subpageof = '0' ORDER BY page_order"; $result = mysql_query($sql) or die("Error: ".mysql_error()); $menu = ''; while ($row = mysql_fetch_assoc($result)) { $activepageclass = ''; if ($currentpage == $row['page_linkname']) { $activepageclass='class="active"'; } $menu .= '
  • '.$row['page_name'].'
  • '; } print(""); } function f_print_submenu($currentpage, $currentsubpage) { $sql = "SELECT page_id FROM pages WHERE page_linkname = '".$currentpage."'"; $result = mysql_query($sql) or die("Error: ".mysql_error()); $pageid = mysql_fetch_assoc($result); $total = mysql_num_rows($result); if($total > 0) { $sql = "SELECT * FROM pages WHERE page_subpageof = '".$pageid['page_id']."' ORDER BY page_order"; $result = mysql_query($sql) or die("Error: ".mysql_error()); $submenu = ''; while ($row = mysql_fetch_assoc($result)) { $activesubpageid = ''; if ($currentsubpage == $row['page_linkname']) { $activesubpageid = 'id="current"'; } $submenu .= '
  • '.$row['page_name'].'
  • '; } if($submenu) { print(''); } } } function f_print_dropdownmenu($page, $subpage) { $sql = "SELECT * FROM pages WHERE page_inmenu = '1' AND page_subpageof = '0' ORDER BY page_order"; $result = mysql_query($sql) or die ("ERROR: ".mysql_error()); $menuitem = 1; $submenuitem = 0; $activepage = $_GET['page']; $activesubpage = $_GET['sub']; while ($row = mysql_fetch_assoc($result)){ $activepageclass = ''; $pijltje = ''; $subpageUL = ''; $sql = "SELECT * FROM pages WHERE page_subpageof = '".$row['page_id']."' ORDER BY page_order"; $resultaat = mysql_query($sql) or die ("Error: " .mysql_error()); $total = mysql_num_rows($resultaat); if($total > 0) { $Teller = 0; $class = 'firstsub '; $subpageUL .= ''; } if ($activepage == $row['page_linkname']) { $activepageclass='class="active"'; $pijltje = '
    '; } echo ''; } } function f_print_title_metatags($firstpage, $page, $subpage, $view) { $enable_slogan = 1; $seperator = " - "; $title = ""; $keywords = ""; $description = ""; if($subpage) { $sql = "SELECT page_name FROM pages WHERE page_linkname = '".$subpage."'"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); $subpagerow = mysql_fetch_assoc($result); $title = $subpagerow['page_name'].$seperator; } else if($view) { $title = $view.$seperator; } $sql = "SELECT page_name FROM pages WHERE page_linkname = '".$page."'"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); $pagerow = mysql_fetch_assoc($result); $title .= $pagerow['page_name'].$seperator; $sql = "SELECT * FROM siteinfo"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); if($row = mysql_fetch_assoc($result)) { if($page == $firstpage) { $title = $row['site_company']; } else { $title .= $row['site_company']; } if($enable_slogan == 1) { $title .= ' '.$row['site_slogan']; } $keywords = $row['site_keywords']; $description = $row['site_description']; } $Metatags .= ''.$title.' '; print($Metatags); } function f_print_stylesheets() { $stylesheets .= f_getModuleCSS(); $stylesheets .= ''; $stylesheets .= ''; $stylesheets .= ''; $stylesheets .= ''; print($stylesheets); } function f_print_alljavascripts($page, $subpage){ $sql = "SELECT module_name FROM modules WHERE module_used = '1' AND module_name <> 'googletool'"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); while ($row = mysql_fetch_assoc($result)) { $dir = "modules/".$row['module_name']."/front/js"; $AllJavascripts .= f_opendir_and_checkfor($dir,'js'); } $sql = "SELECT page_linkname FROM pages LEFT JOIN modules ON page_module = module_id WHERE module_name = 'googletool'"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); $total = mysql_num_rows($result); $row = mysql_fetch_assoc($result); if($total == 1 && $page == $row['page_linkname'] && $_GET['subpage'] == '') { $dir = "modules/googletool/front/js"; $AllJavascripts .= ''; $AllJavascripts .= ''; $AllJavascripts .= f_opendir_and_checkfor($dir,'js'); } $dir = 'js'; $AllJavascripts .= f_opendir_and_checkfor($dir,'js'); print($AllJavascripts); } function f_opendir_and_checkfor($dir,$extention) { if(is_dir($dir)) { $files_in_dir = array(); $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { array_push($files_in_dir,$filename); } $arraylength = count($files_in_dir); sort($files_in_dir); for($i=0; $i<=$arraylength; $i++) { $fileextension = substr(strrchr($files_in_dir[$i], '.'), 1); if($fileextension == $extention ) { if($extention == 'js') { $ThisFile .= ''; } } } } return $ThisFile; } function f_print_text($firstpage) { // Voorkomen van database injectie $sql = "SELECT page_linkname FROM pages"; $result = mysql_query($sql) or die ("ERROR: ".mysql_error()); $pagelinkname_array = array(); while($row = mysql_fetch_assoc($result)) { array_push($pagelinkname_array, $row['page_linkname']); } $error .= '

    Deze pagina lijkt niet te bestaan.
    '; $error .= 'Je wordt teruggebracht naar de pagina van binnenkomst.

    '; $error .= ''; if(isset($_GET['page'])) { if(in_array($_GET['page'], $pagelinkname_array)) { $query = "SELECT page_id, page_name, page_content, page_module FROM pages WHERE page_linkname = '".$_GET['page']."' LIMIT 1"; $queryresult = mysql_query($query) or die ("ERROR: ".mysql_error()); $total = mysql_num_rows($queryresult); while ($pages = mysql_fetch_assoc($queryresult)) { if (isset($_GET['sub'])) { if(in_array($_GET['sub'], $pagelinkname_array)) { $sql = "SELECT page_name, page_content, page_module FROM pages WHERE page_linkname = '".$_GET['sub']."' AND page_subpageof = '".$pages['page_id']."' LIMIT 1"; $result = mysql_query($sql) or die ("Error ".mysql_query()); $total = mysql_num_rows($result); $subpages = mysql_fetch_assoc($result); if($total > 0) { // $content .= '

    '.$subpages['page_name'].'

    '; if ($subpages['page_module'] != '0') { $content .= f_add_module($subpages['page_module'],$subpages['page_name'],$subpages['page_content'],''); } else { $content .= stripslashes($subpages['page_content']); } } else { $doesnt_exist = true; } } else { $doesnt_exist = true; } } else { if ($pages['page_module'] != '0') { $content .= f_add_module($pages['page_module'],$pages['page_name'],$pages['page_content'],''); } else { // $content .= '

    '.$pages['page_name'].'

    '; $content .= stripslashes($pages['page_content']); } } } } else { switch($_GET['page']){ case 'logout': unset($_SESSION["toegang"]); unset($_SESSION["beheer"]); unset($_SESSION["admin"]); unset($_SESSION["lid"]); unset($_SESSION["naam"]); header ("Location: ".$firstpage); break; case 'login': header("Location: login.php"); break; } $doesnt_exist = true; } } if($doesnt_exist == true) { print($error); } else { print($content); } } function f_add_module($moduleid,$pagename,$pagecontent,$admin) { $AddToPath = ''; $AddToFilename = ''; $Side = 'front'; $sql = "SELECT module_id, module_name, module_showpagecontent FROM modules WHERE module_used = 1 AND module_id = '".$moduleid."' LIMIT 1"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); $total = mysql_num_rows($result); $row = mysql_fetch_assoc($result); if($admin == 'admin') { $AddToPath = '../'; $AddToFilename = 'beheer'; $Side = 'admin'; } $path = $AddToPath."modules/".$row['module_name']."/".$Side."/".$row['module_name'].$AddToFilename.".php"; if($row['module_showpagecontent'] == '1') { if($admin == 'admin') { $modulecontent = f_print_texteditor(stripslashes($pagecontent),''); } else { $modulecontent .= stripslashes($pagecontent); } } if(file_exists($path)) { ob_start(); include($path); $modulecontent .= ob_get_clean(); } else { $modulecontent .= 'De module lijkt niet geinstalleerd te zijn, neem contact op met Team3D om dit probleem te verhelpen.'; } return $modulecontent; } function strip_html_tags($text) { $text = preg_replace( array( '@]*?>.*?@siu', '@]*?>.*?@siu', '@]*?.*?@siu', '@]*?.*?@siu', '@]*?.*?@siu', '@]*?.*?@siu', '@]*?.*?@siu', '@]*?.*?@siu', '@]*?.*?@siu', '@@siu', '@'.$linktext.''; } if(strlen($text) > $number) { return substr(($text=wordwrap($text,$number,'$$$')),0,strpos($text,'$$$')).'... '.$link; } else { return $text; } } function f_print_sidemodules($currentpage, $admin) { $sql = "SELECT page_id FROM pages WHERE page_linkname = '".$currentpage."'"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); $pageid = mysql_fetch_assoc($result); $sql = "SELECT module_visiblesidebar, module_name FROM modules WHERE module_visiblesidebar <> '0' ORDER BY module_order"; $sidemoduleresult = mysql_query($sql) or die ("Error: ".mysql_error()); $total = mysql_num_rows($sidemoduleresult); $ModuleFolder = 'front/'; if($admin == 'admin') { $PathUp = '../'; $ModuleFolder = 'admin/'; } if($total > 0) { while($row = mysql_fetch_array($sidemoduleresult)) { $sidemodule_content .= '
    '; $array = explode(",", $row['module_visiblesidebar']); if((in_array($pageid['page_id'], $array)) or (in_array("all", $array))) { $path = $PathUp.'modules/'.$row['module_name'].'/'.$ModuleFolder.$row['module_name'].'-sidebar.php'; if(file_exists($path)) { ob_start(); include($path); $includefile = ob_get_clean(); } else { $sidemodule_content .= '
    De zijmodule "'.$row['module_name'].'" lijkt niet te bestaan.'; } } $sidemodule_content .= $includefile; $sidemodule_content .= '
    '; } } echo $sidemodule_content; } function f_getModuleCSS() { $sql = "SELECT module_name FROM modules WHERE module_used = 1 AND module_available = 1"; $result = mysql_query($sql) or die ("Error: ".mysql_error()); while($row = mysql_fetch_assoc($result)) { $path = 'modules/'.$row['module_name'].'/style/style.css'; if(file_exists($path)) { $ModuleCSS .= '\n'; } } return $ModuleCSS; } function CreateFolderStructure($FolderPath) { $SuccessFeedback = 'De mapstructuur "'.$FolderPath.'" is aangemaakt!'; $Folders = explode('/', $FolderPath); $NrFolders = count($Folders); for($i=0; $i<$NrFolders; $i++) { if($Folders[$i] != '..' && $Folders[$i] != '.') { $CreateFolder .= $Folders[$i].'/'; if(!is_dir($UpFolder.$CreateFolder)) { $old_umask = umask(0); $permission = mkdir($UpFolder.$CreateFolder, 0777); umask($old_mask); } } else { $UpFolder .= $Folders[$i].'/'; } } if(is_dir($FolderPath)) { return $SuccessFeedback; } } function RandomImage($PathToImages, $ViewedImages) { if(!is_dir($PathToImages)) { CreateFolderStructure($PathToImages); } if(is_dir($PathToImages)) { $FolderFiles = array(); $AllImages = array(); $OpenDir = opendir($PathToImages); while (false !== ($Filename = readdir($OpenDir))) { array_push($FolderFiles,$Filename); } closedir($OpenDir); $NrOfFiles = count($FolderFiles); if($NrOfFiles > 2) { $AllowedIMGs = array('jpg','jpeg','gif','png','bmp','tiff'); foreach ($FolderFiles as $File) { $Extention = strtolower(substr(strrchr($File, '.'), 1)); $PathToImage = $PathToImages.$File; if(in_array($Extention,$AllowedIMGs)) { list($imagetype) = getimagesize($PathToImage); if($imagetype) { array_push($AllImages, $PathToImage); } } } $NrImages = count($AllImages); if($NrImages > 0) { shuffle($AllImages); $RandomizedImages .= '

    Aanbiedingen

    '; for($i=0; $i<$ViewedImages; $i++) { $RandomizedImages .= ''; } } } } echo $RandomizedImages; } function f_print_aanbieding($UpFolder) { $ImgDir = $UpFolder.'uploads/images/'; $FilesDir = $UpFolder.'uploads/files/'; $TargetImg = 'aanbieding.jpg'; $TargetFile = 'aanbieding.pdf'; if(file_exists($ImgDir.$TargetImg) && file_exists($FilesDir.$TargetFile)) { $Aanbieding .= '

    Aanbiedingen

    '; $Aanbieding .= ''; } echo $Aanbieding; } function f_add_p($Text) { $BeginP = substr($Text,0,2); $EndP = substr($Text,-4,4); if($BeginP != 'Error: Access denied for user ''@'localhost' (using password: NO)