1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package templates
|
6
|
* @author Ryan Djurovich, WebsiteBaker Project
|
7
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
8
|
* @link http://www.websitebaker2.org/
|
9
|
* @license http://www.gnu.org/licenses/gpl.html
|
10
|
* @platform WebsiteBaker 2.8.x
|
11
|
* @requirements PHP 5.2.2 and higher
|
12
|
* @version $Id: details.php 1643 2012-03-22 15:30:03Z darkviper $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/templates/details.php $
|
14
|
* @lastmodified $Date: 2012-03-22 16:30:03 +0100 (Thu, 22 Mar 2012) $
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
// Include the config file
|
19
|
require('../../config.php');
|
20
|
require_once(WB_PATH .'/framework/functions.php');
|
21
|
require_once(WB_PATH.'/framework/class.admin.php');
|
22
|
// suppress to print the header, so no new FTAN will be set
|
23
|
$admin = new admin('Addons', 'templates_view', false);
|
24
|
if( !$admin->checkFTAN() )
|
25
|
{
|
26
|
$admin->print_header();
|
27
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
28
|
}
|
29
|
|
30
|
// Get template name
|
31
|
if(!isset($_POST['file']) OR $_POST['file'] == "") {
|
32
|
header("Location: index.php");
|
33
|
exit(0);
|
34
|
} else {
|
35
|
$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']); // fix secunia 2010-92-2
|
36
|
}
|
37
|
|
38
|
// Check if the template exists
|
39
|
if(!file_exists(WB_PATH.'/templates/'.$file)) {
|
40
|
header("Location: index.php");
|
41
|
exit(0);
|
42
|
}
|
43
|
|
44
|
// Print admin header
|
45
|
$admin = new admin('Addons', 'templates_view');
|
46
|
|
47
|
// Setup template object, parse vars to it, then parse it
|
48
|
// Create new template object
|
49
|
$template = new Template(dirname($admin->correct_theme_source('templates_details.htt')));
|
50
|
// $template->debug = true;
|
51
|
$template->set_file('page', 'templates_details.htt');
|
52
|
$template->set_block('page', 'main_block', 'main');
|
53
|
$template->set_var('FTAN', $admin->getFTAN());
|
54
|
|
55
|
// Insert values
|
56
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'");
|
57
|
if($result->numRows() > 0) {
|
58
|
$row = $result->fetchRow();
|
59
|
}
|
60
|
|
61
|
// check if a template description exists for the displayed backend language
|
62
|
$tool_description = false;
|
63
|
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/templates/'.$file.'/languages/'.LANGUAGE .'.php')) {
|
64
|
// read contents of the template language file into string
|
65
|
$data = @file_get_contents(WB_PATH .'/templates/' .$file .'/languages/' .LANGUAGE .'.php');
|
66
|
// use regular expressions to fetch the content of the variable from the string
|
67
|
$tool_description = get_variable_content('template_description', $data, false, false);
|
68
|
// replace optional placeholder {WB_URL} with value stored in config.php
|
69
|
if($tool_description !== false && strlen(trim($tool_description)) != 0) {
|
70
|
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
|
71
|
} else {
|
72
|
$tool_description = false;
|
73
|
}
|
74
|
}
|
75
|
if($tool_description !== false) {
|
76
|
// Override the template-description with correct desription in users language
|
77
|
$row['description'] = $tool_description;
|
78
|
}
|
79
|
|
80
|
$template->set_var(array(
|
81
|
'NAME' => $row['name'],
|
82
|
'AUTHOR' => $row['author'],
|
83
|
'DESCRIPTION' => $row['description'],
|
84
|
'VERSION' => $row['version'],
|
85
|
'DESIGNED_FOR' => $row['platform'],
|
86
|
'LICENSE' => $row['license'],
|
87
|
)
|
88
|
);
|
89
|
|
90
|
// Insert language headings
|
91
|
$template->set_var(array(
|
92
|
'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
|
93
|
)
|
94
|
);
|
95
|
// Insert language text and messages
|
96
|
$template->set_var(array(
|
97
|
'TEXT_NAME' => $TEXT['NAME'],
|
98
|
'TEXT_AUTHOR' => $TEXT['AUTHOR'],
|
99
|
'TEXT_VERSION' => $TEXT['VERSION'],
|
100
|
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
|
101
|
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
|
102
|
'TEXT_BACK' => $TEXT['BACK'],
|
103
|
'TEXT_LICENSE' => '',
|
104
|
)
|
105
|
);
|
106
|
$template->set_var('TEXT_FUNCTION', ($row['function'] == 'theme' ? $TEXT['THEME'] : $TEXT['TEMPLATE']));
|
107
|
// Parse template object
|
108
|
$template->parse('main', 'main_block', false);
|
109
|
$template->pparse('output', 'page');
|
110
|
|
111
|
// Print admin footer
|
112
|
$admin->print_footer();
|
113
|
|
114
|
?>
|