| 1 |
1386
|
Luisehahne
|
<?php
|
| 2 |
|
|
/**
|
| 3 |
|
|
*
|
| 4 |
|
|
* @category admin
|
| 5 |
|
|
* @package modules
|
| 6 |
1529
|
Luisehahne
|
* @author Ryan Djurovich, WebsiteBaker Project
|
| 7 |
1712
|
Luisehahne
|
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
| 8 |
1386
|
Luisehahne
|
* @link http://www.websitebaker2.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$
|
| 13 |
1457
|
Luisehahne
|
* @filesource $HeadURL$
|
| 14 |
|
|
* @lastmodified $Date$
|
| 15 |
1386
|
Luisehahne
|
*
|
| 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 |
1457
|
Luisehahne
|
if( !$admin->checkFTAN() )
|
| 25 |
|
|
{
|
| 26 |
1467
|
Luisehahne
|
$admin->print_header();
|
| 27 |
1457
|
Luisehahne
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
| 28 |
|
|
}
|
| 29 |
|
|
// After check print the header
|
| 30 |
|
|
$admin->print_header();
|
| 31 |
1386
|
Luisehahne
|
|
| 32 |
1712
|
Luisehahne
|
$mLang = ModLanguage::getInstance();
|
| 33 |
|
|
$mLang->setLanguage(ADMIN_PATH.'/addons/languages/', LANGUAGE, DEFAULT_LANGUAGE);
|
| 34 |
|
|
|
| 35 |
|
|
if(!isset($_POST['file']) OR $_POST['file'] == "") {
|
| 36 |
|
|
$admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS']);
|
| 37 |
|
|
} else {
|
| 38 |
|
|
$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']); // fix secunia 2010-92-2
|
| 39 |
|
|
}
|
| 40 |
|
|
|
| 41 |
|
|
// Check if the template exists
|
| 42 |
|
|
if(!is_dir(WB_PATH.'/modules/'.$file)) {
|
| 43 |
|
|
$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']);
|
| 44 |
|
|
}
|
| 45 |
|
|
|
| 46 |
|
|
// Check if the template exists
|
| 47 |
|
|
if(!is_readable(WB_PATH.'/modules/'.$file)) {
|
| 48 |
|
|
$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
|
| 49 |
|
|
}
|
| 50 |
|
|
|
| 51 |
|
|
/*
|
| 52 |
1386
|
Luisehahne
|
// Get module name
|
| 53 |
|
|
if(!isset($_POST['file']) OR $_POST['file'] == "")
|
| 54 |
|
|
{
|
| 55 |
|
|
header("Location: index.php");
|
| 56 |
|
|
exit(0);
|
| 57 |
|
|
}
|
| 58 |
|
|
else
|
| 59 |
|
|
{
|
| 60 |
1494
|
Luisehahne
|
$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']); // fix secunia 2010-92-1
|
| 61 |
1386
|
Luisehahne
|
}
|
| 62 |
|
|
|
| 63 |
|
|
// Check if the module exists
|
| 64 |
1712
|
Luisehahne
|
if(!is_readable(WB_PATH.'/modules/'.$file)) {
|
| 65 |
1386
|
Luisehahne
|
header("Location: index.php");
|
| 66 |
|
|
exit(0);
|
| 67 |
|
|
}
|
| 68 |
1712
|
Luisehahne
|
*/
|
| 69 |
1386
|
Luisehahne
|
|
| 70 |
1529
|
Luisehahne
|
// Setup template object, parse vars to it, then parse it
|
| 71 |
|
|
// Create new template object
|
| 72 |
1712
|
Luisehahne
|
$template = new Template(dirname($admin->correct_theme_source('modules_details.htt')),'keep');
|
| 73 |
1529
|
Luisehahne
|
// $template->debug = true;
|
| 74 |
1386
|
Luisehahne
|
$template->set_file('page', 'modules_details.htt');
|
| 75 |
|
|
$template->set_block('page', 'main_block', 'main');
|
| 76 |
|
|
|
| 77 |
|
|
// Insert values
|
| 78 |
|
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND directory = '$file'");
|
| 79 |
|
|
if($result->numRows() > 0) {
|
| 80 |
|
|
$module = $result->fetchRow();
|
| 81 |
|
|
}
|
| 82 |
|
|
|
| 83 |
1712
|
Luisehahne
|
/*-- insert all needed vars from language files ----------------------------------------*/
|
| 84 |
|
|
$template->set_var($mLang->getLangArray());
|
| 85 |
|
|
|
| 86 |
1386
|
Luisehahne
|
// check if a module description exists for the displayed backend language
|
| 87 |
|
|
$tool_description = false;
|
| 88 |
|
|
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$file.'/languages/'.LANGUAGE .'.php')) {
|
| 89 |
|
|
// read contents of the module language file into string
|
| 90 |
|
|
$data = @file_get_contents(WB_PATH .'/modules/' .$file .'/languages/' .LANGUAGE .'.php');
|
| 91 |
|
|
// use regular expressions to fetch the content of the variable from the string
|
| 92 |
|
|
$tool_description = get_variable_content('module_description', $data, false, false);
|
| 93 |
|
|
// replace optional placeholder {WB_URL} with value stored in config.php
|
| 94 |
|
|
if($tool_description !== false && strlen(trim($tool_description)) != 0) {
|
| 95 |
|
|
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description);
|
| 96 |
|
|
} else {
|
| 97 |
|
|
$tool_description = false;
|
| 98 |
|
|
}
|
| 99 |
1712
|
Luisehahne
|
}
|
| 100 |
1386
|
Luisehahne
|
if($tool_description !== false) {
|
| 101 |
|
|
// Override the module-description with correct desription in users language
|
| 102 |
|
|
$module['description'] = $tool_description;
|
| 103 |
|
|
}
|
| 104 |
|
|
|
| 105 |
|
|
$template->set_var(array(
|
| 106 |
|
|
'NAME' => $module['name'],
|
| 107 |
|
|
'AUTHOR' => $module['author'],
|
| 108 |
|
|
'DESCRIPTION' => $module['description'],
|
| 109 |
|
|
'VERSION' => $module['version'],
|
| 110 |
|
|
'DESIGNED_FOR' => $module['platform'],
|
| 111 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
| 112 |
|
|
'WB_URL' => WB_URL,
|
| 113 |
|
|
'THEME_URL' => THEME_URL
|
| 114 |
|
|
)
|
| 115 |
|
|
);
|
| 116 |
1712
|
Luisehahne
|
|
| 117 |
1386
|
Luisehahne
|
switch ($module['function']) {
|
| 118 |
|
|
case NULL:
|
| 119 |
|
|
$type_name = $TEXT['UNKNOWN'];
|
| 120 |
|
|
break;
|
| 121 |
|
|
case 'page':
|
| 122 |
|
|
$type_name = $TEXT['PAGE'];
|
| 123 |
|
|
break;
|
| 124 |
|
|
case 'wysiwyg':
|
| 125 |
|
|
$type_name = $TEXT['WYSIWYG_EDITOR'];
|
| 126 |
|
|
break;
|
| 127 |
|
|
case 'tool':
|
| 128 |
|
|
$type_name = $TEXT['ADMINISTRATION_TOOL'];
|
| 129 |
|
|
break;
|
| 130 |
|
|
case 'admin':
|
| 131 |
|
|
$type_name = $TEXT['ADMIN'];
|
| 132 |
|
|
break;
|
| 133 |
|
|
case 'administration':
|
| 134 |
|
|
$type_name = $TEXT['ADMINISTRATION'];
|
| 135 |
|
|
break;
|
| 136 |
|
|
case 'snippet':
|
| 137 |
|
|
$type_name = $TEXT['CODE_SNIPPET'];
|
| 138 |
|
|
break;
|
| 139 |
|
|
default:
|
| 140 |
|
|
$type_name = $TEXT['UNKNOWN'];
|
| 141 |
|
|
}
|
| 142 |
|
|
$template->set_var('TYPE', $type_name);
|
| 143 |
|
|
|
| 144 |
1712
|
Luisehahne
|
//// Insert language headings
|
| 145 |
|
|
//$template->set_var(array(
|
| 146 |
|
|
// 'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS']
|
| 147 |
|
|
// )
|
| 148 |
|
|
// );
|
| 149 |
|
|
//// Insert language text and messages
|
| 150 |
|
|
//$template->set_var(array(
|
| 151 |
|
|
// 'TEXT_NAME' => $TEXT['NAME'],
|
| 152 |
|
|
// 'TEXT_TYPE' => $TEXT['TYPE'],
|
| 153 |
|
|
// 'TEXT_AUTHOR' => $TEXT['AUTHOR'],
|
| 154 |
|
|
// 'TEXT_VERSION' => $TEXT['VERSION'],
|
| 155 |
|
|
// 'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
|
| 156 |
|
|
// 'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
|
| 157 |
|
|
// 'TEXT_BACK' => $TEXT['BACK']
|
| 158 |
|
|
// )
|
| 159 |
|
|
// );
|
| 160 |
|
|
//
|
| 161 |
1386
|
Luisehahne
|
// Parse module object
|
| 162 |
|
|
$template->parse('main', 'main_block', false);
|
| 163 |
|
|
$template->pparse('output', 'page');
|
| 164 |
|
|
|
| 165 |
|
|
// Print admin footer
|
| 166 |
|
|
$admin->print_footer();
|