Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-26677 flickr repo - fix undefined index usewatermarks

  • Loading branch information...
commit 14b2d8d86541b9cc63b8d832bbf1e0df2d315e0f 1 parent 3552484
@dcai dcai authored
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;
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.