Revision 2098
Added by darkviper over 11 years ago
| details.php | ||
|---|---|---|
| 17 | 17 |
|
| 18 | 18 |
// Include the config file |
| 19 | 19 |
require('../../config.php');
|
| 20 |
$mLang = Translate::getInstance();
|
|
| 21 |
$mLang->enableAddon('admin\addons');
|
|
| 20 |
$oTrans = Translate::getInstance();
|
|
| 21 |
$oTrans->enableAddon('admin\\addons');
|
|
| 22 | 22 |
require_once(WB_PATH .'/framework/functions.php'); |
| 23 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 24 | 23 |
// suppress to print the header, so no new FTAN will be set |
| 25 | 24 |
$admin = new admin('Addons', 'templates_view', false);
|
| 26 | 25 |
if( !$admin->checkFTAN() ) |
| 27 | 26 |
{
|
| 28 | 27 |
$admin->print_header(); |
| 29 |
$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
|
|
| 28 |
$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
|
|
| 30 | 29 |
} |
| 31 | 30 |
|
| 32 | 31 |
// After check print the header |
| 33 | 32 |
$admin->print_header(); |
| 34 | 33 |
// Get template name |
| 35 | 34 |
if(!isset($_POST['file']) OR $_POST['file'] == "") {
|
| 36 |
$admin->print_error($mLang->MESSAGE_GENERIC_FORGOT_OPTIONS);
|
|
| 35 |
$admin->print_error($oTrans->MESSAGE_GENERIC_FORGOT_OPTIONS);
|
|
| 37 | 36 |
} else {
|
| 38 | 37 |
$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']); // fix secunia 2010-92-2
|
| 39 | 38 |
} |
| 40 | 39 |
|
| 41 | 40 |
// Check if the template exists |
| 42 | 41 |
if(!is_dir(WB_PATH.'/templates/'.$file)) {
|
| 43 |
$admin->print_error($mLang->MESSAGE_GENERIC_NOT_INSTALLED);
|
|
| 42 |
$admin->print_error($oTrans->MESSAGE_GENERIC_NOT_INSTALLED);
|
|
| 44 | 43 |
} |
| 45 | 44 |
|
| 46 | 45 |
// Check if the template exists |
| 47 | 46 |
if(!is_readable(WB_PATH.'/templates/'.$file)) {
|
| 48 |
$admin->print_error($mLang->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES);
|
|
| 47 |
$admin->print_error($oTrans->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES);
|
|
| 49 | 48 |
} |
| 50 | 49 |
// Print admin header |
| 51 | 50 |
//$admin = new admin('Addons', 'templates_view');
|
| ... | ... | |
| 56 | 55 |
// $template->debug = true; |
| 57 | 56 |
$template->set_file('page', 'templates_details.htt');
|
| 58 | 57 |
$template->set_block('page', 'main_block', 'main');
|
| 58 |
/*-- insert all needed vars from language files ----------------------------------------*/ |
|
| 59 |
$template->set_var($oTrans->getLangArray()); |
|
| 59 | 60 |
$template->set_var('FTAN', $admin->getFTAN());
|
| 60 | 61 |
|
| 61 | 62 |
// Insert values |
| 62 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'");
|
|
| 63 |
$sql = 'SELECT * FROM `'.WbDatabase::getInstance()->TablePrefix.'addons` ' |
|
| 64 |
. 'WHERE `type` = \'template\' AND directory = \''.$file.'\''; |
|
| 65 |
$result = WbDatabase::getInstance()->doQuery($sql); |
|
| 63 | 66 |
if($result->numRows() > 0) {
|
| 64 | 67 |
$row = $result->fetchRow(); |
| 65 | 68 |
} |
| ... | ... | |
| 92 | 95 |
'LICENSE' => $row['license'], |
| 93 | 96 |
) |
| 94 | 97 |
); |
| 95 |
/*-- insert all needed vars from language files ----------------------------------------*/ |
|
| 96 |
$template->set_var($mLang->getLangArray()); |
|
| 97 | 98 |
|
| 98 |
$template->set_var('TEXT_FUNCTION', ($row['function'] == 'theme' ? $mLang->TEXT_THEME : $mLang->TEXT_TEMPLATE));
|
|
| 99 |
$template->set_var('TEXT_FUNCTION', ($row['function'] == 'theme' ? $oTrans->TEXT_THEME : $oTrans->TEXT_TEMPLATE));
|
|
| 99 | 100 |
// Parse template object |
| 100 | 101 |
$template->parse('main', 'main_block', false);
|
| 101 | 102 |
$template->pparse('output', 'page');
|
Also available in: Unified diff
! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate