navigation MDLSITE-970 Check module support function exists before calling it
authorSam Hemelryk <sam@moodle.com>
Fri, 1 Oct 2010 06:22:08 +0000 (06:22 +0000)
committerSam Hemelryk <sam@moodle.com>
Fri, 1 Oct 2010 06:22:08 +0000 (06:22 +0000)
lib/navigationlib.php

index 5438bac..0ba2c2f 100644 (file)
@@ -3106,7 +3106,7 @@ class settings_navigation extends navigation_node {
 
         // Add a backup link
         $featuresfunc = $this->page->activityname.'_supports';
 
         // Add a backup link
         $featuresfunc = $this->page->activityname.'_supports';
-        if ($featuresfunc(FEATURE_BACKUP_MOODLE2) && has_capability('moodle/backup:backupactivity', $this->page->cm->context)) {
+        if (function_exists($featuresfunc) && $featuresfunc(FEATURE_BACKUP_MOODLE2) && has_capability('moodle/backup:backupactivity', $this->page->cm->context)) {
             $url = new moodle_url('/backup/backup.php', array('id'=>$this->page->cm->course, 'cm'=>$this->page->cm->id));
             $modulenode->add(get_string('backup'), $url, self::TYPE_SETTING);
         }
             $url = new moodle_url('/backup/backup.php', array('id'=>$this->page->cm->course, 'cm'=>$this->page->cm->id));
             $modulenode->add(get_string('backup'), $url, self::TYPE_SETTING);
         }