Project

General

Profile

1 238 stefan
<?php
2 1467 Luisehahne
/**
3
 *
4
 * @category        admin
5
 * @package         templates
6 1529 Luisehahne
 * @author          Ryan Djurovich, WebsiteBaker Project
7 1467 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 238 stefan
18
// Print admin header
19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
21
$admin = new admin('Addons', 'templates');
22
23 1529 Luisehahne
// Setup template object, parse vars to it, then parse it
24
// Create new template object
25 1625 Luisehahne
$template = new Template(dirname($admin->correct_theme_source('templates.htt')));
26 1529 Luisehahne
// $template->debug = true;
27 944 Ruebenwurz
$template->set_file('page', 'templates.htt');
28 238 stefan
$template->set_block('page', 'main_block', 'main');
29 1355 FrankH
$template->set_var('FTAN', $admin->getFTAN());
30 238 stefan
31
// Insert values into template list
32
$template->set_block('main_block', 'template_list_block', 'template_list');
33 1643 darkviper
$sql = 'SELECT `directory`, `name`, `function` FROM `'.TABLE_PREFIX.'addons` '
34
     . 'WHERE `type`=\'template\' ORDER BY `name`';
35
if(($result = $database->query($sql))) {
36
	while($addon = $result->fetchRow(MYSQL_ASSOC)) {
37 238 stefan
		$template->set_var('VALUE', $addon['directory']);
38 1643 darkviper
		$template->set_var('NAME', (($addon['function'] == 'theme' ? '[Theme] ' : '').$addon['name']));
39 238 stefan
		$template->parse('template_list', 'template_list_block', true);
40
	}
41
}
42
43
// Insert permissions values
44
if($admin->get_permission('templates_install') != true) {
45
	$template->set_var('DISPLAY_INSTALL', 'hide');
46
}
47
if($admin->get_permission('templates_uninstall') != true) {
48
	$template->set_var('DISPLAY_UNINSTALL', 'hide');
49
}
50
if($admin->get_permission('templates_view') != true) {
51
	$template->set_var('DISPLAY_LIST', 'hide');
52
}
53
54
// Insert language headings
55
$template->set_var(array(
56 1457 Luisehahne
					'HEADING_INSTALL_TEMPLATE' => $HEADING['INSTALL_TEMPLATE'],
57
					'HEADING_UNINSTALL_TEMPLATE' => $HEADING['UNINSTALL_TEMPLATE'],
58
					'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
59
				)
60
			);
61
// insert urls
62
$template->set_var(array(
63
					'ADMIN_URL' => ADMIN_URL,
64
					'WB_URL' => WB_URL,
65
					'THEME_URL' => THEME_URL,
66
					'FTAN' => $admin->getFTAN()
67
				)
68
			);
69 238 stefan
// Insert language text and messages
70
$template->set_var(array(
71 928 doc
	'URL_MODULES' => $admin->get_permission('modules') ?
72
		'<a href="' . ADMIN_URL . '/modules/index.php">' . $MENU['MODULES'] . '</a>' : '',
73 1457 Luisehahne
	'URL_LANGUAGES' => $admin->get_permission('languages') ?
74 928 doc
		'<a href="' . ADMIN_URL . '/languages/index.php">' . $MENU['LANGUAGES'] . '</a>' : '',
75 1529 Luisehahne
	'URL_ADVANCED' => '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;',
76 928 doc
	'TEXT_INSTALL' => $TEXT['INSTALL'],
77
	'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
78
	'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
79
	'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
80 933 doc
	'CHANGE_TEMPLATE_NOTICE' => $MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE']
81 928 doc
	)
82
);
83 238 stefan
84
// Parse template object
85
$template->parse('main', 'main_block', false);
86
$template->pparse('output', 'page');
87
88
// Print admin footer
89
$admin->print_footer();