1
|
<?php
|
2
|
|
3
|
// $Id: details.php 1355 2010-12-27 11:14:16Z FrankH $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2009, Ryan Djurovich
|
9
|
|
10
|
Website Baker is free software; you can redistribute it and/or modify
|
11
|
it under the terms of the GNU General Public License as published by
|
12
|
the Free Software Foundation; either version 2 of the License, or
|
13
|
(at your option) any later version.
|
14
|
|
15
|
Website Baker is distributed in the hope that it will be useful,
|
16
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
GNU General Public License for more details.
|
19
|
|
20
|
You should have received a copy of the GNU General Public License
|
21
|
along with Website Baker; if not, write to the Free Software
|
22
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
|
24
|
*/
|
25
|
|
26
|
// Include the config file
|
27
|
require('../../config.php');
|
28
|
require_once(WB_PATH .'/framework/functions.php');
|
29
|
require_once(WB_PATH.'/framework/class.admin.php');
|
30
|
$admin = new admin('Addons', 'templates_view',false);
|
31
|
|
32
|
if( !$admin->checkFTAN() )
|
33
|
{
|
34
|
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
35
|
exit();
|
36
|
}
|
37
|
|
38
|
// Get template name
|
39
|
if(!isset($_POST['file']) OR $_POST['file'] == "") {
|
40
|
header("Location: index.php");
|
41
|
exit(0);
|
42
|
} else {
|
43
|
$file = preg_replace("/\W/", "", $admin->add_slashes($_POST['file'])); // fix secunia 2010-92-2
|
44
|
}
|
45
|
|
46
|
// Check if the template exists
|
47
|
if(!file_exists(WB_PATH.'/templates/'.$file)) {
|
48
|
header("Location: index.php");
|
49
|
exit(0);
|
50
|
}
|
51
|
|
52
|
// Print admin header
|
53
|
$admin = new admin('Addons', 'templates_view');
|
54
|
|
55
|
// Setup template object
|
56
|
$template = new Template(THEME_PATH.'/templates');
|
57
|
$template->set_file('page', 'templates_details.htt');
|
58
|
$template->set_block('page', 'main_block', 'main');
|
59
|
$template->set_var('FTAN', $admin->getFTAN());
|
60
|
|
61
|
// Insert values
|
62
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'");
|
63
|
if($result->numRows() > 0) {
|
64
|
$row = $result->fetchRow();
|
65
|
}
|
66
|
|
67
|
// check if a template description exists for the displayed backend language
|
68
|
$tool_description = false;
|
69
|
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/templates/'.$file.'/languages/'.LANGUAGE .'.php')) {
|
70
|
// read contents of the template language file into string
|
71
|
$data = @file_get_contents(WB_PATH .'/templates/' .$file .'/languages/' .LANGUAGE .'.php');
|
72
|
// use regular expressions to fetch the content of the variable from the string
|
73
|
$tool_description = get_variable_content('template_description', $data, false, false);
|
74
|
// replace optional placeholder {WB_URL} with value stored in config.php
|
75
|
if($tool_description !== false && strlen(trim($tool_description)) != 0) {
|
76
|
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
|
77
|
} else {
|
78
|
$tool_description = false;
|
79
|
}
|
80
|
}
|
81
|
if($tool_description !== false) {
|
82
|
// Override the template-description with correct desription in users language
|
83
|
$row['description'] = $tool_description;
|
84
|
}
|
85
|
|
86
|
$template->set_var(array(
|
87
|
'NAME' => $row['name'],
|
88
|
'AUTHOR' => $row['author'],
|
89
|
'DESCRIPTION' => $row['description'],
|
90
|
'VERSION' => $row['version'],
|
91
|
'DESIGNED_FOR' => $row['platform']
|
92
|
)
|
93
|
);
|
94
|
|
95
|
// Insert language headings
|
96
|
$template->set_var(array(
|
97
|
'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
|
98
|
)
|
99
|
);
|
100
|
// Insert language text and messages
|
101
|
$template->set_var(array(
|
102
|
'TEXT_NAME' => $TEXT['NAME'],
|
103
|
'TEXT_AUTHOR' => $TEXT['AUTHOR'],
|
104
|
'TEXT_VERSION' => $TEXT['VERSION'],
|
105
|
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
|
106
|
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
|
107
|
'TEXT_BACK' => $TEXT['BACK']
|
108
|
)
|
109
|
);
|
110
|
|
111
|
// Parse template object
|
112
|
$template->parse('main', 'main_block', false);
|
113
|
$template->pparse('output', 'page');
|
114
|
|
115
|
// Print admin footer
|
116
|
$admin->print_footer();
|
117
|
|
118
|
?>
|