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