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

Section identifiers must be defined as PARAM_RAW in wiki external functions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.1, 3.2
    • Fix Version/s: 3.1.2
    • Component/s: Wiki (2.x)
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a course with a student.
      2. Create a collaborative wiki in that course.
      3. Create an HTML page for that wiki (remember the pageid, you'll need it later). Please make sure this page has at least 1 title, and that title has HTML in it. For example:

        <h1><span>Title</span></h1>
        

      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the student:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the student user. You need to retrieve a section whose title contains HTML (in this example we use the same section created in the example above).
        • You need to replace the wstoken, pageid, section and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'pageid=61&section=%3Cspan%3ETitle%3C%2Fspan%3E&moodlewssettingfilter=true&wsfunction=mod_wiki_get_page_for_editing&wstoken=5b6154a56566a194f60f7f395f235179'

          Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output

      7. Check that you receive the right section contents.
      8. Now we'll perform another CURL request, in this case to edit the section. We use the same section as before.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'pageid=61&section=%3Cspan%3ETitle%3C%2Fspan%3E&content=%3Ch1%3E%3Cspan%3ETitle%3C%2Fspan%3E%3C%2Fh1%3ENewContent&moodlewssettingfilter=true&wsfunction=mod_wiki_edit_page&wstoken=5b6154a56566a194f60f7f395f235179'

      9. Check that you receive the pageid and an empty array of warnings. Go to Moodle and check that the section contents have been updated.
      Show
      Create a course with a student. Create a collaborative wiki in that course. Create an HTML page for that wiki (remember the pageid , you'll need it later). Please make sure this page has at least 1 title, and that title has HTML in it. For example: <h1><span>Title</span></h1> Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user. You need to retrieve a section whose title contains HTML (in this example we use the same section created in the example above). You need to replace the wstoken, pageid, section and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'pageid=61&section=%3Cspan%3ETitle%3C%2Fspan%3E&moodlewssettingfilter=true&wsfunction=mod_wiki_get_page_for_editing&wstoken=5b6154a56566a194f60f7f395f235179' Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output Check that you receive the right section contents. Now we'll perform another CURL request, in this case to edit the section. We use the same section as before. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'pageid=61&section=%3Cspan%3ETitle%3C%2Fspan%3E&content=%3Ch1%3E%3Cspan%3ETitle%3C%2Fspan%3E%3C%2Fh1%3ENewContent&moodlewssettingfilter=true&wsfunction=mod_wiki_edit_page&wstoken=5b6154a56566a194f60f7f395f235179' Check that you receive the pageid and an empty array of warnings. Go to Moodle and check that the section contents have been updated.
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-55348-master

      Description

      Section identifiers may content html, see mod/wiki/edit.php for an example where is defined as PARAM_RAW

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/Sep/16