1 |
238
|
stefan
|
<?php
|
2 |
1361
|
Luisehahne
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category admin
|
5 |
|
|
* @package modules
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright 2004-2009, Ryan Djurovich
|
8 |
|
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9 |
|
|
* @link http://www.websitebaker2.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.x
|
12 |
|
|
* @requirements PHP 5.2.2 and higher
|
13 |
|
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/modules/install.php $
|
15 |
|
|
* @lastmodified $Date: 2010-12-21 23:00:08 +0100 (Di, 21. Dez 2010) $
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
238
|
stefan
|
|
19 |
|
|
// Print admin header
|
20 |
|
|
require('../../config.php');
|
21 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
22 |
|
|
$admin = new admin('Addons', 'modules');
|
23 |
|
|
|
24 |
|
|
// Setup template object
|
25 |
944
|
Ruebenwurz
|
$template = new Template(THEME_PATH.'/templates');
|
26 |
|
|
$template->set_file('page', 'modules.htt');
|
27 |
238
|
stefan
|
$template->set_block('page', 'main_block', 'main');
|
28 |
|
|
|
29 |
|
|
// Insert values into module list
|
30 |
|
|
$template->set_block('main_block', 'module_list_block', 'module_list');
|
31 |
384
|
Ruebenwurz
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' order by name");
|
32 |
238
|
stefan
|
if($result->numRows() > 0) {
|
33 |
|
|
while ($addon = $result->fetchRow()) {
|
34 |
|
|
$template->set_var('VALUE', $addon['directory']);
|
35 |
|
|
$template->set_var('NAME', $addon['name']);
|
36 |
|
|
$template->parse('module_list', 'module_list_block', true);
|
37 |
|
|
}
|
38 |
|
|
}
|
39 |
|
|
|
40 |
934
|
doc
|
// Insert modules which includes a install.php file to install list
|
41 |
938
|
doc
|
$module_files = glob(WB_PATH . '/modules/*');
|
42 |
934
|
doc
|
$template->set_block('main_block', 'install_list_block', 'install_list');
|
43 |
938
|
doc
|
$template->set_block('main_block', 'upgrade_list_block', 'upgrade_list');
|
44 |
|
|
$template->set_block('main_block', 'uninstall_list_block', 'uninstall_list');
|
45 |
|
|
$template->set_var(array('INSTALL_VISIBLE' => 'hide', 'UPGRADE_VISIBLE' => 'hide', 'UNINSTALL_VISIBLE' => 'hide'));
|
46 |
|
|
|
47 |
|
|
$show_block = false;
|
48 |
934
|
doc
|
foreach ($module_files as $index => $path) {
|
49 |
938
|
doc
|
if (is_dir($path)) {
|
50 |
|
|
if (file_exists($path . '/install.php')) {
|
51 |
|
|
$show_block = true;
|
52 |
|
|
$template->set_var('INSTALL_VISIBLE', '');
|
53 |
|
|
$template->set_var('VALUE', basename($path));
|
54 |
|
|
$template->set_var('NAME', basename($path));
|
55 |
|
|
$template->parse('install_list', 'install_list_block', true);
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
if (file_exists($path . '/upgrade.php')) {
|
59 |
|
|
$show_block = true;
|
60 |
|
|
$template->set_var('UPGRADE_VISIBLE', '');
|
61 |
|
|
$template->set_var('VALUE', basename($path));
|
62 |
|
|
$template->set_var('NAME', basename($path));
|
63 |
|
|
$template->parse('upgrade_list', 'upgrade_list_block', true);
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
if (file_exists($path . '/uninstall.php')) {
|
67 |
|
|
$show_block = true;
|
68 |
|
|
$template->set_var('UNINSTALL_VISIBLE', '');
|
69 |
|
|
$template->set_var('VALUE', basename($path));
|
70 |
|
|
$template->set_var('NAME', basename($path));
|
71 |
|
|
$template->parse('uninstall_list', 'uninstall_list_block', true);
|
72 |
|
|
}
|
73 |
|
|
|
74 |
934
|
doc
|
} else {
|
75 |
|
|
unset($module_files[$index]);
|
76 |
|
|
}
|
77 |
|
|
}
|
78 |
|
|
|
79 |
238
|
stefan
|
// Insert permissions values
|
80 |
|
|
if($admin->get_permission('modules_install') != true) {
|
81 |
|
|
$template->set_var('DISPLAY_INSTALL', 'hide');
|
82 |
|
|
}
|
83 |
|
|
if($admin->get_permission('modules_uninstall') != true) {
|
84 |
|
|
$template->set_var('DISPLAY_UNINSTALL', 'hide');
|
85 |
|
|
}
|
86 |
|
|
if($admin->get_permission('modules_view') != true) {
|
87 |
|
|
$template->set_var('DISPLAY_LIST', 'hide');
|
88 |
|
|
}
|
89 |
938
|
doc
|
// only show block if there is something to show
|
90 |
|
|
if(!$show_block || count($module_files) == 0 || !isset($_GET['advanced']) || $admin->get_permission('admintools') != true) {
|
91 |
934
|
doc
|
$template->set_var('DISPLAY_MANUAL_INSTALL', 'hide');
|
92 |
|
|
}
|
93 |
238
|
stefan
|
|
94 |
|
|
// Insert language headings
|
95 |
|
|
$template->set_var(array(
|
96 |
|
|
'HEADING_INSTALL_MODULE' => $HEADING['INSTALL_MODULE'],
|
97 |
|
|
'HEADING_UNINSTALL_MODULE' => $HEADING['UNINSTALL_MODULE'],
|
98 |
1361
|
Luisehahne
|
'OVERWRITE_NEWER_FILES' => $MESSAGE['ADDON_OVERWRITE_NEWER_FILES'],
|
99 |
934
|
doc
|
'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS'],
|
100 |
938
|
doc
|
'HEADING_INVOKE_MODULE_FILES' => $HEADING['INVOKE_MODULE_FILES']
|
101 |
238
|
stefan
|
)
|
102 |
|
|
);
|
103 |
1112
|
Ruebenwurz
|
// insert urls
|
104 |
|
|
$template->set_var(array(
|
105 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
106 |
|
|
'WB_URL' => WB_URL,
|
107 |
|
|
'WB_PATH' => WB_PATH,
|
108 |
|
|
'THEME_URL' => THEME_URL
|
109 |
|
|
)
|
110 |
|
|
);
|
111 |
238
|
stefan
|
// Insert language text and messages
|
112 |
|
|
$template->set_var(array(
|
113 |
928
|
doc
|
'URL_TEMPLATES' => $admin->get_permission('templates') ?
|
114 |
|
|
'<a href="' . ADMIN_URL . '/templates/index.php">' . $MENU['TEMPLATES'] . '</a>' : '',
|
115 |
|
|
'URL_LANGUAGES' => $admin->get_permission('languages') ?
|
116 |
|
|
'<a href="' . ADMIN_URL . '/languages/index.php">' . $MENU['LANGUAGES'] . '</a>' : '',
|
117 |
934
|
doc
|
'URL_ADVANCED' => $admin->get_permission('admintools') ?
|
118 |
|
|
'<a href="' . ADMIN_URL . '/modules/index.php?advanced">' . $TEXT['ADVANCED'] . '</a>' : '',
|
119 |
928
|
doc
|
'TEXT_INSTALL' => $TEXT['INSTALL'],
|
120 |
|
|
'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
|
121 |
|
|
'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
|
122 |
934
|
doc
|
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
|
123 |
|
|
'TEXT_MANUAL_INSTALLATION' => $MESSAGE['ADDON']['MANUAL_INSTALLATION'],
|
124 |
|
|
'TEXT_MANUAL_INSTALLATION_WARNING' => $MESSAGE['ADDON']['MANUAL_INSTALLATION_WARNING'],
|
125 |
938
|
doc
|
'TEXT_EXECUTE' => $TEXT['EXECUTE'],
|
126 |
|
|
'TEXT_FILE' => $TEXT['FILE']
|
127 |
928
|
doc
|
)
|
128 |
|
|
);
|
129 |
238
|
stefan
|
|
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();
|
136 |
|
|
|
137 |
239
|
stefan
|
?>
|