Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         languages
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: details.php 1712 2012-08-29 11:59:57Z Luisehahne $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/languages/details.php $
14
 * @lastmodified    $Date: 2012-08-29 13:59:57 +0200 (Wed, 29 Aug 2012) $
15
 * @description
16
 *
17
 */
18

    
19
// Include the config code
20
require('../../config.php');
21

    
22
// Print admin header
23
require_once(WB_PATH.'/framework/class.admin.php');
24
$admin = new admin('Addons', 'languages_view', false);
25
if( !$admin->checkFTAN() )
26
{
27
	$admin->print_header();
28
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
29
}
30
// After check print the header
31
$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

    
72
// Setup template object, parse vars to it, then parse it
73
// Create new template object
74
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')),'keep');
75
// $template->debug = true;
76
$template->set_file('page', 'languages_details.htt');
77
$template->set_block('page', 'main_block', 'main');
78

    
79
// 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

    
96
/*-- insert all needed vars from language files ----------------------------------------*/
97
$template->set_var($mLang->getLangArray());
98

    
99
// Parse language object
100
$template->parse('main', 'main_block', false);
101
$template->pparse('output', 'page');
102

    
103
// Print admin footer
104
$admin->print_footer();
(1-1/4)