sql = $GLOBALS['sql']; $this->link = (isset($_REQUEST['link']) && !empty($_REQUEST['link']))?$_REQUEST['link']:'home'; $this->taal = array(); $this->inhoud = array(); $this->galleries = array(); $this->getTaal(); $this->getPage(); $this->getGalleries(); } protected function getTaal(){ $this->sql->execute('SELECT * FROM `talen` WHERE `ta_afkorting` = "'. LANG .'"'); if($this->sql->numrows == 1){ $this->sql->results(); $this->taal = $this->sql->data[0]; }else{ header( 'Status: 404' ); exit(0); } } public function __get($name){ switch($name){ case 'paginaID': $return = $this->inhoud['paginaID']; break; case 'koptitel': $return = $this->inhoud['pc_koptitel']; break; case 'kern': $return = $this->editKern(); break; case 'link': $return = $this->inhoud['pc_link']; break; case 'metatags': $return = $this->createMetatags(); break; case 'taal': $return = $this->taal['ta_afkorting']; break; case 'galleries': $return = implode('', $this->galleries); break; case 'javascripts': $return = $this->getJavascripts(); break; case 'stylesheets': $return = $this->getStylesheets(); break; default: $return = 'Bestaat niet.'; break; } return(stripslashes($return)); } protected function getPage() { $this->sql->execute('SELECT * FROM `pagina_content` INNER JOIN `paginas` ON (`paginaID` = `pc_paginaID`) WHERE `pc_publiceren` = 1 AND `pc_link` = "'. $this->link .'" AND `pc_taalID` = '. (int)$this->taal['taalID'] .' AND `pa_actief` = 1 AND `pa_publiceren` = 1 LIMIT 1;'); if($this->sql->numrows == 1){ $this->sql->results(); $this->inhoud = $this->sql->data[0]; $this->checkPageType(); }else{ header("HTTP/1.0 404 Not Found"); header("Location: ErrorDocument 404"); exit(0); } } protected function checkPageType(){ switch($this->inhoud['pa_type']){ case 'nieuws': case 'gastenboek': $artikelen = new Artikelen($this->inhoud['pa_type'], $this->taal['taalID']); $artikelen->getMessages(); $this->inhoud['pc_koptitel'] = $artikelen->koptitel; $this->inhoud['pc_kern'] .= $artikelen->kern; break; } } protected function createMetatags(){ return (sprintf(' ', /* 1 */ stripslashes($this->inhoud['pc_keywords']), /* 2 */ stripslashes($this->inhoud['pc_description']), /* 3 */ $this->taal['ta_afkorting'])); } protected function getJavascripts(){ $return = ''; if(!empty($this->inhoud['pa_javascript'])){ $scripts = explode(';', $this->inhoud['pa_javascript']); foreach($scripts as $script){ switch($script){ case 'googleMaps': $return .= ''; break; } $return .= sprintf('', /* 1 */ $script); } } return ($return); } protected function getStylesheets(){ $return = ''; if(!empty($this->inhoud['pa_stylesheets'])){ $sheets = explode(';', $this->inhoud['pa_javascript']); foreach($sheets as $sheet){ $return .= sprintf('', /* 1 */ $sheet); } } return ($return); } protected function editKern($toevoeging=''){ $kern = str_replace('Les Fouillarjoux', 'Les Fouillarjoux', $this->inhoud['pc_kern']); return($kern); } protected function getGalleries(){ //$this->inhoud['pa_galleries'] = '1|2'; if(!empty($this->inhoud['pa_galleries'])){ $galleries = explode('|', $this->inhoud['pa_galleries']); foreach($galleries as $i => $galleryID){ $this->getGallery($galleryID, $i+1); } } } protected function getGallery($galleryID, $frame){ $gallery = ''; $this->sql->execute('SELECT * FROM `gallery_images` WHERE `gi_galleryID` = '. (int)$galleryID .' AND `gi_actief` = 1 ORDER BY RAND()'); $numrows = $this->sql->numrows; if($numrows > 0){ $this->sql->results(); foreach($this->sql->data as $i => $image){ if($i == 0){ $gallery .= sprintf('
Klik om meer foto\'s te bekijken
%5$s
', /* 1 */ sprintf('%03d', (int)$image['gi_galleryID']), /* 2 */ stripslashes($image['gi_bestand']), /* 3 */ $i+1, /* 4 */ '', // Titel /* 5 */ '', // Omschrijving /* 6 */ (int)$frame); }else{ $gallery .= sprintf('
%5$s
', /* 1 */ sprintf('%03d', (int)$image['gi_galleryID']), /* 2 */ stripslashes($image['gi_bestand']), /* 3 */ $i+1, /* 4 */ '', // Titel /* 5 */ ''); // Omschrijving } } } array_push($this->galleries, $gallery); } } ?>