Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-7749

1.7+ Front Page Settings Not Sticking - admin > settings.php - and Temporary fix

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7.1, 1.8
    • Component/s: Administration
    • Labels:
      None
    • Environment:
      WAMP
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE

      Description

      When changing the front page settings, none of the selections "stick"... I have not checked to see if they are actually being written to the database as I am new to Moodle and don't know which table they are stored in yet.

      However, I have found the problem code section, it is related to the "slashes" changes. And the temporary fix is to comment out the slashes with an older version of the code section before the change. Once this is done it works fine again. However, I do not know if this creates any security issues.

      This appears to be a problem that many others are having when looking through the forums...

      admin > settings.php near line 54

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      /// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------

      $statusmsg = '';

      // Problems with the following code section. The slashes functions are not working correctly
      /*
      if ($data = data_submitted()) {
      if (confirm_sesskey()) {
      $olddbsessions = !empty($CFG->dbsessions);
      $unslashed = array();
      foreach($data as $key=>$value)

      { $unslashed[$key] = stripslashes($value); }

      $errors = $root->write_settings($unslashed);
      //force logout if dbsession setting changes
      if ($olddbsessions != !empty($CFG->dbsessions))

      { require_logout(); }
      if (empty($errors)) {
      switch ($return) { case 'site': redirect("$CFG->wwwroot/"); case 'admin': redirect("$CFG->wwwroot/$CFG->admin/"); default: $statusmsg = get_string('changessaved'); }
      } else { $statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors; }
      } else { error(get_string('confirmsesskeybad', 'error')); }
      // now update $SITE - it might have been changed
      $SITE = get_record('course', 'id', $SITE->id);
      $COURSE = clone($SITE);
      }
      */

      // Replaced with OLD Code section that is working

      if ($data = data_submitted()) {
      if (confirm_sesskey()) {
      $olddbsessions = !empty($CFG->dbsessions);
      $errors = $root->write_settings((array)$data);
      //force logout if dbsession setting changes
      if ($olddbsessions != !empty($CFG->dbsessions)) { require_logout(); }

      if (empty($errors)) {
      switch ($return)

      { case 'site': redirect("$CFG->wwwroot/"); case 'admin': redirect("$CFG->wwwroot/$CFG->admin/"); default: $statusmsg = get_string('changessaved'); }

      } else

      { $statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors; }

      } else

      { error(get_string('confirmsesskeybad', 'error')); }

      // now update $SITE - it might have been changed
      $SITE = get_record('course', 'id', $SITE->id);
      $COURSE = clone($SITE);
      }

      // E N D R E P L A C E M E N T - THIS IS THE NEW / TEMPORARY WORKING CODE SECTION

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              wjwood64 Bill
              Tester:
              Nobody
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/Jan/07