diff options
author | joe.lapp <joe.lapp@pobox.com> | 2005-09-16 22:38:52 +0200 |
---|---|---|
committer | joe.lapp <joe.lapp@pobox.com> | 2005-09-16 22:38:52 +0200 |
commit | 7a98db204d43c43f79d2b8897adb5f0536b37f28 (patch) | |
tree | 05bdd3363a9966462984b3688e71bc5a7e74fbf8 /feed.php | |
parent | 31f1284d8344c4ed31c2fbb0f337ecb1c29f9042 (diff) | |
download | rpg-7a98db204d43c43f79d2b8897adb5f0536b37f28.tar.gz rpg-7a98db204d43c43f79d2b8897adb5f0536b37f28.tar.bz2 |
fixed author/email handling in RSS/Atom feeds
1) Now reports full user name for logged in users
2) Reports actual email when not mail guarding; otherwise it's "user@ip"
3) RSS 1.0 (default) format is now <dc:creator>name (email)</dc:creator>
4) RSS 0.91/RSS 2.0 format is now <author>email (name)</author>
5) Atom format is now <author><name>name</name><email>email</email></author>
6) When anonymous, all RSS formats just reports "user@ip" in element
7) When anonymous, Atom just reports <author><email>user@ip</email></author>
darcs-hash:20050916203852-36b45-ed5310a65360811bdd153ba12b0e925675bdd7a4.gz
Diffstat (limited to 'feed.php')
-rw-r--r-- | feed.php | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -91,6 +91,7 @@ function rssRecentChanges(&$rss,$num,$ltype,$ns){ global $conf; if(!$num) $num = $conf['recent']; + $guardmail = ($conf['mailguard'] != '' && $conf['mailguard'] != 'none'); $recents = getRecents(0,$num,false,$ns); @@ -137,12 +138,23 @@ function rssRecentChanges(&$rss,$num,$ltype,$ns){ if(strpos($id,':')!==false){ $item->category = substr($id,0,strrpos($id,':')); } - if($recents[$id]['user']){ - $item->author = $recents[$id]['user'].'@'; + + $user = null; + $user = @$recents[$id]['user']; // the @ spares time repeating lookup + $item->author = ''; + + if($user){ + $userInfo = auth_getUserData($user); + $item->author = $userInfo['name']; + if($guardmail) { + //cannot obfuscate because some RSS readers may check validity + $item->authorEmail = $user.'@'.$recents[$id]['ip']; + }else{ + $item->authorEmail = $userInfo['mail']; + } }else{ - $item->author = 'anonymous@'; + $item->authorEmail = 'anonymous@'.$recents[$id]['ip']; } - $item->author .= $recents[$id]['ip']; $rss->addItem($item); } } |