From 5aa2b2e9430e8ecdc6e4fcb8694d9b8d8440d033 Mon Sep 17 00:00:00 2001 From: Eloy Lafuente Date: Fri, 20 Nov 2009 15:07:18 +0000 Subject: [PATCH] MDL-20916 protect the whole xmldb editor with sesskey. Backported from 19_STABLE --- admin/xmldb/actions/XMLDBAction.class.php | 12 +++++++-- .../check_indexes/check_indexes.class.php | 2 +- .../delete_field/delete_field.class.php | 2 +- .../delete_index/delete_index.class.php | 2 +- .../actions/delete_key/delete_key.class.php | 2 +- .../delete_sentence/delete_sentence.class.php | 2 +- .../delete_statement.class.php | 2 +- .../delete_table/delete_table.class.php | 2 +- .../delete_xml_file/delete_xml_file.class.php | 2 +- .../actions/edit_field/edit_field.class.php | 2 ++ .../actions/edit_index/edit_index.class.php | 2 ++ .../xmldb/actions/edit_key/edit_key.class.php | 2 ++ .../edit_sentence/edit_sentence.class.php | 2 ++ .../edit_statement/edit_statement.class.php | 8 +++--- .../actions/edit_table/edit_table.class.php | 26 ++++++++++--------- .../edit_xml_file/edit_xml_file.class.php | 20 +++++++------- .../get_db_directories.class.php | 1 + .../load_xml_file/load_xml_file.class.php | 1 + .../actions/main_view/main_view.class.php | 13 +++++----- .../new_statement/new_statement.class.php | 1 + .../new_table_from_mysql.class.php | 1 + .../revert_changes/revert_changes.class.php | 2 +- admin/xmldb/actions/test/test.class.php | 14 ++++++++++ .../unload_xml_file/unload_xml_file.class.php | 1 + .../view_field_xml/view_field_xml.class.php | 1 + .../view_index_xml/view_index_xml.class.php | 1 + .../view_key_xml/view_key_xml.class.php | 1 + .../view_reserved_words.class.php | 1 + .../view_statement_xml.class.php | 1 + .../view_structure_php.class.php | 1 + .../view_structure_sql.class.php | 1 + .../view_structure_xml.class.php | 1 + .../view_table_php/view_table_php.class.php | 1 + .../view_table_sql/view_table_sql.class.php | 1 + .../view_table_xml/view_table_xml.class.php | 1 + .../xmldb/actions/view_xml/view_xml.class.php | 1 + 36 files changed, 95 insertions(+), 41 deletions(-) diff --git a/admin/xmldb/actions/XMLDBAction.class.php b/admin/xmldb/actions/XMLDBAction.class.php index 615dd1e9e1f..fd613b546c4 100644 --- a/admin/xmldb/actions/XMLDBAction.class.php +++ b/admin/xmldb/actions/XMLDBAction.class.php @@ -47,6 +47,8 @@ class XMLDBAction { var $postaction; //Action to execute at the end of the invoke script + var $sesskey_protected; // Actions must be protected by sesskey mechanishm + /** * Constructor */ @@ -72,6 +74,7 @@ class XMLDBAction { $this->output = NULL; $this->errormsg = NULL; $this->subaction = NULL; + $this->sesskey_protected = true; } /** @@ -130,13 +133,18 @@ class XMLDBAction { } /** - * main invoke method, it simply sets the postaction attribute - * if possible + * main invoke method, it sets the postaction attribute + * if possible and checks sesskey_protected if needed */ function invoke() { global $SESSION; + /// Sesskey protection + if ($this->sesskey_protected) { + require_sesskey(); + } + /// If we are used any dir, save it in the lastused session object /// Some actions can use it to perform positioning if ($lastused = optional_param ('dir', NULL, PARAM_PATH)) { diff --git a/admin/xmldb/actions/check_indexes/check_indexes.class.php b/admin/xmldb/actions/check_indexes/check_indexes.class.php index baa7103f92a..7eb39f76016 100644 --- a/admin/xmldb/actions/check_indexes/check_indexes.class.php +++ b/admin/xmldb/actions/check_indexes/check_indexes.class.php @@ -94,7 +94,7 @@ class check_indexes extends XMLDBAction { $o.= '

' . $this->str['confirmcheckindexes'] . '

'; $o.= '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/delete_field/delete_field.class.php b/admin/xmldb/actions/delete_field/delete_field.class.php index 3bdee9aa400..2a320756645 100644 --- a/admin/xmldb/actions/delete_field/delete_field.class.php +++ b/admin/xmldb/actions/delete_field/delete_field.class.php @@ -77,7 +77,7 @@ class delete_field extends XMLDBAction { $o.= '

' . $this->str['confirmdeletefield'] . '

' . $fieldparam . '

'; $o.= '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/delete_index/delete_index.class.php b/admin/xmldb/actions/delete_index/delete_index.class.php index 182e1ad58b5..dc04d2154e7 100644 --- a/admin/xmldb/actions/delete_index/delete_index.class.php +++ b/admin/xmldb/actions/delete_index/delete_index.class.php @@ -77,7 +77,7 @@ class delete_index extends XMLDBAction { $o.= '

' . $this->str['confirmdeleteindex'] . '

' . $indexparam . '

'; $o.= '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/delete_key/delete_key.class.php b/admin/xmldb/actions/delete_key/delete_key.class.php index dc340ca2f2e..2d873b11b6f 100644 --- a/admin/xmldb/actions/delete_key/delete_key.class.php +++ b/admin/xmldb/actions/delete_key/delete_key.class.php @@ -77,7 +77,7 @@ class delete_key extends XMLDBAction { $o.= '

' . $this->str['confirmdeletekey'] . '

' . $keyparam . '

'; $o.= '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/delete_sentence/delete_sentence.class.php b/admin/xmldb/actions/delete_sentence/delete_sentence.class.php index 7208ca01321..9006609a0f7 100644 --- a/admin/xmldb/actions/delete_sentence/delete_sentence.class.php +++ b/admin/xmldb/actions/delete_sentence/delete_sentence.class.php @@ -77,7 +77,7 @@ class delete_sentence extends XMLDBAction { $o.= '

' . $this->str['confirmdeletesentence'] . '

'; $o.= '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/delete_statement/delete_statement.class.php b/admin/xmldb/actions/delete_statement/delete_statement.class.php index bb7c74fc5d4..4331d0f6b3c 100644 --- a/admin/xmldb/actions/delete_statement/delete_statement.class.php +++ b/admin/xmldb/actions/delete_statement/delete_statement.class.php @@ -76,7 +76,7 @@ class delete_statement extends XMLDBAction { $o.= '

' . $this->str['confirmdeletestatement'] . '

' . $statementparam . '

'; $o.= '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/delete_table/delete_table.class.php b/admin/xmldb/actions/delete_table/delete_table.class.php index 3b1811c9405..73624b835b4 100644 --- a/admin/xmldb/actions/delete_table/delete_table.class.php +++ b/admin/xmldb/actions/delete_table/delete_table.class.php @@ -76,7 +76,7 @@ class delete_table extends XMLDBAction { $o.= '

' . $this->str['confirmdeletetable'] . '

' . $tableparam . '

'; $o.= '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/delete_xml_file/delete_xml_file.class.php b/admin/xmldb/actions/delete_xml_file/delete_xml_file.class.php index 1eb2ea81913..0dc4f8fbfac 100644 --- a/admin/xmldb/actions/delete_xml_file/delete_xml_file.class.php +++ b/admin/xmldb/actions/delete_xml_file/delete_xml_file.class.php @@ -75,7 +75,7 @@ class delete_xml_file extends XMLDBAction { $o.= '

' . $this->str['confirmdeletexmlfile'] . '

' . $dirpath . '/install.php

'; $o.= '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/edit_field/edit_field.class.php b/admin/xmldb/actions/edit_field/edit_field.class.php index 853c3cf5c6d..e2931ee42b9 100644 --- a/admin/xmldb/actions/edit_field/edit_field.class.php +++ b/admin/xmldb/actions/edit_field/edit_field.class.php @@ -35,6 +35,7 @@ class edit_field extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( @@ -103,6 +104,7 @@ class edit_field extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= ' '; $o.= ' '; $o.= ' '; diff --git a/admin/xmldb/actions/edit_index/edit_index.class.php b/admin/xmldb/actions/edit_index/edit_index.class.php index 31f38b1cb0f..f28a5b7aa7f 100644 --- a/admin/xmldb/actions/edit_index/edit_index.class.php +++ b/admin/xmldb/actions/edit_index/edit_index.class.php @@ -35,6 +35,7 @@ class edit_index extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( @@ -103,6 +104,7 @@ class edit_index extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= ' '; $o.= ' '; $o.= '
'; diff --git a/admin/xmldb/actions/edit_key/edit_key.class.php b/admin/xmldb/actions/edit_key/edit_key.class.php index f12ed74adcf..7532b43f149 100644 --- a/admin/xmldb/actions/edit_key/edit_key.class.php +++ b/admin/xmldb/actions/edit_key/edit_key.class.php @@ -35,6 +35,7 @@ class edit_key extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( @@ -103,6 +104,7 @@ class edit_key extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= ' '; $o.= ' '; $o.= '
'; diff --git a/admin/xmldb/actions/edit_sentence/edit_sentence.class.php b/admin/xmldb/actions/edit_sentence/edit_sentence.class.php index e997cb9fa71..47fae500158 100644 --- a/admin/xmldb/actions/edit_sentence/edit_sentence.class.php +++ b/admin/xmldb/actions/edit_sentence/edit_sentence.class.php @@ -35,6 +35,7 @@ class edit_sentence extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( @@ -119,6 +120,7 @@ class edit_sentence extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= ' '; $o.= ' '; $o.= '
'; diff --git a/admin/xmldb/actions/edit_statement/edit_statement.class.php b/admin/xmldb/actions/edit_statement/edit_statement.class.php index a3443d2c102..f3b8be2365c 100644 --- a/admin/xmldb/actions/edit_statement/edit_statement.class.php +++ b/admin/xmldb/actions/edit_statement/edit_statement.class.php @@ -35,6 +35,7 @@ class edit_statement extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( @@ -106,6 +107,7 @@ class edit_statement extends XMLDBAction { $o.= '
'; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= ' '; $o.= ' '; $o.= '
'; @@ -129,7 +131,7 @@ class edit_statement extends XMLDBAction { $b .= ' [' . $this->str['viewedited'] . ']'; } /// The new sentence button - $b .= ' [' . $this->str['newsentence'] . ']'; + $b .= ' [' . $this->str['newsentence'] . ']'; /// The back to edit xml file button $b .= ' [' . $this->str['back'] . ']'; $b .= '

'; @@ -157,10 +159,10 @@ class edit_statement extends XMLDBAction { $b .= '[' . $this->str['edit'] . ']'; $b .= ''; /// Print table row $o .= ''; diff --git a/admin/xmldb/actions/edit_table/edit_table.class.php b/admin/xmldb/actions/edit_table/edit_table.class.php index 8c010efd9f3..5ea22925090 100644 --- a/admin/xmldb/actions/edit_table/edit_table.class.php +++ b/admin/xmldb/actions/edit_table/edit_table.class.php @@ -35,6 +35,7 @@ class edit_table extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( @@ -107,6 +108,7 @@ class edit_table extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= ' '; $o.= '
'; /// The duplicate button - $b .= '[' . $this->str['duplicate'] . ']'; + $b .= '[' . $this->str['duplicate'] . ']'; $b .= ''; /// The delete button - $b .= '[' . $this->str['delete'] . ']'; + $b .= '[' . $this->str['delete'] . ']'; $b .= '
' . $p . $sentence . $b . '
'; /// If the table is being used, we cannot rename it @@ -134,11 +136,11 @@ class edit_table extends XMLDBAction { $b .= ' [' . $this->str['viewedited'] . ']'; } /// The new field button - $b .= ' [' . $this->str['newfield'] . ']'; + $b .= ' [' . $this->str['newfield'] . ']'; /// The new key button - $b .= ' [' . $this->str['newkey'] . ']'; + $b .= ' [' . $this->str['newkey'] . ']'; /// The new index button - $b .= ' [' . $this->str['newindex'] . ']'; + $b .= ' [' . $this->str['newindex'] . ']'; /// The back to edit xml file button $b .= ' [' . $this->str['back'] . ']'; $b .= '

'; @@ -185,14 +187,14 @@ class edit_table extends XMLDBAction { $b .= ''; /// Print table row diff --git a/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php b/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php index 734c6725dcd..3facdd247bf 100644 --- a/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php +++ b/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php @@ -35,6 +35,7 @@ class edit_xml_file extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( @@ -107,6 +108,7 @@ class edit_xml_file extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= '
'; /// The up button if ($field->getPrevious()) { - $b .= '[' . $this->str['up'] . ']'; + $b .= '[' . $this->str['up'] . ']'; } else { $b .= '[' . $this->str['up'] . ']'; } $b .= ''; /// The down button if ($field->getNext()) { - $b .= '[' . $this->str['down'] . ']'; + $b .= '[' . $this->str['down'] . ']'; } else { $b .= '[' . $this->str['down'] . ']'; } @@ -200,7 +202,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 .= '[' . $this->str['delete'] . ']'; + $b .= '[' . $this->str['delete'] . ']'; } else { $b .= '[' . $this->str['delete'] . ']'; } @@ -234,21 +236,21 @@ class edit_table extends XMLDBAction { $b .= ''; /// The up button if ($key->getPrevious()) { - $b .= '[' . $this->str['up'] . ']'; + $b .= '[' . $this->str['up'] . ']'; } else { $b .= '[' . $this->str['up'] . ']'; } $b .= ''; /// The down button if ($key->getNext()) { - $b .= '[' . $this->str['down'] . ']'; + $b .= '[' . $this->str['down'] . ']'; } else { $b .= '[' . $this->str['down'] . ']'; } $b .= ''; /// The delete button (if the key hasn't uses) if (!$structure->getKeyUses($table->getName(), $key->getName())) { - $b .= '[' . $this->str['delete'] . ']'; + $b .= '[' . $this->str['delete'] . ']'; } else { $b .= '[' . $this->str['delete'] . ']'; } @@ -274,20 +276,20 @@ class edit_table extends XMLDBAction { $b .= ''; /// The up button if ($index->getPrevious()) { - $b .= '[' . $this->str['up'] . ']'; + $b .= '[' . $this->str['up'] . ']'; } else { $b .= '[' . $this->str['up'] . ']'; } $b .= ''; /// The down button if ($index->getNext()) { - $b .= '[' . $this->str['down'] . ']'; + $b .= '[' . $this->str['down'] . ']'; } else { $b .= '[' . $this->str['down'] . ']'; } $b .= ''; /// The delete button - $b .= '[' . $this->str['delete'] . ']'; + $b .= '[' . $this->str['delete'] . ']'; /// The readable info $r = '' . $index->readableInfo() . '
'; $o.= ' '; $o.= ' '; @@ -125,15 +127,15 @@ class edit_xml_file extends XMLDBAction { $b .= ' [' . $this->str['viewedited'] . ']'; } /// The new table button - $b .= ' [' . $this->str['newtable'] . ']'; + $b .= ' [' . $this->str['newtable'] . ']'; /// The new from MySQL button if ($CFG->dbfamily == 'mysql') { - $b .= ' [' . $this->str['newtablefrommysql'] . ']'; + $b .= ' [' . $this->str['newtablefrommysql'] . ']'; } else { $b .= ' [' . $this->str['newtablefrommysql'] . ']'; } /// The new statement button - $b .= ' [' . $this->str['newstatement'] . ']'; + $b .= ' [' . $this->str['newstatement'] . ']'; /// The back to main menu button $b .= ' [' . $this->str['backtomainview'] . ']'; $b .= '

'; @@ -169,14 +171,14 @@ class edit_xml_file extends XMLDBAction { $b .= ''; /// Print statement row $o .= ''; diff --git a/admin/xmldb/actions/get_db_directories/get_db_directories.class.php b/admin/xmldb/actions/get_db_directories/get_db_directories.class.php index 0eae7c8e233..bd629b8350b 100644 --- a/admin/xmldb/actions/get_db_directories/get_db_directories.class.php +++ b/admin/xmldb/actions/get_db_directories/get_db_directories.class.php @@ -39,6 +39,7 @@ class get_db_directories extends XMLDBAction { //$this->can_subaction = ACTION_HAVE_SUBACTIONS; /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/load_xml_file/load_xml_file.class.php b/admin/xmldb/actions/load_xml_file/load_xml_file.class.php index 9dd18eda8c6..b98695339cf 100644 --- a/admin/xmldb/actions/load_xml_file/load_xml_file.class.php +++ b/admin/xmldb/actions/load_xml_file/load_xml_file.class.php @@ -38,6 +38,7 @@ class load_xml_file extends XMLDBAction { //$this->can_subaction = ACTION_HAVE_SUBACTIONS; /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/main_view/main_view.class.php b/admin/xmldb/actions/main_view/main_view.class.php index 673cb885a0b..93d3c6733ec 100644 --- a/admin/xmldb/actions/main_view/main_view.class.php +++ b/admin/xmldb/actions/main_view/main_view.class.php @@ -35,6 +35,7 @@ class main_view extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( @@ -84,9 +85,9 @@ class main_view extends XMLDBAction { /// The reserved_words button $b .= ' [' . $this->str['reservedwords'] . ']'; /// The test button - $b .= ' [' . $this->str['test'] . ']'; + $b .= ' [' . $this->str['test'] . ']'; /// The check indexes button - $b .= ' [' . $this->str['checkindexes'] . ']'; + $b .= ' [' . $this->str['checkindexes'] . ']'; $b .= '

'; /// Send buttons to output $o .= $b; @@ -126,7 +127,7 @@ class main_view extends XMLDBAction { if ($dbdir->path_exists && !file_exists($key . '/install.xml') && is_writeable($key)) { - $b .= '[' . $this->str['create'] . ']'; + $b .= '[' . $this->str['create'] . ']'; } else { $b .= '[' . $this->str['create'] . ']'; } @@ -159,7 +160,7 @@ class main_view extends XMLDBAction { is_writeable($key) && !empty($dbdir->xml_loaded) && !empty($dbdir->xml_changed)) { - $b .= '[' . $this->str['save'] . ']'; + $b .= '[' . $this->str['save'] . ']'; /// Check if the file has been manually edited while being modified in the editor if ($dbdir->filemtime != filemtime($key . '/install.xml')) { /// File manually modified. Add to errors. @@ -178,7 +179,7 @@ class main_view extends XMLDBAction { is_writeable($key) && !empty($dbdir->xml_loaded) && !empty($dbdir->xml_changed)) { - $b .= '[' . $this->str['revert'] . ']'; + $b .= '[' . $this->str['revert'] . ']'; } else { $b .= '[' . $this->str['revert'] . ']'; } @@ -200,7 +201,7 @@ class main_view extends XMLDBAction { is_readable($key . '/install.xml') && is_writeable($key) && empty($dbdir->xml_loaded)) { - $b .= '[' . $this->str['delete'] . ']'; + $b .= '[' . $this->str['delete'] . ']'; } else { $b .= '[' . $this->str['delete'] . ']'; } diff --git a/admin/xmldb/actions/new_statement/new_statement.class.php b/admin/xmldb/actions/new_statement/new_statement.class.php index 5e19b5eceb1..39c951e7e74 100644 --- a/admin/xmldb/actions/new_statement/new_statement.class.php +++ b/admin/xmldb/actions/new_statement/new_statement.class.php @@ -107,6 +107,7 @@ class new_statement extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= '
Path:' . s($structure->getPath()) . '
Version:' . s($structure->getVersion()) . '
'; /// The up button if ($table->getPrevious()) { - $b .= '[' . $this->str['up'] . ']'; + $b .= '[' . $this->str['up'] . ']'; } else { $b .= '[' . $this->str['up'] . ']'; } $b .= ''; /// The down button if ($table->getNext()) { - $b .= '[' . $this->str['down'] . ']'; + $b .= '[' . $this->str['down'] . ']'; } else { $b .= '[' . $this->str['down'] . ']'; } @@ -185,7 +187,7 @@ class edit_xml_file extends XMLDBAction { if (count($tables) > 1 && !$structure->getTableUses($table->getName())) { ///!$structure->getTableUses($table->getName())) { - $b .= '[' . $this->str['delete'] . ']'; + $b .= '[' . $this->str['delete'] . ']'; } else { $b .= '[' . $this->str['delete'] . ']'; } @@ -214,20 +216,20 @@ class edit_xml_file extends XMLDBAction { $b .= ''; /// The up button if ($statement->getPrevious()) { - $b .= '[' . $this->str['up'] . ']'; + $b .= '[' . $this->str['up'] . ']'; } else { $b .= '[' . $this->str['up'] . ']'; } $b .= ''; /// The down button if ($statement->getNext()) { - $b .= '[' . $this->str['down'] . ']'; + $b .= '[' . $this->str['down'] . ']'; } else { $b .= '[' . $this->str['down'] . ']'; } $b .= ''; /// The delete button - $b .= '[' . $this->str['delete'] . ']'; + $b .= '[' . $this->str['delete'] . ']'; $b .= '
' . $statement->getName() . '' . $b . '
'; $o.= ' '; $o.= ' '; diff --git a/admin/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php b/admin/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php index 4155403f861..d5031054c39 100644 --- a/admin/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php +++ b/admin/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php @@ -111,6 +111,7 @@ class new_table_from_mysql extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; + $o.= ' '; $o.= '
' . choose_from_menu($typeoptions, 'type', '', 'choose', '', 0, true) . '' .choose_from_menu($selecttables, 'table', '', 'choose', '', 0, true) . '
'; $o.= ' '; $o.= ' '; diff --git a/admin/xmldb/actions/revert_changes/revert_changes.class.php b/admin/xmldb/actions/revert_changes/revert_changes.class.php index 0e9c8c6d9b8..f4329e217b1 100644 --- a/admin/xmldb/actions/revert_changes/revert_changes.class.php +++ b/admin/xmldb/actions/revert_changes/revert_changes.class.php @@ -75,7 +75,7 @@ class revert_changes extends XMLDBAction { $o.= '

' . $this->str['confirmrevertchanges'] . '

' . $dirpath . '

'; $o.= '
' . choose_from_menu($selecttables, 'table', '', 'choose', '', 0, true) . '' .choose_from_menu($aftertables, 'after', '', 'choose', '', 0, true) . '
'; $o.= '
'; - $o.= '
'; + $o.= '
'; $o.= '
'; $o.= '
'; $o.= '
'; diff --git a/admin/xmldb/actions/test/test.class.php b/admin/xmldb/actions/test/test.class.php index 97f04e87a5c..f92b099f465 100644 --- a/admin/xmldb/actions/test/test.class.php +++ b/admin/xmldb/actions/test/test.class.php @@ -955,6 +955,20 @@ class test extends XMLDBAction { $this->output = $o; + /// Finally drop all the potentially existing test tables + $table = new XMLDBTable('testtable'); + if (table_exists($table)) { + $status = drop_table($table, true, false); + } + $table = new XMLDBTable ('anothertest'); + if (table_exists($table)) { + $status = drop_table($table, true, false); + } + $table = new XMLDBTable ('newnameforthetable'); + if (table_exists($table)) { + $status = drop_table($table, true, false); + } + /// Launch postaction if exists (leave this here!) if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); diff --git a/admin/xmldb/actions/unload_xml_file/unload_xml_file.class.php b/admin/xmldb/actions/unload_xml_file/unload_xml_file.class.php index eba9d001f3c..7129d9e0f5a 100644 --- a/admin/xmldb/actions/unload_xml_file/unload_xml_file.class.php +++ b/admin/xmldb/actions/unload_xml_file/unload_xml_file.class.php @@ -35,6 +35,7 @@ class unload_xml_file extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_field_xml/view_field_xml.class.php b/admin/xmldb/actions/view_field_xml/view_field_xml.class.php index a18505b57c3..c609b628130 100644 --- a/admin/xmldb/actions/view_field_xml/view_field_xml.class.php +++ b/admin/xmldb/actions/view_field_xml/view_field_xml.class.php @@ -35,6 +35,7 @@ class view_field_xml extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_index_xml/view_index_xml.class.php b/admin/xmldb/actions/view_index_xml/view_index_xml.class.php index 016c16d3e87..b91993f44ea 100644 --- a/admin/xmldb/actions/view_index_xml/view_index_xml.class.php +++ b/admin/xmldb/actions/view_index_xml/view_index_xml.class.php @@ -35,6 +35,7 @@ class view_index_xml extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_key_xml/view_key_xml.class.php b/admin/xmldb/actions/view_key_xml/view_key_xml.class.php index d271f5b1199..2ee682a77f1 100644 --- a/admin/xmldb/actions/view_key_xml/view_key_xml.class.php +++ b/admin/xmldb/actions/view_key_xml/view_key_xml.class.php @@ -35,6 +35,7 @@ class view_key_xml extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_reserved_words/view_reserved_words.class.php b/admin/xmldb/actions/view_reserved_words/view_reserved_words.class.php index ba68520b3f3..c76e3405df3 100644 --- a/admin/xmldb/actions/view_reserved_words/view_reserved_words.class.php +++ b/admin/xmldb/actions/view_reserved_words/view_reserved_words.class.php @@ -38,6 +38,7 @@ class view_reserved_words extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_statement_xml/view_statement_xml.class.php b/admin/xmldb/actions/view_statement_xml/view_statement_xml.class.php index 89fea5cbcef..50e3a686812 100644 --- a/admin/xmldb/actions/view_statement_xml/view_statement_xml.class.php +++ b/admin/xmldb/actions/view_statement_xml/view_statement_xml.class.php @@ -35,6 +35,7 @@ class view_statement_xml extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_structure_php/view_structure_php.class.php b/admin/xmldb/actions/view_structure_php/view_structure_php.class.php index 7269491c1ce..a87942f2c2d 100644 --- a/admin/xmldb/actions/view_structure_php/view_structure_php.class.php +++ b/admin/xmldb/actions/view_structure_php/view_structure_php.class.php @@ -36,6 +36,7 @@ class view_structure_php extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_structure_sql/view_structure_sql.class.php b/admin/xmldb/actions/view_structure_sql/view_structure_sql.class.php index 9c9e3aba67b..5eef788fc09 100644 --- a/admin/xmldb/actions/view_structure_sql/view_structure_sql.class.php +++ b/admin/xmldb/actions/view_structure_sql/view_structure_sql.class.php @@ -36,6 +36,7 @@ class view_structure_sql extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_structure_xml/view_structure_xml.class.php b/admin/xmldb/actions/view_structure_xml/view_structure_xml.class.php index b84528509a9..5ee0127c8a4 100644 --- a/admin/xmldb/actions/view_structure_xml/view_structure_xml.class.php +++ b/admin/xmldb/actions/view_structure_xml/view_structure_xml.class.php @@ -35,6 +35,7 @@ class view_structure_xml extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_table_php/view_table_php.class.php b/admin/xmldb/actions/view_table_php/view_table_php.class.php index 9185ccc5943..1a94238deb4 100644 --- a/admin/xmldb/actions/view_table_php/view_table_php.class.php +++ b/admin/xmldb/actions/view_table_php/view_table_php.class.php @@ -36,6 +36,7 @@ class view_table_php extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_table_sql/view_table_sql.class.php b/admin/xmldb/actions/view_table_sql/view_table_sql.class.php index 5a91ac5dafb..1c44368b4a5 100644 --- a/admin/xmldb/actions/view_table_sql/view_table_sql.class.php +++ b/admin/xmldb/actions/view_table_sql/view_table_sql.class.php @@ -36,6 +36,7 @@ class view_table_sql extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_table_xml/view_table_xml.class.php b/admin/xmldb/actions/view_table_xml/view_table_xml.class.php index 36ad3f77176..b6d290f21e1 100644 --- a/admin/xmldb/actions/view_table_xml/view_table_xml.class.php +++ b/admin/xmldb/actions/view_table_xml/view_table_xml.class.php @@ -35,6 +35,7 @@ class view_table_xml extends XMLDBAction { parent::init(); /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( diff --git a/admin/xmldb/actions/view_xml/view_xml.class.php b/admin/xmldb/actions/view_xml/view_xml.class.php index 5e5872d4459..e7cdc28b7df 100644 --- a/admin/xmldb/actions/view_xml/view_xml.class.php +++ b/admin/xmldb/actions/view_xml/view_xml.class.php @@ -38,6 +38,7 @@ class view_xml extends XMLDBAction { //$this->can_subaction = ACTION_HAVE_SUBACTIONS; /// Set own custom attributes + $this->sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array(