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