| 1 | 4 | ryan | <?php
 | 
      
        | 2 |  |  | 
 | 
      
        | 3 | 223 | stefan | // $Id$
 | 
      
        | 4 | 4 | ryan | 
 | 
      
        | 5 |  |  | /*
 | 
      
        | 6 |  |  | 
 | 
      
        | 7 |  |  |  Website Baker Project <http://www.websitebaker.org/>
 | 
      
        | 8 | 399 | Ruebenwurz |  Copyright (C) 2004-2007, 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 |  |  | 
 | 
      
        | 29 |  |  | // Get module name
 | 
      
        | 30 |  |  | if(!isset($_POST['file']) OR $_POST['file'] == "") {
 | 
      
        | 31 |  |  | 	header("Location: index.php");
 | 
      
        | 32 | 286 | stefan | 	exit(0);
 | 
      
        | 33 | 4 | ryan | } else {
 | 
      
        | 34 |  |  | 	$file = $_POST['file'];
 | 
      
        | 35 |  |  | }
 | 
      
        | 36 |  |  | 
 | 
      
        | 37 |  |  | // Check if the module exists
 | 
      
        | 38 |  |  | if(!file_exists(WB_PATH.'/modules/'.$file)) {
 | 
      
        | 39 |  |  | 	header("Location: index.php");
 | 
      
        | 40 | 286 | stefan | 	exit(0);
 | 
      
        | 41 | 4 | ryan | }
 | 
      
        | 42 |  |  | 
 | 
      
        | 43 |  |  | // Print admin header
 | 
      
        | 44 |  |  | require_once(WB_PATH.'/framework/class.admin.php');
 | 
      
        | 45 |  |  | $admin = new admin('Addons', 'modules_view');
 | 
      
        | 46 |  |  | 
 | 
      
        | 47 |  |  | // Setup module object
 | 
      
        | 48 |  |  | $template = new Template(ADMIN_PATH.'/modules');
 | 
      
        | 49 |  |  | $template->set_file('page', 'details.html');
 | 
      
        | 50 |  |  | $template->set_block('page', 'main_block', 'main');
 | 
      
        | 51 |  |  | 
 | 
      
        | 52 |  |  | // Insert values
 | 
      
        | 53 | 223 | stefan | $result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND directory = '$file'");
 | 
      
        | 54 |  |  | if($result->numRows() > 0) {
 | 
      
        | 55 |  |  | 	$module = $result->fetchRow();
 | 
      
        | 56 |  |  | }
 | 
      
        | 57 |  |  | 
 | 
      
        | 58 | 421 | Ruebenwurz | // Get language description if available
 | 
      
        | 59 |  |  | // First get users defined language
 | 
      
        | 60 |  |  | $query = "SELECT language FROM ".TABLE_PREFIX."users WHERE user_id = '".$admin->get_user_id()."'";
 | 
      
        | 61 |  |  | $results = $database->query($query);
 | 
      
        | 62 |  |  | if($results->numRows() > 0) {
 | 
      
        | 63 |  |  | 	// We found a language for the user, store it
 | 
      
        | 64 |  |  | 	$user_info=$results->fetchRow();
 | 
      
        | 65 |  |  | 	$user_language = $user_info['language'];
 | 
      
        | 66 |  |  | 
 | 
      
        | 67 |  |  | 	// Next check for language file in module dir and insert the variables from that file
 | 
      
        | 68 |  |  | 	if(file_exists(WB_PATH.'/modules/'.$file.'/languages/'.$user_language.'.php')) {
 | 
      
        | 69 |  |  | 		require(WB_PATH.'/modules/'.$file.'/languages/'.$user_language.'.php');
 | 
      
        | 70 |  |  | 
 | 
      
        | 71 | 439 | Ruebenwurz | 		// Check to see if new variable exists... -> $module_description
 | 
      
        | 72 |  |  | 		if (isset($module_description)) {
 | 
      
        | 73 | 421 | Ruebenwurz | 			// Override the module-description with correct desription in users language
 | 
      
        | 74 | 439 | Ruebenwurz | 			$module['description']=$module_description;
 | 
      
        | 75 | 421 | Ruebenwurz | 		}
 | 
      
        | 76 |  |  | 	}
 | 
      
        | 77 |  |  | }
 | 
      
        | 78 |  |  | 
 | 
      
        | 79 | 4 | ryan | $template->set_var(array(
 | 
      
        | 80 | 223 | stefan | 								'NAME' => $module['name'],
 | 
      
        | 81 |  |  | 								'AUTHOR' => $module['author'],
 | 
      
        | 82 |  |  | 								'DESCRIPTION' => $module['description'],
 | 
      
        | 83 |  |  | 								'VERSION' => $module['version'],
 | 
      
        | 84 |  |  | 								'DESIGNED_FOR' => $module['platform']
 | 
      
        | 85 | 4 | ryan | 								)
 | 
      
        | 86 |  |  | 						);
 | 
      
        | 87 | 223 | stefan | 
 | 
      
        | 88 |  |  | switch ($module['function']) {
 | 
      
        | 89 |  |  | 	case NULL:
 | 
      
        | 90 |  |  | 		$type_name = $TEXT['UNKNOWN'];
 | 
      
        | 91 |  |  | 	break;
 | 
      
        | 92 |  |  | 	case 'page':
 | 
      
        | 93 |  |  | 		$type_name = $TEXT['PAGE'];
 | 
      
        | 94 |  |  | 	break;
 | 
      
        | 95 |  |  | 	case 'wysiwyg':
 | 
      
        | 96 |  |  | 		$type_name = $TEXT['WYSIWYG_EDITOR'];
 | 
      
        | 97 |  |  | 	break;
 | 
      
        | 98 |  |  | 	case 'tool':
 | 
      
        | 99 |  |  | 		$type_name = $TEXT['ADMINISTRATION_TOOL'];
 | 
      
        | 100 |  |  | 	break;
 | 
      
        | 101 |  |  | 	case 'admin':
 | 
      
        | 102 |  |  | 		$type_name = $TEXT['ADMIN'];
 | 
      
        | 103 |  |  | 	break;
 | 
      
        | 104 |  |  | 	case 'administration':
 | 
      
        | 105 |  |  | 		$type_name = $TEXT['ADMINISTRATION'];
 | 
      
        | 106 |  |  | 	break;
 | 
      
        | 107 |  |  | 	$type_name = $TEXT['unknown'];
 | 
      
        | 108 | 4 | ryan | }
 | 
      
        | 109 |  |  | $template->set_var('TYPE', $type_name);
 | 
      
        | 110 |  |  | 
 | 
      
        | 111 |  |  | // Insert language headings
 | 
      
        | 112 |  |  | $template->set_var(array(
 | 
      
        | 113 |  |  | 								'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS']
 | 
      
        | 114 |  |  | 								)
 | 
      
        | 115 |  |  | 						);
 | 
      
        | 116 |  |  | // Insert language text and messages
 | 
      
        | 117 |  |  | $template->set_var(array(
 | 
      
        | 118 |  |  | 								'TEXT_NAME' => $TEXT['NAME'],
 | 
      
        | 119 |  |  | 								'TEXT_TYPE' => $TEXT['TYPE'],
 | 
      
        | 120 |  |  | 								'TEXT_AUTHOR' => $TEXT['AUTHOR'],
 | 
      
        | 121 |  |  | 								'TEXT_VERSION' => $TEXT['VERSION'],
 | 
      
        | 122 |  |  | 								'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
 | 
      
        | 123 | 277 | stefan | 								'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
 | 
      
        | 124 |  |  | 								'TEXT_BACK' => $TEXT['BACK']
 | 
      
        | 125 | 4 | ryan | 								)
 | 
      
        | 126 |  |  | 						);
 | 
      
        | 127 |  |  | 
 | 
      
        | 128 |  |  | // Parse module object
 | 
      
        | 129 |  |  | $template->parse('main', 'main_block', false);
 | 
      
        | 130 |  |  | $template->pparse('output', 'page');
 | 
      
        | 131 |  |  | 
 | 
      
        | 132 |  |  | // Print admin footer
 | 
      
        | 133 |  |  | $admin->print_footer();
 | 
      
        | 134 |  |  | 
 | 
      
        | 135 |  |  | ?>
 |