Project

General

Profile

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