forked from unl/phpunltemplates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.php
More file actions
47 lines (42 loc) · 1.5 KB
/
Copy pathserver.php
File metadata and controls
47 lines (42 loc) · 1.5 KB
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
39
40
41
42
43
44
45
46
47
<?php
if (file_exists(dirname(__FILE__).'/data/tpl_cache')) {
$tpl_dir = dirname(__FILE__).'/data/tpl_cache';
} else {
$tpl_dir = '/usr/share/pear/data/UNL_Templates/data/tpl_cache';
}
$version = 3;
$default_template = 'Fixed.tpl';
if (isset($_GET['version'])) {
$version = $_GET['version'];
if (!is_numeric($version)) {
throw new Exception('Invalid version number passed.');
}
}
if (isset($_GET['template'])
&& strpos($_GET['template'],'/') === false) {
if (isset($_GET['full'])) {
require_once 'UNL/Templates.php';
UNL_Templates::$options['version'] = $version;
$p = UNL_Templates::factory(str_replace('.tpl', '', $_GET['template']));
$p->maincontentarea = '';
$p->leftRandomPromo = '';
$p->footercontent = '';
$p->navlinks = '';
$p->breadcrumbs = '';
$p->titlegraphic = '';
$p->doctitle = '<title></title>';
echo $p->toHtml();
} else {
// Replace 3.1 with 3x1
$version = str_replace('.', 'x', $version);
$dwt = $tpl_dir.'/Version'.$version.'/'.$_GET['template'];
if (file_exists($dwt)) {
echo file_get_contents($dwt);
} elseif (file_exists($tpl_dir.'/Version'.$version.'/'.$default_template)) {
echo file_get_contents($tpl_dir.'/Version'.$version.'/'.$default_template);
} else {
header('HTTP/1.0 404 Not Found');
echo 'Sorry could not load the template files!';
}
}
}