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