1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package modules
|
6
|
* @author Ryan Djurovich, WebsiteBaker Project
|
7
|
* @copyright 2009-2013, WebsiteBaker Org. e.V.
|
8
|
* @link http://www.websitebaker.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: details.php 1923 2013-06-08 09:58:47Z darkviper $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/modules/details.php $
|
14
|
* @lastmodified $Date: 2013-06-08 11:58:47 +0200 (Sat, 08 Jun 2013) $
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
// Include the config file
|
19
|
require('../../config.php');
|
20
|
$mLang = Translate::getinstance();
|
21
|
$mLang->enableAddon('admin\addons');
|
22
|
require_once(WB_PATH .'/framework/functions.php');
|
23
|
require_once(WB_PATH.'/framework/class.admin.php');
|
24
|
// No print admin header
|
25
|
$admin = new admin('Addons', 'modules_view', false);
|
26
|
if( !$admin->checkFTAN() )
|
27
|
{
|
28
|
$admin->print_header();
|
29
|
$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
|
30
|
}
|
31
|
// After check print the header
|
32
|
$admin->print_header();
|
33
|
|
34
|
if(!isset($_POST['file']) OR $_POST['file'] == "") {
|
35
|
$admin->print_error($mLang->MESSAGE_GENERIC_FORGOT_OPTIONS);
|
36
|
} else {
|
37
|
$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']); // fix secunia 2010-92-2
|
38
|
}
|
39
|
|
40
|
// Check if the template exists
|
41
|
if(!is_dir(WB_PATH.'/modules/'.$file)) {
|
42
|
$admin->print_error($mLang->MESSAGE_GENERIC_NOT_INSTALLED);
|
43
|
}
|
44
|
|
45
|
// Check if the template exists
|
46
|
if(!is_readable(WB_PATH.'/modules/'.$file)) {
|
47
|
$admin->print_error($mLang->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES);
|
48
|
}
|
49
|
// Setup template object, parse vars to it, then parse it
|
50
|
// Create new template object
|
51
|
$template = new Template(dirname($admin->correct_theme_source('modules_details.htt')),'keep');
|
52
|
// $template->debug = true;
|
53
|
$template->set_file('page', 'modules_details.htt');
|
54
|
$template->set_block('page', 'main_block', 'main');
|
55
|
|
56
|
// Insert values
|
57
|
$module = false;
|
58
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
|
59
|
. 'WHERE `type`=\'module\' AND `directory`=\''.$file.'\'';
|
60
|
if( ($result = $database->query($sql)) ){
|
61
|
$module = $result->fetchRow(MYSQL_ASSOC);
|
62
|
}
|
63
|
if(!$module) { $admin->print_error($mLang->MESSAGE_GENERIC_NOT_INSTALLED); }
|
64
|
/*-- insert all needed vars from language files ----------------------------------------*/
|
65
|
$template->set_var($mLang->getLangArray());
|
66
|
|
67
|
// check if a module description exists for the displayed backend language
|
68
|
$tool_description = false;
|
69
|
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$file.'/languages/'.LANGUAGE .'.php')) {
|
70
|
// read contents of the module language file into string
|
71
|
$data = @file_get_contents(WB_PATH .'/modules/' .$file .'/languages/' .LANGUAGE .'.php');
|
72
|
// use regular expressions to fetch the content of the variable from the string
|
73
|
$tool_description = get_variable_content('module_description', $data, false, false);
|
74
|
// replace optional placeholder {WB_URL} with value stored in config.php
|
75
|
if($tool_description !== false && strlen(trim($tool_description)) != 0) {
|
76
|
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
|
77
|
} else {
|
78
|
$tool_description = false;
|
79
|
}
|
80
|
}
|
81
|
if($tool_description !== false) {
|
82
|
// Override the module-description with correct desription in users language
|
83
|
$module['description'] = $tool_description;
|
84
|
}
|
85
|
|
86
|
$template->set_var(array(
|
87
|
'NAME' => $module['name'],
|
88
|
'AUTHOR' => $module['author'],
|
89
|
'DESCRIPTION' => $module['description'],
|
90
|
'VERSION' => $module['version'],
|
91
|
'DESIGNED_FOR' => $module['platform'],
|
92
|
'ADMIN_URL' => ADMIN_URL,
|
93
|
'WB_URL' => WB_URL,
|
94
|
'THEME_URL' => THEME_URL
|
95
|
)
|
96
|
);
|
97
|
|
98
|
switch ($module['function']) {
|
99
|
case NULL:
|
100
|
$type_name = $mLang->TEXT_UNKNOWN;
|
101
|
break;
|
102
|
case 'page':
|
103
|
$type_name = $mLang->TEXT_PAGE;
|
104
|
break;
|
105
|
case 'wysiwyg':
|
106
|
$type_name = $mLang->TEXT_WYSIWYG_EDITOR;
|
107
|
break;
|
108
|
case 'tool':
|
109
|
$type_name = $mLang->TEXT_ADMINISTRATION_TOOL;
|
110
|
break;
|
111
|
case 'admin':
|
112
|
$type_name = $mLang->TEXT_ADMIN;
|
113
|
break;
|
114
|
case 'administration':
|
115
|
$type_name = $mLang->TEXT_ADMINISTRATION;
|
116
|
break;
|
117
|
case 'snippet':
|
118
|
$type_name = $mLang->TEXT_CODE_SNIPPET;
|
119
|
break;
|
120
|
default:
|
121
|
$type_name = $mLang->TEXT_UNKNOWN;
|
122
|
}
|
123
|
$template->set_var('TYPE', $type_name);
|
124
|
|
125
|
|
126
|
// Parse module object
|
127
|
$template->parse('main', 'main_block', false);
|
128
|
$template->pparse('output', 'page');
|
129
|
// Print admin footer
|
130
|
$admin->print_footer();
|