diff options
author | Glen Harris <astfgl@iamnota.org> | 2008-01-18 21:15:11 +0100 |
---|---|---|
committer | Glen Harris <astfgl@iamnota.org> | 2008-01-18 21:15:11 +0100 |
commit | 63211f61be6c6109a6858dc974e91facec45aafd (patch) | |
tree | 382dfd338ebd18363939e0d4968cec986184dec0 | |
parent | 4e037c98ea981de9ac17ab529a2323e7c14aacdc (diff) | |
download | rpg-63211f61be6c6109a6858dc974e91facec45aafd.tar.gz rpg-63211f61be6c6109a6858dc974e91facec45aafd.tar.bz2 |
Show proxy path in notify mails FS#1308
darcs-hash:20080118201511-f6de1-13f0ffff4f546298cce1a4e3dcd2d9679217ace8.gz
-rw-r--r-- | inc/common.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/inc/common.php b/inc/common.php index 866c64b8c..3a5839b5d 100644 --- a/inc/common.php +++ b/inc/common.php @@ -577,6 +577,21 @@ function clientIP($single=false){ } /** + * Convert one or more comma separated IPs to hostnames + * + * @author Glen Harris <astfgl@iamnota.org> + * @returns a comma separated list of hostnames + */ +function gethostsbyaddrs($ips){ + $hosts = array(); + $ips = explode(',',$ips); + foreach($ip as $ip){ + $host[] = gethostbyaddr(trim($ip)); + } + return join(',',$host);; +} + +/** * Checks if a given page is currently locked. * * removes stale lockfiles @@ -892,10 +907,11 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){ return; //just to be safe } + $ip = clientIP(); $text = str_replace('@DATE@',date($conf['dformat']),$text); $text = str_replace('@BROWSER@',$_SERVER['HTTP_USER_AGENT'],$text); - $text = str_replace('@IPADDRESS@',$_SERVER['REMOTE_ADDR'],$text); - $text = str_replace('@HOSTNAME@',gethostbyaddr($_SERVER['REMOTE_ADDR']),$text); + $text = str_replace('@IPADDRESS@',$ip,$text); + $text = str_replace('@HOSTNAME@',gethostsbyaddrs($ip),$text); $text = str_replace('@NEWPAGE@',wl($id,'',true,'&'),$text); $text = str_replace('@PAGE@',$id,$text); $text = str_replace('@TITLE@',$conf['title'],$text); |