/** * Real IPアドレスを戻す * プライベートアドレスの場合もある */ function get_realip() { foreach ($this->proxy as $x) { if (!$x[2]) { continue; } // IP取得利用 $rc = ''; if (isset($_SERVER[$x[0]])) { $rc = trim($_SERVER[$x[0]]); } if (empty($rc)) { continue; } if (!is_ipaddr($rc)) { continue; } // IPアドレス体系か? if (!is_localIP($rc)) { return $rc; } // プライベートな生IPを取得してもあまり意味がない } return ''; }
function isMyNet() { if (is_localIP($this->host)) { return true; } if (ip_scope_check($this->host, $this->MyNetList)) { return true; } return false; }
function tb_send($page, $links) { global $trackback, $page_title; if (!$trackback) { return; } // No link, END if (!is_array($links) || empty($links)) { return; } $script = get_script_uri(); // PROHIBITION OF INVALID TRANSMISSION $url = parse_url($script); $host = empty($url['host']) ? $script : $url['host']; if (is_ipaddr($host)) { if (is_localIP($host)) { return; } } else { if (is_ReservedTLD($host)) { return; } } if (is_ignore_page($page)) { return; } // Disable 'max execution time' (php.ini: max_execution_time) if (ini_get('safe_mode') == '0') { set_time_limit(0); } $r_page = rawurlencode($page); $excerpt = strip_htmltag(convert_html(get_source($page))); // Sender's information $putdata = array('title' => $page, 'url' => $script . '?' . $r_page, 'excerpt' => mb_strimwidth(preg_replace("/[\r\n]/", ' ', $excerpt), 0, 255, '...'), 'blog_name' => $page_title . ' (' . PLUGIN_TRACKBACK_VERSION . ')', 'charset' => SOURCE_ENCODING); foreach ($links as $link) { if (path_check($script, $link)) { continue; } // Same Site $tb_id = tb_get_url($link); // Get Trackback ID from the URL if (empty($tb_id)) { continue; } // Trackback is not supported $result = http_request($tb_id, 'POST', '', $putdata, 2, CONTENT_CHARSET); // FIXME: Create warning notification space at pukiwiki.skin! } }
function isListed() { if (is_localIP($this->host)) { return FALSE; } if (ip_scope_check($this->host, $this->MyNetList)) { return FALSE; } // reverse ip を生成 $host = implode('.', $this->reverse); foreach ($this->BlockList as $zone) { if (!$zone[1]) { continue; } $lookup = $host . '.' . $zone[0]; $ip = gethostbyname($lookup); if ($this->debug) { $result = $lookup != $ip ? ' ' . $ip : ''; $this->debug_result[] = array($zone[0], $host, $result); continue; } if ($ip != $lookup) { return TRUE; } } return FALSE; }