Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Now gets it's courseid properly from the caller

  • Loading branch information...
commit 546764d89c32262046baa4b53cfa4de2eb805008 1 parent dc1e6ee
authored August 27, 2004

Showing 1 changed file with 8 additions and 6 deletions. Show diff stats Hide diff stats

  1. 14  lib/wiki.php
14  lib/wiki.php
@@ -54,6 +54,7 @@ class Wiki {
54 54
   var $spelling_on;
55 55
   var $list_backtrack;
56 56
   var $output; // output buffer
  57
+  var $courseid;
57 58
 
58 59
   function close_block( $state ) {
59 60
     // provide appropriate closure for block according to state
@@ -270,23 +271,23 @@ function line_replace( $line ) {
270 271
          " <a href=\"".$CFG->wwwroot."/mod/\\1/view.php?id=\\2\">\\3</a> ", $line );
271 272
 
272 273
       // Replace picture resource link 
273  
-      global $course;    // This is a bit risky - it won't work everywhere
  274
+      // global $course;    // This is a bit risky - it won't work everywhere
274 275
 
275 276
       if ($CFG->slasharguments) {
276 277
         $line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)",
277  
-          "<img src=\"$CFG->wwwroot/file.php/$course->id/\\1\\2\" alt=\"\\3\" />", $line );
  278
+          "<img src=\"$CFG->wwwroot/file.php/$this->courseid/\\1\\2\" alt=\"\\3\" />", $line );
278 279
       } else {
279 280
         $line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)",
280  
-          "<img src=\"$CFG->wwwroot/file.php\?file=$course->id/\\1\\2\" alt=\"\\3\" />", $line );
  281
+          "<img src=\"$CFG->wwwroot/file.php\?file=$this->courseid/\\1\\2\" alt=\"\\3\" />", $line );
281 282
       }
282 283
 
283 284
       // Replace everything else resource link
284 285
       if ($CFG->slasharguments) {
285 286
         $line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)",
286  
-          "<a href=\"$CFG->wwwroot/file.php/$course->id/\\1\" >\\2</a>", $line );
  287
+          "<a href=\"$CFG->wwwroot/file.php/$this->courseid/\\1\" >\\2</a>", $line );
287 288
       } else {
288 289
         $line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)",
289  
-          "<a href=\"$CFG->wwwroot/file.php\?file=$course->id/\\1\" >\\2</a>", $line );
  290
+          "<a href=\"$CFG->wwwroot/file.php\?file=$this->courseid/\\1\" >\\2</a>", $line );
290 291
       }
291 292
 
292 293
       replace_smilies( $line );
@@ -327,7 +328,7 @@ function spellcheck( $line,$pspell_link ) {
327 328
   }
328 329
 
329 330
 
330  
-  function format( $content ) {
  331
+  function format( $content, $courseid ) {
331 332
     // main entry point for processing TikiText
332 333
     // $content is string containing text with Tiki formatting
333 334
     // return: string containing XHTML formatting
@@ -339,6 +340,7 @@ function format( $content ) {
339 340
     $this->list_depth = 0;
340 341
     $this->list_backtrack = array();
341 342
     $this->spelling_on = false;
  343
+    $this->courseid = $courseid;
342 344
 
343 345
     // split content into array of single lines
344 346
     $lines = explode( "\n",$content );

0 notes on commit 546764d

Please sign in to comment.
Something went wrong with that request. Please try again.