Revision 1712
Added by Dietmar about 12 years ago
index.php | ||
---|---|---|
4 | 4 |
* @category admin |
5 | 5 |
* @package modules |
6 | 6 |
* @author Ryan Djurovich, WebsiteBaker Project |
7 |
* @copyright 2009-2011, Website Baker Org. e.V.
|
|
7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
|
8 | 8 |
* @link http://www.websitebaker2.org/ |
9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
10 | 10 |
* @platform WebsiteBaker 2.8.x |
... | ... | |
22 | 22 |
|
23 | 23 |
// Setup template object, parse vars to it, then parse it |
24 | 24 |
// Create new template object |
25 |
$template = new Template(dirname($admin->correct_theme_source('modules.htt'))); |
|
25 |
$template = new Template(dirname($admin->correct_theme_source('modules.htt')),'keep');
|
|
26 | 26 |
// $template->debug = true; |
27 | 27 |
$template->set_file('page', 'modules.htt'); |
28 | 28 |
$template->set_block('page', 'main_block', 'main'); |
... | ... | |
31 | 31 |
$template->set_block('main_block', 'module_list_block', 'module_list'); |
32 | 32 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' order by name"); |
33 | 33 |
if($result->numRows() > 0) { |
34 |
while ($addon = $result->fetchRow()) { |
|
34 |
while ($addon = $result->fetchRow()) |
|
35 |
{ |
|
36 |
if ($admin->get_permission($addon['directory'],'module')==false) { continue;} |
|
37 |
//echo $addon['directory'].'<br />'; |
|
35 | 38 |
$template->set_var('VALUE', $addon['directory']); |
36 | 39 |
$template->set_var('NAME', $addon['name']); |
37 | 40 |
$template->parse('module_list', 'module_list_block', true); |
... | ... | |
46 | 49 |
$template->set_var(array('INSTALL_VISIBLE' => 'hide', 'UPGRADE_VISIBLE' => 'hide', 'UNINSTALL_VISIBLE' => 'hide')); |
47 | 50 |
|
48 | 51 |
$show_block = false; |
49 |
foreach ($module_files as $index => $path) { |
|
52 |
foreach ($module_files as $index => $path) |
|
53 |
{ |
|
54 |
if ( $admin->get_permission(basename($path),'module')==false ) { continue;} |
|
50 | 55 |
if (is_dir($path)) { |
51 |
if (file_exists($path . '/install.php')) { |
|
56 |
//echo basename($path).'<br />'; |
|
57 |
if (is_readable($path . '/install.php')) { |
|
52 | 58 |
$show_block = true; |
53 | 59 |
$template->set_var('INSTALL_VISIBLE', ''); |
54 | 60 |
$template->set_var('VALUE', basename($path)); |
... | ... | |
56 | 62 |
$template->parse('install_list', 'install_list_block', true); |
57 | 63 |
} |
58 | 64 |
|
59 |
if (file_exists($path . '/upgrade.php')) {
|
|
65 |
if (is_readable($path . '/upgrade.php')) {
|
|
60 | 66 |
$show_block = true; |
61 | 67 |
$template->set_var('UPGRADE_VISIBLE', ''); |
62 | 68 |
$template->set_var('VALUE', basename($path)); |
63 | 69 |
$template->set_var('NAME', basename($path)); |
64 | 70 |
$template->parse('upgrade_list', 'upgrade_list_block', true); |
65 |
}
|
|
66 |
|
|
67 |
if (file_exists($path . '/uninstall.php')) {
|
|
71 |
} |
|
72 |
|
|
73 |
if (is_readable($path . '/uninstall.php')) {
|
|
68 | 74 |
$show_block = true; |
69 | 75 |
$template->set_var('UNINSTALL_VISIBLE', ''); |
70 | 76 |
$template->set_var('VALUE', basename($path)); |
... | ... | |
88 | 94 |
$template->set_var('DISPLAY_LIST', 'hide'); |
89 | 95 |
} |
90 | 96 |
// only show block if there is something to show |
91 |
if(!$show_block || count($module_files) == 0 || !isset($_GET['advanced']) || $admin->get_permission('admintools') != true) {
|
|
97 |
if(!$show_block || count($module_files) == 0 || !isset($_GET['advanced']) || $admin->get_permission('settings_advanced') != true) {
|
|
92 | 98 |
$template->set_var('DISPLAY_MANUAL_INSTALL', 'hide'); |
93 | 99 |
} |
94 | 100 |
|
95 |
// Insert language headings |
|
96 |
$template->set_var(array( |
|
97 |
'HEADING_INSTALL_MODULE' => $HEADING['INSTALL_MODULE'], |
|
98 |
'HEADING_UNINSTALL_MODULE' => $HEADING['UNINSTALL_MODULE'], |
|
99 |
'OVERWRITE_NEWER_FILES' => $MESSAGE['ADDON_OVERWRITE_NEWER_FILES'], |
|
100 |
'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS'], |
|
101 |
'HEADING_INVOKE_MODULE_FILES' => $HEADING['INVOKE_MODULE_FILES'] |
|
102 |
) |
|
103 |
); |
|
101 |
$mLang = ModLanguage::getInstance(); |
|
102 |
$mLang->setLanguage(ADMIN_PATH.'/addons/languages/', LANGUAGE, DEFAULT_LANGUAGE); |
|
103 |
|
|
104 |
/*-- insert all needed vars from language files ----------------------------------------*/ |
|
105 |
$template->set_var($mLang->getLangArray()); |
|
106 |
|
|
104 | 107 |
// insert urls |
105 | 108 |
$template->set_var(array( |
106 | 109 |
'ADMIN_URL' => ADMIN_URL, |
... | ... | |
111 | 114 |
); |
112 | 115 |
// Insert language text and messages |
113 | 116 |
$template->set_var(array( |
114 |
'URL_TEMPLATES' => $admin->get_permission('templates') ? |
|
115 |
'<a href="' . ADMIN_URL . '/templates/index.php">' . $MENU['TEMPLATES'] . '</a>' : '', |
|
116 |
'URL_LANGUAGES' => $admin->get_permission('languages') ? |
|
117 |
'<a href="' . ADMIN_URL . '/languages/index.php">' . $MENU['LANGUAGES'] . '</a>' : '', |
|
118 |
'URL_ADVANCED' => $admin->get_permission('admintools') ? |
|
119 |
'<a href="' . ADMIN_URL . '/modules/index.php?advanced">' . $TEXT['ADVANCED'] . '</a>' : '', |
|
120 |
'TEXT_INSTALL' => $TEXT['INSTALL'], |
|
121 |
'TEXT_UNINSTALL' => $TEXT['UNINSTALL'], |
|
122 |
'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'], |
|
123 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'], |
|
124 |
'TEXT_MANUAL_INSTALLATION' => $MESSAGE['ADDON']['MANUAL_INSTALLATION'], |
|
125 |
'TEXT_MANUAL_INSTALLATION_WARNING' => $MESSAGE['ADDON']['MANUAL_INSTALLATION_WARNING'], |
|
126 |
'TEXT_EXECUTE' => $TEXT['EXECUTE'], |
|
127 |
'TEXT_FILE' => $TEXT['FILE'] |
|
117 |
'URL_TEMPLATES' => $admin->get_permission('templates') ? |
|
118 |
'<a href="' . ADMIN_URL . '/templates/index.php">' . $mLang->MENU_TEMPLATES . '</a>' : '<b>'.$mLang->MENU_TEMPLATES.'</b>', |
|
119 |
'URL_LANGUAGES' => $admin->get_permission('languages') ? |
|
120 |
'<a href="' . ADMIN_URL . '/languages/index.php">' . $mLang->MENU_LANGUAGES . '</a>' : '<b>'.$mLang->MENU_LANGUAGES.'</b>', |
|
121 |
'URL_ADVANCED' => $admin->get_permission('settings_advanced') ? |
|
122 |
'<a href="' . ADMIN_URL . '/modules/index.php?advanced">' . $mLang->TEXT_ADVANCED . '</a>' : '<b>'.$mLang->TEXT_ADVANCED.'</b>' , |
|
123 |
'HEADING_CHANGE_TEMPLATE_NOTICE' => '' |
|
128 | 124 |
) |
129 | 125 |
); |
130 | 126 |
|
Also available in: Unified diff
! update folder admin/addons admin/skel/htt