| 1 | 4 | ryan | <?php
 | 
      
        | 2 |  |  | 
 | 
      
        | 3 | 223 | stefan | // $Id$
 | 
      
        | 4 | 4 | ryan | 
 | 
      
        | 5 |  |  | /*
 | 
      
        | 6 |  |  | 
 | 
      
        | 7 |  |  |  Website Baker Project <http://www.websitebaker.org/>
 | 
      
        | 8 | 519 | Ruebenwurz |  Copyright (C) 2004-2008, Ryan Djurovich
 | 
      
        | 9 | 4 | ryan | 
 | 
      
        | 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 | 587 | doc | require_once(WB_PATH .'/framework/functions.php');
 | 
      
        | 29 | 4 | ryan | 
 | 
      
        | 30 | 656 | thorn | // Print admin header
 | 
      
        | 31 |  |  | require_once(WB_PATH.'/framework/class.admin.php');
 | 
      
        | 32 |  |  | $admin = new admin('Addons', 'modules_view');
 | 
      
        | 33 |  |  | 
 | 
      
        | 34 | 4 | ryan | // Get module name
 | 
      
        | 35 |  |  | if(!isset($_POST['file']) OR $_POST['file'] == "") {
 | 
      
        | 36 |  |  | 	header("Location: index.php");
 | 
      
        | 37 | 286 | stefan | 	exit(0);
 | 
      
        | 38 | 4 | ryan | } else {
 | 
      
        | 39 | 656 | thorn | 	$file = $admin->add_slashes($_POST['file']);
 | 
      
        | 40 | 4 | ryan | }
 | 
      
        | 41 |  |  | 
 | 
      
        | 42 |  |  | // Check if the module exists
 | 
      
        | 43 |  |  | if(!file_exists(WB_PATH.'/modules/'.$file)) {
 | 
      
        | 44 |  |  | 	header("Location: index.php");
 | 
      
        | 45 | 286 | stefan | 	exit(0);
 | 
      
        | 46 | 4 | ryan | }
 | 
      
        | 47 |  |  | 
 | 
      
        | 48 |  |  | // Setup module object
 | 
      
        | 49 |  |  | $template = new Template(ADMIN_PATH.'/modules');
 | 
      
        | 50 |  |  | $template->set_file('page', 'details.html');
 | 
      
        | 51 |  |  | $template->set_block('page', 'main_block', 'main');
 | 
      
        | 52 |  |  | 
 | 
      
        | 53 |  |  | // Insert values
 | 
      
        | 54 | 223 | stefan | $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 | 587 | doc | // 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, true, false);
 | 
      
        | 66 |  |  | }
 | 
      
        | 67 |  |  | if($tool_description !== false) {
 | 
      
        | 68 |  |  | 	// Override the module-description with correct desription in users language
 | 
      
        | 69 |  |  | 	$module['description'] = $tool_description;
 | 
      
        | 70 | 421 | Ruebenwurz | }
 | 
      
        | 71 |  |  | 
 | 
      
        | 72 | 4 | ryan | $template->set_var(array(
 | 
      
        | 73 | 223 | stefan | 								'NAME' => $module['name'],
 | 
      
        | 74 |  |  | 								'AUTHOR' => $module['author'],
 | 
      
        | 75 |  |  | 								'DESCRIPTION' => $module['description'],
 | 
      
        | 76 |  |  | 								'VERSION' => $module['version'],
 | 
      
        | 77 |  |  | 								'DESIGNED_FOR' => $module['platform']
 | 
      
        | 78 | 4 | ryan | 								)
 | 
      
        | 79 |  |  | 						);
 | 
      
        | 80 | 223 | stefan | 
 | 
      
        | 81 |  |  | switch ($module['function']) {
 | 
      
        | 82 |  |  | 	case NULL:
 | 
      
        | 83 |  |  | 		$type_name = $TEXT['UNKNOWN'];
 | 
      
        | 84 |  |  | 	break;
 | 
      
        | 85 |  |  | 	case 'page':
 | 
      
        | 86 |  |  | 		$type_name = $TEXT['PAGE'];
 | 
      
        | 87 |  |  | 	break;
 | 
      
        | 88 |  |  | 	case 'wysiwyg':
 | 
      
        | 89 |  |  | 		$type_name = $TEXT['WYSIWYG_EDITOR'];
 | 
      
        | 90 |  |  | 	break;
 | 
      
        | 91 |  |  | 	case 'tool':
 | 
      
        | 92 |  |  | 		$type_name = $TEXT['ADMINISTRATION_TOOL'];
 | 
      
        | 93 |  |  | 	break;
 | 
      
        | 94 |  |  | 	case 'admin':
 | 
      
        | 95 |  |  | 		$type_name = $TEXT['ADMIN'];
 | 
      
        | 96 |  |  | 	break;
 | 
      
        | 97 |  |  | 	case 'administration':
 | 
      
        | 98 |  |  | 		$type_name = $TEXT['ADMINISTRATION'];
 | 
      
        | 99 |  |  | 	break;
 | 
      
        | 100 |  |  | 	$type_name = $TEXT['unknown'];
 | 
      
        | 101 | 4 | ryan | }
 | 
      
        | 102 |  |  | $template->set_var('TYPE', $type_name);
 | 
      
        | 103 |  |  | 
 | 
      
        | 104 |  |  | // Insert language headings
 | 
      
        | 105 |  |  | $template->set_var(array(
 | 
      
        | 106 |  |  | 								'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS']
 | 
      
        | 107 |  |  | 								)
 | 
      
        | 108 |  |  | 						);
 | 
      
        | 109 |  |  | // Insert language text and messages
 | 
      
        | 110 |  |  | $template->set_var(array(
 | 
      
        | 111 |  |  | 								'TEXT_NAME' => $TEXT['NAME'],
 | 
      
        | 112 |  |  | 								'TEXT_TYPE' => $TEXT['TYPE'],
 | 
      
        | 113 |  |  | 								'TEXT_AUTHOR' => $TEXT['AUTHOR'],
 | 
      
        | 114 |  |  | 								'TEXT_VERSION' => $TEXT['VERSION'],
 | 
      
        | 115 |  |  | 								'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
 | 
      
        | 116 | 277 | stefan | 								'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
 | 
      
        | 117 |  |  | 								'TEXT_BACK' => $TEXT['BACK']
 | 
      
        | 118 | 4 | ryan | 								)
 | 
      
        | 119 |  |  | 						);
 | 
      
        | 120 |  |  | 
 | 
      
        | 121 |  |  | // Parse module object
 | 
      
        | 122 |  |  | $template->parse('main', 'main_block', false);
 | 
      
        | 123 |  |  | $template->pparse('output', 'page');
 | 
      
        | 124 |  |  | 
 | 
      
        | 125 |  |  | // Print admin footer
 | 
      
        | 126 |  |  | $admin->print_footer();
 | 
      
        | 127 |  |  | 
 | 
      
        | 128 |  |  | ?>
 |