From c8d3345cd3e0bbf3d627d591d19c5a2b725ad9ab Mon Sep 17 00:00:00 2001
From: Petr Skoda <commits@skodak.org>
Date: Sat, 23 Jul 2011 13:25:39 +0200
Subject: [PATCH] MDL-27464 continuation link sometimes links off-site

This code was manually merged from MOODLE_19_STABLE, credit goes to Matt Meisberger.
---
 lib/setuplib.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/setuplib.php b/lib/setuplib.php
index aeae850b8a3..8d724b0599c 100644
--- a/lib/setuplib.php
+++ b/lib/setuplib.php
@@ -501,6 +501,12 @@ function get_exception_info($ex) {
         }
     }
 
+    // when printing an error the continue button should never link offsite
+    if (stripos($link, $CFG->wwwroot) === false &&
+        stripos($link, $CFG->httpswwwroot) === false) {
+        $link = $CFG->wwwroot.'/';
+    }
+
     $info = new stdClass();
     $info->message     = $message;
     $info->errorcode   = $errorcode;