Project

General

Profile

1
<?php
2

    
3
// $Id: details.php 1112 2009-08-08 14:28:54Z Ruebenwurzel $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
// Include the config file
27
require('../../config.php');
28
require_once(WB_PATH .'/framework/functions.php');
29

    
30
// Print admin header
31
require_once(WB_PATH.'/framework/class.admin.php');
32
$admin = new admin('Addons', 'modules_view');
33

    
34
// Get module name
35
if(!isset($_POST['file']) OR $_POST['file'] == "") {
36
	header("Location: index.php");
37
	exit(0);
38
} else {
39
	$file = $admin->add_slashes($_POST['file']);
40
}
41

    
42
// Check if the module exists
43
if(!file_exists(WB_PATH.'/modules/'.$file)) {
44
	header("Location: index.php");
45
	exit(0);
46
}
47

    
48
// Setup module object
49
$template = new Template(THEME_PATH.'/templates');
50
$template->set_file('page', 'modules_details.htt');
51
$template->set_block('page', 'main_block', 'main');
52

    
53
// Insert values
54
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND directory = '$file'");
55
if($result->numRows() > 0) {
56
	$module = $result->fetchRow();
57
}
58

    
59
// check if a module description exists for the displayed backend language
60
$tool_description = false;
61
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$file.'/languages/'.LANGUAGE .'.php')) {
62
	// read contents of the module language file into string
63
	$data = @file_get_contents(WB_PATH .'/modules/' .$file .'/languages/' .LANGUAGE .'.php');
64
	// use regular expressions to fetch the content of the variable from the string
65
	$tool_description = get_variable_content('module_description', $data, false, false);
66
	// replace optional placeholder {WB_URL} with value stored in config.php
67
	if($tool_description !== false && strlen(trim($tool_description)) != 0) {
68
		$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
69
	} else {
70
		$tool_description = false;
71
	}
72
}		
73
if($tool_description !== false) {
74
	// Override the module-description with correct desription in users language
75
	$module['description'] = $tool_description;
76
}
77

    
78
$template->set_var(array(
79
								'NAME' => $module['name'],
80
								'AUTHOR' => $module['author'],
81
								'DESCRIPTION' => $module['description'],
82
								'VERSION' => $module['version'],
83
								'DESIGNED_FOR' => $module['platform'],
84
								'ADMIN_URL' => ADMIN_URL,
85
								'WB_URL' => WB_URL,
86
								'WB_PATH' => WB_PATH,
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
?>
(1-1/5)