139 |
# protect HTML from wiki modifications |
# protect HTML from wiki modifications |
140 |
sub e { |
sub e { |
141 |
my $t = shift; |
my $t = shift; |
142 |
return 'uri_unescape{' . uri_escape($t, '^a-zA-Z0-9') . '}'; |
eval { $t = 'uri_unescape{' . uri_escape($t, '^a-zA-Z0-9') . '}'; }; |
143 |
|
return $t; |
144 |
} |
} |
145 |
|
|
146 |
$m =~ s/($escape_re)/$escape{$1}/gs; |
$m =~ s/($escape_re)/$escape{$1}/gs; |
147 |
$m =~ s#($RE{URI}{HTTP})#e(qq{<a href="$1">$1</a>})#egs; |
$m =~ s#($RE{URI}{HTTP})#e(qq{<a href="$1">$1</a>})#egs; |
148 |
$m =~ s#\/(\w+)\/#<i>$1</i>#gs; |
# $m =~ s#\/(\w+)\/#<i>$1</i>#gs; |
149 |
$m =~ s#$tag_regex#e(qq{<a href="$url?tag=$1" class="tag">$1</a>})#egs; |
$m =~ s#$tag_regex#e(qq{<a href="$url?tag=$1" class="tag">$1</a>})#egs; |
150 |
$m =~ s#\*(\w+)\*#<b>$1</b>#gs; |
$m =~ s#\*(\w+)\*#<b>$1</b>#gs; |
151 |
$m =~ s#_(\w+)_#<u>$1</u>#gs; |
$m =~ s#_(\w+)_#<u>$1</u>#gs; |
256 |
|
|
257 |
eval { $sth->execute( $value, $nick, $channel, $name ) }; |
eval { $sth->execute( $value, $nick, $channel, $name ) }; |
258 |
|
|
259 |
# error or no result |
if ( $@ ) { |
260 |
if ( $@ || ! $sth->rows ) { |
# error |
261 |
|
_log("META ERROR: $@"); |
262 |
|
} elsif ( ! $sth->rows ) { |
263 |
|
# no result -> add new |
264 |
$sth = $dbh->prepare(qq{ insert into meta (value,nick,channel,name,changed) values (?,?,?,?,now()) }); |
$sth = $dbh->prepare(qq{ insert into meta (value,nick,channel,name,changed) values (?,?,?,?,now()) }); |
265 |
$sth->execute( $value, $nick, $channel, $name ); |
eval { $sth->execute( $value, $nick, $channel, $name ); }; |
266 |
warn "## created $nick/$channel/$name = $value\n"; |
if ( $@ ) { |
267 |
|
_log "META ERROR: $@"; |
268 |
|
} else { |
269 |
|
_log "META: created $nick/$channel/$name = $value\n"; |
270 |
|
} |
271 |
} else { |
} else { |
272 |
warn "## updated $nick/$channel/$name = $value\n"; |
_log "META: updated $nick/$channel/$name = $value\n"; |
273 |
} |
} |
274 |
|
|
275 |
return $value; |
return $value; |
564 |
" " . $a->{message}; |
" " . $a->{message}; |
565 |
|
|
566 |
eval { $sth_insert_log->execute($a->{channel}, $a->{me}, $a->{nick}, $a->{message}, $a->{time}); }; |
eval { $sth_insert_log->execute($a->{channel}, $a->{me}, $a->{nick}, $a->{message}, $a->{time}); }; |
567 |
_log "ERROR: can't archive ", $a->{message} if $@; |
if ( $@ ) { |
568 |
$cloud->add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef), %$a ); |
_log "ERROR: can't archive ", $a->{message}; |
569 |
|
} else { |
570 |
|
$cloud->add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef), %$a ); |
571 |
|
} |
572 |
} |
} |
573 |
|
|
574 |
|
|
637 |
|
|
638 |
warn "## RSS fetch first $send_rss_msgs items from", $args->{url} if $debug; |
warn "## RSS fetch first $send_rss_msgs items from", $args->{url} if $debug; |
639 |
|
|
640 |
my $feed = XML::Feed->parse( \$args->{xml} ); |
my $feed; |
641 |
|
eval { $feed = XML::Feed->parse( \$args->{xml} ) }; |
642 |
if ( ! $feed ) { |
if ( ! $feed ) { |
643 |
_log "can't fetch RSS ", $args->{url}, XML::Feed->errstr; |
_log "can't fetch RSS ", $args->{url}, XML::Feed->errstr; |
644 |
return; |
return; |
1295 |
$rc = RC_DENY; |
$rc = RC_DENY; |
1296 |
} |
} |
1297 |
|
|
1298 |
$response->content( $feed->as_xml ); |
eval { $response->content( $feed->as_xml ); }; |
1299 |
|
$rc = RC_INTERNAL_SERVER_ERROR if $@; |
1300 |
return $rc; |
return $rc; |
1301 |
} |
} |
1302 |
|
|