guest or course->password if ((!$course->guest || $course->password) && (!($isstudent || $isteacher))) { not_found(); } //Check for "security" if the course is hidden or the activity is hidden if ((!$course->visible || !$cm->visible) && (!$isteacher)) { not_found(); } $pathname = $CFG->dataroot.'/rss/'.$modulename.'/'.$instance.'.xml'; //Check that file exists if (!file_exists($pathname)) { not_found(); } //Send it to user! send_file($pathname, $filename, $lifetime); function not_found() { /// error, send some XML with error message global $lifetime, $filename; send_file(rss_geterrorxmlfile(), $filename, $lifetime, false, true); } ?>