/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_CLEAN);
- $dirpath = stripslashes_safe($dirpath);
+ $dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
if (!$confirmed) {
$o = '<table align="center" width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
$o.= ' <tr><td class="generalboxcontent">';
- $o.= ' <p align="center">' . $this->str['confirmdeletexmlfile'] . '<br /><br />' . $dirpath . '</p>';
+ $o.= ' <p align="center">' . $this->str['confirmdeletexmlfile'] . '<br /><br />' . $dirpath . '/install.php</p>';
$o.= ' <table align="center" cellpadding="20"><tr><td>';
$o.= ' <div class="singlebutton">';
- $o.= ' <form action="index.php?action=delete_xml_file&confirmed=yes&dir=' . urlencode($dirpath) . '&postaction=main_view#lastused" method="post">';
+ $o.= ' <form action="index.php?action=delete_xml_file&confirmed=yes&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&postaction=main_view#lastused" method="post">';
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
$o.= ' </td><td>';
$o.= ' <div class="singlebutton">';
foreach ($XMLDB->dbdirs as $key => $dbdir) {
/// Detect if this is the lastused dir
$hithis = false;
- if ($key == $lastused) {
+ if (str_replace($CFG->dirroot, '', $key) == $lastused) {
$hithis = true;
}
$elementtext = str_replace($CFG->dirroot . '/', '', $key);
if ($dbdir->path_exists &&
!file_exists($key . '/install.xml') &&
is_writeable($key)) {
- $b .= '<a href="index.php?action=create_xml_file&dir=' . urlencode($key) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['create'] . ']</a>';
+ $b .= '<a href="index.php?action=create_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['create'] . ']</a>';
} else {
$b .= '[' . $this->str['create'] . ']';
}
file_exists($key . '/install.xml') &&
is_readable($key . '/install.xml') &&
empty($dbdir->xml_loaded)) {
- $b .= '<a href="index.php?action=load_xml_file&dir=' . urlencode($key) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['load'] . ']</a>';
+ $b .= '<a href="index.php?action=load_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['load'] . ']</a>';
} else {
$b .= '[' . $this->str['load'] . ']';
}
is_readable($key . '/install.xml') &&
is_readable($key) &&
!empty($dbdir->xml_loaded)) {
- $b .= '<a href="index.php?action=edit_xml_file&dir=' . urlencode($key) . '">[' . $this->str['edit'] . ']</a>';
+ $b .= '<a href="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['edit'] . ']</a>';
} else {
$b .= '[' . $this->str['edit'] . ']';
}
is_writeable($key) &&
!empty($dbdir->xml_loaded) &&
!empty($dbdir->xml_changed)) {
- $b .= '<a href="index.php?action=save_xml_file&dir=' . urlencode($key) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['save'] . ']</a>';
+ $b .= '<a href="index.php?action=save_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['save'] . ']</a>';
} else {
$b .= '[' . $this->str['save'] . ']';
}
is_writeable($key) &&
!empty($dbdir->xml_loaded) &&
!empty($dbdir->xml_changed)) {
- $b .= '<a href="index.php?action=revert_changes&dir=' . urlencode($key) . '">[' . $this->str['revert'] . ']</a>';
+ $b .= '<a href="index.php?action=revert_changes&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['revert'] . ']</a>';
} else {
$b .= '[' . $this->str['revert'] . ']';
}
is_readable($key . '/install.xml') &&
!empty($dbdir->xml_loaded) &&
empty($dbdir->xml_changed)) {
- $b .= '<a href="index.php?action=unload_xml_file&dir=' . urlencode($key) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['unload'] . ']</a>';
+ $b .= '<a href="index.php?action=unload_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['unload'] . ']</a>';
} else {
$b .= '[' . $this->str['unload'] . ']';
}
is_readable($key . '/install.xml') &&
is_writeable($key) &&
empty($dbdir->xml_loaded)) {
- $b .= '<a href="index.php?action=delete_xml_file&dir=' . urlencode($key) . '">[' . $this->str['delete'] . ']</a>';
+ $b .= '<a href="index.php?action=delete_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '">[' . $this->str['delete'] . ']</a>';
} else {
$b .= '[' . $this->str['delete'] . ']';
}
if ($dbdir->path_exists &&
file_exists($key . '/install.xml') &&
is_readable($key . '/install.xml')) {
- $elementtext = '<a href="index.php?action=view_xml&file=' . urlencode($key . '/install.xml') . '" target="_blank">' . $elementtext . '</a></td>';
+ $elementtext = '<a href="index.php?action=view_xml&file=' . urlencode(str_replace($CFG->dirroot, '', $key) . '/install.xml') . '" target="_blank">' . $elementtext . '</a></td>';
} else {
$elementtext = $elementtext . '</td>';
}