]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - readityourself.php
3 define("VERSION", "0.0.3");
5 header('Content-type:text/html; charset=utf-8');
6 // Set locale to French
7 setlocale(LC_ALL
, 'fr_FR');
9 // set timezone to Europe/Paris
10 date_default_timezone_set('Europe/Paris');
12 // set charset to utf-8 important since all pages will be transform to utf-8
13 header('Content-Type: text/html;charset=utf-8');
15 // get readability library
16 require_once dirname(__FILE__
).'/inc/Readability.php';
18 // get Encoding library.
19 require_once dirname(__FILE__
).'/inc/Encoding.php';
21 // appel de la libraire RainTPL.
22 require_once dirname(__FILE__
).'/inc/rain.tpl.class.php';
24 include dirname(__FILE__
).'/inc/functions.php';
29 if(isset($_GET['url']) && $_GET['url'] != null && trim($_GET['url']) != "") {
31 if(strlen(trim($_GET['url'])) > 2048) {
32 echo "Error URL is too large !!";
34 $url = trim($_GET['url']);
37 $url = html_entity_decode($url);
39 // if url use https protocol change it to http
40 if (!preg_match('!^https?://!i', $url)) $url = 'http://'.$url;
42 // convert page to utf-8
43 $html = Encoding
::toUTF8(get_external_file($url,15));
45 if(isset($html) and strlen($html) > 0) {
47 // send result to readability library
48 $r = new Readability($html, $url);
51 generate_page($url,$r->articleTitle
->innerHTML
,$r->articleContent
->innerHTML
);
53 // return data into an iframe
54 echo "<iframe id='readabilityframe'>".$html."</iframe>";
57 echo "Error unable to get link : ".$url;