/[drupal]/contributions/modules/gdata/extras/gdata_blog.inc
ViewVC logotype

Diff of /contributions/modules/gdata/extras/gdata_blog.inc

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

revision 1.3, Mon Sep 4 19:44:05 2006 UTC revision 1.4, Mon Sep 4 20:37:16 2006 UTC
# Line 25  function blog_gdata($op, $path = '') { Line 25  function blog_gdata($op, $path = '') {
25          if (0 == ($module_details = variable_get('gdata_blog', 0))) {          if (0 == ($module_details = variable_get('gdata_blog', 0))) {
26          die(_gdata_error('error'));          die(_gdata_error('error'));
27          }          }
28          gdata_blog_feed();          _gdata_blog_feed($path);
29        break;        break;
30    
31      case 'write':      case 'write':
# Line 66  function blog_gdata($op, $path = '') { Line 66  function blog_gdata($op, $path = '') {
66        break;        break;
67    }    }
68    return $array;    return $array;
 }  
69    }
70    
71    /**
72     * Helper function for printing blogs
73     */
74    function _gdata_blog_feed($path) {
75      global $base_url;
76      if(strpos(arg(3), 'gdata') === 0 || strpos(arg(3), 'feed') === 0) {
77        die(drupal_not_found());
78      }
79      $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));
80    
81      $feed_info = array();
82      $feed_info['title']    = strip_tags(sprintf(t('%s blogs'), variable_get('site_name', 'Drupal')));
83      $feed_info['subtitle'] = strip_tags(variable_get('site_slogan', ''));
84      $feed_info['path'] = $path;
85      _gdata_print_feed($nodes, $feed_info);
86    }
87    
88    function _gdata_user_blog_feed() {
89      global $path;
90      if(strpos(arg(4), 'gdata') === 0 || strpos(arg(4), 'feed') === 0) {
91        die(drupal_not_found());
92      }
93      $user_result = db_query_range("SELECT u.name FROM {users} u WHERE u.uid = %d", arg(1), 0, 1);
94      if(!$user = db_result($user_result)) {
95        return drupal_not_found();
96      }
97    
98      $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));
99    
100      $feed_info = array();
101      $feed_info['title']    = sprintf(t("%s's blog"), $user);
102      $feed_info['html_url'] = $path;//url('gdata/blog/'. arg(1), NULL, NULL, true);
103      $feed_info['gdata_url'] = url(
104      (substr($path, 0, 3) == '?q=')?substr($path, 2):$path . arg(1) .'',
105      NULL, NULL, true);
106      _gdata_print_feed($nodes, $feed_info);
107    }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2