home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Neil's C++ Stuff
/
2014-11-mediatemple-neilstuff.zip
/
neilo
/
hn.php
< prev
next >
Wrap
PHP Script
|
2014-11-20
|
1KB
|
29 lines
<?php header('Content-Type: text/html; charset=utf-8');
require('common.php');
if ($id = @$_GET['id']) {
$text = HttpGet('http://news.ycombinator.com/item?id=' . $id);
$text = preg_replace('/<\/?(center|table|td|tr|img|span|font|div)[^>]*>/', '', $text);
$text = preg_replace('/<u><a href="reply\?id=[^"]+">reply<\/a><\/u><a id=up_[0-9]+ href="vote\?for=[^"]+"><\/a>/', '', $text);
$text = preg_replace('/[0-9]+ points?/', '<b><u>$0</u></b>', $text);
$text = preg_replace('/ \| <a href="item\?id=[0-9]+">link<\/a>/', '', $text);
$text = preg_replace('/<body.*?<span id=down_'.$id.'><\/span>/', '', $text);
echo($text);
} else if ($fnid = @$_GET['fnid']) {
$text = HttpGet('http://news.ycombinator.com/x?fnid='.$fnid);
$text = str_replace('"item?id=', '"hn.php?id=', $text);
$text = str_replace('"/x?fnid=', '"hn.php?fnid=', $text);
echo($text);
} else {
$text = HttpGet('http://news.ycombinator.com/');
$text = str_replace('"item?id=', '"hn.php?id=', $text);
$text = str_replace('"/x?fnid=', '"hn.php?fnid=', $text);
echo($text);
}
?>