'f4v' => array ('type'=>'video/mp4', 'icon'=>'flash', 'groups'=>array('video','web_video'), 'string'=>'video'),
'gallery' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
- 'galleryitem,' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
+ 'galleryitem' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
'gallerycollection' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
'gif' => array ('type'=>'image/gif', 'icon'=>'gif', 'groups'=>array('image', 'web_image'), 'string'=>'image'),
'gtar' => array ('type'=>'application/x-gtar', 'icon'=>'archive', 'groups'=>array('archive'), 'string'=>'archive'),
}
/**
- * Set curl options
+ * Set curl options.
*
- * @param array $options If array is null, this function will
- * reset the options to default value.
+ * Do not use the curl constants to define the options, pass a string
+ * corresponding to that constant. Ie. to set CURLOPT_MAXREDIRS, pass
+ * array('CURLOPT_MAXREDIRS' => 10) or array('maxredirs' => 10) to this method.
+ *
+ * @param array $options If array is null, this function will reset the options to default value.
+ * @return void
+ * @throws coding_exception If an option uses constant value instead of option name.
*/
public function setopt($options = array()) {
if (is_array($options)) {
- foreach($options as $name => $val){
+ foreach ($options as $name => $val){
+ if (!is_string($name)) {
+ throw new coding_exception('Curl options should be defined using strings, not constant values.');
+ }
if (stripos($name, 'CURLOPT_') === false) {
$name = strtoupper('CURLOPT_'.$name);
}
var_dump($this->header);
}
- // set options
+ // Set options.
foreach($this->options as $name => $val) {
- if (is_string($name)) {
- $name = constant(strtoupper($name));
- }
+ $name = constant(strtoupper($name));
curl_setopt($curl, $name, $val);
}
return $curl;
send_file_not_found();
}
- $bprecord = $DB->get_record('block_positions', array('blockinstanceid' => $context->instanceid), 'visible');
+ $bprecord = $DB->get_record('block_positions', array('contextid' => $context->id, 'blockinstanceid' => $context->instanceid));
// User can't access file, if block is hidden or doesn't have block:view capability
if (($bprecord && !$bprecord->visible) || !has_capability('moodle/block:view', $context)) {
send_file_not_found();