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 1712 Luisehahne
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 1467 Luisehahne
 * @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 2098 darkviper
$oDb = WbDatabase::getInstance();
21
$oTrans = Translate::getInstance();
22
$oTrans->enableAddon('admin\\addons');
23 238 stefan
$admin = new admin('Addons', 'templates');
24
25 1529 Luisehahne
// Setup template object, parse vars to it, then parse it
26
// Create new template object
27 1712 Luisehahne
$template = new Template(dirname($admin->correct_theme_source('templates.htt')),'keep');
28 1529 Luisehahne
// $template->debug = true;
29 944 Ruebenwurz
$template->set_file('page', 'templates.htt');
30 238 stefan
$template->set_block('page', 'main_block', 'main');
31 1355 FrankH
$template->set_var('FTAN', $admin->getFTAN());
32 2098 darkviper
/*-- insert all needed vars from language files ----------------------------------------*/
33
$template->set_var($oTrans->getLangArray());
34 238 stefan
35
// Insert values into template list
36
$template->set_block('main_block', 'template_list_block', 'template_list');
37 2098 darkviper
$sql = 'SELECT `directory`, `name`, `function` FROM `'.$oDb->TablePrefix.'addons` '
38 1643 darkviper
     . 'WHERE `type`=\'template\' ORDER BY `name`';
39 2098 darkviper
if (($result = $oDb->doQuery($sql))) {
40
	while ($addon = $result->fetchRow(MYSQL_ASSOC)) {
41 1712 Luisehahne
		if ($admin->get_permission($addon['directory'],'template')==false) { continue;}
42 238 stefan
		$template->set_var('VALUE', $addon['directory']);
43 1643 darkviper
		$template->set_var('NAME', (($addon['function'] == 'theme' ? '[Theme] ' : '').$addon['name']));
44 238 stefan
		$template->parse('template_list', 'template_list_block', true);
45
	}
46
}
47
48
// Insert permissions values
49
if($admin->get_permission('templates_install') != true) {
50
	$template->set_var('DISPLAY_INSTALL', 'hide');
51
}
52
if($admin->get_permission('templates_uninstall') != true) {
53
	$template->set_var('DISPLAY_UNINSTALL', 'hide');
54
}
55
if($admin->get_permission('templates_view') != true) {
56
	$template->set_var('DISPLAY_LIST', 'hide');
57
}
58
59 1457 Luisehahne
// insert urls
60
$template->set_var(array(
61
					'ADMIN_URL' => ADMIN_URL,
62
					'WB_URL' => WB_URL,
63
					'THEME_URL' => THEME_URL,
64
					'FTAN' => $admin->getFTAN()
65
				)
66
			);
67 238 stefan
// Insert language text and messages
68
$template->set_var(array(
69 1712 Luisehahne
	'URL_MODULES' => $admin->get_permission('modules') ?
70 2098 darkviper
		'<a href="' . ADMIN_URL . '/modules/index.php">' . $oTrans->MENU_MODULES . '</a>' : '<b>'.$oTrans->MENU_MODULES.'</b>',
71 1457 Luisehahne
	'URL_LANGUAGES' => $admin->get_permission('languages') ?
72 2098 darkviper
		'<a href="' . ADMIN_URL . '/languages/index.php">' . $oTrans->MENU_LANGUAGES . '</a>' : '<b>'.$oTrans->MENU_LANGUAGES.'</b>',
73 1789 Luisehahne
	'URL_ADVANCED' => $admin->get_permission('modules_advanced')
74 2098 darkviper
                ? '<a href="' . ADMIN_URL . '/addons/index.php?advanced">' . $oTrans->TEXT_ADVANCED . '</a>' : '<b>'.$oTrans->TEXT_ADVANCED.'</b>' ,
75 928 doc
	)
76
);
77 238 stefan
78
// Parse template object
79
$template->parse('main', 'main_block', false);
80
$template->pparse('output', 'page');
81
82 2098 darkviper
$oTrans->disableAddon();
83 238 stefan
// Print admin footer
84
$admin->print_footer();