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
// Create new template object
54 1625 Luisehahne
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')));
55 1529 Luisehahne
// $template->debug = true;
56 944 Ruebenwurz
$template->set_file('page', 'languages_details.htt');
57 4 ryan
$template->set_block('page', 'main_block', 'main');
58
59
// Insert values
60
require(WB_PATH.'/languages/'.$code.'.php');
61
$template->set_var(array(
62
								'CODE' => $language_code,
63
								'NAME' => $language_name,
64
								'AUTHOR' => $language_author,
65
								'VERSION' => $language_version,
66 1112 Ruebenwurz
								'DESIGNED_FOR' => $language_platform,
67
								'ADMIN_URL' => ADMIN_URL,
68
								'WB_URL' => WB_URL,
69
								'THEME_URL' => THEME_URL
70 4 ryan
								)
71
						);
72
73
// Restore language to original code
74
require(WB_PATH.'/languages/'.LANGUAGE.'.php');
75
76
// Insert language headings
77
$template->set_var(array(
78
								'HEADING_LANGUAGE_DETAILS' => $HEADING['LANGUAGE_DETAILS']
79
								)
80
						);
81
// Insert language text and messages
82
$template->set_var(array(
83
								'TEXT_CODE' => $TEXT['CODE'],
84
								'TEXT_NAME' => $TEXT['NAME'],
85
								'TEXT_TYPE' => $TEXT['TYPE'],
86
								'TEXT_AUTHOR' => $TEXT['AUTHOR'],
87
								'TEXT_VERSION' => $TEXT['VERSION'],
88 277 stefan
								'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'],
89
								'TEXT_BACK' => $TEXT['BACK']
90 4 ryan
								)
91
						);
92
93
// Parse language object
94
$template->parse('main', 'main_block', false);
95
$template->pparse('output', 'page');
96
97
// Print admin footer
98
$admin->print_footer();