//Extracts user id from file path
$tok = strtok($dir,"/");
if ($tok) {
- $userid = $tok;
+ $userid = $tok;
} else {
- $tok = "";
+ //We were getting $dir='0', so continue (WAS: $tok = "";)
+ continue;
}
//Look it is a backupable user
$data = get_record ("backup_ids","backup_code","$backup_unique_code",
//Personalize the searchstring
$searchstring='/\$@(RESOURCEINDEX)\*('.$old_id.')@\$/';
//If it is a link to this course, update the link to its new location
- if($rec->new_id) {
+ if (!empty($rec->new_id)) {
//Now replace it
$result= preg_replace($searchstring,$CFG->wwwroot.'/mod/resource/index.php?id='.$rec->new_id,$result);
} else {
//Personalize the searchstring
$searchstring='/\$@(RESOURCEVIEWBYID)\*('.$old_id.')@\$/';
//If it is a link to this course, update the link to its new location
- if($rec->new_id) {
+ if (!empty($rec->new_id)) {
//Now replace it
$result= preg_replace($searchstring,$CFG->wwwroot.'/mod/resource/view.php?id='.$rec->new_id,$result);
} else {