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 2020 2013-12-06 03:55:35Z Luisehahne $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/languages/details.php $
14
 * @lastmodified    $Date: 2013-12-06 04:55:35 +0100 (Fri, 06 Dec 2013) $
15
 * @description
16
 *
17
 */
18

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

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

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