diff --git a/css/style.css b/css/style.css index d53060ec6..959a411a6 100644 --- a/css/style.css +++ b/css/style.css @@ -100,7 +100,15 @@ footer { margin-left: -20px; } -#main .entrie .tools a.tool span { +#article .tools { + display: inline; +} + +#article .tools a.tool { + cursor: pointer; +} + +#main .entrie .tools a.tool span, #article .tools a.tool span { display: inline-block; width: 16px; height: 16px; @@ -110,18 +118,34 @@ a.fav span { background: url('../img/fav-on.png') no-repeat; } +a.fav span:hover { + background: url('../img/fav-off.png') no-repeat; +} + a.fav-off span { background: url('../img/fav-off.png') no-repeat; } +a.fav-off span:hover { + background: url('../img/fav-on.png') no-repeat; +} + a.archive span { background: url('../img/archive-on.png') no-repeat; } +a.archive span:hover { + background: url('../img/archive-off.png') no-repeat; +} + a.archive-off span { background: url('../img/archive-off.png') no-repeat; } +a.archive-off span:hover { + background: url('../img/archive-on.png') no-repeat; +} + a.delete span { background: url('../img/delete.png') no-repeat; } @@ -153,6 +177,10 @@ body.article { text-decoration: none; } +.backhome { + display: inline; +} + /*** ***/ #main { diff --git a/inc/Encoding.php b/inc/Encoding.php index ac107af9e..577763b4b 100755 --- a/inc/Encoding.php +++ b/inc/Encoding.php @@ -1,4 +1,4 @@ - * @package Encoding @@ -8,7 +8,7 @@ */ class Encoding { - + protected static $win1252ToUtf8 = array( 128 => "\xe2\x82\xac", @@ -43,10 +43,10 @@ class Encoding { 158 => "\xc5\xbe", 159 => "\xc5\xb8" ); - + protected static $brokenUtf8ToUtf8 = array( "\xc2\x80" => "\xe2\x82\xac", - + "\xc2\x82" => "\xe2\x80\x9a", "\xc2\x83" => "\xc6\x92", "\xc2\x84" => "\xe2\x80\x9e", @@ -58,10 +58,10 @@ class Encoding { "\xc2\x8a" => "\xc5\xa0", "\xc2\x8b" => "\xe2\x80\xb9", "\xc2\x8c" => "\xc5\x92", - + "\xc2\x8e" => "\xc5\xbd", - - + + "\xc2\x91" => "\xe2\x80\x98", "\xc2\x92" => "\xe2\x80\x99", "\xc2\x93" => "\xe2\x80\x9c", @@ -74,14 +74,14 @@ class Encoding { "\xc2\x9a" => "\xc5\xa1", "\xc2\x9b" => "\xe2\x80\xba", "\xc2\x9c" => "\xc5\x93", - + "\xc2\x9e" => "\xc5\xbe", "\xc2\x9f" => "\xc5\xb8" ); - + protected static $utf8ToWin1252 = array( "\xe2\x82\xac" => "\x80", - + "\xe2\x80\x9a" => "\x82", "\xc6\x92" => "\x83", "\xe2\x80\x9e" => "\x84", @@ -93,10 +93,10 @@ class Encoding { "\xc5\xa0" => "\x8a", "\xe2\x80\xb9" => "\x8b", "\xc5\x92" => "\x8c", - + "\xc5\xbd" => "\x8e", - - + + "\xe2\x80\x98" => "\x91", "\xe2\x80\x99" => "\x92", "\xe2\x80\x9c" => "\x93", @@ -109,7 +109,7 @@ class Encoding { "\xc5\xa1" => "\x9a", "\xe2\x80\xba" => "\x9b", "\xc5\x93" => "\x9c", - + "\xc5\xbe" => "\x9e", "\xc5\xb8" => "\x9f" ); @@ -119,7 +119,7 @@ class Encoding { * Function Encoding::toUTF8 * * This function leaves UTF8 characters alone, while converting almost all non-UTF8 to UTF8. - * + * * It assumes that the encoding of the original string is either Windows-1252 or ISO 8859-1. * * It may fail to convert characters to UTF-8 if they fall into one of these scenarios: @@ -128,7 +128,7 @@ class Encoding { * are followed by any of these: ("group B") * ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶•¸¹º»¼½¾¿ * For example: %ABREPRESENT%C9%BB. «REPRESENTÉ» - * The "«" (%AB) character will be converted, but the "É" followed by "»" (%C9%BB) + * The "«" (%AB) character will be converted, but the "É" followed by "»" (%C9%BB) * is also a valid unicode character, and will be left unchanged. * * 2) when any of these: àáâãäåæçèéêëìíîï are followed by TWO chars from group B, @@ -148,7 +148,7 @@ class Encoding { } return $text; } elseif(is_string($text)) { - + $max = strlen($text); $buf = ""; for($i = 0; $i < $max; $i++){ @@ -244,15 +244,15 @@ class Encoding { $text = self::toUTF8(utf8_decode(str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), $text))); return $text; } - + static function UTF8FixWin1252Chars($text){ - // If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1 + // If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1 // (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it. // See: http://en.wikipedia.org/wiki/Windows-1252 - + return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text); } - + static function removeBOM($str=""){ if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { $str=substr($str, 3); diff --git a/inc/functions.php b/inc/functions.php index 6fa5a17a9..37a560385 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1,32 +1,46 @@ assign( "url", $url); - $tpl->assign( "title", $title); - $tpl->assign( "content", $content); + $tpl->assign("id", $entry['id']); + $tpl->assign("url", $entry['url']); + $tpl->assign("title", $entry['title']); + $tpl->assign("content", $entry['content']); + $tpl->assign("is_fav", $entry['is_fav']); + $tpl->assign("is_read", $entry['is_read']); - $tpl->draw( "index"); // draw the template + $tpl->draw( "index"); } // function define to retrieve url content -function get_external_file($url, $timeout) { +function get_external_file($url, $timeout) +{ // spoofing FireFox 18.0 $useragent="Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"; @@ -95,57 +109,4 @@ function get_external_file($url, $timeout) { else { return FALSE; } -} - -function rel2abs($rel, $base) -{ - /* return if already absolute URL */ - if (parse_url($rel, PHP_URL_SCHEME) != '') return $rel; - - /* queries and anchors */ - if ($rel[0]=='#' || $rel[0]=='?') return $base.$rel; - - /* parse base URL and convert to local variables: - $scheme, $host, $path */ - extract(parse_url($base)); - - /* remove non-directory element from path */ - $path = preg_replace('#/[^/]*$#', '', $path); - - /* destroy path if relative url points to root */ - if ($rel[0] == '/') $path = ''; - - /* dirty absolute URL */ - $abs = "$host$path/$rel"; - - /* replace '//' or '/./' or '/foo/../' with '/' */ - $re = array('#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#'); - for($n=1; $n>0; $abs=preg_replace($re, '/', $abs, -1, $n)) {} - - /* absolute URL is ready! */ - return $scheme.'://'.$abs; -} - -// $str=preg_replace('#(href|src)="([^:"]*)("|(?:(?:%20|\s|\+)[^"]*"))#','$1="http://wintermute.com.au/$2$3',$str); - -function absolutes_links($data, $base) { - // cherche les balises 'a' qui contiennent un href - $matches = array(); - preg_match_all('#(href|src)="([^:"]*)("|(?:(?:%20|\s|\+)[^"]*"))#Si', $data, $matches, PREG_SET_ORDER); - - // ne conserve que les liens ne commençant pas par un protocole « protocole:// » ni par une ancre « # » - foreach($matches as $i => $link) { - $link[1] = trim($link[1]); - - if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1]) ) { - - $absolutePath=rel2abs($link[2],$base); - - $data = str_replace($matches[$i][2], $absolutePath, $data); - } - - } - return $data; -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/index.php b/index.php index 7ae2fb6fe..6f7c5fc01 100755 --- a/index.php +++ b/index.php @@ -148,7 +148,7 @@ catch (Exception $e)
- +
diff --git a/js/poche.js b/js/poche.js index 42958e83e..64df553c9 100644 --- a/js/poche.js +++ b/js/poche.js @@ -1,4 +1,4 @@ -function toggle_favorite(element,id) { +function toggle_favorite(element, id) { $(element).toggleClass('fav-off'); $.ajax ({ url: "process.php?action=toggle_fav", @@ -6,15 +6,18 @@ function toggle_favorite(element,id) { }); } -function toggle_archive(id) { - /*$('#entry-'+id).toggle();*/ +function toggle_archive(element, id, view_article) { + $(element).toggleClass('archive-off'); $.ajax ({ url: "process.php?action=toggle_archive", data:{id:id} }); var obj = $('#entry-'+id); - $('#content').masonry('remove',obj); - $('#content').masonry('reloadItems'); - $('#content').masonry('reload'); + // on vient de la vue de l'article, donc pas de gestion de grille + if (view_article != 1) { + $('#content').masonry('remove',obj); + $('#content').masonry('reloadItems'); + $('#content').masonry('reload'); + } } \ No newline at end of file diff --git a/tpl/footer.html b/tpl/footer.html index 8cdda21c9..ffe4e0d3e 100755 --- a/tpl/footer.html +++ b/tpl/footer.html @@ -1,3 +1,5 @@ + + \ No newline at end of file diff --git a/tpl/index.html b/tpl/index.html index c8b54c844..1c6c83b90 100755 --- a/tpl/index.html +++ b/tpl/index.html @@ -17,6 +17,11 @@
+
+ + + +

{$title}

view original
diff --git a/view.php b/view.php index aba1b7ec0..75e6c3a9e 100755 --- a/view.php +++ b/view.php @@ -31,5 +31,13 @@ if(isset($_GET['id']) && $_GET['id'] != '') { die('query error : '.$e->getMessage()); } - generate_page($entry[0]['url'], $entry[0]['title'], $entry[0]['content']); + if ($entry != NULL) { + generate_page($entry[0]); + } + else { + die('error in view call'); + } +} +else { + die('error in view call'); } \ No newline at end of file