/[drupal]/contributions/modules/gdata/gdata.module
ViewVC logotype

Diff of /contributions/modules/gdata/gdata.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.22, Mon Sep 4 19:44:05 2006 UTC revision 1.23, Mon Sep 4 20:37:16 2006 UTC
# Line 193  function gdata_feed() { Line 193  function gdata_feed() {
193              module_invoke($module,              module_invoke($module,
194                'gdata',                'gdata',
195                $service,                $service,
196                substr($_SERVER['REQUEST_URI'], 1)                (substr($_SERVER['REQUEST_URI'], 0, 4) == '/?q=')?substr($_SERVER['REQUEST_URI'], 4):substr($_SERVER['REQUEST_URI'], 1)
197              );              );
198            }            }
199            else {            else {
# Line 355  function _gdata_blank_feed($path = '') { Line 355  function _gdata_blank_feed($path = '') {
355  '<?xml version="1.0" encoding="utf-8"?>  '<?xml version="1.0" encoding="utf-8"?>
356  <feed xmlns="http://www.w3.org/2005/Atom">  <feed xmlns="http://www.w3.org/2005/Atom">
357    <title>'.variable_get('site_name', 'Drupal').'</title>    <title>'.variable_get('site_name', 'Drupal').'</title>
358    <updated>2006-01-23T16:25:00-08:00</updated>    <updated>'. _gdata_timestamp2w3dtf(time()) .'</updated>
359    <id>'.url($path, NULL, NULL, TRUE).'</id>';    <id>'.url($path, NULL, NULL, TRUE).'</id>';
360  /*  /*
361  * Not sure of the following part  * Not sure of the following part
# Line 376  function _gdata_blank_feed($path = '') { Line 376  function _gdata_blank_feed($path = '') {
376    print $output;    print $output;
377  }  }
378    
 function _gdata_blog_feed() {  
   if(strpos(arg(3), 'gdata') === 0 || strpos(arg(3), 'feed') === 0) {  
     die(drupal_not_found());  
   }  
   $nodes = db_query_range("SELECT n.nid FROM {node} n WHERE n.type = 'blog' AND n.status = '1' ORDER BY n.created DESC", 0, variable_get('atom_feed_entries', 15));  
   
   $feed_info = array();  
   $feed_info['title']    = strip_tags(sprintf(t('%s blogs'), variable_get('site_name', 'Drupal')));  
   $feed_info['subtitle'] = strip_tags(variable_get('site_slogan', ''));  
   $feed_info['html_url'] = url('blog', NULL, NULL, true);  
   $feed_info['gdata_url'] = url('blog/gdata/feed', NULL, NULL, true);  
   _gdata_print_feed($nodes, $feed_info);  
 }  
   
 function _gdata_user_blog_feed() {  
   if(strpos(arg(4), 'gdata') === 0 || strpos(arg(4), 'feed') === 0) {  
     die(drupal_not_found());  
   }  
   $user_result = db_query_range("SELECT u.name FROM {users} u WHERE u.uid = %d", arg(1), 0, 1);  
   if(!$user = db_result($user_result)) {  
     return drupal_not_found();  
   }  
   
   $nodes = db_query_range("SELECT n.nid FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = '1' ORDER BY n.created DESC", arg(1), 0, variable_get('atom_feed_entries', 15));  
   
   $feed_info = array();  
   $feed_info['title']    = sprintf(t("%s's blog"), $user);  
   $feed_info['html_url'] = url('blog/'. arg(1), NULL, NULL, true);  
   $feed_info['gdata_url'] = url('blog/'. arg(1) .'/gdata/feed', NULL, NULL, true);  
   _gdata_print_feed($nodes, $feed_info);  
 }  
   
379  /**  /**
380   * prints feed information from query of either front page or blog content   * prints feed information from query of either front page or blog content
381   *   *
# Line 473  function _gdata_print_feed($nodes, $feed Line 441  function _gdata_print_feed($nodes, $feed
441    print '<?xml version="1.0" encoding="utf-8"?>'. "\n";    print '<?xml version="1.0" encoding="utf-8"?>'. "\n";
442    print '<feed xmlns="http://www.w3.org/2005/Atom">'. "\n";    print '<feed xmlns="http://www.w3.org/2005/Atom">'. "\n";
443    print '  <title>'. $feed_info['title'] ."</title>\n";    print '  <title>'. $feed_info['title'] ."</title>\n";
444    print '  <updated>'. _gdata_timestamp2w3dtf($last_mod) ."</updated>\n";    print '  <updated>'. _gdata_timestamp2w3dtf(time()) ."</updated>\n";
445    print '  <id>'. $feed_info['gdata_url'] ."</id>\n";    print '  <id>'.url($feed_info['path'], NULL, NULL, TRUE)."</id>\n";
446    print $feed_info['subtitle'] == '' ? '' : '  <subtitle>'. $feed_info['subtitle'] . "</subtitle>\n";    print $feed_info['subtitle'] == '' ? '' : '  <subtitle>'. $feed_info['subtitle'] . "</subtitle>\n";
447    print '  <link rel="self" href="'. $feed_info['feed_url'] .'"/>'. "\n";    print '  <link href="'. $feed_info['path'] .'" rel="self"/>'. "\n";
448    print $output;    print $output;
   print '  <link rel="alternate" type="text/html" href="'.$feed_info['html_url'] .'"/>'. "\n";  
449    print "</feed>\n";    print "</feed>\n";
450  }  }
451    

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.2