]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - readityourself.php
2 header('Content-type:text/html; charset=utf-8');
4 setlocale(LC_ALL
, 'fr_FR');
5 date_default_timezone_set('Europe/Paris');
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';
12 if(isset($_GET['url']) && $_GET['url'] != null && trim($_GET['url']) != "") {
14 if(strlen(trim($_GET['url'])) > 2048) {
15 echo "Error URL is too large !!";
17 $url = trim($_GET['url']);
20 $url = html_entity_decode($url);
22 // if url use https protocol change it to http
23 if (!preg_match('!^https?://!i', $url)) $url = 'http://'.$url;
25 // convert page to utf-8
26 $html = Encoding
::toUTF8(get_external_file($url,15));
28 if(isset($html) and strlen($html) > 0) {
30 // send result to readability library
31 $r = new Readability($html, $url);
34 generate_page($url,$r->articleTitle
->innerHTML
,$r->articleContent
->innerHTML
);
36 // return data into an iframe
37 echo "<iframe id='readabilityframe'>".$html."</iframe>";
40 echo "Error unable to get link : ".$url;