1 |
1386
|
Luisehahne
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category admin
|
5 |
|
|
* @package modules
|
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 |
1457
|
Luisehahne
|
* @filesource $HeadURL$
|
15 |
|
|
* @lastmodified $Date$
|
16 |
1386
|
Luisehahne
|
*
|
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 |
|
|
// No print admin header
|
24 |
|
|
$admin = new admin('Addons', 'modules_view', false);
|
25 |
1457
|
Luisehahne
|
if( !$admin->checkFTAN() )
|
26 |
|
|
{
|
27 |
|
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
28 |
|
|
}
|
29 |
|
|
// After check print the header
|
30 |
|
|
$admin->print_header();
|
31 |
1386
|
Luisehahne
|
|
32 |
|
|
// Get module name
|
33 |
|
|
if(!isset($_POST['file']) OR $_POST['file'] == "")
|
34 |
|
|
{
|
35 |
|
|
header("Location: index.php");
|
36 |
|
|
exit(0);
|
37 |
|
|
}
|
38 |
|
|
else
|
39 |
|
|
{
|
40 |
|
|
$file = preg_replace("/\W/", "", $admin->add_slashes($_POST['file'])); // fix secunia 2010-92-1
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
// Check if the module exists
|
44 |
|
|
if(!file_exists(WB_PATH.'/modules/'.$file)) {
|
45 |
|
|
header("Location: index.php");
|
46 |
|
|
exit(0);
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
// Setup module object
|
50 |
|
|
$template = new Template(THEME_PATH.'/templates');
|
51 |
|
|
$template->set_file('page', 'modules_details.htt');
|
52 |
|
|
$template->set_block('page', 'main_block', 'main');
|
53 |
|
|
|
54 |
|
|
// Insert values
|
55 |
|
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND directory = '$file'");
|
56 |
|
|
if($result->numRows() > 0) {
|
57 |
|
|
$module = $result->fetchRow();
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
// check if a module description exists for the displayed backend language
|
61 |
|
|
$tool_description = false;
|
62 |
|
|
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$file.'/languages/'.LANGUAGE .'.php')) {
|
63 |
|
|
// read contents of the module language file into string
|
64 |
|
|
$data = @file_get_contents(WB_PATH .'/modules/' .$file .'/languages/' .LANGUAGE .'.php');
|
65 |
|
|
// use regular expressions to fetch the content of the variable from the string
|
66 |
|
|
$tool_description = get_variable_content('module_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 module-description with correct desription in users language
|
76 |
|
|
$module['description'] = $tool_description;
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
$template->set_var(array(
|
80 |
|
|
'NAME' => $module['name'],
|
81 |
|
|
'AUTHOR' => $module['author'],
|
82 |
|
|
'DESCRIPTION' => $module['description'],
|
83 |
|
|
'VERSION' => $module['version'],
|
84 |
|
|
'DESIGNED_FOR' => $module['platform'],
|
85 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
86 |
|
|
'WB_URL' => WB_URL,
|
87 |
|
|
'THEME_URL' => THEME_URL
|
88 |
|
|
)
|
89 |
|
|
);
|
90 |
|
|
|
91 |
|
|
switch ($module['function']) {
|
92 |
|
|
case NULL:
|
93 |
|
|
$type_name = $TEXT['UNKNOWN'];
|
94 |
|
|
break;
|
95 |
|
|
case 'page':
|
96 |
|
|
$type_name = $TEXT['PAGE'];
|
97 |
|
|
break;
|
98 |
|
|
case 'wysiwyg':
|
99 |
|
|
$type_name = $TEXT['WYSIWYG_EDITOR'];
|
100 |
|
|
break;
|
101 |
|
|
case 'tool':
|
102 |
|
|
$type_name = $TEXT['ADMINISTRATION_TOOL'];
|
103 |
|
|
break;
|
104 |
|
|
case 'admin':
|
105 |
|
|
$type_name = $TEXT['ADMIN'];
|
106 |
|
|
break;
|
107 |
|
|
case 'administration':
|
108 |
|
|
$type_name = $TEXT['ADMINISTRATION'];
|
109 |
|
|
break;
|
110 |
|
|
case 'snippet':
|
111 |
|
|
$type_name = $TEXT['CODE_SNIPPET'];
|
112 |
|
|
break;
|
113 |
|
|
default:
|
114 |
|
|
$type_name = $TEXT['UNKNOWN'];
|
115 |
|
|
}
|
116 |
|
|
$template->set_var('TYPE', $type_name);
|
117 |
|
|
|
118 |
|
|
// Insert language headings
|
119 |
|
|
$template->set_var(array(
|
120 |
|
|
'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS']
|
121 |
|
|
)
|
122 |
|
|
);
|
123 |
|
|
// Insert language text and messages
|
124 |
|
|
$template->set_var(array(
|
125 |
|
|
'TEXT_NAME' => $TEXT['NAME'],
|
126 |
|
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
127 |
|
|
'TEXT_AUTHOR' => $TEXT['AUTHOR'],
|
128 |
|
|
'TEXT_VERSION' => $TEXT['VERSION'],
|
129 |
|
|
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
|
130 |
|
|
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
|
131 |
|
|
'TEXT_BACK' => $TEXT['BACK']
|
132 |
|
|
)
|
133 |
|
|
);
|
134 |
|
|
|
135 |
|
|
// Parse module object
|
136 |
|
|
$template->parse('main', 'main_block', false);
|
137 |
|
|
$template->pparse('output', 'page');
|
138 |
|
|
|
139 |
|
|
// Print admin footer
|
140 |
|
|
$admin->print_footer();
|
141 |
|
|
|
142 |
4
|
ryan
|
?>
|