/// 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);
$statementparam = required_param('statement', PARAM_CLEAN);
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
$o.= ' <p align="center">' . $this->str['confirmdeletestatement'] . '<br /><br />' . $statementparam . '</p>';
$o.= ' <table align="center" cellpadding="20"><tr><td>';
$o.= ' <div class="singlebutton">';
- $o.= ' <form action="index.php?action=delete_statement&confirmed=yes&postaction=edit_xml_file&statement=' . $statementparam . '&dir=' . urlencode($dirpath) . '" method="post">';
+ $o.= ' <form action="index.php?action=delete_statement&confirmed=yes&postaction=edit_xml_file&statement=' . $statementparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
$o.= ' <input type="submit" value="'. $this->str['yes'] .'" /></form></div>';
$o.= ' </td><td>';
$o.= ' <div class="singlebutton">';
- $o.= ' <form action="index.php?action=edit_xml_file&dir=' . urlencode($dirpath) . '" method="post">';
+ $o.= ' <form action="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '" method="post">';
$o.= ' <input type="submit" value="'. $this->str['no'] .'" /></form></div>';
$o.= ' </td></tr>';
$o.= ' </table>';
/// 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 dirs
if (!empty($XMLDB->dbdirs)) {
/// Add the main form
$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 ="action" value="edit_statement_save" />';
$o.= ' <input type="hidden" name ="postaction" value="edit_statement" />';
$b = ' <p align="center" class="buttons">';
/// The view original XML button
if ($origstructure->getStatement($statementparam)) {
- $b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode($dirpath) . '&select=original&statement=' . $statementparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
+ $b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&statement=' . $statementparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
} else {
$b .= ' [' . $this->str['vieworiginal'] . ']';
}
/// The view edited XML button
if ($statement->hasChanged()) {
- $b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode($dirpath) . '&select=edited&statement=' . $statementparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
+ $b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&statement=' . $statementparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
} else {
$b .= ' [' . $this->str['viewedited'] . ']';
}
/// The new sentence button
- $b .= ' <a href="index.php?action=new_sentence&postaction=edit_sentence&statement=' . $statementparam . '&dir=' . urlencode($dirpath) . '">[' . $this->str['newsentence'] . ']</a>';
+ $b .= ' <a href="index.php?action=new_sentence&postaction=edit_sentence&statement=' . $statementparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newsentence'] . ']</a>';
/// The back to edit xml file button
- $b .= ' <a href="index.php?action=edit_xml_file&dir=' . urlencode($dirpath) . '">[' . $this->str['back'] . ']</a>';
+ $b .= ' <a href="index.php?action=edit_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
$b .= '</p>';
$o .= $b;
/// Calculate buttons
$b = '</td><td class="button cell">';
/// The edit button
- $b .= '<a href="index.php?action=edit_sentence&sentence=' .$key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode($dirpath) . '">[' . $this->str['edit'] . ']</a>';
+ $b .= '<a href="index.php?action=edit_sentence&sentence=' .$key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['edit'] . ']</a>';
$b .= '</td><td class="button cell">';
/// The duplicate button
- $b .= '<a href="index.php?action=new_sentence&postaction=edit_sentence&basesentence=' . $key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode($dirpath) . '">[' . $this->str['duplicate'] . ']</a>';
+ $b .= '<a href="index.php?action=new_sentence&postaction=edit_sentence&basesentence=' . $key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['duplicate'] . ']</a>';
$b .= '</td><td class="button cell">';
/// The delete button
- $b .= '<a href="index.php?action=delete_sentence&sentence=' . $key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode($dirpath) . '">[' . $this->str['delete'] . ']</a>';
+ $b .= '<a href="index.php?action=delete_sentence&sentence=' . $key . '&statement=' . urlencode($statement->getName()) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
$b .= '</td>';
/// Print table row
$o .= '<tr class="r' . $row . '"><td class="table cell">' . $p . $sentence . $b . '</tr>';