relative+cleaned paths

This commit is contained in:
stronk7 2006-08-29 23:20:03 +00:00
parent 51b8bebb7a
commit 8f5b5e4f68
4 changed files with 18 additions and 18 deletions

View file

@ -63,8 +63,8 @@ class delete_statement extends XMLDBAction {
/// Do the job, setting result as needed /// Do the job, setting result as needed
/// Get the dir containing the file /// Get the dir containing the file
$dirpath = required_param('dir', PARAM_CLEAN); $dirpath = required_param('dir', PARAM_PATH);
$dirpath = stripslashes_safe($dirpath); $dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
$statementparam = required_param('statement', PARAM_CLEAN); $statementparam = required_param('statement', PARAM_CLEAN);
$confirmed = optional_param('confirmed', false, PARAM_BOOL); $confirmed = optional_param('confirmed', false, PARAM_BOOL);
@ -76,11 +76,11 @@ class delete_statement extends XMLDBAction {
$o.= ' <p align="center">' . $this->str['confirmdeletestatement'] . '<br /><br />' . $statementparam . '</p>'; $o.= ' <p align="center">' . $this->str['confirmdeletestatement'] . '<br /><br />' . $statementparam . '</p>';
$o.= ' <table align="center" cellpadding="20"><tr><td>'; $o.= ' <table align="center" cellpadding="20"><tr><td>';
$o.= ' <div class="singlebutton">'; $o.= ' <div class="singlebutton">';
$o.= ' <form action="index.php?action=delete_statement&amp;confirmed=yes&amp;postaction=edit_xml_file&amp;statement=' . $statementparam . '&amp;dir=' . urlencode($dirpath) . '" method="post">'; $o.= ' <form action="index.php?action=delete_statement&amp;confirmed=yes&amp;postaction=edit_xml_file&amp;statement=' . $statementparam . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>'; $o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
$o.= ' </td><td>'; $o.= ' </td><td>';
$o.= ' <div class="singlebutton">'; $o.= ' <div class="singlebutton">';
$o.= ' <form action="index.php?action=edit_xml_file&amp;dir=' . urlencode($dirpath) . '" method="post">'; $o.= ' <form action="index.php?action=edit_xml_file&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>'; $o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
$o.= ' </td></tr>'; $o.= ' </td></tr>';
$o.= ' </table>'; $o.= ' </table>';

View file

@ -68,8 +68,8 @@ class edit_statement extends XMLDBAction {
/// Do the job, setting result as needed /// Do the job, setting result as needed
/// Get the dir containing the file /// Get the dir containing the file
$dirpath = required_param('dir', PARAM_CLEAN); $dirpath = required_param('dir', PARAM_PATH);
$dirpath = stripslashes_safe($dirpath); $dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dirs /// Get the correct dirs
if (!empty($XMLDB->dbdirs)) { if (!empty($XMLDB->dbdirs)) {
@ -103,7 +103,7 @@ class edit_statement extends XMLDBAction {
/// Add the main form /// Add the main form
$o = '<form id="form" action="index.php" method="post">'; $o = '<form id="form" action="index.php" method="post">';
$o.= ' <input type="hidden" name ="dir" value="' . $dirpath . '" />'; $o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
$o.= ' <input type="hidden" name ="statement" value="' . $statementparam .'" />'; $o.= ' <input type="hidden" name ="statement" value="' . $statementparam .'" />';
$o.= ' <input type="hidden" name ="action" value="edit_statement_save" />'; $o.= ' <input type="hidden" name ="action" value="edit_statement_save" />';
$o.= ' <input type="hidden" name ="postaction" value="edit_statement" />'; $o.= ' <input type="hidden" name ="postaction" value="edit_statement" />';
@ -117,20 +117,20 @@ class edit_statement extends XMLDBAction {
$b = ' <p align="center" class="buttons">'; $b = ' <p align="center" class="buttons">';
/// The view original XML button /// The view original XML button
if ($origstructure->getStatement($statementparam)) { if ($origstructure->getStatement($statementparam)) {
$b .= '&nbsp;<a href="index.php?action=view_statement_xml&amp;dir=' . urlencode($dirpath) . '&amp;select=original&amp;statement=' . $statementparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>'; $b .= '&nbsp;<a href="index.php?action=view_statement_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;select=original&amp;statement=' . $statementparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
} else { } else {
$b .= '&nbsp;[' . $this->str['vieworiginal'] . ']'; $b .= '&nbsp;[' . $this->str['vieworiginal'] . ']';
} }
/// The view edited XML button /// The view edited XML button
if ($statement->hasChanged()) { if ($statement->hasChanged()) {
$b .= '&nbsp;<a href="index.php?action=view_statement_xml&amp;dir=' . urlencode($dirpath) . '&amp;select=edited&amp;statement=' . $statementparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>'; $b .= '&nbsp;<a href="index.php?action=view_statement_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;select=edited&amp;statement=' . $statementparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
} else { } else {
$b .= '&nbsp;[' . $this->str['viewedited'] . ']'; $b .= '&nbsp;[' . $this->str['viewedited'] . ']';
} }
/// The new sentence button /// The new sentence button
$b .= '&nbsp;<a href="index.php?action=new_sentence&amp;postaction=edit_sentence&amp;statement=' . $statementparam . '&amp;dir=' . urlencode($dirpath) . '">[' . $this->str['newsentence'] . ']</a>'; $b .= '&nbsp;<a href="index.php?action=new_sentence&amp;postaction=edit_sentence&amp;statement=' . $statementparam . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newsentence'] . ']</a>';
/// The back to edit xml file button /// The back to edit xml file button
$b .= '&nbsp;<a href="index.php?action=edit_xml_file&amp;dir=' . urlencode($dirpath) . '">[' . $this->str['back'] . ']</a>'; $b .= '&nbsp;<a href="index.php?action=edit_xml_file&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
$b .= '</p>'; $b .= '</p>';
$o .= $b; $o .= $b;
@ -153,13 +153,13 @@ class edit_statement extends XMLDBAction {
/// Calculate buttons /// Calculate buttons
$b = '</td><td class="button cell">'; $b = '</td><td class="button cell">';
/// The edit button /// The edit button
$b .= '<a href="index.php?action=edit_sentence&amp;sentence=' .$key . '&amp;statement=' . urlencode($statement->getName()) . '&amp;dir=' . urlencode($dirpath) . '">[' . $this->str['edit'] . ']</a>'; $b .= '<a href="index.php?action=edit_sentence&amp;sentence=' .$key . '&amp;statement=' . urlencode($statement->getName()) . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['edit'] . ']</a>';
$b .= '</td><td class="button cell">'; $b .= '</td><td class="button cell">';
/// The duplicate button /// The duplicate button
$b .= '<a href="index.php?action=new_sentence&amp;postaction=edit_sentence&amp;basesentence=' . $key . '&amp;statement=' . urlencode($statement->getName()) . '&amp;dir=' . urlencode($dirpath) . '">[' . $this->str['duplicate'] . ']</a>'; $b .= '<a href="index.php?action=new_sentence&amp;postaction=edit_sentence&amp;basesentence=' . $key . '&amp;statement=' . urlencode($statement->getName()) . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['duplicate'] . ']</a>';
$b .= '</td><td class="button cell">'; $b .= '</td><td class="button cell">';
/// The delete button /// The delete button
$b .= '<a href="index.php?action=delete_sentence&amp;sentence=' . $key . '&amp;statement=' . urlencode($statement->getName()) . '&amp;dir=' . urlencode($dirpath) . '">[' . $this->str['delete'] . ']</a>'; $b .= '<a href="index.php?action=delete_sentence&amp;sentence=' . $key . '&amp;statement=' . urlencode($statement->getName()) . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
$b .= '</td>'; $b .= '</td>';
/// Print table row /// Print table row
$o .= '<tr class="r' . $row . '"><td class="table cell">' . $p . $sentence . $b . '</tr>'; $o .= '<tr class="r' . $row . '"><td class="table cell">' . $p . $sentence . $b . '</tr>';

View file

@ -61,8 +61,8 @@ class move_updown_statement extends XMLDBAction {
/// Do the job, setting result as needed /// Do the job, setting result as needed
/// Get the dir containing the file /// Get the dir containing the file
$dirpath = required_param('dir', PARAM_CLEAN); $dirpath = required_param('dir', PARAM_PATH);
$dirpath = stripslashes_safe($dirpath); $dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dirs /// Get the correct dirs
if (!empty($XMLDB->dbdirs)) { if (!empty($XMLDB->dbdirs)) {

View file

@ -64,8 +64,8 @@ class view_statement_xml extends XMLDBAction {
$statement = required_param('statement', PARAM_CLEAN); $statement = required_param('statement', PARAM_CLEAN);
$select = required_param('select', PARAM_ALPHA); //original/edited $select = required_param('select', PARAM_ALPHA); //original/edited
/// Get the dir containing the file /// Get the dir containing the file
$dirpath = required_param('dir', PARAM_CLEAN); $dirpath = required_param('dir', PARAM_PATH);
$dirpath = stripslashes_safe($dirpath); $dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dir /// Get the correct dir
if ($select == 'original') { if ($select == 'original') {