include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root."/includes/packages.inc");
+if ($use_popup_windows) {
+ $js = get_js_open_window(900, 500);
+}
page(_($help_context = "Install/Activate extensions"));
include_once($path_to_root . "/includes/date_functions.inc");
return false;
}
if ($id == -1 && !is_uploaded_file($_FILES['uploadfile']['tmp_name'])) {
- display_error(_("You have to select plugin file to upload"));
+ display_error(_("You have to select extension file to upload"));
return false;
}
return true;
return false;
$id = $selected_id==-1 ? $next_extension_id : $selected_id;
- if ($selected_id != -1 && $extensions[$id]['type'] != 'plugin') {
+ if ($selected_id != -1 && $extensions[$id]['type'] != 'extension'
+ || (isset($extensions[$id]['tabs']) && count($extensions[$id]['tabs']))) {
display_error(_('Module installation support is not implemented.'));
return;
}
$entry['title'] = $_POST['title'];
$entry['section'] = 2; // menu section aka module
- // Only plugin extensions can be installed manually.
- $extensions[$id]['type'] = 'plugin';
+ // Only simple plugin type extensions can be installed manually.
+ $extensions[$id]['type'] = 'extension';
+ $extensions[$id]['path'] = 'modules/'.$_POST['path'];
$directory = $path_to_root . "/modules/" . $_POST['path'];
if (!file_exists($directory))
{
}
if (is_uploaded_file($_FILES['uploadfile']['tmp_name']))
{
- $entry['url'] = '/modules/'.$_POST['path'].'/'.$_FILES['uploadfile']['name'];
+ $entry['url'] = $_FILES['uploadfile']['name'];
$file1 = $_FILES['uploadfile']['tmp_name'];
$file2 = $directory . "/".$_FILES['uploadfile']['name'];
if (file_exists($file2))
move_uploaded_file($file1, $file2);
}
else
- $entry['url'] = '/modules/'.$_POST['path'].'/'.get_post('filename');
+ $entry['url'] = get_post('filename');
if (is_uploaded_file($_FILES['uploadfile2']['tmp_name']))
{
if (is_uploaded_file($_FILES['uploadfile3']['tmp_name']))
{
- $extensions[$id]['acc_file'] = '/modules/'.$_POST['path'].'/'.$_FILES['uploadfile3']['name'];
+ $extensions[$id]['acc_file'] = $_FILES['uploadfile3']['name'];
$file1 = $_FILES['uploadfile3']['tmp_name'];
$file2 = $directory . "/".$_FILES['uploadfile3']['name'];
if (file_exists($file2))
move_uploaded_file($file1, $file2);
}
else
- $extensions[$id]['acc_file'] = '/modules/'.$_POST['path'].'/'.get_post('acc_file');
+ $extensions[$id]['acc_file'] = get_post('acc_file');
// security area guess for plugins
- $exttext = file_get_contents($path_to_root.$entry['url']);
+ $exttext = file_get_contents($path_to_root.'/'.$extensions[$id]['path'].'/'.$entry['url']);
$area = 'SA_OPEN';
if (preg_match('/.*\$page_security\s*=\s*[\'"]([^\'"]*)/', $exttext, $match)) {
$area = trim($match[1]);
return false;
} else {
- $dirname = dirname(@$extensions[$id]['entries'][0]['url']);
+ $dirname = $extensions[$id]['path'];
if ($dirname) {
- $dirname = $path_to_root.$dirname;
+ $dirname = $path_to_root.'/'.$dirname;
flush_dir($dirname, true);
rmdir($dirname);
}
table_header($th);
$k = 0;
- $mods = get_extensions_list();
+ $mods = get_extensions_list('extension');
foreach($mods as $pkg_name => $ext)
{
($available && $installed ? $installed : _("Unknown")));
label_cell($available ? $available : _("None"));
- if (!$available && $ext['type'] == 'plugin') // third-party plugin
+ if (!$available && $ext['type'] == 'extension' && !count(@$ext['tabs'])) // third-party plugin
button_cell('Edit'.$id, _("Edit"), _('Edit third-party extension parameters.'),
ICON_EDIT);
elseif (check_pkg_upgrade($installed, $available)) // outdated or not installed extension in repo
end_table(1);
submit_center_first('Refresh', _("Update"), '', null);
- submit_center_last('Add', _("Add third-party plugin"), '', false);
+ submit_center_last('Add', _("Add third-party extension"), '', false);
div_end();
}
$k = 0;
foreach($mods as $i => $mod)
{
+ if ($mod['type'] != 'extension') continue;
alt_table_row_color($k);
label_cell($mod['name']);
$entries = fmt_titles(@$mod['entries']);
start_table(TABLESTYLE2);
- if ($selected_id != -1 && $extensions[$selected_id]['type'] == 'plugin')
+ if ($selected_id != -1 && $extensions[$selected_id]['type'] == 'extension')
{
if ($Mode == 'Edit') {
$mod = $extensions[$selected_id];
$_POST['name'] = $mod['name'];
$_POST['tab'] = $entry['tab_id'];
$_POST['title'] = $entry['title'];
- $_POST['path'] = substr(dirname($entry['url']), 9); //strip '/modules/'
+ $_POST['path'] = substr(dirname($mod['path']), 9); //strip '/modules/'
$_POST['filename'] = basename($entry['url']);
$_POST['acc_file'] = @$mod['acc_file'] ? basename($mod['acc_file']) : null;
hidden('filename', $_POST['filename']);
hidden('selected_id', $selected_id);
}
text_row_ex(_("Name"), 'name', 30);
- text_row_ex(_("Folder"), 'path', 20);
+ text_row_ex(_("Subfolder (in modules directory)"), 'path', 20);
tab_list_row(_("Menu Tab"), 'tab', null, true);
text_row_ex(_("Menu Link Text"), 'title', 30);
record_status_list_row(_("Default status"), 'active');
- file_row(_("Module File"), 'uploadfile');
- file_row(_("Access Levels Extensions"), 'uploadfile3');
+ file_row(_("Extension File"), 'uploadfile');
+ file_row(_("Access Levels File"), 'uploadfile3');
file_row(_("SQL File"), 'uploadfile2');
end_table(0);
- display_note(_("Select your module PHP file from your local harddisk."), 0, 1);
- submit_add_or_update_center($selected_id == -1, '', 'both');
+ display_note(_("Select your extension PHP files from your local harddisk."), 0, 1);
+ echo '<center>';
+ submit_add_or_update($selected_id == -1, '', 'both');
+ echo '</center>';
}
//---------------------------------------------------------------------------------------------