relative+cleaned paths
This commit is contained in:
@@ -65,8 +65,8 @@ class create_xml_file extends XMLDBAction {
|
||||
/// Do the job, setting result as needed
|
||||
|
||||
/// Get the dir containing the file
|
||||
$dirpath = required_param('dir', PARAM_CLEAN);
|
||||
$dirpath = stripslashes_safe($dirpath);
|
||||
$dirpath = required_param('dir', PARAM_PATH);
|
||||
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
|
||||
$file = $dirpath . '/install.xml';
|
||||
|
||||
/// Some variables
|
||||
|
||||
@@ -64,7 +64,7 @@ class delete_xml_file extends XMLDBAction {
|
||||
|
||||
/// 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);
|
||||
|
||||
@@ -72,10 +72,10 @@ class delete_xml_file extends XMLDBAction {
|
||||
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">';
|
||||
|
||||
@@ -65,8 +65,8 @@ class load_xml_file extends XMLDBAction {
|
||||
/// Do the job, setting $result as needed
|
||||
|
||||
/// Get the dir containing the file
|
||||
$dirpath = required_param('dir', PARAM_CLEAN);
|
||||
$dirpath = stripslashes_safe($dirpath);
|
||||
$dirpath = required_param('dir', PARAM_PATH);
|
||||
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
|
||||
|
||||
/// Get the correct dir
|
||||
if (!empty($XMLDB->dbdirs)) {
|
||||
|
||||
@@ -96,7 +96,7 @@ class main_view extends XMLDBAction {
|
||||
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);
|
||||
@@ -120,7 +120,7 @@ class main_view extends XMLDBAction {
|
||||
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'] . ']';
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class main_view extends XMLDBAction {
|
||||
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'] . ']';
|
||||
}
|
||||
@@ -141,7 +141,7 @@ class main_view extends XMLDBAction {
|
||||
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'] . ']';
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class main_view extends XMLDBAction {
|
||||
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'] . ']';
|
||||
}
|
||||
@@ -165,7 +165,7 @@ class main_view extends XMLDBAction {
|
||||
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'] . ']';
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class main_view extends XMLDBAction {
|
||||
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'] . ']';
|
||||
}
|
||||
@@ -187,7 +187,7 @@ class main_view extends XMLDBAction {
|
||||
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'] . ']';
|
||||
}
|
||||
@@ -196,7 +196,7 @@ class main_view extends XMLDBAction {
|
||||
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>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user