Project

General

Profile

« Previous | Next » 

Revision 1921

Added by darkviper over 11 years ago

in /admin/languages some little corrections

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14

  
14
07 Jun-2013 Build 1921 Werner v.d.Decken(DarkViper)
15
! /admin/languages  some little corrections
15 16
07 Jun-2013 Build 1920 Dietmar Woellbrink (Luisehahne)
16 17
! /modules/admin.php $sSectionIdPrefix
17 18
! /admin/media/upload.php change $database->query($sql) to $database->get_one($sql)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1920');
54
if(!defined('REVISION')) define('REVISION', '1921');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/admin/languages/details.php
16 16
 *
17 17
 */
18 18

  
19
// *** Helper function *******************************************************************
20
function getInfoFromLanguageFile($sFile)
21
{
22
	$mRetval = array();
23
	$mLang = Translate::getinstance();
24
	// check for valid language code
25
	if(preg_match('/^([A-Z]{2}.php)/', $sFile)) {
26
		if(is_file(WB_PATH.'/languages/'.$sFile) ) {
27
			if(is_readable(WB_PATH.'/languages/'.$sFile) ) {
28
				require_once(WB_PATH.'/languages/'.$sFile);
29
				$mRetval['CODE'] = $language_code;
30
				$mRetval['NAME'] = $language_name;
31
				$mRetval['AUTHOR'] = $language_author;
32
				$mRetval['VERSION'] = $language_version;
33
				$mRetval['DESIGNED_FOR'] = $language_platform;
34
			}else {
35
				$mRetval = $mLang->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES;
36
			}
37
		}else {
38
			$mRetval = $mLang->MESSAGE_GENERIC_NOT_INSTALLED;
39
		}
40
	}else {
41
		$mRetval= $mLang->MESSAGE_GENERIC_FORGOT_OPTIONS;
42
	}
43
	return $mRetval;
44
}
45
// ***************************************************************************************
19 46
// Include the config code
20 47
require('../../config.php');
21

  
22 48
// Print admin header
49
$mLang = Translate::getinstance();
50
$mLang->enableAddon('admin\addons');
23 51
require_once(WB_PATH.'/framework/class.admin.php');
24 52
$admin = new admin('Addons', 'languages_view', false);
25
if( !$admin->checkFTAN() )
26
{
53
if(!$admin->checkFTAN()) {
27 54
	$admin->print_header();
28
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
55
	$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
29 56
}
30 57
// After check print the header
31 58
$admin->print_header();
32

  
33
// Get language name
34
if(!isset($_POST['code']) OR $_POST['code'] == "") {
35
	$code = '';
36
	$file = '';
37
} else {
38
	$code = $_POST['code'];
39
	$file = $_POST['code'].'.php';
40
}
41
// fix secunia 2010-93-2
42
if (!preg_match('/^([A-Z]{2}.php)/', $file)) {
43
	$admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS']);
44
}
45

  
46
// Check if the template exists
47
if(!is_file(WB_PATH.'/languages/'.$file) ) {
48
	$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']);
49
}
50

  
51
// Check if the template exists
52
if(!is_readable(WB_PATH.'/languages/'.$file) ) {
53
	$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
54
}
55

  
56
/*
57
print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong>  basename: '.basename(__FILE__).'  line: '.__LINE__.' -> <br />';
58
print_r( $file ); print '</pre>'; // flush ();sleep(10); die();
59

  
60
if (!preg_match('/^[A-Z]{2}$/', $code)) {
61
	header("Location: index.php");
62
	exit(0);
63
}
64

  
65
// Check if the language exists
66
if(!file_exists(WB_PATH.'/languages/'.$code.'.php')) {
67
	header("Location: index.php");
68
	exit(0);
69
}
70
*/
71

  
59
// Get language code
60
$sFile = (string)$admin->get_post('code').'.php';
72 61
// Setup template object, parse vars to it, then parse it
73 62
// Create new template object
74 63
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')),'keep');
75 64
// $template->debug = true;
76 65
$template->set_file('page', 'languages_details.htt');
77 66
$template->set_block('page', 'main_block', 'main');
67
//getinfo
68
$aValues = getInfoFromLanguageFile($sFile);
69
if(!is_array($aValues)) {
70
	$admin->print_error($aValues);
71
}
72
$aValues['ADMIN_URL'] = ADMIN_URL;
73
$aValues['WB_URL']    = WB_URL;
74
$aValues['THEME_URL'] = THEME_URL;
78 75

  
79 76
// Insert values
80
require(WB_PATH.'/languages/'.$file);
81
$template->set_var(array(
82
						'CODE' => $language_code,
83
						'NAME' => $language_name,
84
						'AUTHOR' => $language_author,
85
						'VERSION' => $language_version,
86
						'DESIGNED_FOR' => $language_platform,
87
						'ADMIN_URL' => ADMIN_URL,
88
						'WB_URL' => WB_URL,
89
						'THEME_URL' => THEME_URL
90
						)
91
				);
92

  
93
//$mLang = ModLanguage::getInstance();
94
//$mLang->setLanguage(ADMIN_PATH.'/addons/languages/', LANGUAGE, DEFAULT_LANGUAGE);
95
$mLang = Translate::getinstance();
96
$mLang->enableAddon('admin\addons');
97

  
77
$template->set_var($aValues);
98 78
/*-- insert all needed vars from language files ----------------------------------------*/
99 79
$template->set_var($mLang->getLangArray());
100 80

  
101 81
// Parse language object
102 82
$template->parse('main', 'main_block', false);
103 83
$template->pparse('output', 'page');
104

  
105 84
// Print admin footer
106 85
$admin->print_footer();
branches/2.8.x/wb/admin/languages/index.php
79 79
// Parse template object
80 80
$template->parse('main', 'main_block', false);
81 81
$template->pparse('output', 'page');
82

  
82
$mLang->disableAddon();
83 83
// Print admin footer
84 84
$admin->print_footer();

Also available in: Unified diff