1 |
1457
|
Luisehahne
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category admin
|
5 |
|
|
* @package addons
|
6 |
1529
|
Luisehahne
|
* @author Ryan Djurovich, WebsiteBaker Project
|
7 |
1457
|
Luisehahne
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
8 |
|
|
* @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 |
|
|
*
|
16 |
|
|
*/
|
17 |
|
|
|
18 |
|
|
require('../../config.php');
|
19 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
20 |
|
|
$admin = new admin('Addons', 'addons');
|
21 |
|
|
|
22 |
1529
|
Luisehahne
|
// Setup template object, parse vars to it, then parse it
|
23 |
|
|
// Create new template object
|
24 |
1625
|
Luisehahne
|
$template = new Template(dirname($admin->correct_theme_source('addons.htt')));
|
25 |
1457
|
Luisehahne
|
$template->set_file('page', 'addons.htt');
|
26 |
|
|
$template->set_block('page', 'main_block', 'main');
|
27 |
2098
|
darkviper
|
$oTrans = Translate::getInstance();
|
28 |
|
|
$oTrans->enableAddon('admin\\addons');
|
29 |
|
|
$template->set_var($oTrans->getLangArray());
|
30 |
1457
|
Luisehahne
|
|
31 |
|
|
// Insert values into the template object
|
32 |
|
|
$template->set_var(array(
|
33 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
34 |
|
|
'THEME_URL' => THEME_URL,
|
35 |
2098
|
darkviper
|
'WB_URL' => WB_URL
|
36 |
1457
|
Luisehahne
|
)
|
37 |
|
|
);
|
38 |
|
|
|
39 |
|
|
/**
|
40 |
|
|
* Setting up the blocks
|
41 |
|
|
*/
|
42 |
|
|
$template->set_block('main_block', "modules_block", "modules");
|
43 |
|
|
$template->set_block('main_block', "templates_block", "templates");
|
44 |
|
|
$template->set_block('main_block', "languages_block", "languages");
|
45 |
|
|
$template->set_block('main_block', "reload_block", "reload");
|
46 |
|
|
|
47 |
|
|
/**
|
48 |
|
|
* Insert permission values into the template object
|
49 |
|
|
* Obsolete as we are using blocks ... see "parsing the blocks" section
|
50 |
|
|
*/
|
51 |
|
|
$display_none = "style=\"display: none;\"";
|
52 |
1643
|
darkviper
|
if($admin->get_permission('modules') != true) { $template->set_var('DISPLAY_MODULES', $display_none); }
|
53 |
|
|
if($admin->get_permission('templates') != true) { $template->set_var('DISPLAY_TEMPLATES', $display_none); }
|
54 |
|
|
if($admin->get_permission('languages') != true) { $template->set_var('DISPLAY_LANGUAGES', $display_none); }
|
55 |
1789
|
Luisehahne
|
if($admin->get_permission('modules_advanced') != true) { $template->set_var('DISPLAY_ADVANCED', $display_none); }
|
56 |
1457
|
Luisehahne
|
|
57 |
1789
|
Luisehahne
|
if(!isset($_GET['advanced']) || $admin->get_permission('modules_advanced') != true) {
|
58 |
1457
|
Luisehahne
|
$template->set_var('DISPLAY_RELOAD', $display_none);
|
59 |
1643
|
darkviper
|
}
|
60 |
1457
|
Luisehahne
|
/**
|
61 |
|
|
* Insert section names and descriptions
|
62 |
|
|
*/
|
63 |
|
|
$template->set_var(array(
|
64 |
2098
|
darkviper
|
'ADDONS_OVERVIEW' => $oTrans->MENU_ADDONS,
|
65 |
|
|
'FTAN' => $admin->getFTAN(),
|
66 |
|
|
'MODULES' => $oTrans->MENU_MODULES,
|
67 |
|
|
'TEMPLATES' => $oTrans->MENU_TEMPLATES,
|
68 |
|
|
'LANGUAGES' => $oTrans->MENU_LANGUAGES,
|
69 |
|
|
'MODULES_OVERVIEW' => $oTrans->OVERVIEW_MODULES,
|
70 |
|
|
'TEMPLATES_OVERVIEW' => $oTrans->OVERVIEW_TEMPLATES,
|
71 |
|
|
'LANGUAGES_OVERVIEW' => $oTrans->OVERVIEW_LANGUAGES,
|
72 |
|
|
'TXT_ADMIN_SETTINGS' => $oTrans->TEXT_ADMIN . ' ' . $oTrans->TEXT_SETTINGS,
|
73 |
|
|
'MESSAGE_RELOAD_ADDONS' => $oTrans->MESSAGE_ADDON_RELOAD,
|
74 |
|
|
'TEXT_RELOAD' => $oTrans->TEXT_RELOAD,
|
75 |
1789
|
Luisehahne
|
|
76 |
2098
|
darkviper
|
'RELOAD_URL' => ADMIN_URL . '/addons/reload.php',
|
77 |
|
|
'URL_ADVANCED' => $admin->get_permission('modules_advanced')
|
78 |
|
|
? '<a href="' . ADMIN_URL . '/addons/index.php?advanced">' . $oTrans->TEXT_ADVANCED . '</a>' : '',
|
79 |
|
|
'ADVANCED_URL' => $admin->get_permission('modules_advanced') ? ADMIN_URL . '/addons/index.php' : '',
|
80 |
|
|
'TEXT_ADVANCED' => $oTrans->TEXT_ADVANCED,
|
81 |
|
|
'TEXT_EMPTY' => ' ',
|
82 |
1457
|
Luisehahne
|
)
|
83 |
|
|
);
|
84 |
|
|
|
85 |
|
|
/**
|
86 |
|
|
* Parsing the blocks ...
|
87 |
|
|
*/
|
88 |
1643
|
darkviper
|
if ( $admin->get_permission('modules') == true) { $template->parse('main_block', "modules_block", true); }
|
89 |
|
|
if ( $admin->get_permission('templates') == true) { $template->parse('main_block', "templates_block", true); }
|
90 |
|
|
if ( $admin->get_permission('languages') == true) { $template->parse('main_block', "languages_block", true); }
|
91 |
|
|
// start advanced block
|
92 |
1789
|
Luisehahne
|
if ( isset($_GET['advanced']) AND $admin->get_permission('modules_advanced') == true) {
|
93 |
1643
|
darkviper
|
$template->set_var(array(
|
94 |
2098
|
darkviper
|
'TXT_THEME_COPY_CURRENT' => $oTrans->TEXT_THEME_COPY_CURRENT,
|
95 |
|
|
'TXT_THEME_NEW_NAME' => $oTrans->TEXT_THEME_NEW_NAME,
|
96 |
|
|
'TXT_THEME_CURRENT' => $oTrans->TEXT_THEME_CURRENT,
|
97 |
|
|
'TXT_THEME_START_COPY' => $oTrans->TEXT_THEME_START_COPY,
|
98 |
|
|
'TXT_THEME_IMPORT_HTT' => $oTrans->TEXT_THEME_IMPORT_HTT,
|
99 |
|
|
'TXT_THEME_SELECT_HTT' => $oTrans->TEXT_THEME_SELECT_HTT,
|
100 |
|
|
'TXT_THEME_NOMORE_HTT' => $oTrans->TEXT_THEME_NOMORE_HTT,
|
101 |
|
|
'TXT_THEME_START_IMPORT' => $oTrans->TEXT_THEME_START_IMPORT,
|
102 |
1643
|
darkviper
|
)
|
103 |
|
|
);
|
104 |
|
|
// start copy current theme
|
105 |
|
|
$sql = 'SELECT `name` FROM `'.TABLE_PREFIX.'addons` '
|
106 |
|
|
. 'WHERE `directory`=\''.DEFAULT_THEME.'\' AND `function`=\'theme\'';
|
107 |
|
|
$tmp = $database->get_one($sql);
|
108 |
|
|
$template->set_var('THEME_DEFAULT_NAME', $tmp);
|
109 |
1651
|
darkviper
|
$template->set_var('CURRENT_THEME', $tmp);
|
110 |
|
|
$tmp = str_replace(str_replace('\\', '/', WB_PATH), '', str_replace('\\', '/', THEME_PATH));
|
111 |
|
|
$template->set_var('THEME_PATH', $tmp);
|
112 |
1643
|
darkviper
|
// end copy current theme
|
113 |
|
|
// start template import
|
114 |
|
|
include(dirname(__FILE__).'/CopyThemeHtt.php');
|
115 |
1648
|
darkviper
|
$aTplList = CopyThemeHtt::getDivList(ADMIN_PATH.'/skel/themes/htt',
|
116 |
1643
|
darkviper
|
THEME_PATH.'/templates', 'htt');
|
117 |
|
|
$sOptionList = '';
|
118 |
|
|
if(sizeof($aTplList)) {
|
119 |
|
|
foreach($aTplList as $key=>$val) {
|
120 |
|
|
$sOptionList .= '<option value="'.$val.'">'.$key.'</option>'."\n";
|
121 |
|
|
}
|
122 |
|
|
}else {
|
123 |
2098
|
darkviper
|
$sOptionList = '<option value="none">'.$oTrans->TEXT_THEME_NOMORE_HTT.'</option>'."\n";
|
124 |
1643
|
darkviper
|
}
|
125 |
|
|
$template->set_var('THEME_TEMPLATE_LIST', $sOptionList);
|
126 |
|
|
// end template import
|
127 |
|
|
$template->parse('main_block', "reload_block", true);
|
128 |
|
|
}
|
129 |
|
|
// end advanced block
|
130 |
1457
|
Luisehahne
|
|
131 |
|
|
/**
|
132 |
|
|
* Parse template object
|
133 |
|
|
*/
|
134 |
|
|
$template->parse('main', 'main_block', false);
|
135 |
|
|
$template->pparse('output', 'page');
|
136 |
|
|
|
137 |
|
|
/**
|
138 |
|
|
* Print admin footer
|
139 |
|
|
*/
|
140 |
|
|
$admin->print_footer();
|