| 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 |
|
|
// Include the config code
|
| 20 |
|
|
require('../../config.php');
|
| 21 |
|
|
|
| 22 |
1457
|
Luisehahne
|
// Print admin header
|
| 23 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
| 24 |
|
|
$admin = new admin('Addons', 'languages_view', false);
|
| 25 |
|
|
if( !$admin->checkFTAN() )
|
| 26 |
|
|
{
|
| 27 |
1467
|
Luisehahne
|
$admin->print_header();
|
| 28 |
1457
|
Luisehahne
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
| 29 |
|
|
}
|
| 30 |
|
|
// After check print the header
|
| 31 |
|
|
$admin->print_header();
|
| 32 |
|
|
|
| 33 |
4
|
ryan
|
// Get language name
|
| 34 |
|
|
if(!isset($_POST['code']) OR $_POST['code'] == "") {
|
| 35 |
1353
|
FrankH
|
$code = '';
|
| 36 |
1712
|
Luisehahne
|
$file = '';
|
| 37 |
4
|
ryan
|
} else {
|
| 38 |
|
|
$code = $_POST['code'];
|
| 39 |
1712
|
Luisehahne
|
$file = $_POST['code'].'.php';
|
| 40 |
4
|
ryan
|
}
|
| 41 |
1712
|
Luisehahne
|
// fix secunia 2010-93-2
|
| 42 |
|
|
if (!preg_match('/^([A-Z]{2}.php)/', $file)) {
|
| 43 |
|
|
$admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS']);
|
| 44 |
|
|
}
|
| 45 |
4
|
ryan
|
|
| 46 |
1712
|
Luisehahne
|
// Check if the template exists
|
| 47 |
|
|
if(!is_file(WB_PATH.'/languages/'.$file) ) {
|
| 48 |
|
|
$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']);
|
| 49 |
|
|
}
|
| 50 |
|
|
|
| 51 |
|
|
// Check if the template exists
|
| 52 |
|
|
if(!is_readable(WB_PATH.'/languages/'.$file) ) {
|
| 53 |
|
|
$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
|
| 54 |
|
|
}
|
| 55 |
|
|
|
| 56 |
|
|
/*
|
| 57 |
|
|
print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong> basename: '.basename(__FILE__).' line: '.__LINE__.' -> <br />';
|
| 58 |
|
|
print_r( $file ); print '</pre>'; // flush ();sleep(10); die();
|
| 59 |
|
|
|
| 60 |
1353
|
FrankH
|
if (!preg_match('/^[A-Z]{2}$/', $code)) {
|
| 61 |
|
|
header("Location: index.php");
|
| 62 |
|
|
exit(0);
|
| 63 |
|
|
}
|
| 64 |
|
|
|
| 65 |
4
|
ryan
|
// Check if the language exists
|
| 66 |
|
|
if(!file_exists(WB_PATH.'/languages/'.$code.'.php')) {
|
| 67 |
|
|
header("Location: index.php");
|
| 68 |
286
|
stefan
|
exit(0);
|
| 69 |
4
|
ryan
|
}
|
| 70 |
1712
|
Luisehahne
|
*/
|
| 71 |
4
|
ryan
|
|
| 72 |
1529
|
Luisehahne
|
// Setup template object, parse vars to it, then parse it
|
| 73 |
|
|
// Create new template object
|
| 74 |
1712
|
Luisehahne
|
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')),'keep');
|
| 75 |
1529
|
Luisehahne
|
// $template->debug = true;
|
| 76 |
944
|
Ruebenwurz
|
$template->set_file('page', 'languages_details.htt');
|
| 77 |
4
|
ryan
|
$template->set_block('page', 'main_block', 'main');
|
| 78 |
|
|
|
| 79 |
|
|
// Insert values
|
| 80 |
1712
|
Luisehahne
|
require(WB_PATH.'/languages/'.$file);
|
| 81 |
4
|
ryan
|
$template->set_var(array(
|
| 82 |
1712
|
Luisehahne
|
'CODE' => $language_code,
|
| 83 |
|
|
'NAME' => $language_name,
|
| 84 |
|
|
'AUTHOR' => $language_author,
|
| 85 |
|
|
'VERSION' => $language_version,
|
| 86 |
|
|
'DESIGNED_FOR' => $language_platform,
|
| 87 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
| 88 |
|
|
'WB_URL' => WB_URL,
|
| 89 |
|
|
'THEME_URL' => THEME_URL
|
| 90 |
|
|
)
|
| 91 |
|
|
);
|
| 92 |
4
|
ryan
|
|
| 93 |
1712
|
Luisehahne
|
$mLang = ModLanguage::getInstance();
|
| 94 |
|
|
$mLang->setLanguage(ADMIN_PATH.'/addons/languages/', LANGUAGE, DEFAULT_LANGUAGE);
|
| 95 |
4
|
ryan
|
|
| 96 |
1712
|
Luisehahne
|
/*-- insert all needed vars from language files ----------------------------------------*/
|
| 97 |
|
|
$template->set_var($mLang->getLangArray());
|
| 98 |
4
|
ryan
|
|
| 99 |
|
|
// Parse language object
|
| 100 |
|
|
$template->parse('main', 'main_block', false);
|
| 101 |
|
|
$template->pparse('output', 'page');
|
| 102 |
|
|
|
| 103 |
|
|
// Print admin footer
|
| 104 |
|
|
$admin->print_footer();
|