diff options
Diffstat (limited to 'readityourself.php')
-rwxr-xr-x | readityourself.php | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/readityourself.php b/readityourself.php deleted file mode 100755 index 588baeca..00000000 --- a/readityourself.php +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | <?php | ||
2 | header('Content-type:text/html; charset=utf-8'); | ||
3 | |||
4 | setlocale(LC_ALL, 'fr_FR'); | ||
5 | date_default_timezone_set('Europe/Paris'); | ||
6 | |||
7 | require_once dirname(__FILE__).'/inc/Readability.php'; | ||
8 | require_once dirname(__FILE__).'/inc/Encoding.php'; | ||
9 | require_once dirname(__FILE__).'/inc/rain.tpl.class.php'; | ||
10 | include dirname(__FILE__).'/inc/functions.php'; | ||
11 | |||
12 | if(isset($_GET['url']) && $_GET['url'] != null && trim($_GET['url']) != "") { | ||
13 | // get url link | ||
14 | if(strlen(trim($_GET['url'])) > 2048) { | ||
15 | echo "Error URL is too large !!"; | ||
16 | } else { | ||
17 | $url = trim($_GET['url']); | ||
18 | |||
19 | // decode it | ||
20 | $url = html_entity_decode($url); | ||
21 | |||
22 | // if url use https protocol change it to http | ||
23 | if (!preg_match('!^https?://!i', $url)) $url = 'http://'.$url; | ||
24 | |||
25 | // convert page to utf-8 | ||
26 | $html = Encoding::toUTF8(get_external_file($url,15)); | ||
27 | |||
28 | if(isset($html) and strlen($html) > 0) { | ||
29 | |||
30 | // send result to readability library | ||
31 | $r = new Readability($html, $url); | ||
32 | |||
33 | if($r->init()) { | ||
34 | generate_page($url,$r->articleTitle->innerHTML,$r->articleContent->innerHTML); | ||
35 | } else { | ||
36 | // return data into an iframe | ||
37 | echo "<iframe id='readabilityframe'>".$html."</iframe>"; | ||
38 | } | ||
39 | } else { | ||
40 | echo "Error unable to get link : ".$url; | ||
41 | } | ||
42 | } | ||
43 | } \ No newline at end of file | ||