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 2098 2014-02-11 01:37:03Z darkviper $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/languages/details.php $
14
 * @lastmodified    $Date: 2014-02-11 02:37:03 +0100 (Tue, 11 Feb 2014) $
15
 * @description
16
 *
17
 */
18

    
19
// *** Helper function *******************************************************************
20
function getInfoFromLanguageFile($sFile)
21
{
22
	$mRetval = array();
23
	$oLang = Translate::getInstance();
24
    $oLang->enableAddon('admin\\languages');
25
    $oReg  = WbAdaptor::getInstance();
26
	// check for valid language code
27
	if(preg_match('/^([A-Z]{2}.php)/', $sFile)) {
28
		if(is_file($oReg->AppPath.'languages/'.$sFile) ) {
29
			if(is_readable($oReg->AppPath.'languages/'.$sFile) ) {
30
				require($oReg->AppPath.'languages/'.$sFile);
31
				$mRetval['CODE'] = $language_code;
32
				$mRetval['NAME'] = $language_name;
33
				$mRetval['AUTHOR'] = $language_author;
34
				$mRetval['VERSION'] = $language_version;
35
				$mRetval['DESIGNED_FOR'] = $language_platform;
36
			}else {
37
				$mRetval = $oLang->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES;
38
			}
39
		}else {
40
			$mRetval = $oLang->MESSAGE_GENERIC_NOT_INSTALLED;
41
		}
42
	}else {
43
		$mRetval= $oLang->MESSAGE_GENERIC_FORGOT_OPTIONS;
44
	}
45
	return $mRetval;
46
}
47
// ***************************************************************************************
48
// Include the config code
49
require('../../config.php');
50
// Print admin header
51
$oLang = Translate::getInstance();
52
$oLang->enableAddon('admin\\languages');
53
require_once(WB_PATH.'/framework/class.admin.php');
54
if(!$admin->checkFTAN()) {
55
	$admin->print_header();
56
	$admin->print_error($oLang->MESSAGE_GENERIC_SECURITY_ACCESS);
57
}
58
// After check print the header
59
$admin->print_header();
60
// Get language code
61
$oLang->enableAddon('admin\\languages');
62
$sFile = (string)$admin->get_post('code').'.php';
63
// Setup template object, parse vars to it, then parse it
64
// Create new template object
65
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')),'keep');
66
// $template->debug = true;
67
$template->set_file('page', 'languages_details.htt');
68
$template->set_block('page', 'main_block', 'main');
69
$template->set_var($oLang->getLangArray());
70
//getinfo
71
$aValues = getInfoFromLanguageFile($sFile);
72
if(!is_array($aValues)) {
73
	$admin->print_error($aValues);
74
}
75
$aValues['ADMIN_URL'] = ADMIN_URL;
76
$aValues['WB_URL']    = WB_URL;
77
$aValues['THEME_URL'] = THEME_URL;
78

    
79
// Insert values
80
$template->set_var($aValues);
81
/*-- insert all needed vars from language files ----------------------------------------*/
82
$template->set_var($oLang->getLangArray());
83

    
84
// Parse language object
85
$template->parse('main', 'main_block', false);
86
$template->pparse('output', 'page');
87
// Print admin footer
88
$admin->print_footer();
(1-1/4)