| |
1 |
1 |
set url /[ad_conn extra_url] |
| |
2 |
2 |
|
| |
3 |
3 |
if { [regexp {^/(u|user)/([^/]+)/rss} $url ignore ignore2 screen_name] } { |
| |
4 |
4 |
#Support old model user/<screen_name>/rss/rss.xml |
| |
5 |
5 |
|
| |
6 |
6 |
set package_id [ad_conn package_id] |
| |
7 |
7 |
|
| |
8 |
8 |
set screen_name [lindex $extra_url_list 1] |
| |
9 |
9 |
|
| |
10 |
10 |
set sql "select channel_id as summary_context_id |
| |
11 |
11 |
from weblogger_channels w, users u |
| |
12 |
12 |
where w.user_id = u.user_id |
| |
13 |
13 |
and u.screen_name = :screen_name |
| |
14 |
14 |
and w.package_id = :package_id" |
| |
15 |
15 |
|
| |
16 |
16 |
set summary_context_id [db_string select_user_id $sql] |
| |
17 |
17 |
|
| |
18 |
|
ns_returnfile 200 text/xml [rss_gen_report_file -summary_context_id $summary_context_id -impl_name pinds_blog_entries] |
| |
|
18 |
set datasource [acs_sc_call RssGenerationSubscriber datasource \ |
| |
|
19 |
$summary_context_id pinds_blog_entries] |
| |
|
20 |
if { [empty_string_p $datasource] } { |
| |
|
21 |
ns_log Error "Empty datasource returned from $impl_name for context $summary_context_id in rss_gen_report. Probably because the implementation hasn't been bound." |
| |
|
22 |
return |
| |
|
23 |
} |
| |
|
24 |
set args "" |
| |
|
25 |
foreach {name val} $datasource { |
| |
|
26 |
regsub -all {[\]\[\{\}""\\$]} $val {\\&} val |
| |
|
27 |
append args "-$name \"$val\" " |
| |
|
28 |
if { [lsearch [list channel_link channel_title] $name] >= 0 } { |
| |
|
29 |
set $name $val |
| |
|
30 |
} |
| |
|
31 |
} |
| |
|
32 |
set xml [apply rss_gen $args] |
| |
|
33 |
ns_set put [ns_conn outputheaders] "Content-Disposition" "attachment; filename=\"rss.xml\"" |
| |
|
34 |
ReturnHeaders "application/xml" |
| |
|
35 |
ns_write $xml |
| |
19 |
36 |
|
| |
20 |
37 |
} else { |
| |
21 |
38 |
|
| |
22 |
39 |
if { [regexp {^/+(u|user)/+([^/]+)(/*.*)} $url \ |
| |
23 |
40 |
ignore_whole ignore_user screen_name rest_url] } { |
| |
24 |
41 |
rp_form_put screen_name $screen_name |
| |
25 |
42 |
# This is a /user/joe - style URL. If there was something |
| |
26 |
43 |
# after /user/joe it is now stored in rest_url |
| |
27 |
44 |
} else { |
| |
28 |
45 |
# This is not a /user/joe style URL. |
| |
29 |
46 |
set rest_url $url |
| |
30 |
47 |
} |
| |
31 |
48 |
|
| |
32 |
49 |
if {[regexp {^/+(c|cat|category)/+([^/]+)/*$} $rest_url \ |
| |
33 |
50 |
ignore_whole ignore_cat category_short_name]} { |
| |
34 |
51 |
rp_form_put category_short_name $category_short_name |
| |
35 |
52 |
} elseif {[regexp {^/+(a|archive)/*([0-9]*)/*([0-9]*)/*([0-9]*)/*$} \ |
| |
36 |
53 |
$rest_url ignore_whole ignore_a year month day]} { |
| |
37 |
54 |
if {[empty_string_p $year] && [empty_string_p $month] && \ |
| |
38 |
55 |
[empty_string_p $day]} { |