1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package addons
|
6
|
* @author Ryan Djurovich, WebsiteBaker Project
|
7
|
* @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: index.php 1789 2012-10-14 10:17:38Z Luisehahne $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/addons/index.php $
|
14
|
* @lastmodified $Date: 2012-10-14 12:17:38 +0200 (Sun, 14 Oct 2012) $
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
require('../../config.php');
|
19
|
require_once(WB_PATH.'/framework/class.admin.php');
|
20
|
$admin = new admin('Addons', 'addons');
|
21
|
|
22
|
// Setup template object, parse vars to it, then parse it
|
23
|
// Create new template object
|
24
|
$template = new Template(dirname($admin->correct_theme_source('addons.htt')));
|
25
|
$template->set_file('page', 'addons.htt');
|
26
|
$template->set_block('page', 'main_block', 'main');
|
27
|
|
28
|
// Insert values into the template object
|
29
|
$template->set_var(array(
|
30
|
'ADMIN_URL' => ADMIN_URL,
|
31
|
'THEME_URL' => THEME_URL,
|
32
|
'WB_URL' => WB_URL
|
33
|
)
|
34
|
);
|
35
|
|
36
|
/**
|
37
|
* Setting up the blocks
|
38
|
*/
|
39
|
$template->set_block('main_block', "modules_block", "modules");
|
40
|
$template->set_block('main_block', "templates_block", "templates");
|
41
|
$template->set_block('main_block', "languages_block", "languages");
|
42
|
$template->set_block('main_block', "reload_block", "reload");
|
43
|
|
44
|
/**
|
45
|
* Insert permission values into the template object
|
46
|
* Obsolete as we are using blocks ... see "parsing the blocks" section
|
47
|
*/
|
48
|
$display_none = "style=\"display: none;\"";
|
49
|
if($admin->get_permission('modules') != true) { $template->set_var('DISPLAY_MODULES', $display_none); }
|
50
|
if($admin->get_permission('templates') != true) { $template->set_var('DISPLAY_TEMPLATES', $display_none); }
|
51
|
if($admin->get_permission('languages') != true) { $template->set_var('DISPLAY_LANGUAGES', $display_none); }
|
52
|
if($admin->get_permission('modules_advanced') != true) { $template->set_var('DISPLAY_ADVANCED', $display_none); }
|
53
|
|
54
|
if(!isset($_GET['advanced']) || $admin->get_permission('modules_advanced') != true) {
|
55
|
$template->set_var('DISPLAY_RELOAD', $display_none);
|
56
|
}
|
57
|
/**
|
58
|
* Insert section names and descriptions
|
59
|
*/
|
60
|
$template->set_var(array(
|
61
|
'ADDONS_OVERVIEW' => $MENU['ADDONS'],
|
62
|
'FTAN'=> $admin->getFTAN(),
|
63
|
'MODULES' => $MENU['MODULES'],
|
64
|
'TEMPLATES' => $MENU['TEMPLATES'],
|
65
|
'LANGUAGES' => $MENU['LANGUAGES'],
|
66
|
'MODULES_OVERVIEW' => $OVERVIEW['MODULES'],
|
67
|
'TEMPLATES_OVERVIEW' => $OVERVIEW['TEMPLATES'],
|
68
|
'LANGUAGES_OVERVIEW' => $OVERVIEW['LANGUAGES'],
|
69
|
'TXT_ADMIN_SETTINGS' => $TEXT['ADMIN'] . ' ' . $TEXT['SETTINGS'],
|
70
|
'MESSAGE_RELOAD_ADDONS' => $MESSAGE['ADDON_RELOAD'],
|
71
|
'TEXT_RELOAD' => $TEXT['RELOAD'],
|
72
|
|
73
|
'RELOAD_URL' => ADMIN_URL . '/addons/reload.php',
|
74
|
'URL_ADVANCED' => $admin->get_permission('modules_advanced')
|
75
|
? '<a href="' . ADMIN_URL . '/addons/index.php?advanced">' . $TEXT['ADVANCED'] . '</a>' : '',
|
76
|
'ADVANCED_URL' => $admin->get_permission('modules_advanced') ? ADMIN_URL . '/addons/index.php' : '',
|
77
|
'TEXT_ADVANCED' => $TEXT['ADVANCED'],
|
78
|
'TEXT_EMPTY' => ' ',
|
79
|
)
|
80
|
);
|
81
|
|
82
|
/**
|
83
|
* Parsing the blocks ...
|
84
|
*/
|
85
|
if ( $admin->get_permission('modules') == true) { $template->parse('main_block', "modules_block", true); }
|
86
|
if ( $admin->get_permission('templates') == true) { $template->parse('main_block', "templates_block", true); }
|
87
|
if ( $admin->get_permission('languages') == true) { $template->parse('main_block', "languages_block", true); }
|
88
|
// start advanced block
|
89
|
if ( isset($_GET['advanced']) AND $admin->get_permission('modules_advanced') == true) {
|
90
|
$template->set_var(array(
|
91
|
'TXT_THEME_COPY_CURRENT' => $TEXT['THEME_COPY_CURRENT'],
|
92
|
'TXT_THEME_NEW_NAME' => $TEXT['THEME_NEW_NAME'],
|
93
|
'TXT_THEME_CURRENT' => $TEXT['THEME_CURRENT'],
|
94
|
'TXT_THEME_START_COPY' => $TEXT['THEME_START_COPY'],
|
95
|
'TXT_THEME_IMPORT_HTT' => $TEXT['THEME_IMPORT_HTT'],
|
96
|
'TXT_THEME_SELECT_HTT' => $TEXT['THEME_SELECT_HTT'],
|
97
|
'TXT_THEME_NOMORE_HTT' => $TEXT['THEME_NOMORE_HTT'],
|
98
|
'TXT_THEME_START_IMPORT' => $TEXT['THEME_START_IMPORT'],
|
99
|
'MESSAGE_THEME_COPY_CURRENT' => $MESSAGE['THEME_COPY_CURRENT'],
|
100
|
'MESSAGE_THEME_ALREADY_EXISTS' => $MESSAGE['THEME_ALREADY_EXISTS'],
|
101
|
'MESSAGE_THEME_INVALID_SOURCE_DESTINATION' => $MESSAGE['THEME_INVALID_SOURCE_DESTINATION'],
|
102
|
'MESSAGE_THEME_DESTINATION_READONLY' => $MESSAGE['THEME_DESTINATION_READONLY'],
|
103
|
'MESSAGE_THEME_IMPORT_HTT' => $MESSAGE['THEME_IMPORT_HTT'],
|
104
|
)
|
105
|
);
|
106
|
// start copy current theme
|
107
|
$sql = 'SELECT `name` FROM `'.TABLE_PREFIX.'addons` '
|
108
|
. 'WHERE `directory`=\''.DEFAULT_THEME.'\' AND `function`=\'theme\'';
|
109
|
$tmp = $database->get_one($sql);
|
110
|
$template->set_var('THEME_DEFAULT_NAME', $tmp);
|
111
|
$template->set_var('CURRENT_THEME', $tmp);
|
112
|
$tmp = str_replace(str_replace('\\', '/', WB_PATH), '', str_replace('\\', '/', THEME_PATH));
|
113
|
$template->set_var('THEME_PATH', $tmp);
|
114
|
// end copy current theme
|
115
|
// start template import
|
116
|
include(dirname(__FILE__).'/CopyThemeHtt.php');
|
117
|
$aTplList = CopyThemeHtt::getDivList(ADMIN_PATH.'/skel/themes/htt',
|
118
|
THEME_PATH.'/templates', 'htt');
|
119
|
$sOptionList = '';
|
120
|
if(sizeof($aTplList)) {
|
121
|
foreach($aTplList as $key=>$val) {
|
122
|
$sOptionList .= '<option value="'.$val.'">'.$key.'</option>'."\n";
|
123
|
}
|
124
|
}else {
|
125
|
$sOptionList = '<option value="none">'.$TEXT['THEME_NOMORE_HTT'].'</option>'."\n";
|
126
|
}
|
127
|
$template->set_var('THEME_TEMPLATE_LIST', $sOptionList);
|
128
|
// end template import
|
129
|
$template->parse('main_block', "reload_block", true);
|
130
|
}
|
131
|
// end advanced block
|
132
|
|
133
|
/**
|
134
|
* Parse template object
|
135
|
*/
|
136
|
$template->parse('main', 'main_block', false);
|
137
|
$template->pparse('output', 'page');
|
138
|
|
139
|
/**
|
140
|
* Print admin footer
|
141
|
*/
|
142
|
$admin->print_footer();
|