Project

General

Profile

« Previous | Next » 

Revision 587

Added by doc almost 17 years ago

Added multi-lingual Admin tool description. Moved Admin tool language text from global language file to module language files. Added function get_variable_content to allow extraction of variable without including files.

View differences:

details.php
25 25

  
26 26
// Include the config file
27 27
require('../../config.php');
28
require_once(WB_PATH .'/framework/functions.php');
28 29

  
29 30
// Get module name
30 31
if(!isset($_POST['file']) OR $_POST['file'] == "") {
......
55 56
	$module = $result->fetchRow();
56 57
}
57 58

  
58
// 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
		// Check to see if new variable exists... -> $module_description
72
		if (isset($module_description)) {
73
			// Override the module-description with correct desription in users language
74
			$module['description']=$module_description;
75
		}	
76
	}
59
// 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;
77 70
}
78 71

  
79 72
$template->set_var(array(

Also available in: Unified diff