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 1921 2013-06-07 12:15:13Z darkviper $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/languages/details.php $
14
 * @lastmodified    $Date: 2013-06-07 14:15:13 +0200 (Fri, 07 Jun 2013) $
15
 * @description
16
 *
17
 */
18

    
19
// *** 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
// Include the config code
47
require('../../config.php');
48
// Print admin header
49
$mLang = Translate::getinstance();
50
$mLang->enableAddon('admin\addons');
51
require_once(WB_PATH.'/framework/class.admin.php');
52
$admin = new admin('Addons', 'languages_view', false);
53
if(!$admin->checkFTAN()) {
54
	$admin->print_header();
55
	$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
56
}
57
// After check print the header
58
$admin->print_header();
59
// Get language code
60
$sFile = (string)$admin->get_post('code').'.php';
61
// Setup template object, parse vars to it, then parse it
62
// Create new template object
63
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')),'keep');
64
// $template->debug = true;
65
$template->set_file('page', 'languages_details.htt');
66
$template->set_block('page', 'main_block', 'main');
67
//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

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

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