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 1712 Luisehahne
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 1467 Luisehahne
 * @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 1921 darkviper
// *** 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
// ***************************************************************************************
46 4 ryan
// Include the config code
47
require('../../config.php');
48 1457 Luisehahne
// Print admin header
49 1921 darkviper
$mLang = Translate::getinstance();
50
$mLang->enableAddon('admin\addons');
51 1457 Luisehahne
require_once(WB_PATH.'/framework/class.admin.php');
52
$admin = new admin('Addons', 'languages_view', false);
53 1921 darkviper
if(!$admin->checkFTAN()) {
54 1467 Luisehahne
	$admin->print_header();
55 1921 darkviper
	$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
56 1457 Luisehahne
}
57
// After check print the header
58
$admin->print_header();
59 1921 darkviper
// Get language code
60
$sFile = (string)$admin->get_post('code').'.php';
61 1529 Luisehahne
// Setup template object, parse vars to it, then parse it
62
// Create new template object
63 1712 Luisehahne
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')),'keep');
64 1529 Luisehahne
// $template->debug = true;
65 944 Ruebenwurz
$template->set_file('page', 'languages_details.htt');
66 4 ryan
$template->set_block('page', 'main_block', 'main');
67 1921 darkviper
//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;
75 4 ryan
76
// Insert values
77 1921 darkviper
$template->set_var($aValues);
78 1712 Luisehahne
/*-- insert all needed vars from language files ----------------------------------------*/
79
$template->set_var($mLang->getLangArray());
80 4 ryan
81
// Parse language object
82
$template->parse('main', 'main_block', false);
83
$template->pparse('output', 'page');
84
// Print admin footer
85
$admin->print_footer();