Revision 1712
Added by Dietmar about 12 years ago
details.php | ||
---|---|---|
4 | 4 |
* @category admin |
5 | 5 |
* @package languages |
6 | 6 |
* @author Ryan Djurovich, WebsiteBaker Project |
7 |
* @copyright 2009-2011, Website Baker Org. e.V.
|
|
7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
|
8 | 8 |
* @link http://www.websitebaker2.org/ |
9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
10 | 10 |
* @platform WebsiteBaker 2.8.x |
... | ... | |
33 | 33 |
// Get language name |
34 | 34 |
if(!isset($_POST['code']) OR $_POST['code'] == "") { |
35 | 35 |
$code = ''; |
36 |
$file = ''; |
|
36 | 37 |
} else { |
37 | 38 |
$code = $_POST['code']; |
39 |
$file = $_POST['code'].'.php'; |
|
38 | 40 |
} |
41 |
// fix secunia 2010-93-2 |
|
42 |
if (!preg_match('/^([A-Z]{2}.php)/', $file)) { |
|
43 |
$admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS']); |
|
44 |
} |
|
39 | 45 |
|
40 |
// fix secunia 2010-93-2 |
|
46 |
// 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 |
|
|
41 | 60 |
if (!preg_match('/^[A-Z]{2}$/', $code)) { |
42 | 61 |
header("Location: index.php"); |
43 | 62 |
exit(0); |
... | ... | |
48 | 67 |
header("Location: index.php"); |
49 | 68 |
exit(0); |
50 | 69 |
} |
70 |
*/ |
|
51 | 71 |
|
52 | 72 |
// Setup template object, parse vars to it, then parse it |
53 | 73 |
// Create new template object |
54 |
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt'))); |
|
74 |
$template = new Template(dirname($admin->correct_theme_source('languages_details.htt')),'keep');
|
|
55 | 75 |
// $template->debug = true; |
56 | 76 |
$template->set_file('page', 'languages_details.htt'); |
57 | 77 |
$template->set_block('page', 'main_block', 'main'); |
58 | 78 |
|
59 | 79 |
// Insert values |
60 |
require(WB_PATH.'/languages/'.$code.'.php');
|
|
80 |
require(WB_PATH.'/languages/'.$file);
|
|
61 | 81 |
$template->set_var(array( |
62 |
'CODE' => $language_code,
|
|
63 |
'NAME' => $language_name,
|
|
64 |
'AUTHOR' => $language_author,
|
|
65 |
'VERSION' => $language_version,
|
|
66 |
'DESIGNED_FOR' => $language_platform,
|
|
67 |
'ADMIN_URL' => ADMIN_URL,
|
|
68 |
'WB_URL' => WB_URL,
|
|
69 |
'THEME_URL' => THEME_URL
|
|
70 |
)
|
|
71 |
);
|
|
82 |
'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 |
); |
|
72 | 92 |
|
73 |
// Restore language to original code
|
|
74 |
require(WB_PATH.'/languages/'.LANGUAGE.'.php');
|
|
93 |
$mLang = ModLanguage::getInstance();
|
|
94 |
$mLang->setLanguage(ADMIN_PATH.'/addons/languages/', LANGUAGE, DEFAULT_LANGUAGE);
|
|
75 | 95 |
|
76 |
// Insert language headings |
|
77 |
$template->set_var(array( |
|
78 |
'HEADING_LANGUAGE_DETAILS' => $HEADING['LANGUAGE_DETAILS'] |
|
79 |
) |
|
80 |
); |
|
81 |
// Insert language text and messages |
|
82 |
$template->set_var(array( |
|
83 |
'TEXT_CODE' => $TEXT['CODE'], |
|
84 |
'TEXT_NAME' => $TEXT['NAME'], |
|
85 |
'TEXT_TYPE' => $TEXT['TYPE'], |
|
86 |
'TEXT_AUTHOR' => $TEXT['AUTHOR'], |
|
87 |
'TEXT_VERSION' => $TEXT['VERSION'], |
|
88 |
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'], |
|
89 |
'TEXT_BACK' => $TEXT['BACK'] |
|
90 |
) |
|
91 |
); |
|
96 |
/*-- insert all needed vars from language files ----------------------------------------*/ |
|
97 |
$template->set_var($mLang->getLangArray()); |
|
92 | 98 |
|
93 | 99 |
// Parse language object |
94 | 100 |
$template->parse('main', 'main_block', false); |
Also available in: Unified diff
! update folder admin/addons admin/skel/htt