Merge lp:planet-drupal/planet-5x into lp:planet-drupal

Proposed by Rocky Road
Status: Merged
Merged at revision: 3
Proposed branch: lp:planet-drupal/planet-5x
Merge into: lp:planet-drupal
Diff against target: None lines
To merge this branch: bzr merge lp:planet-drupal/planet-5x
Reviewer Review Type Date Requested Status
Rocky Road drupal.org release Pending
Review via email: mp+7081@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Rocky Road (m-baert) wrote :

This is the CVS release tag DRUPAL-5--1-2,
base of 6.x branch, lp:~swe3tdave/drupal-planet/6.x
released on http://drupal.org/node/80702/release as follows:
---------------------------------------------------------
planet 5.x-1.2
5.x · New features
dllh - June 15, 2007 - 17:34
Official release from CVS tag: DRUPAL-5--1-2
First released: June 15, 2007 - 17:34
Download: planet-5.x-1.2.tar.gz
Size: 18.87 KB
md5_file hash: 62926edcff4e923997ad8e07b40a0ee2
Last updated: June 15, 2007 - 17:35
View usage statistics for this release

This release adds the ability to have planet nodes automatically redirect to the source link for a given planet item. This may be useful for people who aren't comfortable editing templates to use the $node->link attribute the module adds. It's also useful for feed links, which are generated using node_feed, which defaults to the node/$nid url. Rather than hacking a copy of node_feed into planet, administrators can toggle this option on in the planet settings and have both web site clicks and feed clicks forward to the originating link.

One possible liability of this addition is that with the option turned on, administrators will not be able to click to a planet item to get the edit tab for editing and deleting; these operations will have to be performed through administration menus.
---------------------------------------------------------

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CREDITS'
--- CREDITS 2009-06-04 09:16:03 +0000
+++ CREDITS 2009-06-04 14:37:33 +0000
@@ -1,5 +1,1 @@
1Written by Daryl Houston <daryl@learnhouston.com>1Written by Daryl Houston <daryl@learnhouston.com>
2
3The core fetching and parsing of this module is lifted straight
4out of the aggregator2 module, which presumably lifts from
5aggregator.
62
=== modified file 'planet.info'
--- planet.info 2009-06-04 08:45:43 +0000
+++ planet.info 2009-06-04 14:40:20 +0000
@@ -1,5 +1,10 @@
1; $Id: planet.info,v 1.1 2007/05/10 20:27:41 daryl Exp $1; $Id: planet.info,v 1.2 2007/05/30 03:22:01 daryl Exp $
2name = Planet2name = Planet
3description = Planet blog aggregator3description = Planet blog aggregator
4package = Community - optional4package = Community - optional
5version = 0.15version = 0.1
6
7; Information added by drupal.org packaging script on 2007-05-10
8version = "5.x-1.0"
9project = "planet"
10
611
=== modified file 'planet.install'
--- planet.install 2009-06-04 08:45:43 +0000
+++ planet.install 2009-06-04 14:40:20 +0000
@@ -1,5 +1,5 @@
1<?php1<?php
2// $Id: planet.install,v 1.1 2006/08/25 20:11:43 daryl Exp $2// $Id: planet.install,v 1.3 2007/05/30 03:22:01 daryl Exp $
33
4/**4/**
5 * Implementation of hook_install()5 * Implementation of hook_install()
@@ -31,6 +31,7 @@
31 fid int(10) unsigned zerofill,31 fid int(10) unsigned zerofill,
32 nid int(10) unsigned zerofill,32 nid int(10) unsigned zerofill,
33 guid varchar(120),33 guid varchar(120),
34 link varchar(180),
34 created int(11)35 created int(11)
35 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");36 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
3637
3738
=== modified file 'planet.module'
--- planet.module 2009-06-04 09:40:49 +0000
+++ planet.module 2009-06-04 15:45:25 +0000
@@ -3,8 +3,15 @@
3define('PLANET_ADMIN', 'administer planet');3define('PLANET_ADMIN', 'administer planet');
44
5function planet_node_info() {5function planet_node_info() {
6 return array('planet' => array('name' => t('planet'), 'base' => 'planet'));6 return array(
7} 7 'planet' => array(
8 'name' => t('Planet Entry'),
9 'module' => 'planet',
10 'description' => t('Node to contain posts aggregated from various blogs.'),
11 )
12 );
13}
14
815
9function planet_perm() {16function planet_perm() {
10 return array(PLANET_ADMIN);17 return array(PLANET_ADMIN);
@@ -20,15 +27,23 @@
20 $output .= '<li><strong>General Settings</strong>. The auto-publish value is a string that the module looks for in categories (if possible) or within a post itself. Posts that include the value will be auto-converted into blog entries. The role to select bloggers from lets you narrow the user list for when you\'re adding a feed and associating it with a user. A common setting will be to create a staff role and use this for planet.</li>';27 $output .= '<li><strong>General Settings</strong>. The auto-publish value is a string that the module looks for in categories (if possible) or within a post itself. Posts that include the value will be auto-converted into blog entries. The role to select bloggers from lets you narrow the user list for when you\'re adding a feed and associating it with a user. A common setting will be to create a staff role and use this for planet.</li>';
21 $output .= '<li><strong>Feeds</strong>. This section lets you add a new feed. Give it a title, select an author, provide the feed url, and you\'re off. You\'ll have to manually refresh it or wait for a cron run for items to be imported.</li>';28 $output .= '<li><strong>Feeds</strong>. This section lets you add a new feed. Give it a title, select an author, provide the feed url, and you\'re off. You\'ll have to manually refresh it or wait for a cron run for items to be imported.</li>';
22 $output .= '<li><strong>Feeds</strong>. This section lists current feeds, when they were last updated, how many items they have, and it allows you to edit, refresh, or freeze them. Freezing is a quick way to temporarily suspend updates from the given feed.</li>';29 $output .= '<li><strong>Feeds</strong>. This section lists current feeds, when they were last updated, how many items they have, and it allows you to edit, refresh, or freeze them. Freezing is a quick way to temporarily suspend updates from the given feed.</li>';
23 $output .= '</ul>';
24 return $output;30 return $output;
25 case 'admin/modules#description':31 case 'admin/modules#description':
26 return t('Aggregates RSS feeds and faciliates their association with site users who belong to a given role.');32 return t('Aggregates RSS feeds and faciliates their association with site users who belong to a given role.');
27 }33 }
28}34}
2935
30function planet_node_name(){36function planet_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE){
31 return 'planet';37 if($page === true && variable_get('planet_redirect_page', 0) == 1){
38 $obj = db_fetch_object(db_query('SELECT * FROM {planet_items} WHERE nid = %d', $node->nid));
39 if($obj->nid == $node->nid && $obj->link != ''){
40 header('Location: ' . $obj->link);
41 exit;
42 }
43 }
44 else{
45 return node_prepare($node, $teaser);
46 }
32}47}
3348
34function planet_access($op, $node){49function planet_access($op, $node){
@@ -39,7 +54,7 @@
39 }54 }
4055
41 if ($op == 'update' || $op == 'delete') {56 if ($op == 'update' || $op == 'delete') {
42 if (user_access('edit own blog') && ($user->uid == $node->uid)) {57 if (user_access('edit own blog') && ($user->uid == $node->uid) || user_access('administer nodes')) {
43 return TRUE;58 return TRUE;
44 }59 }
45 }60 }
@@ -105,8 +120,8 @@
105}120}
106121
107function _planet_settings(){122function _planet_settings(){
108 if($_POST['edit']){ 123 if($_POST){
109 $edit = $_POST['edit'];124 $edit = $_POST;
110 125
111 if($_POST['op'] == 'Delete' && intval($edit['fid']) > 0){126 if($_POST['op'] == 'Delete' && intval($edit['fid']) > 0){
112 db_query('DELETE FROM {planet_feeds} WHERE fid = %d', intval($edit['fid']));127 db_query('DELETE FROM {planet_feeds} WHERE fid = %d', intval($edit['fid']));
@@ -128,6 +143,12 @@
128 if($edit['planet_auto_publish']){143 if($edit['planet_auto_publish']){
129 variable_set('planet_auto_publish', $edit['planet_auto_publish']);144 variable_set('planet_auto_publish', $edit['planet_auto_publish']);
130 }145 }
146 if($edit['planet_redirect_page'] == 1){
147 variable_set('planet_redirect_page', $edit['planet_redirect_page']);
148 }
149 else{
150 variable_del('planet_redirect_page');
151 }
131 drupal_set_message('Edited general planet settings.'); 152 drupal_set_message('Edited general planet settings.');
132 } 153 }
133 } 154 }
@@ -137,35 +158,21 @@
137 $fid = intval(arg(3));158 $fid = intval(arg(3));
138 if($fid > 0){ 159 if($fid > 0){
139 $edit = db_fetch_array(db_query('SELECT * FROM {planet_feeds} WHERE fid = %d', $fid));160 $edit = db_fetch_array(db_query('SELECT * FROM {planet_feeds} WHERE fid = %d', $fid));
140 $output .= planet_feed_form($edit, true);161 $output .= drupal_get_form('planet_feed_form', $edit, true);
141 }162 }
142 else{163 else{
143 164
144 $roles = array();
145
146 $result = db_query('SELECT rid, name FROM {role}');
147 while($role = db_fetch_object($result)){
148 $roles[$role->rid] = $role->name;
149 }
150
151 $output .= '<h2>Recent Items</h2>';165 $output .= '<h2>Recent Items</h2>';
152 $output .= planet_queue();166 $output .= planet_queue();
153
154 $form = array();
155
156 $form['general'] = array('#type' => 'fieldset', '#title' => t('General Settings'));
157 167
158 $form['general']['planet_auto_publish'] = array('#type' => 'textfield', '#title' => t('Auto-publish text'), '#value' => variable_get('planet_auto_publish', ''), '#size' => 30, '#maxlength' => 30, '#description' => t('If this snippet appears in the aggregated item, it will be auto-published.'));168 $output .= drupal_get_form('planet_settings_form');
159 $form['general']['planet_author_roles'] = array('#type' => 'select', '#title' => 'Role to select authors from', '#options' => $roles, '#default_value' => variable_get('planet_author_roles', 2), '#description' =>t('Select the role from which blog authors should be selected on the feed creation screen.'));169 //$output .= drupal_get_form('settings', $form);
160 $form['general']['submit'] = array('#type' => 'submit', '#value' => 'Adjust Settings');
161
162 $output .= drupal_get_form('settings', $form);
163 //$output .= $form;170 //$output .= $form;
164171
165 $output .= planet_feed_form($edit);172 $output .= drupal_get_form('planet_feed_form', $edit);
166 173
167 $result = db_query('SELECT *, (UNIX_TIMESTAMP(NOW()) - checked) _checked FROM {planet_feeds}');174 $result = db_query('SELECT *, (UNIX_TIMESTAMP(NOW()) - checked) _checked FROM {planet_feeds}');
168 $result = db_query('SELECT COUNT(f.uid) cnt, f.*, (UNIX_TIMESTAMP(NOW()) - checked) _checked FROM planet_feeds f LEFT OUTER JOIN planet_items i ON i.fid = f.fid GROUP BY f.uid;');175 $result = db_query('SELECT COUNT(f.fid) cnt, f.*, (UNIX_TIMESTAMP(NOW()) - checked) _checked FROM {planet_feeds} f LEFT OUTER JOIN {planet_items} i ON i.fid = f.fid GROUP BY f.fid;');
169 $rows = array();176 $rows = array();
170 $headers = array('Feed', 'Items', 'Edit', 'Last checked', 'Refresh', 'Freeze');177 $headers = array('Feed', 'Items', 'Edit', 'Last checked', 'Refresh', 'Freeze');
171 while($feed = db_fetch_object($result)){178 while($feed = db_fetch_object($result)){
@@ -191,6 +198,24 @@
191 }198 }
192}199}
193200
201function planet_settings_form(){
202 $roles = array();
203
204 $result = db_query('SELECT rid, name FROM {role}');
205 while($role = db_fetch_object($result)){
206 $roles[$role->rid] = $role->name;
207 }
208
209 $form = array();
210 $form['general'] = array('#type' => 'fieldset', '#title' => t('General Settings'));
211 $form['general']['planet_auto_publish'] = array('#type' => 'textfield', '#title' => t('Auto-publish text'), '#value' => variable_get('planet_auto_publish', ''), '#size' => 30, '#maxlength' => 30, '#description' => t('If this snippet appears in the aggregated item, it will be auto-published.'));
212 $form['general']['planet_author_roles'] = array('#type' => 'select', '#title' => t('Role to select authors from'), '#options' => $roles, '#default_value' => variable_get('planet_author_roles', 2), '#description' =>t('Select the role from which blog authors should be selected on the feed creation screen.'));
213 $form['general']['planet_redirect_page'] = array('#type' => 'checkbox', '#title' => t('Redirect node?'), '#return_value' => 1, '#value' => (variable_get('planet_redirect_page', 0) == 1) ? 1 : null, '#description' => t('Check this if you want the node view to redirect to the original content link; this is useful if you want the feed to forward through instead of showing the planet node.'));
214 $form['general']['submit'] = array('#type' => 'submit', '#value' => 'Adjust Settings');
215 return $form;
216}
217
218
194function planet_feed_form($edit = array(), $individual = false){219function planet_feed_form($edit = array(), $individual = false){
195 $uids = array();220 $uids = array();
196 $result = db_query('SELECT u.uid, u.name FROM {users} u, {role} r, {users_roles} ur WHERE u.uid = ur.uid AND ur.rid = r.rid AND r.rid = %d ORDER BY u.name ASC', variable_get('planet_author_roles',2));221 $result = db_query('SELECT u.uid, u.name FROM {users} u, {role} r, {users_roles} ur WHERE u.uid = ur.uid AND ur.rid = r.rid AND r.rid = %d ORDER BY u.name ASC', variable_get('planet_author_roles',2));
@@ -200,18 +225,17 @@
200 225
201 $form = array();226 $form = array();
202 $form['feeds'] = array('#type' => 'fieldset', '#title' => 'Feeds'); 227 $form['feeds'] = array('#type' => 'fieldset', '#title' => 'Feeds');
203 $form['feeds']['fid'] = array('#type' => 'hidden', '#value' => $edit['title']);228 $form['feeds']['fid'] = array('#type' => 'hidden', '#value' => $edit['fid']);
204 $form['feeds']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#value' => $edit['title'], '#size' => 40, '#maxlength' => 40);229 $form['feeds']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#value' => $edit['title'], '#size' => 40, '#maxlength' => 40);
205 $form['feeds']['uid'] = array('#type' => 'select', '#title' => t('Original author'), '#value' => $edit['uid'], '#options' => $uids, '#description' => t('Select a user to associate this feed with'));230 $form['feeds']['uid'] = array('#type' => 'select', '#title' => t('Original author'), '#value' => $edit['uid'], '#options' => $uids, '#description' => t('Select a user to associate this feed with'));
206 $form['feeds']['link'] = array('#type' => 'textfield', '#title' => t('URL'), '#value' => $edit['link'], '#size' => 40, '#maxlength' => 80);231 $form['feeds']['link'] = array('#type' => 'textfield', '#title' => t('URL'), '#value' => $edit['link'], '#size' => 40, '#maxlength' => 80);
207 $form['feeds']['submit'] = array('#type' => 'submit', '#value' => $edit['fid'] > 0 ? 'Edit' : 'Add' . ' Feed');232 $form['feeds']['submit'] = array('#type' => 'submit', '#value' => $edit['fid'] > 0 ? 'Edit' : 'Add' . ' Feed');
208 $output .= drupal_get_form('settings',$form);233
209
210 if($individual){234 if($individual){
211 $output .= planet_queue(intval($edit['uid']));235 $form['queue'] = array('#type' => 'item', '#value' => planet_queue(intval($edit['uid'])));
212 }236 }
213 237
214 return $output;238 return $form;
215}239}
216240
217function planet_queue($uid = null){241function planet_queue($uid = null){
@@ -873,7 +897,7 @@
873 // If title was "escaped" then it may still contain entities, becuase each & from entity was also escabet to &amp; before897 // If title was "escaped" then it may still contain entities, becuase each & from entity was also escabet to &amp; before
874 // TODO: the same for content?898 // TODO: the same for content?
875 if ($item['TITLE'][0]['MODE'] == 'escaped') {899 if ($item['TITLE'][0]['MODE'] == 'escaped') {
876 $title = feeds_replace_entities($title);900 $title = planet_replace_entities($title);
877 }901 }
878 $title = strip_tags($title);902 $title = strip_tags($title);
879903
@@ -988,7 +1012,7 @@
988 else {1012 else {
989 $entry = db_fetch_object(db_query("SELECT ai.nid AS nid FROM {node} n, {planet_items} ai WHERE ai.fid = %d AND ai.nid = n.nid AND n.title = '%s'", $feed->fid, $title));1013 $entry = db_fetch_object(db_query("SELECT ai.nid AS nid FROM {node} n, {planet_items} ai WHERE ai.fid = %d AND ai.nid = n.nid AND n.title = '%s'", $feed->fid, $title));
990 }1014 }
991 1015
992 //print $guid . '<br />';1016 //print $guid . '<br />';
993 //print $entry->nid . '<br />';1017 //print $entry->nid . '<br />';
994 // Ignore items already existing in database and not allowed to be updated1018 // Ignore items already existing in database and not allowed to be updated
@@ -999,6 +1023,7 @@
999 $entry->body = $body;1023 $entry->body = $body;
1000 $entry->body = planet_convert_relative_urls($body, $link);1024 $entry->body = planet_convert_relative_urls($body, $link);
1001 $entry->teaser = node_teaser($entry->body); 1025 $entry->teaser = node_teaser($entry->body);
1026 $entry->revision = true;
10021027
1003 // Check for an auto-publish string in the post and publish if applicable.1028 // Check for an auto-publish string in the post and publish if applicable.
1004 $has_category = false;1029 $has_category = false;
@@ -1016,8 +1041,9 @@
10161041
1017 //Fields to set if it's a new item. 1042 //Fields to set if it's a new item.
1018 if(!isset($entry->nid)){ 1043 if(!isset($entry->nid)){
1044 //print "Planet item " . $entry->title . "<br />";
1019 $entry->type = 'planet';1045 $entry->type = 'planet';
1020 if($has_category == true || preg_match('/' . $auto_publish . '/',$entry->body)){ 1046 if($has_category == true || ($auto_publish != '' && preg_match('/' . $auto_publish . '/',$entry->body))){
1021 $entry->type = 'blog';1047 $entry->type = 'blog';
1022 } 1048 }
10231049
@@ -1029,8 +1055,9 @@
1029 $entry->promote = in_array('promote', $options) ? 1 : 0;1055 $entry->promote = in_array('promote', $options) ? 1 : 0;
1030 $entry->sticky = in_array('sticky', $options) ? 1 : 0;1056 $entry->sticky = in_array('sticky', $options) ? 1 : 0;
1031 $entry->comment = in_array('comment', $options) ? 2 : 0;1057 $entry->comment = in_array('comment', $options) ? 2 : 0;
1032 $entry->format = 3;1058 $entry->format = 4; //TODO: probably need to make this an option.
1033 $entry->created = strtotime($date);1059 $entry->created = strtotime($date);
1060 $entry->revision = true;
1034 1061
1035 $terms = module_invoke('taxonomy', 'node_get_terms', $edit->nid, 'tid');1062 $terms = module_invoke('taxonomy', 'node_get_terms', $edit->nid, 'tid');
1036 foreach ($terms as $tid => $term) {1063 foreach ($terms as $tid => $term) {
@@ -1038,8 +1065,9 @@
1038 $edit->taxonomy[] = $term->tid;1065 $edit->taxonomy[] = $term->tid;
1039 }1066 }
1040 }1067 }
1068 //print '<pre>' . print_r($entry, 1) . '</pre>';
1041 node_save($entry);1069 node_save($entry);
1042 db_query('INSERT INTO {planet_items} (fid, nid, guid, created) VALUES(%d, %d, "%s", UNIX_TIMESTAMP(NOW()))', $feed->fid, $entry->nid, $guid); 1070 db_query('INSERT INTO {planet_items} (fid, nid, guid, link, created) VALUES(%d, %d, "%s", "%s", UNIX_TIMESTAMP(NOW()))', $feed->fid, $entry->nid, $guid, $link);
1043 watchdog('planet', 'Adding ' . $title);1071 watchdog('planet', 'Adding ' . $title);
1044 drupal_set_message('Adding ' . $title);1072 drupal_set_message('Adding ' . $title);
1045 } 1073 }
@@ -1048,10 +1076,10 @@
1048 if($has_category == true || preg_match('/' . $auto_publish . '/',$entry->body)){ 1076 if($has_category == true || preg_match('/' . $auto_publish . '/',$entry->body)){
1049 $entry->type = 'blog';1077 $entry->type = 'blog';
1050 }1078 }
1051 node_save($entry);
1052 watchdog('planet', 'Updating ' . $title);
1053 drupal_set_message('Updating ' . $title);1079 drupal_set_message('Updating ' . $title);
1054 }1080 }
1081 node_save($entry);
1082 watchdog('planet', 'Updating ' . $title);
1055 }1083 }
1056 }1084 }
10571085
@@ -1189,12 +1217,16 @@
1189 */1217 */
1190function planet_user($type, &$edit, &$user) {1218function planet_user($type, &$edit, &$user) {
1191 if ($type == 'view' && user_access('edit own blog', $user)) {1219 if ($type == 'view' && user_access('edit own blog', $user)) {
1192 $items[] = array('title' => t('Planet'),1220 $items[] = array('title' => t('Blog'),
1193 'value' => l(t('view recent planet entries'), "planet/$user->uid", array('title' => t("Read %username's latest planet entries.", array('%username' => $user->name)))),1221 'value' => l(t('view recent blog entries'), "planet/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name)))),
1194 'class' => 'planet',1222 'class' => 'blog',
1195 );1223 );
1196 return array(t('History') => $items);1224 return array(t('History') => $items);
1197 }1225 }
1226 if($type == 'load'){
1227 $obj = db_fetch_object(db_query('SELECT link FROM {planet_feeds} WHERE uid = %d', $user->uid));
1228 $user->planet_feed = $obj->link;
1229 }
1198}1230}
11991231
1200/**1232/**
@@ -1251,7 +1283,7 @@
1251}1283}
12521284
1253function planet_load($node){1285function planet_load($node){
1254 $additions = db_fetch_object(db_query('SELECT guid FROM {planet_items} WHERE nid = %d', $node->nid));1286 $additions = db_fetch_object(db_query('SELECT link, guid FROM {planet_items} WHERE nid = %d', $node->nid));
1255 return $additions;1287 return $additions;
1256}1288}
12571289
12581290
=== removed file 'planet.sql'
--- planet.sql 2009-06-04 08:45:43 +0000
+++ planet.sql 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1CREATE TABLE planet_feeds(
2 fid int(10) unsigned zerofill not null primary key auto_increment,
3 uid int(10) unsigned zerofill,
4 title varchar(50),
5 link varchar(80),
6 image varchar(120),
7 checked int(11)
8);
9
10CREATE TABLE planet_items(
11 id int(10) unsigned zerofill not null primary key auto_increment,
12 fid int(10) unsigned zerofill,
13 nid int(10) unsigned zerofill,
14 guid varchar(120),
15 created int(11)
16);
17\ No newline at end of file0\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: