| 1 |
<?php |
<?php |
| 2 |
/* $Id: mmb.module,v 1.12 2007/08/17 06:13:56 sanduhrs Exp $ */ |
/* $Id: mmb.module,v 1.13 2007/08/17 10:21:11 sanduhrs Exp $ */ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 41 |
//Handle different node types |
//Handle different node types |
| 42 |
switch ($node->type) { |
switch ($node->type) { |
| 43 |
case 'image': |
case 'image': |
| 44 |
|
if (!module_exists('image')) { |
| 45 |
|
watchdog('mmb', t('Install and setup !image to post image files.', array('!image' => l('image.module', 'http://drupal.org/project/image', array(), NULL, NULL, TRUE))), WATCHDOG_WARNING); |
| 46 |
|
break; |
| 47 |
|
} |
| 48 |
//Get the first attached image file |
//Get the first attached image file |
| 49 |
foreach($node->files as $key => $file) { |
foreach($node->files as $key => $file) { |
| 50 |
$mime = explode('/', $file['filemime']); |
$mime = explode('/', $file['filemime']); |
| 52 |
//Prepare for image.module |
//Prepare for image.module |
| 53 |
$node->images[IMAGE_ORIGINAL] = $node->files[$key]['filepath']; |
$node->images[IMAGE_ORIGINAL] = $node->files[$key]['filepath']; |
| 54 |
break; |
break; |
| 55 |
} |
} |
| 56 |
} |
} |
| 57 |
break; |
break; |
| 58 |
case 'audio': |
case 'audio': |
| 59 |
//TODO: audio attachments |
if (!module_exists('audio') OR !module_exists('audio_getid3')) { |
| 60 |
|
watchdog('mmb', t('Install and setup !audio and !audio_getid3 to post audio files.', array('!audio' => l('audio.module', 'http://drupal.org/project/audio', array(), NULL, NULL, TRUE), '!audio_getid3' => l('audio_getid3.module', 'http://drupal.org/project/audio', array(), NULL, NULL, TRUE),)), WATCHDOG_WARNING); |
| 61 |
|
break; |
| 62 |
|
} |
| 63 |
|
//Get the first attached audio file |
| 64 |
|
foreach($node->files as $key => $file) { |
| 65 |
|
$mime = explode('/', $file['filemime']); |
| 66 |
|
if (strtolower($mime[0]) == 'audio') { |
| 67 |
|
//Prepare for audio.module |
| 68 |
|
$node = audio_api_insert($node->files[$key]['filepath'], $title_format = NULL, $tags = array()); |
| 69 |
|
//TODO: Check what was replaced by audio_api_insert and restore it |
| 70 |
|
break; |
| 71 |
|
} |
| 72 |
|
} |
| 73 |
break; |
break; |
| 74 |
case 'video': |
case 'video': |
| 75 |
//TODO: video attachments |
//TODO: video attachments |