Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         templates
6
 * @author          WebsiteBaker Project
7
 * @copyright       Ryan Djurovich
8
 * @copyright       WebsiteBaker Org. e.V.
9
 * @link            http://websitebaker.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.3
12
 * @requirements    PHP 5.3.6 and higher
13
 * @version         $Id: index.php 2 2017-07-02 15:14:29Z Manuela $
14
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/admin/templates/index.php $
15
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
16
 *
17
 */
18

    
19
// Print admin header
20
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
21
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
22
$admin = new admin('Addons', 'templates');
23

    
24
// Setup template object, parse vars to it, then parse it
25
// Create new template object
26
$template = new Template(dirname($admin->correct_theme_source('templates.htt')));
27
// $template->debug = true;
28
$template->set_file('page', 'templates.htt');
29
$template->set_block('page', 'main_block', 'main');
30
$template->set_var('FTAN', $admin->getFTAN());
31

    
32
// Insert values into template list
33
$template->set_block('main_block', 'template_detail_block', 'template_detail');
34
$template->set_block('template_detail_block', 'template_detail_select_block', 'template_detail_select');
35
$template->set_block('main_block', 'template_uninstall_block', 'template_uninstall');
36
$template->set_block('template_uninstall_block', 'template_uninstall_select_block', 'template_uninstall_select');
37
$aPreventFromUninstall = array (' wb_theme ', ' WbTheme ', ' default ', ' default_theme ', ' DefaultTheme ');
38
$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
39
      . 'WHERE `type` = \'template\' '
40
      . 'ORDER BY `name`';
41
if($oAddons = $database->query( $sql )) {
42
    while($aAddon = $oAddons->fetchRow( MYSQLI_ASSOC )) {
43
        if( !$admin->get_permission( $aAddon['directory'], 'template' )) { continue; }
44
        $aAddonIdKey = $admin->getIDKEY($aAddon['addon_id']);
45
        $template->set_var('DETAIL_VALUE',  $aAddonIdKey);
46
        $template->set_var('DETAIL_NAME', $aAddon['name']);
47
        $template->parse('template_detail_select', 'template_detail_select_block', true);
48
        if (!preg_match('/'.$aAddon['directory'].'/si', implode('|', $aPreventFromUninstall))) {
49
            $template->set_var('UNINSTALL_VALUE', $aAddonIdKey);
50
            $template->set_var('UNINSTALL_NAME', $aAddon['name']);
51
            $template->parse('template_uninstall_select', 'template_uninstall_select_block', true);
52
        }
53
    }
54
}
55

    
56
// Insert permissions values
57
$template->set_block('main_block', 'template_install_block', 'template_install');
58
if($admin->get_permission('templates_install') != true) {
59
    $template->set_var('DISPLAY_INSTALL', '');
60
    $template->set_block('template_install', '');
61
} else {
62
    $template->parse('template_install', 'template_install_block', true);
63
}
64
if($admin->get_permission('templates_uninstall') != true) {
65
    $template->set_var('DISPLAY_UNINSTALL', '');
66
    $template->set_block('template_uninstall', '');
67
} else {
68
    $template->parse('template_uninstall', 'template_uninstall_block', true);
69
}
70
if($admin->get_permission('templates_view') != true) {
71
    $template->set_var('DISPLAY_LIST', '');
72
    $template->set_block('template_detail', '');
73
} else {
74
    $template->parse('template_detail', 'template_detail_block', true);
75
}
76

    
77
$template->set_block('main_block', 'addon_module_block', 'addon_module');
78
if($admin->get_permission('modules_view') != true) {
79
    $template->set_block ('addon_module', '');
80
} else {
81
    $template->parse('addon_module', 'addon_module_block', true);
82
}
83

    
84
$template->set_block('main_block', 'addon_language_block', 'addon_language');
85
if($admin->get_permission('languages_view') != true) {
86
    $template->set_block ('addon_language', '');
87
} else {
88
    $template->parse('addon_language', 'addon_language_block', true);
89
}
90

    
91
$template->set_block('main_block', 'addon_template_block', 'addon_template');
92
if($admin->get_permission('admintools') != true) {
93
    $template->set_block ('addon_template', '');
94
} else {
95
    $template->parse('addon_template', 'addon_template_block', true);
96
}
97

    
98

    
99

    
100
// Insert language headings
101
$template->set_var(array(
102
                    'HEADING_INSTALL_TEMPLATE' => $HEADING['INSTALL_TEMPLATE'],
103
                    'HEADING_UNINSTALL_TEMPLATE' => $HEADING['UNINSTALL_TEMPLATE'],
104
                    'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
105
                )
106
            );
107
// insert urls
108
$template->set_var(array(
109
                    'ADMIN_URL' => ADMIN_URL,
110
                    'WB_URL' => WB_URL,
111
                    'THEME_URL' => THEME_URL,
112
                    'FTAN' => $admin->getFTAN()
113
                )
114
            );
115
// Insert language text and messages
116
$template->set_var(array(
117
    'URL_MODULES' => $admin->get_permission('modules') ? ADMIN_URL . '/modules/index.php'  : '',
118
    'URL_LANGUAGES' => $admin->get_permission('languages') ? ADMIN_URL . '/languages/index.php'  : '',
119
    'URL_ADVANCED' => '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;',
120
    'MENU_LANGUAGES' => $admin->get_permission('languages') ? $MENU['LANGUAGES'] : '&#160;&#160;&#160;',
121
    'MENU_MODULES' => $admin->get_permission('modules') ? $MENU['MODULES'] : '&#160;&#160;&#160;',
122
    'TEXT_INSTALL' => $TEXT['INSTALL'],
123
    'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
124
    'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
125
    'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
126
    'CHANGE_TEMPLATE_NOTICE' => $MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE']
127
    )
128
);
129

    
130
// Parse template object
131
$template->parse('main', 'main_block', false);
132
$template->pparse('output', 'page');
133

    
134
// Print admin footer
135
$admin->print_footer();
(2-2/4)