mirror of
https://github.com/moodle/moodle.git
synced 2025-05-04 15:27:34 +02:00
relative+cleaned paths
This commit is contained in:
parent
d81f3415ca
commit
2af2711f79
@ -63,8 +63,8 @@ class delete_table 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);
|
||||
$tableparam = required_param('table', PARAM_CLEAN);
|
||||
|
||||
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
|
||||
@ -76,11 +76,11 @@ class delete_table extends XMLDBAction {
|
||||
$o.= ' <p align="center">' . $this->str['confirmdeletetable'] . '<br /><br />' . $tableparam . '</p>';
|
||||
$o.= ' <table align="center" cellpadding="20"><tr><td>';
|
||||
$o.= ' <div class="singlebutton">';
|
||||
$o.= ' <form action="index.php?action=delete_table&confirmed=yes&postaction=edit_xml_file&table=' . $tableparam . '&dir=' . urlencode($dirpath) . '" method="post">';
|
||||
$o.= ' <form action="index.php?action=delete_table&confirmed=yes&postaction=edit_xml_file&table=' . $tableparam . '&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>';
|
||||
|
@ -76,8 +76,8 @@ class edit_table 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 dirs
|
||||
if (!empty($XMLDB->dbdirs)) {
|
||||
@ -103,7 +103,7 @@ class edit_table extends XMLDBAction {
|
||||
|
||||
/// 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 ="table" value="' . $tableparam .'" />';
|
||||
$o.= ' <input type="hidden" name ="action" value="edit_table_save" />';
|
||||
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
|
||||
@ -122,30 +122,30 @@ class edit_table extends XMLDBAction {
|
||||
$b = ' <p align="center" class="buttons">';
|
||||
/// The view original XML button
|
||||
if ($origstructure->getTable($tableparam)) {
|
||||
$b .= ' <a href="index.php?action=view_table_xml&dir=' . urlencode($dirpath) . '&select=original&table=' . $tableparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '" target="_blank">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['vieworiginal'] . ']';
|
||||
}
|
||||
/// The view edited XML button
|
||||
if ($table->hasChanged()) {
|
||||
$b .= ' <a href="index.php?action=view_table_xml&dir=' . urlencode($dirpath) . '&select=edited&table=' . $tableparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_table_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited&table=' . $tableparam . '" target="_blank">[' . $this->str['viewedited'] . ']</a>';
|
||||
} else {
|
||||
$b .= ' [' . $this->str['viewedited'] . ']';
|
||||
}
|
||||
/// The new field button
|
||||
$b .= ' <a href="index.php?action=new_field&postaction=edit_field&table=' . $tableparam . '&field=changeme&dir=' . urlencode($dirpath) . '">[' . $this->str['newfield'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_field&postaction=edit_field&table=' . $tableparam . '&field=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newfield'] . ']</a>';
|
||||
/// The new key button
|
||||
$b .= ' <a href="index.php?action=new_key&postaction=edit_key&table=' . $tableparam . '&key=changeme&dir=' . urlencode($dirpath) . '">[' . $this->str['newkey'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_key&postaction=edit_key&table=' . $tableparam . '&key=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newkey'] . ']</a>';
|
||||
/// The new index button
|
||||
$b .= ' <a href="index.php?action=new_index&postaction=edit_index&table=' . $tableparam . '&index=changeme&dir=' . urlencode($dirpath) . '">[' . $this->str['newindex'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=new_index&postaction=edit_index&table=' . $tableparam . '&index=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newindex'] . ']</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>';
|
||||
$b .= ' <p align="center" class="buttons">';
|
||||
/// The view sql code button
|
||||
$b .= '<a href="index.php?action=view_table_sql&table=' . $tableparam . '&dir=' . urlencode($dirpath) . '">[' .$this->str['viewsqlcode'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=view_table_sql&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' .$this->str['viewsqlcode'] . ']</a>';
|
||||
/// The view php code button
|
||||
$b .= ' <a href="index.php?action=view_table_php&table=' . $tableparam . '&dir=' . urlencode($dirpath) . '">[' . $this->str['viewphpcode'] . ']</a>';
|
||||
$b .= ' <a href="index.php?action=view_table_php&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['viewphpcode'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
$o .= $b;
|
||||
|
||||
@ -177,21 +177,21 @@ class edit_table extends XMLDBAction {
|
||||
$b = '</td><td class="button cell">';
|
||||
/// The edit button (if the field has no uses)
|
||||
if (!$structure->getFieldUses($table->getName(), $field->getName())) {
|
||||
$b .= '<a href="index.php?action=edit_field&field=' .$field->getName() . '&table=' . $table->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['edit'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=edit_field&field=' .$field->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['edit'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['edit'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The up button
|
||||
if ($field->getPrevious()) {
|
||||
$b .= '<a href="index.php?action=move_updown_field&direction=up&field=' . $field->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['up'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_field&direction=up&field=' . $field->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&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 ($field->getNext()) {
|
||||
$b .= '<a href="index.php?action=move_updown_field&direction=down&field=' . $field->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['down'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_field&direction=down&field=' . $field->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['down'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['down'] . ']';
|
||||
}
|
||||
@ -199,7 +199,7 @@ class edit_table extends XMLDBAction {
|
||||
/// The delete button (if we have more than one and it isn't used
|
||||
if (count($fields) > 1 &&
|
||||
!$structure->getFieldUses($table->getName(), $field->getName())) {
|
||||
$b .= '<a href="index.php?action=delete_field&field=' . $field->getName() . '&table=' . $table->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_field&field=' . $field->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['delete'] . ']';
|
||||
}
|
||||
@ -210,7 +210,7 @@ class edit_table extends XMLDBAction {
|
||||
/// The readable info
|
||||
$r = '</td><td class="readableinfo cell">' . $field->readableInfo() . '</td>';
|
||||
/// Print table row
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_field_xml&dir=' . urlencode($dirpath) . '&field=' . $field->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $field->getName() . '</a>' . $b . $r . '</tr>';
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_field_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&field=' . $field->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $field->getName() . '</a>' . $b . $r . '</tr>';
|
||||
$row = ($row + 1) % 2;
|
||||
}
|
||||
$o .= '</table>';
|
||||
@ -226,35 +226,35 @@ class edit_table extends XMLDBAction {
|
||||
$b = '</td><td class="button cell">';
|
||||
/// The edit button (if the key hasn't uses)
|
||||
if (!$structure->getKeyUses($table->getName(), $key->getName())) {
|
||||
$b .= '<a href="index.php?action=edit_key&key=' .$key->getName() . '&table=' . $table->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['edit'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=edit_key&key=' .$key->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['edit'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['edit'] . ']';
|
||||
}
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The up button
|
||||
if ($key->getPrevious()) {
|
||||
$b .= '<a href="index.php?action=move_updown_key&direction=up&key=' . $key->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['up'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_key&direction=up&key=' . $key->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&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 ($key->getNext()) {
|
||||
$b .= '<a href="index.php?action=move_updown_key&direction=down&key=' . $key->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['down'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_key&direction=down&key=' . $key->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&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 (if the key hasn't uses)
|
||||
if (!$structure->getKeyUses($table->getName(), $key->getName())) {
|
||||
$b .= '<a href="index.php?action=delete_key&key=' . $key->getName() . '&table=' . $table->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_key&key=' . $key->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
} else {
|
||||
$b .= '[' . $this->str['delete'] . ']';
|
||||
}
|
||||
/// The readable info
|
||||
$r = '</td><td class="readableinfo cell">' . $key->readableInfo() . '</td>';
|
||||
/// Print table row
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_key_xml&dir=' . urlencode($dirpath) . '&key=' . $key->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $key->getName() . '</a>' . $b . $r .'</tr>';
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_key_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&key=' . $key->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $key->getName() . '</a>' . $b . $r .'</tr>';
|
||||
$row = ($row + 1) % 2;
|
||||
}
|
||||
$o .= '</table>';
|
||||
@ -269,28 +269,28 @@ class edit_table extends XMLDBAction {
|
||||
/// Calculate buttons
|
||||
$b = '</td><td class="button cell">';
|
||||
/// The edit button
|
||||
$b .= '<a href="index.php?action=edit_index&index=' .$index->getName() . '&table=' . $table->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['edit'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=edit_index&index=' .$index->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['edit'] . ']</a>';
|
||||
$b .= '</td><td class="button cell">';
|
||||
/// The up button
|
||||
if ($index->getPrevious()) {
|
||||
$b .= '<a href="index.php?action=move_updown_index&direction=up&index=' . $index->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['up'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_index&direction=up&index=' . $index->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&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 ($index->getNext()) {
|
||||
$b .= '<a href="index.php?action=move_updown_index&direction=down&index=' . $index->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&dir=' . urlencode($dirpath) . '">[' . $this->str['down'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=move_updown_index&direction=down&index=' . $index->getName() . '&table=' . $table->getName() . '&postaction=edit_table' . '&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_index&index=' . $index->getName() . '&table=' . $table->getName() . '&dir=' . urlencode($dirpath) . '">[' . $this->str['delete'] . ']</a>';
|
||||
$b .= '<a href="index.php?action=delete_index&index=' . $index->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['delete'] . ']</a>';
|
||||
/// The readable info
|
||||
$r = '</td><td class="readableinfo cell">' . $index->readableInfo() . '</td>';
|
||||
/// Print table row
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_index_xml&dir=' . urlencode($dirpath) . '&index=' . $index->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $index->getName() . '</a>' . $b . $r .'</tr>';
|
||||
$o .= '<tr class="r' . $row . '"><td class="table cell"><a href="index.php?action=view_index_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&index=' . $index->getName() . '&table=' . $table->getName() . '&select=edited" target="_blank">' . $index->getName() . '</a>' . $b . $r .'</tr>';
|
||||
$row = ($row + 1) % 2;
|
||||
}
|
||||
$o .= '</table>';
|
||||
|
@ -61,8 +61,8 @@ class move_updown_table 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 dirs
|
||||
if (!empty($XMLDB->dbdirs)) {
|
||||
|
@ -64,8 +64,8 @@ class view_table_xml extends XMLDBAction {
|
||||
$table = required_param('table', PARAM_CLEAN);
|
||||
$select = required_param('select', PARAM_ALPHA); //original/edited
|
||||
/// 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 ($select == 'original') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user