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 |
2091
|
darkviper
|
$mLang = Translate::getInstance();
|
24 |
2020
|
Luisehahne
|
$oReg = WbAdaptor::getInstance();
|
25 |
1921
|
darkviper
|
// check for valid language code
|
26 |
|
|
if(preg_match('/^([A-Z]{2}.php)/', $sFile)) {
|
27 |
2020
|
Luisehahne
|
if(is_file($oReg->AppPath.'languages/'.$sFile) ) {
|
28 |
|
|
if(is_readable($oReg->AppPath.'languages/'.$sFile) ) {
|
29 |
|
|
require($oReg->AppPath.'languages/'.$sFile);
|
30 |
1921
|
darkviper
|
$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 |
4
|
ryan
|
// Include the config code
|
48 |
|
|
require('../../config.php');
|
49 |
1457
|
Luisehahne
|
// Print admin header
|
50 |
2091
|
darkviper
|
$mLang = Translate::getInstance();
|
51 |
1921
|
darkviper
|
$mLang->enableAddon('admin\addons');
|
52 |
1457
|
Luisehahne
|
require_once(WB_PATH.'/framework/class.admin.php');
|
53 |
|
|
$admin = new admin('Addons', 'languages_view', false);
|
54 |
1921
|
darkviper
|
if(!$admin->checkFTAN()) {
|
55 |
1467
|
Luisehahne
|
$admin->print_header();
|
56 |
1921
|
darkviper
|
$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
|
57 |
1457
|
Luisehahne
|
}
|
58 |
|
|
// After check print the header
|
59 |
|
|
$admin->print_header();
|
60 |
1921
|
darkviper
|
// Get language code
|
61 |
|
|
$sFile = (string)$admin->get_post('code').'.php';
|
62 |
1529
|
Luisehahne
|
// Setup template object, parse vars to it, then parse it
|
63 |
|
|
// Create new template object
|
64 |
1712
|
Luisehahne
|
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')),'keep');
|
65 |
1529
|
Luisehahne
|
// $template->debug = true;
|
66 |
944
|
Ruebenwurz
|
$template->set_file('page', 'languages_details.htt');
|
67 |
4
|
ryan
|
$template->set_block('page', 'main_block', 'main');
|
68 |
1921
|
darkviper
|
//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 |
4
|
ryan
|
|
77 |
|
|
// Insert values
|
78 |
1921
|
darkviper
|
$template->set_var($aValues);
|
79 |
1712
|
Luisehahne
|
/*-- insert all needed vars from language files ----------------------------------------*/
|
80 |
|
|
$template->set_var($mLang->getLangArray());
|
81 |
4
|
ryan
|
|
82 |
|
|
// Parse language object
|
83 |
|
|
$template->parse('main', 'main_block', false);
|
84 |
|
|
$template->pparse('output', 'page');
|
85 |
|
|
// Print admin footer
|
86 |
|
|
$admin->print_footer();
|