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

« back to all changes in this revision

Viewing changes to admin/tool/xmldb/actions/edit_key_save/edit_key_save.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
 */
25
24
 * This class verifies all the data introduced when editing a key for correctness,
26
25
 * performing changes / displaying errors depending of the results.
27
26
 *
28
 
 * @package    tool
29
 
 * @subpackage xmldb
 
27
 * @package    tool_xmldb
30
28
 * @copyright  2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
31
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
30
 */
106
104
            $reffields = str_replace(' ', '', trim(strtolower($reffields)));
107
105
        }
108
106
 
109
 
        $editeddir =& $XMLDB->editeddirs[$dirpath];
110
 
        $structure =& $editeddir->xml_file->getStructure();
111
 
        $table =& $structure->getTable($tableparam);
112
 
        $key =& $table->getKey($keyparam);
 
107
        $editeddir = $XMLDB->editeddirs[$dirpath];
 
108
        $structure = $editeddir->xml_file->getStructure();
 
109
        $table = $structure->getTable($tableparam);
 
110
        $key = $table->getKey($keyparam);
113
111
        $oldhash = $key->getHash();
114
112
 
115
113
        $errors = array(); // To store all the errors found
254
252
        // Continue if we aren't under errors
255
253
        if (empty($errors)) {
256
254
            // If there is one name change, do it, changing the prev and next
257
 
            // atributes of the adjacent fields
 
255
            // attributes of the adjacent fields
258
256
            if ($keyparam != $name) {
259
257
                $key->setName($name);
260
258
                if ($key->getPrevious()) {
261
 
                    $prev =& $table->getKey($key->getPrevious());
 
259
                    $prev = $table->getKey($key->getPrevious());
262
260
                    $prev->setNext($name);
263
261
                    $prev->setChanged(true);
264
262
                }
265
263
                if ($key->getNext()) {
266
 
                    $next =& $table->getKey($key->getNext());
 
264
                    $next = $table->getKey($key->getNext());
267
265
                    $next->setPrevious($name);
268
266
                    $next->setChanged(true);
269
267
                }