File: SpotPage_render.php

package info (click to toggle)
spotweb 20130826%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,132 kB
  • ctags: 11,281
  • sloc: php: 31,367; xml: 1,009; sh: 148; makefile: 83
file content (38 lines) | stat: -rwxr-xr-x 1,003 bytes parent folder | download | duplicates (2)
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