/// 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)) {
$structure =& $editeddir->xml_file->getStructure();
/// 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 ="action" value="edit_xml_file_save" />';
$o.= ' <input type="hidden" name ="postaction" value="edit_xml_file" />';
$o.= ' <input type="hidden" name ="path" value="' . s($structure->getPath()) .'" />';
/// Calculate the buttons
$b = ' <p align="center" class="buttons">';
/// The view original XML button
- $b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode($dirpath) . '&select=original" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
+ $b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
/// The view edited XML button
if ($structure->hasChanged()) {
- $b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode($dirpath) . '&select=edited" target="_blank">[' . $this->str['viewedited'] . ']</a>';
+ $b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited" target="_blank">[' . $this->str['viewedited'] . ']</a>';
} else {
$b .= ' [' . $this->str['viewedited'] . ']';
}
/// The new table button
- $b .= ' <a href="index.php?action=new_table&postaction=edit_table&table=changeme&dir=' . urlencode($dirpath) . '">[' . $this->str['newtable'] . ']</a>';
+ $b .= ' <a href="index.php?action=new_table&postaction=edit_table&table=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtable'] . ']</a>';
/// The new from MySQL button
if ($CFG->dbtype == 'mysql') {
- $b .= ' <a href="index.php?action=new_table_from_mysql&dir=' . urlencode($dirpath) . '">[' . $this->str['newtablefrommysql'] . ']</a>';
+ $b .= ' <a href="index.php?action=new_table_from_mysql&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtablefrommysql'] . ']</a>';
} else {
$b .= ' [' . $this->str['newtablefrommysql'] . ']';
}
/// The new statement button
- $b .= ' <a href="index.php?action=new_statement&dir=' . urlencode($dirpath) . '">[' . $this->str['newstatement'] . ']</a>';
+ $b .= ' <a href="index.php?action=new_statement&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newstatement'] . ']</a>';
/// The back to main menu button
$b .= ' <a href="index.php?action=main_view#lastused">[' . $this->str['backtomainview'] . ']</a>';
$b .= '</p>';
$b .= ' <p align="center" class="buttons">';
/// The view sql code button
- $b .= '<a href="index.php?action=view_structure_sql&dir=' . urlencode($dirpath) . '">[' .$this->str['viewsqlcode'] . ']</a>';
+ $b .= '<a href="index.php?action=view_structure_sql&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' .$this->str['viewsqlcode'] . ']</a>';
/// The view php code button
- $b .= ' <a href="index.php?action=view_structure_php&dir=' . urlencode($dirpath) . '">[' . $this->str['viewphpcode'] . ']</a>';
+ $b .= ' <a href="index.php?action=view_structure_php&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['viewphpcode'] . ']</a>';
$b .= '</p>';
$o .= $b;
/// Join all the reserved words into one big array
/// Calculate buttons
$b = '</td><td class="button cell">';
/// The edit button
- $b .= '<a href="index.php?action=edit_table&table=' . $table->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['edit'] . ']</a>';
+ $b .= '<a href="index.php?action=edit_table&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['edit'] . ']</a>';
$b .= '</td><td class="button cell">';
/// The up button
if ($table->getPrevious()) {
- $b .= '<a href="index.php?action=move_updown_table&direction=up&table=' . $table->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['up'] . ']</a>';
+ $b .= '<a href="index.php?action=move_updown_table&direction=up&table=' . $table->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
} else {
$b .= '[' . $this->str['up'] . ']';
}
$b .= '</td><td class="button cell">';
/// The down button
if ($table->getNext()) {
- $b .= '<a href="index.php?action=move_updown_table&direction=down&table=' . $table->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['down'] . ']</a>';
+ $b .= '<a href="index.php?action=move_updown_table&direction=down&table=' . $table->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
} else {
$b .= '[' . $this->str['down'] . ']';
}
if (count($tables) > 1 &&
!$structure->getTableUses($table->getName())) {
///!$structure->getTableUses($table->getName())) {
- $b .= '<a href="index.php?action=delete_table&table=' . $table->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['delete'] . ']</a>';
+ $b .= '<a href="index.php?action=delete_table&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
} else {
$b .= '[' . $this->str['delete'] . ']';
}
}
$b .= '</td>';
/// Print table row
- $o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_table_xml&dir=' . urlencode($dirpath) . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $table->getName() . '</a>' . $b . '</tr>';
+ $o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $table->getName() . '</a>' . $b . '</tr>';
$row = ($row + 1) % 2;
}
$o .= '</table>';
/// Calculate buttons
$b = '</td><td class="button cell">';
/// The edit button
- $b .= '<a href="index.php?action=edit_statement&statement=' . $statement->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['edit'] . ']</a>';
+ $b .= '<a href="index.php?action=edit_statement&statement=' . $statement->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['edit'] . ']</a>';
$b .= '</td><td class="button cell">';
/// The up button
if ($statement->getPrevious()) {
- $b .= '<a href="index.php?action=move_updown_statement&direction=up&statement=' . $statement->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['up'] . ']</a>';
+ $b .= '<a href="index.php?action=move_updown_statement&direction=up&statement=' . $statement->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['up'] . ']</a>';
} else {
$b .= '[' . $this->str['up'] . ']';
}
$b .= '</td><td class="button cell">';
/// The down button
if ($statement->getNext()) {
- $b .= '<a href="index.php?action=move_updown_statement&direction=down&statement=' . $statement->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['down'] . ']</a>';
+ $b .= '<a href="index.php?action=move_updown_statement&direction=down&statement=' . $statement->getName() . '&postaction=edit_xml_file' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
} else {
$b .= '[' . $this->str['down'] . ']';
}
$b .= '</td><td class="button cell">';
/// The delete button
- $b .= '<a href="index.php?action=delete_statement&statement=' . $statement->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['delete'] . ']</a>';
+ $b .= '<a href="index.php?action=delete_statement&statement=' . $statement->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
$b .= '</td>';
/// Print statement row
- $o .= '<tr class="r' . $row . '"><td class="statement cell"><a href="index.php?action=view_statement_xml&dir=' . urlencode($dirpath) . '&statement=' . $statement->getName() . '&select=edited" target="_blank">' . $statement->getName() . '</a>' . $b . '</tr>';
+ $o .= '<tr class="r' . $row . '"><td class="statement cell"><a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&statement=' . $statement->getName() . '&select=edited" target="_blank">' . $statement->getName() . '</a>' . $b . '</tr>';
$row = ($row + 1) % 2;
}
$o .= '</table>';