1 |
238
|
stefan
|
<?php
|
2 |
|
|
|
3 |
|
|
// $Id$
|
4 |
|
|
|
5 |
|
|
/*
|
6 |
|
|
|
7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
8 |
915
|
Ruebenwurz
|
Copyright (C) 2004-2009, Ryan Djurovich
|
9 |
238
|
stefan
|
|
10 |
|
|
Website Baker is free software; you can redistribute it and/or modify
|
11 |
|
|
it under the terms of the GNU General Public License as published by
|
12 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
13 |
|
|
(at your option) any later version.
|
14 |
|
|
|
15 |
|
|
Website Baker is distributed in the hope that it will be useful,
|
16 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
GNU General Public License for more details.
|
19 |
|
|
|
20 |
|
|
You should have received a copy of the GNU General Public License
|
21 |
|
|
along with Website Baker; if not, write to the Free Software
|
22 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23 |
|
|
|
24 |
|
|
*/
|
25 |
|
|
|
26 |
|
|
// Print admin header
|
27 |
|
|
require('../../config.php');
|
28 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
29 |
|
|
$admin = new admin('Addons', 'modules');
|
30 |
|
|
|
31 |
|
|
// Setup template object
|
32 |
|
|
$template = new Template(ADMIN_PATH.'/modules');
|
33 |
|
|
$template->set_file('page', 'template.html');
|
34 |
|
|
$template->set_block('page', 'main_block', 'main');
|
35 |
|
|
|
36 |
|
|
// Insert values into module list
|
37 |
|
|
$template->set_block('main_block', 'module_list_block', 'module_list');
|
38 |
384
|
Ruebenwurz
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' order by name");
|
39 |
238
|
stefan
|
if($result->numRows() > 0) {
|
40 |
|
|
while ($addon = $result->fetchRow()) {
|
41 |
|
|
$template->set_var('VALUE', $addon['directory']);
|
42 |
|
|
$template->set_var('NAME', $addon['name']);
|
43 |
|
|
$template->parse('module_list', 'module_list_block', true);
|
44 |
|
|
}
|
45 |
|
|
}
|
46 |
|
|
|
47 |
934
|
doc
|
// Insert modules which includes a install.php file to install list
|
48 |
938
|
doc
|
$module_files = glob(WB_PATH . '/modules/*');
|
49 |
934
|
doc
|
$template->set_block('main_block', 'install_list_block', 'install_list');
|
50 |
938
|
doc
|
$template->set_block('main_block', 'upgrade_list_block', 'upgrade_list');
|
51 |
|
|
$template->set_block('main_block', 'uninstall_list_block', 'uninstall_list');
|
52 |
|
|
$template->set_var(array('INSTALL_VISIBLE' => 'hide', 'UPGRADE_VISIBLE' => 'hide', 'UNINSTALL_VISIBLE' => 'hide'));
|
53 |
|
|
|
54 |
|
|
$show_block = false;
|
55 |
934
|
doc
|
foreach ($module_files as $index => $path) {
|
56 |
938
|
doc
|
if (is_dir($path)) {
|
57 |
|
|
if (file_exists($path . '/install.php')) {
|
58 |
|
|
$show_block = true;
|
59 |
|
|
$template->set_var('INSTALL_VISIBLE', '');
|
60 |
|
|
$template->set_var('VALUE', basename($path));
|
61 |
|
|
$template->set_var('NAME', basename($path));
|
62 |
|
|
$template->parse('install_list', 'install_list_block', true);
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
if (file_exists($path . '/upgrade.php')) {
|
66 |
|
|
$show_block = true;
|
67 |
|
|
$template->set_var('UPGRADE_VISIBLE', '');
|
68 |
|
|
$template->set_var('VALUE', basename($path));
|
69 |
|
|
$template->set_var('NAME', basename($path));
|
70 |
|
|
$template->parse('upgrade_list', 'upgrade_list_block', true);
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
if (file_exists($path . '/uninstall.php')) {
|
74 |
|
|
$show_block = true;
|
75 |
|
|
$template->set_var('UNINSTALL_VISIBLE', '');
|
76 |
|
|
$template->set_var('VALUE', basename($path));
|
77 |
|
|
$template->set_var('NAME', basename($path));
|
78 |
|
|
$template->parse('uninstall_list', 'uninstall_list_block', true);
|
79 |
|
|
}
|
80 |
|
|
|
81 |
934
|
doc
|
} else {
|
82 |
|
|
unset($module_files[$index]);
|
83 |
|
|
}
|
84 |
|
|
}
|
85 |
|
|
|
86 |
238
|
stefan
|
// Insert permissions values
|
87 |
|
|
if($admin->get_permission('modules_install') != true) {
|
88 |
|
|
$template->set_var('DISPLAY_INSTALL', 'hide');
|
89 |
|
|
}
|
90 |
|
|
if($admin->get_permission('modules_uninstall') != true) {
|
91 |
|
|
$template->set_var('DISPLAY_UNINSTALL', 'hide');
|
92 |
|
|
}
|
93 |
|
|
if($admin->get_permission('modules_view') != true) {
|
94 |
|
|
$template->set_var('DISPLAY_LIST', 'hide');
|
95 |
|
|
}
|
96 |
938
|
doc
|
// only show block if there is something to show
|
97 |
|
|
if(!$show_block || count($module_files) == 0 || !isset($_GET['advanced']) || $admin->get_permission('admintools') != true) {
|
98 |
934
|
doc
|
$template->set_var('DISPLAY_MANUAL_INSTALL', 'hide');
|
99 |
|
|
}
|
100 |
238
|
stefan
|
|
101 |
|
|
// Insert language headings
|
102 |
|
|
$template->set_var(array(
|
103 |
|
|
'HEADING_INSTALL_MODULE' => $HEADING['INSTALL_MODULE'],
|
104 |
|
|
'HEADING_UNINSTALL_MODULE' => $HEADING['UNINSTALL_MODULE'],
|
105 |
934
|
doc
|
'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS'],
|
106 |
938
|
doc
|
'HEADING_INVOKE_MODULE_FILES' => $HEADING['INVOKE_MODULE_FILES']
|
107 |
238
|
stefan
|
)
|
108 |
|
|
);
|
109 |
|
|
// Insert language text and messages
|
110 |
|
|
$template->set_var(array(
|
111 |
928
|
doc
|
'URL_TEMPLATES' => $admin->get_permission('templates') ?
|
112 |
|
|
'<a href="' . ADMIN_URL . '/templates/index.php">' . $MENU['TEMPLATES'] . '</a>' : '',
|
113 |
|
|
'URL_LANGUAGES' => $admin->get_permission('languages') ?
|
114 |
|
|
'<a href="' . ADMIN_URL . '/languages/index.php">' . $MENU['LANGUAGES'] . '</a>' : '',
|
115 |
934
|
doc
|
'URL_ADVANCED' => $admin->get_permission('admintools') ?
|
116 |
|
|
'<a href="' . ADMIN_URL . '/modules/index.php?advanced">' . $TEXT['ADVANCED'] . '</a>' : '',
|
117 |
928
|
doc
|
'TEXT_INSTALL' => $TEXT['INSTALL'],
|
118 |
|
|
'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
|
119 |
|
|
'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
|
120 |
934
|
doc
|
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
|
121 |
|
|
'TEXT_MANUAL_INSTALLATION' => $MESSAGE['ADDON']['MANUAL_INSTALLATION'],
|
122 |
|
|
'TEXT_MANUAL_INSTALLATION_WARNING' => $MESSAGE['ADDON']['MANUAL_INSTALLATION_WARNING'],
|
123 |
938
|
doc
|
'TEXT_EXECUTE' => $TEXT['EXECUTE'],
|
124 |
|
|
'TEXT_FILE' => $TEXT['FILE']
|
125 |
928
|
doc
|
)
|
126 |
|
|
);
|
127 |
238
|
stefan
|
|
128 |
|
|
// Parse template object
|
129 |
|
|
$template->parse('main', 'main_block', false);
|
130 |
|
|
$template->pparse('output', 'page');
|
131 |
|
|
|
132 |
|
|
// Print admin footer
|
133 |
|
|
$admin->print_footer();
|
134 |
|
|
|
135 |
239
|
stefan
|
?>
|