| 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': |
| 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 |
|
} |