Skip to content

Commit

Permalink
Now gets it's courseid properly from the caller
Browse files Browse the repository at this point in the history
  • Loading branch information
thepurpleblob committed Aug 27, 2004
1 parent dc1e6ee commit 546764d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/wiki.php
Expand Up @@ -54,6 +54,7 @@ class Wiki {
var $spelling_on; var $spelling_on;
var $list_backtrack; var $list_backtrack;
var $output; // output buffer var $output; // output buffer
var $courseid;


function close_block( $state ) { function close_block( $state ) {
// provide appropriate closure for block according to state // provide appropriate closure for block according to state
Expand Down Expand Up @@ -270,23 +271,23 @@ function line_replace( $line ) {
" <a href=\"".$CFG->wwwroot."/mod/\\1/view.php?id=\\2\">\\3</a> ", $line ); " <a href=\"".$CFG->wwwroot."/mod/\\1/view.php?id=\\2\">\\3</a> ", $line );


// Replace picture resource link // Replace picture resource link
global $course; // This is a bit risky - it won't work everywhere // global $course; // This is a bit risky - it won't work everywhere


if ($CFG->slasharguments) { if ($CFG->slasharguments) {
$line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)", $line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)",
"<img src=\"$CFG->wwwroot/file.php/$course->id/\\1\\2\" alt=\"\\3\" />", $line ); "<img src=\"$CFG->wwwroot/file.php/$this->courseid/\\1\\2\" alt=\"\\3\" />", $line );
} else { } else {
$line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)", $line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)",
"<img src=\"$CFG->wwwroot/file.php\?file=$course->id/\\1\\2\" alt=\"\\3\" />", $line ); "<img src=\"$CFG->wwwroot/file.php\?file=$this->courseid/\\1\\2\" alt=\"\\3\" />", $line );
} }


// Replace everything else resource link // Replace everything else resource link
if ($CFG->slasharguments) { if ($CFG->slasharguments) {
$line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)", $line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)",
"<a href=\"$CFG->wwwroot/file.php/$course->id/\\1\" >\\2</a>", $line ); "<a href=\"$CFG->wwwroot/file.php/$this->courseid/\\1\" >\\2</a>", $line );
} else { } else {
$line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)", $line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)",
"<a href=\"$CFG->wwwroot/file.php\?file=$course->id/\\1\" >\\2</a>", $line ); "<a href=\"$CFG->wwwroot/file.php\?file=$this->courseid/\\1\" >\\2</a>", $line );
} }


replace_smilies( $line ); replace_smilies( $line );
Expand Down Expand Up @@ -327,7 +328,7 @@ function spellcheck( $line,$pspell_link ) {
} }




function format( $content ) { function format( $content, $courseid ) {
// main entry point for processing TikiText // main entry point for processing TikiText
// $content is string containing text with Tiki formatting // $content is string containing text with Tiki formatting
// return: string containing XHTML formatting // return: string containing XHTML formatting
Expand All @@ -339,6 +340,7 @@ function format( $content ) {
$this->list_depth = 0; $this->list_depth = 0;
$this->list_backtrack = array(); $this->list_backtrack = array();
$this->spelling_on = false; $this->spelling_on = false;
$this->courseid = $courseid;


// split content into array of single lines // split content into array of single lines
$lines = explode( "\n",$content ); $lines = explode( "\n",$content );
Expand Down

0 comments on commit 546764d

Please sign in to comment.