]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed a typo in loginas.php + added a parameter control in moodle_url::set_url()...
authorDavid Mudrak <david.mudrak@gmail.com>
Thu, 7 Jan 2010 20:17:38 +0000 (20:17 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Thu, 7 Jan 2010 20:17:38 +0000 (20:17 +0000)
course/loginas.php
lib/pagelib.php

index 8a0e7a977f17d5dffcfa649c38bc180a83ca62d7..c642c510f932fc776f6a0cad575a86d18efedec1 100644 (file)
@@ -31,7 +31,7 @@
     if ($id !== SITEID) {
         $url->param('id', $id);
     }
-    $PAGE->set_url($id);
+    $PAGE->set_url($url);
 
     if (!confirm_sesskey()) {
         print_error('confirmsesskeybad');
index 0902a2fb2f46b0da118af7a9153b7719857dca51..27b0a37aee719973ee32f7942c39f06073802d62 100644 (file)
@@ -813,7 +813,7 @@ class moodle_page {
      * For example, course/view.php does:
      *      $id = optional_param('id', 0, PARAM_INT);
      *      $PAGE->set_url('course/view.php', array('id' => $id));
-     * @param mixed $url moodle_url|string URL relative to $CFG->wwwroot or {@link moodle_url} instance
+     * @param moodle_url|string $url URL relative to $CFG->wwwroot or {@link moodle_url} instance
      * @param array $params paramters to add to the URL (allowed only if $url is string)
      */
     public function set_url($url, $params = array()) {
@@ -832,6 +832,9 @@ class moodle_page {
                 // we have to use httpswwwroot here, because of loginhttps pages
                 $this->_url = new moodle_url($CFG->httpswwwroot . '/' . $url, $params);
             }
+
+        } else {
+            throw new coding_exception('Parameter $url must be either moodle_url or string, ' . gettype($url) . ' given instead.');
         }
 
         $fullurl = $this->_url->out(true);