MYSQL ERROR:

' . mysql_error() . '

QUERY:

' . nl2br( $q ) . '

' ); return $data; } function slugify($str = '') { $s = array("&", "\"", "'"); $r = array("en", "", ""); $str = str_replace($s, $r, $str); $str = preg_replace("/(&)([a-z])([a-z]+;)/i", "$2", htmlentities($str, ENT_COMPAT, 'UTF-8')); return trim(preg_replace('~[^-a-z0-9_.]+~', '-', strtolower($str))); } $vars = parse_url($_SERVER['REQUEST_URI']); //var_export($vars); /* cache */ $uri = strtolower( $vars['path'] ); $cfile = 'cache/' . slugify($uri) . '.html'; if( strtolower( $_SERVER['REQUEST_METHOD'] ) !='post' && is_file( $cfile ) ){ readfile( $cfile ); echo "\n"; exit; } /* NO CACHE, CONNECT TO DB AND FETCH PAGE */ include( 'inc/dbconnect.php' ); $urlvars = explode( '/', $uri ); //var_export($urlvars); /* de eerste url variabele is tevens de taal */ $lang = mysql_real_escape_string($urlvars[1]); $q = "SELECT id, url FROM " . $GLOBALS['dbprefix'] . "_pages WHERE dbparent=0 AND url='" . $lang . "' AND status=1;"; $checklang = query( $q ); if( mysql_num_rows( $checklang ) == 0 ){ include_once( 'inc/404.php' ); exit; } else { $tmp = mysql_fetch_assoc( $checklang ); $masterid = $tmp['id']; $masterurl = "/" . $tmp['url']; $toroot[$tmp['id']] = $masterurl; unset( $tmp ); } $requestvars = array(); foreach( $_REQUEST as $k=>$v ){ if( substr( $k,0,5 ) != "__utm" && $k!='PHPSESSID' ){ $requestvars[] = "$k=$v"; } } /* globals */ $currentid = $masterid; $fullurl = '/' . $lang; $isvalid = 1; $children = array(); /* check Url */ for( $validurlvars=2; $validurlvars= 1;"; $tmprow = mysql_fetch_assoc( query( $q ) ); } if( $isvalid==1 && $tmprow['id'] > 0 ){ $currentid = $tmprow['id']; $fullurl .= '/' . $tmprow['url']; $toroot[$tmprow['id']] = $fullurl; $children[] = $tmprow['id']; } else { //break; $requestvars[] = mysql_real_escape_string($urlvars[$validurlvars]); $isvalid = 0; } unset( $tmprow ); } /* 404 - geen pagina gevonden */ if( $currentid == 0 ){ include_once( 'inc/404.php' ); exit; } else { $q = " SELECT p.id AS id, p.sortid AS sortid, p.mediaID AS mediaID, p.subpages AS dbtype, p.cache as cache, p.dbparent AS dbparent, p.title AS title, p.name AS name, p.metakeywords AS metakeywords, p.metadescription AS metadescription, p.head AS head, p.content AS content, t.content AS tcontent FROM " . $GLOBALS['dbprefix'] . "_pages AS p LEFT JOIN " . $GLOBALS['dbprefix'] . "_templates AS t ON ( p.template = t.id ) WHERE p.id='" . $currentid . "' AND p.status >= 1 "; } $row = mysql_fetch_assoc( query( $q ) ); $content = $row['content']; $template = $row['tcontent']; function nav(){ global $GLOBALS, $toroot, $masterid, $masterurl; $str = ''; $q = "SELECT id,name,url FROM " . $GLOBALS['dbprefix'] . "_pages WHERE dbparent='" . $masterid . "' AND status=1 ORDER BY sortid ASC;"; $data = query( $q ); if( mysql_num_rows( $data )>0 ){ while( $r = mysql_fetch_assoc( $data ) ){ $str .= ' ' . $r['name'] . ''; } } return $str; } function langnav(){ global $GLOBALS, $toroot; $str = ''; $q = "SELECT id,name,url FROM " . $GLOBALS['dbprefix'] . "_pages WHERE dbparent=0 AND status=1 ORDER BY sortid ASC;"; $data = query( $q ); if( mysql_num_rows( $data )>0 ){ while( $r = mysql_fetch_assoc( $data ) ){ $str .= ' '; } } return $str; } function subnav( ){ global $GLOBALS, $toroot, $children; if( count( $children ) == 0 ){ return; } $q = "SELECT id,name,url FROM " . $GLOBALS['dbprefix'] . "_pages WHERE dbparent=" . $children[0] . " AND status=1 ORDER BY sortid ASC;"; $data = query( $q ); if( mysql_num_rows( $data )>0 ){ $str = ''; $parent = cmslink( $children[0] ); while( $r = mysql_fetch_assoc( $data ) ){ $str .= ' '; } $str .= '
' . $r['name'] . '
'; } return $str; } function redir( $newurl='/' ){ @mysql_close(); header( 'Location: ' . $newurl ); exit; } /* dynamisch links aanmaken op ID */ function cmslink( $id ){ global $GLOBALS; $url = ''; $q = "SELECT dbparent, url FROM " . $GLOBALS['dbprefix'] . "_pages WHERE id = '" . $id . "' ;"; $tmprow = mysql_fetch_assoc( query( $q ) ); $url = '/' . $tmprow['url']; while( $tmprow['dbparent'] > 0 ){ $q = "SELECT dbparent, url FROM " . $GLOBALS['dbprefix'] . "_pages WHERE id = '" . $tmprow['dbparent'] . "' ;"; $tmprow = mysql_fetch_assoc( query( $q ) ); $url = '/' . $tmprow['url'] . $url; } return $url; } function media( $id=0 ){ global $GLOBALS, $row; $q = "SELECT * FROM " . $GLOBALS['dbprefix'] . "_media WHERE parentid = '" . $id . "' OR parentid=( SELECT mediaID FROM " . $GLOBALS['dbprefix'] . "_pages WHERE id='" . $id . "' ) ORDER BY mtype='jpg' DESC, mtype='flv' DESC, mtype='pdf' DESC, datum ASC LIMIT 0,1;"; $data = query( $q ); if( mysql_num_rows( $data ) > 0 ){ $r = mysql_fetch_assoc( $data ); $str = ' '; return $str; } else { return ''; } } function medianav( $id=0 ){ global $GLOBALS; $q = "SELECT * FROM " . $GLOBALS['dbprefix'] . "_media WHERE parentid = '" . $id . "' OR parentid=( SELECT mediaID FROM " . $GLOBALS['dbprefix'] . "_pages WHERE id='" . $id . "' ) ORDER BY mtype='jpg' DESC, mtype='flv' DESC, mtype='pdf' DESC, datum ASC;"; $data = query( $q ); if( mysql_num_rows( $data ) > 1 ){ $ico = array( 'jpg' => 'page_white_camera.png', 'flv' => '►', 'pdf' => 'pdf'); $str = ''; $i=0; while( $r = mysql_fetch_assoc( $data ) ){ $i++; $str .= '' . ( $r['mtype']=='jpg' ? $i : $ico[$r['mtype']] ) . ''; } return $str; } else { return ''; } } function media4google( $id=0 ){ global $GLOBALS, $row; $str = ''; $q = "SELECT * FROM " . $GLOBALS['dbprefix'] . "_media WHERE parentid = '" . $id . "' OR parentid=( SELECT mediaID FROM " . $GLOBALS['dbprefix'] . "_pages WHERE id='" . $id . "' ) AND mtype='jpg';"; $data = query( $q ); if( mysql_num_rows( $data ) > 0 ){ $str .= '

Afbeeldingen bij dit project:

'; while( $r = mysql_fetch_assoc( $data ) ) { $str .= ' rondaywinkelaar: ' . htmlentities( $r['descr'] ) . ''; } $str .= '

'; } return $str; } function lbl( $k=NULL ){ global $lang; $data = array( 'nl' => array( 'overzicht' => 'Overzicht' ), 'en' => array( 'overzicht' => 'Summary' )); return $data[$lang][$k] ? $data[$lang][$k] : '--UNKNOWN--'; } function projectspecs( $id ){ global $GLOBALS; $q = "SELECT * FROM " . $GLOBALS['dbprefix'] . "_producttypevalues AS a LEFT JOIN " . $GLOBALS['dbprefix'] . "_producttypes AS b ON a.type_id=b.id WHERE a.page_id=" . $id . ";"; $data = query( $q ); if( mysql_num_rows( $data )==0 ){ return; } else { $str = ' '; return $str; } } function prevpage(){ global $GLOBALS, $row; $q = "SELECT name, id FROM " . $GLOBALS['dbprefix'] . "_pages WHERE dbparent=" . $row['dbparent'] . " AND status>0 AND sortid<" . $row['sortid'] . " ORDER BY sortid DESC LIMIT 0,1"; $r = query( $q ); if( mysql_num_rows( $r )==1 ){ $t = mysql_fetch_assoc( $r ); return '>'; } else { return '>'; } } function nextpage(){ global $GLOBALS, $row; $q = "SELECT name, id FROM " . $GLOBALS['dbprefix'] . "_pages WHERE dbparent=" . $row['dbparent'] . " AND status>0 AND sortid>" . $row['sortid'] . " ORDER BY sortid ASC LIMIT 0,1"; $r = query( $q ); if( mysql_num_rows( $r )==1 ){ $t = mysql_fetch_assoc( $r ); return '<'; } else { return '<'; } } function parentlink(){ global $GLOBALS, $row; return cmslink( $row['dbparent'] ); } /* vervang dynamische content als de corresponderende functie bestaat (in index of include)*/ function vervangDyn( $arr ){ if( function_exists( $arr[1] ) ){ return $arr[1]( $arr[2] ); } else { return $arr[1] . " = " . $arr[2]; } } /* module include*/ if( file_exists( 'inc/module/' . $GLOBALS['siteprefix'] . '_' . $row['id'] . '.php' ) ){ include( 'inc/module/' . $GLOBALS['siteprefix'] . '_' . $row['id'] . '.php' ); } /* vervang standaard template velden*/ $ts = array( '#\[TITLE\]#', '#\[NAME\]#', '#\[DESCRIPTION\]#', '#\[KEYWORDS\]#', '#\[HEAD\]#', '#\[LANG\]#', '#\[LANGNAV\]#', '#\[NAV\]#', '#\[SUBNAV\]#', '#\[MEDIANAV\]#', '#\[MEDIA\]#', '#\[MEDIA4GOOGLE\]#', '#\[CONTENT\]#', '#\[MASTER\]#', '#\[MASTERURL\]#', '#\[URL\]#', '#\[PREVPAGE\]#', '#\[NEXTPAGE\]#', '#\[PROJECTSPECS\]#' ); $tr = array( $row['title'], $row['name'], $row['metadescription'], $row['metakeywords'], $row['head'], $lang, langnav(), nav( $masterid, $masterurl ), subnav( ), medianav( $currentid ), media( $currentid ), media4google( $currentid ), $content, $masterid, $masterurl, $fullurl, prevpage(), nextpage(), projectspecs( $currentid ) ); $template = preg_replace( $ts, $tr, $template ); /* vervang dynamische content */ $template = preg_replace_callback( "#\[(\w*?):(.*?)\]#", 'vervangDyn', $template ); /* verwerktijd */ if( !isset( $notags ) ){ $template .= "\n".''."\n".''; } /* schrijf cache */ if( $row['cache']==1 && $_SERVER['REQUEST_METHOD']!='POST' ){ $file = @fopen( $cfile, "wb" ); @fwrite( $file, $template ); @fclose ( $file ); } /* sluit db-connectie*/ if( $GLOBALS['mysql_persistent']!=1 ){ mysql_close(); } /* output naar browser*/ echo $template; exit; ?>