~ubuntu-branches/ubuntu/trusty/moodle/trusty-proposed

« back to all changes in this revision

Viewing changes to admin/tool/xmldb/actions/delete_index/delete_index.class.php

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2013-07-19 08:52:46 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130719085246-yebwditc2exoap2r
Tags: 2.5.1-1
* New upstream version: 2.5.1.
  - Fixes security issues:
    CVE-2013-2242 CVE-2013-2243 CVE-2013-2244 CVE-2013-2245
    CVE-2013-2246
* Depend on apache2 instead of obsolete apache2-mpm-prefork.
* Use packaged libphp-phpmailer (closes: #429339), adodb,
  HTMLPurifier, PclZip.
* Update debconf translations, thanks Salvatore Merone, Pietro Tollot,
  Joe Hansen, Yuri Kozlov, Holger Wansing, Américo Monteiro,
  Adriano Rafael Gomes, victory, Michał Kułach.
  (closes: #716972, #716986, #717080, #717108, #717278)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
/**
18
 
 * @package    tool
19
 
 * @subpackage xmldb
 
18
 * @package    tool_xmldb
20
19
 * @copyright  2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
21
20
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
21
 */
24
23
/**
25
24
 * This class will delete completely one index
26
25
 *
27
 
 * @package    tool
28
 
 * @subpackage xmldb
 
26
 * @package    tool_xmldb
29
27
 * @copyright  2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
30
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
29
 */
75
73
 
76
74
        // If  not confirmed, show confirmation box
77
75
        if (!$confirmed) {
78
 
            $o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
 
76
            $o = '<table width="60" class="generaltable" border="0" cellpadding="5" cellspacing="0" id="notice">';
79
77
            $o.= '  <tr><td class="generalboxcontent">';
80
78
            $o.= '    <p class="centerpara">' . $this->str['confirmdeleteindex'] . '<br /><br />' . $indexparam . '</p>';
81
79
            $o.= '    <table class="boxaligncenter" cellpadding="20"><tr><td>';
96
94
            // Get the edited dir
97
95
            if (!empty($XMLDB->editeddirs)) {
98
96
                if (isset($XMLDB->editeddirs[$dirpath])) {
99
 
                    $dbdir =& $XMLDB->dbdirs[$dirpath];
100
 
                    $editeddir =& $XMLDB->editeddirs[$dirpath];
 
97
                    $dbdir = $XMLDB->dbdirs[$dirpath];
 
98
                    $editeddir = $XMLDB->editeddirs[$dirpath];
101
99
                    if ($editeddir) {
102
 
                        $structure =& $editeddir->xml_file->getStructure();
 
100
                        $structure = $editeddir->xml_file->getStructure();
103
101
                        // Move adjacent indexes prev and next attributes
104
 
                        $tables =& $structure->getTables();
105
 
                        $table =& $structure->getTable($tableparam);
106
 
                        $indexes =& $table->getIndexes();
107
 
                        $index =& $table->getIndex($indexparam);
 
102
                        $tables = $structure->getTables();
 
103
                        $table = $structure->getTable($tableparam);
 
104
                        $indexes = $table->getIndexes();
 
105
                        $index = $table->getIndex($indexparam);
108
106
                        if ($index->getPrevious()) {
109
 
                            $prev =& $table->getIndex($index->getPrevious());
 
107
                            $prev = $table->getIndex($index->getPrevious());
110
108
                            $prev->setNext($index->getNext());
111
109
                        }
112
110
                        if ($index->getNext()) {
113
 
                            $next =& $table->getIndex($index->getNext());
 
111
                            $next = $table->getIndex($index->getNext());
114
112
                            $next->setPrevious($index->getPrevious());
115
113
                        }
116
114
                        // Remove the index
121
119
 
122
120
                        // If the hash has changed from the original one, change the version
123
121
                        // and mark the structure as changed
124
 
                        $origstructure =& $dbdir->xml_file->getStructure();
 
122
                        $origstructure = $dbdir->xml_file->getStructure();
125
123
                        if ($structure->getHash() != $origstructure->getHash()) {
126
124
                            $structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
127
125
                            $structure->setChanged(true);