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