Browse files

MDL-26677 flickr repo - fix undefined index usewatermarks

  • Loading branch information...
1 parent cc50a2f commit 454efc509fc5ec229307a7ae8278af684e629b74 @dcai dcai committed Jun 23, 2011
Showing with 12 additions and 4 deletions.
  1. +5 −1 admin/repositoryinstance.php
  2. +2 −2 repository/flickr_public/lib.php
  3. +5 −1 repository/lib.php
View
6 admin/repositoryinstance.php
@@ -68,7 +68,11 @@
$settings['name'] = $fromform->name;
if (!$instance->readonly) {
foreach($configs as $config) {
- $settings[$config] = $fromform->$config;
+ if (isset($fromform->$config)) {
+ $settings[$config] = $fromform->$config;
+ } else {
+ $settings[$config] = null;
+ }
}
}
$success = $instance->set_option($settings);
View
4 repository/flickr_public/lib.php
@@ -456,7 +456,7 @@ public function get_file($photo_id, $file = '') {
public function instance_config_form($mform) {
$mform->addElement('text', 'email_address', get_string('emailaddress', 'repository_flickr_public'));
$mform->addElement('checkbox', 'usewatermarks', get_string('watermark', 'repository_flickr_public'));
- //$mform->addRule('email_address', get_string('required'), 'required', null, 'client');
+ $mform->setDefault('usewatermarks', 0);
}
/**
@@ -498,7 +498,7 @@ public static function get_type_option_names() {
public static function plugin_init() {
//here we create a default instance for this type
- $id = repository::static_function('flickr_public','create', 'flickr_public', 0, get_system_context(), array('name'=>'', 'email_address' => null), 0);
+ $id = repository::static_function('flickr_public','create', 'flickr_public', 0, get_system_context(), array('name'=>'', 'email_address' => null, 'usewatermarks' => false), 0);
if (empty($id)) {
return false;
} else {
View
6 repository/lib.php
@@ -1381,7 +1381,11 @@ public static function create($type, $userid, $context, $params, $readonly=0) {
$configs = call_user_func($classname . '::get_instance_option_names');
if (!empty($configs)) {
foreach ($configs as $config) {
- $options[$config] = $params[$config];
+ if (isset($params[$config])) {
+ $options[$config] = $params[$config];
+ } else {
+ $options[$config] = null;
+ }
}
}

0 comments on commit 454efc5

Please sign in to comment.