--- encl_remote/encl_remote.info 2007-12-13 08:40:04.000000000 +0100 +++ encl_remote/encl_remote.info 2008-05-12 18:55:21.000000000 +0200 @@ -1,11 +1,9 @@ ; $Id $ -name = RSS Remote Enclosure +name = "RSS Remote Enclosure" description = "Permits RSS feeds to include enclosure elements of files stored on a remote server (e.g., OurMedia.org)." -package = Syndication -version = 5.x-0.8 -; Information added by drupal.org packaging script on 2007-12-13 -version = "5.x-0.5-beta" +package = "Syndication" +version = "6.x-0.5" +core = "6.x" project = "encl_remote" -datestamp = "1197531604" - +datestamp = "1210064775" --- encl_remote/encl_remote.install 2007-07-02 07:24:06.000000000 +0200 +++ encl_remote/encl_remote.install 2008-05-12 19:15:53.000000000 +0200 @@ -5,46 +5,43 @@ * Implementation of hook_install(). */ function encl_remote_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {encl_remotes} ( - `rid` int(11) unsigned NOT NULL auto_increment, - `nid` int(11) unsigned NOT NULL, - `url` varchar(255) NOT NULL, - `mime_type` varchar(32) NOT NULL, - `size` bigint(20) unsigned default NULL, - `link_text` varchar(255) default NULL, - PRIMARY KEY (`rid`, `nid`) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - break; - case 'pgsql': - db_query("CREATE TABLE {encl_remotes} ( - rid serial, - nid int NOT NULL default '0', - url varchar(255) NOT NULL, - mime_type varchar(20) NOT NULL, - size bigint unsigned default NULL, - link_text varchar(255) default NULL, - PRIMARY KEY (rid, nid) - )"); - db_query("CREATE INDEX {encl_remote_item}_fid_idx ON {encl_remote_item} (fid)"); - break; - } + // Create tables. + drupal_install_schema('encl_remotes'); $encl_remote_mime_type_extensions= array( 'mp3' => 'audio/mpeg', 'wmv' => 'video/x-ms-wmv', 'mov' => 'video/quicktime', - 'mpg' => 'video/mpeg'); + 'mpg' => 'video/mpeg', + 'torrent' => 'application/x-bittorrent'); variable_set('encl_remote_mime_type_extensions', $encl_remote_mime_type_extensions); } /** +* Implementation of hook_schema(). +*/ +function encl_remotes_schema() { + $schema['encl_remotes'] = array( + 'fields' => array( + 'rid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), + 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'url' => array('type' => 'varchar', 'not null' => TRUE, 'default' => '', 'length' => 255), + 'mime_type' => array('type' => 'varchar', 'not null' => TRUE, 'default' => '', 'length' => 32), + 'size' => array('type' => 'int', 'not null' => FALSE, 'default' => NULL, 'size' => 'big'), + 'link_text' => array('type' => 'varchar', 'not null' => FALSE, 'default' => NULL, 'length' => 255) + ), + 'indexes' => array('nid' => array('nid')), + 'primary key' => array('rid'), + ); + + return $schema; +} + +/** * Implementation of hook_uninstall(). */ function encl_remote_uninstall() { - db_query('DROP TABLE {encl_remotes}'); + drupal_uninstall_schema('encl_remotes'); variable_del('encl_remote_mime_type_extensions'); } --- encl_remote/encl_remote.module 2007-12-13 08:16:12.000000000 +0100 +++ encl_remote/encl_remote.module 2008-05-12 20:05:23.000000000 +0200 @@ -3,6 +3,7 @@ /** * encl_remote.module -- RSS Remote Enclosures * Copyright (c) 2007 Eric Lloyd. + * Drupal 6.x port 2008 Christian Zuckschwerdt. * * Licensed to you under the terms of Version 2 of the Lesser GNU General Public License. * See the LICENSE file in this archive for more information. @@ -27,21 +28,16 @@ return array(ENCL_REMOTE_PERM_SET, ENCL_REMOTE_PERM_ADMIN); } -function encl_remote_menu($may_cache) { +function encl_remote_menu() { $items = array(); - if ($may_cache) { - $items[] = array( - 'path' => 'admin/content/encl_remote', - 'title' => t('RSS Remote Enclosures'), - 'description' => t('Manage Remote Enclosures - content types, appearance, etc.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('encl_remote_form_admin'), - 'access' => user_access(ENCL_REMOTE_PERM_ADMIN), - 'type' => MENU_DYNAMIC_ITEM); - } - else { - return null; - } + $items['admin/content/encl_remote'] = array( + 'title' => t('RSS Remote Enclosures'), + 'description' => t('Manage Remote Enclosures - content types, appearance, etc.'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('encl_remote_form_admin'), + 'access callback' => 'user_access', + 'access arguments' => array(ENCL_REMOTE_PERM_ADMIN), + 'type' => MENU_NORMAL_ITEM); return $items; } @@ -110,7 +106,7 @@ drupal_set_message('The configuration options have been saved.'); } -function encl_remote_nodeapi(&$node, $op, $teaser) { +function encl_remote_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { if (!_encl_remote_is_nodetype_allowed($node->type)) { return; } $encl_remote = $node->encl_remote; @@ -154,7 +150,7 @@ } break; - case 'submit': + case 'presave': $node->encl_remote = (object)array( 'url' => $node->url, 'link_text' => $node->link_text, @@ -178,10 +174,10 @@ case 'view': if (variable_get(ENCL_REMOTE_RSS_LINK, false)) { if ($teaser) { - $node->teaser .= _encl_remote_encl_link($encl_remote); + $node->content['teaser']['#value'] .= _encl_remote_encl_link($encl_remote); } else { - $node->body .= _encl_remote_encl_link($encl_remote); + $node->content['body']['#value'] .= _encl_remote_encl_link($encl_remote); } } break; @@ -204,7 +200,7 @@ } } -function encl_remote_link($type, $node = null, $teaser = false) { +function encl_remote_link($type, $node = null, $teaser = FALSE) { if ($type != 'node') { return; } if (!_encl_remote_is_nodetype_allowed($node->type)) { return; } if (!$node->encl_remote->link_text) { return; } @@ -234,7 +230,7 @@ } } -function encl_remote_form_alter($form_id, &$form) { +function encl_remote_form_alter(&$form, $form_state, $form_id) { // TODO: Alter the system_rss_feeds_settings form, // instead of maintaining a discrete configuration surface if (!isset($form['type'])) { return; } @@ -290,7 +286,7 @@ '#type' => 'textfield', '#title' => t('MIME Type'), '#default_value' => $encl_remote->mime_type, - '#maxlength' => 20, + '#maxlength' => 30, '#collapsible' => true, '#collapsed' => true, '#description' => t("Specify the MIME type of the remote media resource. $mime_explanation"),