Project

General

Profile

1 4 ryan
<?php
2 1467 Luisehahne
/**
3
 *
4
 * @category        admin
5
 * @package         languages
6 1529 Luisehahne
 * @author          Ryan Djurovich, WebsiteBaker Project
7 1467 Luisehahne
 * @copyright       2009-2011, Website Baker 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$
13
 * @filesource      $HeadURL$
14
 * @lastmodified    $Date$
15
 * @description
16
 *
17
 */
18 4 ryan
19
// Include the config code
20
require('../../config.php');
21
22 1457 Luisehahne
// 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 1467 Luisehahne
	$admin->print_header();
28 1457 Luisehahne
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
29
}
30
// After check print the header
31
$admin->print_header();
32
33 4 ryan
// Get language name
34
if(!isset($_POST['code']) OR $_POST['code'] == "") {
35 1353 FrankH
	$code = '';
36 4 ryan
} else {
37
	$code = $_POST['code'];
38
}
39
40 1353 FrankH
// fix secunia 2010-93-2
41
if (!preg_match('/^[A-Z]{2}$/', $code)) {
42
	header("Location: index.php");
43
	exit(0);
44
}
45
46 4 ryan
// Check if the language exists
47
if(!file_exists(WB_PATH.'/languages/'.$code.'.php')) {
48
	header("Location: index.php");
49 286 stefan
	exit(0);
50 4 ryan
}
51
52 1529 Luisehahne
// Setup template object, parse vars to it, then parse it
53
$ThemePath = realpath(WB_PATH.$admin->correct_theme_source('languages_details.htt'));
54
// Create new template object
55
$template = new Template($ThemePath);
56
// $template->debug = true;
57 944 Ruebenwurz
$template->set_file('page', 'languages_details.htt');
58 4 ryan
$template->set_block('page', 'main_block', 'main');
59
60
// Insert values
61
require(WB_PATH.'/languages/'.$code.'.php');
62
$template->set_var(array(
63
								'CODE' => $language_code,
64
								'NAME' => $language_name,
65
								'AUTHOR' => $language_author,
66
								'VERSION' => $language_version,
67 1112 Ruebenwurz
								'DESIGNED_FOR' => $language_platform,
68
								'ADMIN_URL' => ADMIN_URL,
69
								'WB_URL' => WB_URL,
70
								'THEME_URL' => THEME_URL
71 4 ryan
								)
72
						);
73
74
// Restore language to original code
75
require(WB_PATH.'/languages/'.LANGUAGE.'.php');
76
77
// Insert language headings
78
$template->set_var(array(
79
								'HEADING_LANGUAGE_DETAILS' => $HEADING['LANGUAGE_DETAILS']
80
								)
81
						);
82
// Insert language text and messages
83
$template->set_var(array(
84
								'TEXT_CODE' => $TEXT['CODE'],
85
								'TEXT_NAME' => $TEXT['NAME'],
86
								'TEXT_TYPE' => $TEXT['TYPE'],
87
								'TEXT_AUTHOR' => $TEXT['AUTHOR'],
88
								'TEXT_VERSION' => $TEXT['VERSION'],
89 277 stefan
								'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
90
								'TEXT_BACK' => $TEXT['BACK']
91 4 ryan
								)
92
						);
93
94
// Parse language object
95
$template->parse('main', 'main_block', false);
96
$template->pparse('output', 'page');
97
98
// Print admin footer
99
$admin->print_footer();