From 63211f61be6c6109a6858dc974e91facec45aafd Mon Sep 17 00:00:00 2001 From: Glen Harris <astfgl@iamnota.org> Date: Fri, 18 Jan 2008 21:15:11 +0100 Subject: [PATCH] Show proxy path in notify mails FS#1308 darcs-hash:20080118201511-f6de1-13f0ffff4f546298cce1a4e3dcd2d9679217ace8.gz --- inc/common.php | 20 ++++++++++++++++++-- 1 file 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 @@ -576,6 +576,21 @@ function clientIP($single=false){ return $ip[0]; } +/** + * 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. * @@ -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); -- GitLab