1 |
1386
|
Luisehahne
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category admin
|
5 |
|
|
* @package modules
|
6 |
1529
|
Luisehahne
|
* @author Ryan Djurovich, WebsiteBaker Project
|
7 |
1386
|
Luisehahne
|
* @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$
|
13 |
1457
|
Luisehahne
|
* @filesource $HeadURL$
|
14 |
|
|
* @lastmodified $Date$
|
15 |
1386
|
Luisehahne
|
*
|
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 |
|
|
// No print admin header
|
23 |
|
|
$admin = new admin('Addons', 'modules_view', false);
|
24 |
1457
|
Luisehahne
|
if( !$admin->checkFTAN() )
|
25 |
|
|
{
|
26 |
1467
|
Luisehahne
|
$admin->print_header();
|
27 |
1457
|
Luisehahne
|
$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 |
1494
|
Luisehahne
|
$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']); // fix secunia 2010-92-1
|
41 |
1386
|
Luisehahne
|
}
|
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 |
1529
|
Luisehahne
|
// Setup template object, parse vars to it, then parse it
|
50 |
|
|
// Create new template object
|
51 |
1625
|
Luisehahne
|
$template = new Template(dirname($admin->correct_theme_source('modules_details.htt')));
|
52 |
1529
|
Luisehahne
|
// $template->debug = true;
|
53 |
1386
|
Luisehahne
|
$template->set_file('page', 'modules_details.htt');
|
54 |
|
|
$template->set_block('page', 'main_block', 'main');
|
55 |
|
|
|
56 |
|
|
// Insert values
|
57 |
|
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND directory = '$file'");
|
58 |
|
|
if($result->numRows() > 0) {
|
59 |
|
|
$module = $result->fetchRow();
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
// check if a module description exists for the displayed backend language
|
63 |
|
|
$tool_description = false;
|
64 |
|
|
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$file.'/languages/'.LANGUAGE .'.php')) {
|
65 |
|
|
// read contents of the module language file into string
|
66 |
|
|
$data = @file_get_contents(WB_PATH .'/modules/' .$file .'/languages/' .LANGUAGE .'.php');
|
67 |
|
|
// use regular expressions to fetch the content of the variable from the string
|
68 |
|
|
$tool_description = get_variable_content('module_description', $data, false, false);
|
69 |
|
|
// replace optional placeholder {WB_URL} with value stored in config.php
|
70 |
|
|
if($tool_description !== false && strlen(trim($tool_description)) != 0) {
|
71 |
|
|
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
|
72 |
|
|
} else {
|
73 |
|
|
$tool_description = false;
|
74 |
|
|
}
|
75 |
|
|
}
|
76 |
|
|
if($tool_description !== false) {
|
77 |
|
|
// Override the module-description with correct desription in users language
|
78 |
|
|
$module['description'] = $tool_description;
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
$template->set_var(array(
|
82 |
|
|
'NAME' => $module['name'],
|
83 |
|
|
'AUTHOR' => $module['author'],
|
84 |
|
|
'DESCRIPTION' => $module['description'],
|
85 |
|
|
'VERSION' => $module['version'],
|
86 |
|
|
'DESIGNED_FOR' => $module['platform'],
|
87 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
88 |
|
|
'WB_URL' => WB_URL,
|
89 |
|
|
'THEME_URL' => THEME_URL
|
90 |
|
|
)
|
91 |
|
|
);
|
92 |
|
|
|
93 |
|
|
switch ($module['function']) {
|
94 |
|
|
case NULL:
|
95 |
|
|
$type_name = $TEXT['UNKNOWN'];
|
96 |
|
|
break;
|
97 |
|
|
case 'page':
|
98 |
|
|
$type_name = $TEXT['PAGE'];
|
99 |
|
|
break;
|
100 |
|
|
case 'wysiwyg':
|
101 |
|
|
$type_name = $TEXT['WYSIWYG_EDITOR'];
|
102 |
|
|
break;
|
103 |
|
|
case 'tool':
|
104 |
|
|
$type_name = $TEXT['ADMINISTRATION_TOOL'];
|
105 |
|
|
break;
|
106 |
|
|
case 'admin':
|
107 |
|
|
$type_name = $TEXT['ADMIN'];
|
108 |
|
|
break;
|
109 |
|
|
case 'administration':
|
110 |
|
|
$type_name = $TEXT['ADMINISTRATION'];
|
111 |
|
|
break;
|
112 |
|
|
case 'snippet':
|
113 |
|
|
$type_name = $TEXT['CODE_SNIPPET'];
|
114 |
|
|
break;
|
115 |
|
|
default:
|
116 |
|
|
$type_name = $TEXT['UNKNOWN'];
|
117 |
|
|
}
|
118 |
|
|
$template->set_var('TYPE', $type_name);
|
119 |
|
|
|
120 |
|
|
// Insert language headings
|
121 |
|
|
$template->set_var(array(
|
122 |
|
|
'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS']
|
123 |
|
|
)
|
124 |
|
|
);
|
125 |
|
|
// Insert language text and messages
|
126 |
|
|
$template->set_var(array(
|
127 |
|
|
'TEXT_NAME' => $TEXT['NAME'],
|
128 |
|
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
129 |
|
|
'TEXT_AUTHOR' => $TEXT['AUTHOR'],
|
130 |
|
|
'TEXT_VERSION' => $TEXT['VERSION'],
|
131 |
|
|
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
|
132 |
|
|
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
|
133 |
|
|
'TEXT_BACK' => $TEXT['BACK']
|
134 |
|
|
)
|
135 |
|
|
);
|
136 |
|
|
|
137 |
|
|
// Parse module object
|
138 |
|
|
$template->parse('main', 'main_block', false);
|
139 |
|
|
$template->pparse('output', 'page');
|
140 |
|
|
|
141 |
|
|
// Print admin footer
|
142 |
|
|
$admin->print_footer();
|