Project

General

Profile

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 2098 2014-02-11 01:37:03Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/addons/index.php $
14
 * @lastmodified    $Date: 2014-02-11 02:37:03 +0100 (Tue, 11 Feb 2014) $
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
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\addons');
29
$template->set_var($oTrans->getLangArray());
30

    
31
// Insert values into the template object
32
$template->set_var(array(
33
		'ADMIN_URL' => ADMIN_URL,
34
		'THEME_URL' => THEME_URL,
35
		'WB_URL'    => WB_URL
36
	)
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
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
if($admin->get_permission('modules_advanced') != true) { $template->set_var('DISPLAY_ADVANCED', $display_none); }
56

    
57
if(!isset($_GET['advanced']) || $admin->get_permission('modules_advanced') != true) {
58
	$template->set_var('DISPLAY_RELOAD', $display_none);
59
}
60
/**
61
 *	Insert section names and descriptions
62
 */
63
$template->set_var(array(
64
	'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

    
76
	'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'            => '&nbsp;',
82
	)
83
);
84

    
85
/**
86
 *	Parsing the blocks ...
87
 */
88
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
if ( isset($_GET['advanced']) AND $admin->get_permission('modules_advanced') == true) {
93
	$template->set_var(array(
94
		'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
		)
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
	$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
// end copy current theme
113
// start template import
114
	include(dirname(__FILE__).'/CopyThemeHtt.php');
115
	$aTplList = CopyThemeHtt::getDivList(ADMIN_PATH.'/skel/themes/htt',
116
	                                     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
		$sOptionList = '<option value="none">'.$oTrans->TEXT_THEME_NOMORE_HTT.'</option>'."\n";
124
	}
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

    
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();
(3-3/4)