1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
<?php
class SpotPage_render extends SpotPage_Abs {
private $_tplname;
private $_params;
function __construct(SpotDb $db, SpotSettings $settings, $currentSession, $tplName, $params) {
parent::__construct($db, $settings, $currentSession);
$this->_tplname = $tplName;
$this->_params = $params;
} # ctor
function sanitizeTplName($tpl) {
$validChars = 'abcdefghijklmnopqrstuvwxyz0123456789';
$newName = '';
for($i = 0; $i < strlen($tpl); $i++) {
if (strpos($validChars, $tpl[$i]) !== false) {
$newName .= $tpl[$i];
} # if
} # for
return $newName;
} # sanitizeTplName
function render() {
# Haal de volledige spotinhoud op
$spotsOverview = new SpotsOverview($this->_db, $this->_settings);
# sanitize the template name
$tplFile = $this->sanitizeTplName($this->_tplname);
#- display stuff -#
if (strlen($tplFile) > 0) {
$this->template($tplFile, $this->_params);
} # if
} # render
} # class SpotPage_render
|