Now every link to forums (from resources and forums) and every link

to resources (from resources and forums) are re-encoded in backup/restore.

I could reduce the code size but for now I prefer to have it this looong
form to clarify what it's doing.

Please, test, test and test...
This commit is contained in:
stronk7
2004-05-08 18:30:30 +00:00
parent 92ff72590c
commit 5b76e6fc51
5 changed files with 286 additions and 6 deletions
+14
View File
@@ -57,10 +57,24 @@
return $info;
}
//Return a content encoded to support interactivities linking. Every module
//should have its own. They are called automatically from the backup procedure.
function resource_encode_content_links ($content,$preferences) {
global $CFG;
$base = preg_quote($CFG->wwwroot,"/");
//Link to the list of resources
$buscar="/(".$base."\/mod\/resource\/index.php\?id\=)([0-9]+)/";
$result= preg_replace($buscar,'$@RESOURCEINDEX*$2@$',$content);
//Link to resource view by moduleid
$buscar="/(".$base."\/mod\/resource\/view.php\?id\=)([0-9]+)/";
$result= preg_replace($buscar,'$@RESOURCEVIEWBYID*$2@$',$result);
return $result;
}
// INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE