[wp-trac] [WordPress Trac] #15009: Widget RSS unstopable loop on self timeout
WordPress Trac
wp-trac at lists.automattic.com
Fri Oct 1 16:32:39 UTC 2010
#15009: Widget RSS unstopable loop on self timeout
----------------------------+-----------------------------------------------
Reporter: pentatonicfunk | Owner: pentatonicfunk
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 3.0.1
Severity: normal | Resolution: fixed
Keywords: |
----------------------------+-----------------------------------------------
Changes (by pentatonicfunk):
* status: accepted => closed
* resolution: => fixed
Comment:
the solution is just load widget rss when the requester is the client
so i change line
{{{
register_widget('WP_Widget_RSS');
}}}
with
{{{
if($_SERVER['SERVER_ADDR']!=determineIP()){
register_widget('WP_Widget_RSS');
}
function determineIP() {
if (checkIP($_SERVER["HTTP_CLIENT_IP"])) {
return $_SERVER["HTTP_CLIENT_IP"];
}
foreach (explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]) as $ip) {
if (checkIP(trim($ip))) {
return $ip;
}
}
if (checkIP($_SERVER["HTTP_X_FORWARDED"])) {
return $_SERVER["HTTP_X_FORWARDED"];
} elseif (checkIP($_SERVER["HTTP_X_CLUSTER_CLIENT_IP"])) {
return $_SERVER["HTTP_X_CLUSTER_CLIENT_IP"];
} elseif (checkIP($_SERVER["HTTP_FORWARDED_FOR"])) {
return $_SERVER["HTTP_FORWARDED_FOR"];
} elseif (checkIP($_SERVER["HTTP_FORWARDED"])) {
return $_SERVER["HTTP_FORWARDED"];
} else {
return $_SERVER["REMOTE_ADDR"];
}
}
/* BOB: By Grant Burton @ BURTONTECH.COM (11-30-2008): IP-Proxy-Cluster
Fix */
function checkIP($ip) {
if (!empty($ip) && ip2long($ip)!=-1 && ip2long($ip)!=false) {
$private_ips = array (
array('0.0.0.0','2.255.255.255'),
array('10.0.0.0','10.255.255.255'),
array('127.0.0.0','127.255.255.255'),
array('169.254.0.0','169.254.255.255'),
array('172.16.0.0','172.31.255.255'),
array('192.0.2.0','192.0.2.255'),
array('192.168.0.0','192.168.255.255'),
array('255.255.255.0','255.255.255.255')
);
foreach ($private_ips as $r) {
$min = ip2long($r[0]);
$max = ip2long($r[1]);
if ((ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return
false;
}
return true;
} else {
return false;
}
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15009#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list