Project

General

Profile

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 1913 2013-06-07 03:43:44Z Luisehahne $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/modules/details.php $
14
 * @lastmodified    $Date: 2013-06-07 05:43:44 +0200 (Fri, 07 Jun 2013) $
15
 *
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
if( !$admin->checkFTAN() )
25
{
26
	$admin->print_header();
27
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
28
}
29
// After check print the header
30
$admin->print_header();
31

    
32
//$mLang = ModLanguage::getInstance();
33
//$mLang->setLanguage(ADMIN_PATH.'/addons/languages/', LANGUAGE, DEFAULT_LANGUAGE);
34
$mLang = Translate::getinstance();
35
$mLang->enableAddon('admin\addons');
36

    
37
if(!isset($_POST['file']) OR $_POST['file'] == "") {
38
	$admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS']);
39
} else {
40
	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-2
41
}
42

    
43
// Check if the template exists
44
if(!is_dir(WB_PATH.'/modules/'.$file)) {
45
	$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']);
46
}
47

    
48
// Check if the template exists
49
if(!is_readable(WB_PATH.'/modules/'.$file)) {
50
	$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
51
}
52

    
53
/*
54
// Get module name
55
if(!isset($_POST['file']) OR $_POST['file'] == "")
56
{
57
	header("Location: index.php");
58
	exit(0);
59
}
60
else
61
{
62
	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-1
63
}
64

    
65
// Check if the module exists
66
if(!is_readable(WB_PATH.'/modules/'.$file)) {
67
	header("Location: index.php");
68
	exit(0);
69
}
70
*/
71

    
72
// Setup template object, parse vars to it, then parse it
73
// Create new template object
74
$template = new Template(dirname($admin->correct_theme_source('modules_details.htt')),'keep');
75
// $template->debug = true;
76
$template->set_file('page', 'modules_details.htt');
77
$template->set_block('page', 'main_block', 'main');
78

    
79
// Insert values
80
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND directory = '$file'");
81
if($result->numRows() > 0) {
82
	$module = $result->fetchRow();
83
}
84

    
85
/*-- insert all needed vars from language files ----------------------------------------*/
86
$template->set_var($mLang->getLangArray());
87

    
88
// check if a module description exists for the displayed backend language
89
$tool_description = false;
90
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$file.'/languages/'.LANGUAGE .'.php')) {
91
	// read contents of the module language file into string
92
	$data = @file_get_contents(WB_PATH .'/modules/' .$file .'/languages/' .LANGUAGE .'.php');
93
	// use regular expressions to fetch the content of the variable from the string
94
	$tool_description = get_variable_content('module_description', $data, false, false);
95
	// replace optional placeholder {WB_URL} with value stored in config.php
96
	if($tool_description !== false && strlen(trim($tool_description)) != 0) {
97
		$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
98
	} else {
99
		$tool_description = false;
100
	}
101
}
102
if($tool_description !== false) {
103
	// Override the module-description with correct desription in users language
104
	$module['description'] = $tool_description;
105
}
106

    
107
$template->set_var(array(
108
								'NAME' => $module['name'],
109
								'AUTHOR' => $module['author'],
110
								'DESCRIPTION' => $module['description'],
111
								'VERSION' => $module['version'],
112
								'DESIGNED_FOR' => $module['platform'],
113
								'ADMIN_URL' => ADMIN_URL,
114
								'WB_URL' => WB_URL,
115
								'THEME_URL' => THEME_URL
116
								)
117
						);
118

    
119
switch ($module['function']) {
120
	case NULL:
121
		$type_name = $mLang->TEXT_UNKNOWN;
122
		break;
123
	case 'page':
124
		$type_name = $mLang->TEXT_PAGE;
125
		break;
126
	case 'wysiwyg':
127
		$type_name = $mLang->TEXT_WYSIWYG_EDITOR;
128
		break;
129
	case 'tool':
130
		$type_name = $mLang->TEXT_ADMINISTRATION_TOOL;
131
		break;
132
	case 'admin':
133
		$type_name = $mLang->TEXT_ADMIN;
134
		break;
135
	case 'administration':
136
		$type_name = $mLang->TEXT_ADMINISTRATION;
137
		break;
138
	case 'snippet':
139
		$type_name = $mLang->TEXT_CODE_SNIPPET;
140
		break;
141
	default:
142
		$type_name = $mLang->TEXT_UNKNOWN;
143
}
144
$template->set_var('TYPE', $type_name);
145

    
146

    
147
// Parse module object
148
$template->parse('main', 'main_block', false);
149
$template->pparse('output', 'page');
150

    
151
// Print admin footer
152
$admin->print_footer();
(1-1/5)