From a8572a71823a500d003cd148333a781b0a59cdab Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 25 Jun 2013 22:14:50 +0400 Subject: login page: remove version --- include/login_form.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/login_form.php b/include/login_form.php index 891e25e13..3d2c957a7 100644 --- a/include/login_form.php +++ b/include/login_form.php @@ -246,9 +246,6 @@ function bwLimitChange(elem) { -- cgit v1.2.3 From 44727c79ad0593982b817554412fc5313e36e2fb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 25 Jun 2013 23:07:09 +0400 Subject: batch feed editor: remove title and feed url because batch editing those makes no sense whatsoever --- classes/pref/feeds.php | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index d2dc6f7c3..870c4fed4 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -792,31 +792,10 @@ class Pref_Feeds extends Handler_Protected { print "
".__("Feed")."
"; print "
"; - /* Title */ - - print ""; - - $this->batch_edit_cbox("title"); - - /* Feed URL */ - - print "
"; - - print __('URL:') . " "; - print ""; - - $this->batch_edit_cbox("feed_url"); - /* Category */ if (get_pref('ENABLE_FEED_CATS')) { - print "
"; - print __('Place in category:') . " "; print_feed_cat_select("cat_id", false, @@ -862,7 +841,7 @@ class Pref_Feeds extends Handler_Protected { $this->batch_edit_cbox("auth_login"); - print "
"; -- cgit v1.2.3 From afa1a260d0c47ddb44225786fb3ed892a0a0b428 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 26 Jun 2013 02:17:49 +0400 Subject: fix inverse status not being set correctly for filters when creating them fix inverse rules not being saved/restored properly through opml --- classes/opml.php | 6 ++++-- classes/pref/filters.php | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/classes/opml.php b/classes/opml.php index c5d14cdde..e9a07bb52 100644 --- a/classes/opml.php +++ b/classes/opml.php @@ -190,6 +190,7 @@ class Opml extends Handler_Protected { } $tmp_line["cat_filter"] = sql_bool_to_bool($tmp_line["cat_filter"]); + $tmp_line["inverse"] = sql_bool_to_bool($tmp_line["inverse"]); unset($tmp_line["feed_id"]); unset($tmp_line["cat_id"]); @@ -363,9 +364,10 @@ class Opml extends Handler_Protected { $cat_filter = bool_to_sql_bool($rule["cat_filter"]); $reg_exp = $this->dbh->escape_string($rule["reg_exp"]); $filter_type = (int)$rule["filter_type"]; + $inverse = bool_to_sql_bool($rule["inverse"]); - $this->dbh->query("INSERT INTO ttrss_filters2_rules (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter) - VALUES ($feed_id, $cat_id, $filter_id, $filter_type, '$reg_exp', $cat_filter)"); + $this->dbh->query("INSERT INTO ttrss_filters2_rules (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter,inverse) + VALUES ($feed_id, $cat_id, $filter_id, $filter_type, '$reg_exp', $cat_filter,$inverse)"); } foreach ($filter["actions"] as $action) { diff --git a/classes/pref/filters.php b/classes/pref/filters.php index bcc7b5aec..6a70e622c 100644 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -585,14 +585,15 @@ class Pref_Filters extends Handler_Protected { $enabled = checkbox_to_sql_bool($_REQUEST["enabled"]); $match_any_rule = checkbox_to_sql_bool($_REQUEST["match_any_rule"]); $title = $this->dbh->escape_string($_REQUEST["title"]); + $inverse = checkbox_to_sql_bool($_REQUEST["inverse"]); $this->dbh->query("BEGIN"); /* create base filter */ $result = $this->dbh->query("INSERT INTO ttrss_filters2 - (owner_uid, match_any_rule, enabled, title) VALUES - (".$_SESSION["uid"].",$match_any_rule,$enabled, '$title')"); + (owner_uid, match_any_rule, enabled, title, inverse) VALUES + (".$_SESSION["uid"].",$match_any_rule,$enabled, '$title', $inverse)"); $result = $this->dbh->query("SELECT MAX(id) AS id FROM ttrss_filters2 WHERE owner_uid = ".$_SESSION["uid"]); -- cgit v1.2.3 From ba2463069fc97da3f9b87d549242a44ab91fa1ea Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 26 Jun 2013 08:37:07 +0400 Subject: replace floIcon with jimIcon from https://github.com/jimparis/jimIcon --- .gitignore | 1 - lib/floIcon.php | 20 +++++ lib/jimIcon.php | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 lib/floIcon.php create mode 100644 lib/jimIcon.php diff --git a/.gitignore b/.gitignore index ac3c24319..b4853806c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *~ *.DS_Store #* -lib/floIcon.php .idea/* config.php feed-icons/* diff --git a/lib/floIcon.php b/lib/floIcon.php new file mode 100644 index 000000000..10202862d --- /dev/null +++ b/lib/floIcon.php @@ -0,0 +1,20 @@ +img; + } +} + +class floIcon { + function readICO($file) { + $jim = new jimIcon(); + $icon = new floIconIcon(); + $icon->img = $jim->fromiconstring(file_get_contents($file)); + $this->images = array($icon); + } +} +?> diff --git a/lib/jimIcon.php b/lib/jimIcon.php new file mode 100644 index 000000000..940701bcc --- /dev/null +++ b/lib/jimIcon.php @@ -0,0 +1,270 @@ + and is +// released under the terms of the CC0: +// +// To the extent possible under law, the author(s) have dedicated all +// copyright and related and neighboring rights to this software to +// the public domain worldwide. This software is distributed without +// any arranty. +// +// You may have received a copy of the CC0 Public Domain Dedication +// along with this software. If not, see +// http://creativecommons.org/publicdomain/zero/1.0/ + +class jimIcon { + // Get an image color from a string + function get_color($str, $img) { + $b = ord($str[0]); + $g = ord($str[1]); + $r = ord($str[2]); + if (strlen($str) > 3) { + $a = 127 - (ord($str[3]) / 2); + if ($a != 0 && $a != 127) + $this->had_alpha = 1; + } else { + $a = 0; + } + if ($a != 127) + $this->all_transaprent = 0; + return imagecolorallocatealpha($img, $r, $g, $b, $a); + } + + // Given a string with the contents of an .ICO, + // return a GD image of the icon, or false on error. + function fromiconstring($ico) { + $this->error = "(unknown error)"; + $this->had_alpha = 0; + + // Read header + if (strlen($ico) < 6) { + $this->error = "too short"; + return false; + } + $h = unpack("vzero/vtype/vnum", $ico); + + // Must be ICO format with at least one image + if ($h["zero"] != 0 || $h["type"] != 1 || $h["num"] == 0) { + // See if we can just parse it with GD directly + // if it's not ICO format; maybe it was a mislabeled + // PNG or something. + $i = @imagecreatefromstring($ico); + if ($i) { + imagesavealpha($i, true); + return $i; + } + $this->error = "not ICO or other image"; + return false; + } + + // Read directory entries to find the biggest image + $most_pixels = 0; + for ($i = 0; $i < $h["num"]; $i++) { + $entry = substr($ico, 6 + 16 * $i, 16); + if (!$entry || strlen($entry) < 16) + continue; + $e = unpack("Cwidth/" . + "Cheight/" . + "Ccolors/" . + "Czero/" . + "vplanes/" . + "vbpp/" . + "Vsize/" . + "Voffset/", + $entry); + if ($e["width"] == 0) + $e["width"] = 256; + if ($e["height"] == 0) + $e["height"] = 256; + if ($e["zero"] != 0) { + $this->error = "nonzero reserved field"; + return false; + } + $pixels = $e["width"] * $e["height"]; + if ($pixels > $most_pixels) { + $most_pixels = $pixels; + $most = $e; + } + } + if ($most_pixels == 0) { + $this->error = "no pixels"; + return false; + } + $e = $most; + + // Extract image data + $data = substr($ico, $e["offset"], $e["size"]); + if (!$data || strlen($data) != $e["size"]) { + $this->error = "bad image data"; + return false; + } + + // See if we can parse it (might be PNG format here) + $i = @imagecreatefromstring($data); + if ($i) { + imagesavealpha($img, true); + return $i; + } + + // Must be a BMP. Parse it ourselves. + $img = imagecreatetruecolor($e["width"], $e["height"]); + imagesavealpha($img, true); + $bg = imagecolorallocatealpha($img, 255, 0, 0, 127); + imagefill($img, 0, 0, $bg); + + // Skip over the BITMAPCOREHEADER or BITMAPINFOHEADER; + // we'll just assume the palette and pixel data follow + // in the most obvious format as described by the icon + // directory entry. + $bitmapinfo = unpack("Vsize", $data); + if ($bitmapinfo["size"] == 40) { + $info = unpack("Vsize/" . + "Vwidth/" . + "Vheight/" . + "vplanes/" . + "vbpp/" . + "Vcompress/" . + "Vsize/" . + "Vxres/" . + "Vyres/" . + "Vpalcolors/" . + "Vimpcolors/", $data); + if ($e["bpp"] == 0) { + $e["bpp"] = $info["bpp"]; + } + } + $data = substr($data, $bitmapinfo["size"]); + + $height = $e["height"]; + $width = $e["width"]; + $bpp = $e["bpp"]; + + // For indexed images, we only support 1, 4, or 8 BPP + switch ($bpp) { + case 1: + case 4: + case 8: + $indexed = 1; + break; + case 24: + case 32: + $indexed = 0; + break; + default: + $this->error = "bad BPP $bpp"; + return false; + } + + $offset = 0; + if ($indexed) { + $palette = array(); + $this->all_transparent = 1; + for ($i = 0; $i < (1 << $bpp); $i++) { + $entry = substr($data, $i * 4, 4); + $palette[$i] = $this->get_color($entry, $img); + } + $offset = $i * 4; + + // Hack for some icons: if everything was transparent, + // discard alpha channel. + if ($this->all_transparent) { + for ($i = 0; $i < (1 << $bpp); $i++) { + $palette[$i] &= 0xffffff; + } + } + } + + // Assume image data follows in bottom-up order. + // First the "XOR" image + if ((strlen($data) - $offset) < ($bpp * $height * $width / 8)) { + $this->error = "short data"; + return false; + } + $XOR = array(); + for ($y = $height - 1; $y >= 0; $y--) { + $x = 0; + while ($x < $width) { + if (!$indexed) { + $bytes = $bpp / 8; + $entry = substr($data, $offset, $bytes); + $pixel = $this->get_color($entry, $img); + $XOR[$y][$x] = $pixel; + $x++; + $offset += $bytes; + } elseif ($bpp == 1) { + $p = ord($data[$offset]); + for ($b = 0x80; $b > 0; $b >>= 1) { + if ($p & $b) { + $pixel = $palette[1]; + } else { + $pixel = $palette[0]; + } + $XOR[$y][$x] = $pixel; + $x++; + } + $offset++; + } elseif ($bpp == 4) { + $p = ord($data[$offset]); + $pixel1 = $palette[$p >> 4]; + $pixel2 = $palette[$p & 0x0f]; + $XOR[$y][$x] = $pixel1; + $XOR[$y][$x+1] = $pixel2; + $x += 2; + $offset++; + } elseif ($bpp == 8) { + $pixel = $palette[ord($data[$offset])]; + $XOR[$y][$x] = $pixel; + $x += 1; + $offset++; + } else { + $this->error = "bad BPP"; + return false; + } + } + // End of row padding + while ($offset & 3) + $offset++; + } + + // Now the "AND" image, which is 1 bit per pixel. Ignore + // if some of our image data already had alpha values, + // or if there isn't enough data left. + if ($this->had_alpha || + ((strlen($data) - $offset) < ($height * $width / 8))) { + // Just return what we've got + for ($y = 0; $y < $height; $y++) { + for ($x = 0; $x < $width; $x++) { + imagesetpixel($img, $x, $y, + $XOR[$y][$x]); + } + } + return $img; + } + + // Mask what we have with the "AND" image + for ($y = $height - 1; $y >= 0; $y--) { + $x = 0; + while ($x < $width) { + for ($b = 0x80; + $b > 0 && $x < $width; $b >>= 1) { + if (!(ord($data[$offset]) & $b)) { + imagesetpixel($img, $x, $y, + $XOR[$y][$x]); + } + $x++; + } + $offset++; + } + + // End of row padding + while ($offset & 3) + $offset++; + } + return $img; + } +} +?> \ No newline at end of file -- cgit v1.2.3 From d97efc9967d0823aa6332aa20c45c99621493626 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 26 Jun 2013 13:36:06 +0400 Subject: floicon wrapper: fix short tag --- lib/floIcon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/floIcon.php b/lib/floIcon.php index 10202862d..11a102b50 100644 --- a/lib/floIcon.php +++ b/lib/floIcon.php @@ -1,4 +1,4 @@ - Date: Wed, 26 Jun 2013 16:48:53 +0400 Subject: another counter node positioning hack --- css/tt-rss.css | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/css/tt-rss.css b/css/tt-rss.css index e8382ff05..59143fae2 100644 --- a/css/tt-rss.css +++ b/css/tt-rss.css @@ -1123,9 +1123,7 @@ body#ttrssMain #feedTree { border-radius : 4px; vertical-align : middle; float : right; - margin-right : 5px; - position : relative; - top : 2px; + margin : 5px 5px 5px 0px; min-width : 23px; } -- cgit v1.2.3 From 72f133bb06a5812908a6718c86b0c856626df531 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 26 Jun 2013 16:52:22 +0400 Subject: add experimental counterNode text shadow --- css/tt-rss.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/css/tt-rss.css b/css/tt-rss.css index 59143fae2..3e6b8cd38 100644 --- a/css/tt-rss.css +++ b/css/tt-rss.css @@ -1110,6 +1110,7 @@ body#ttrssMain #feedTree { background : #f0f0f0; color : #999; border-color : #f0f0f0; + text-shadow : none; } #feedTree .counterNode { @@ -1125,6 +1126,7 @@ body#ttrssMain #feedTree { float : right; margin : 5px 5px 5px 0px; min-width : 23px; + text-shadow : 1px 1px rgba(0,0,0,0.2); } #feedTree .dijitTreeRow { -- cgit v1.2.3 From 3cda9e2a404ffc71789c5fbd2de389a1084e8b85 Mon Sep 17 00:00:00 2001 From: craywolf Date: Wed, 26 Jun 2013 09:20:03 -0400 Subject: Fix version in preferences footer --- include/version.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/version.php b/include/version.php index c58dc3a19..460c189d6 100644 --- a/include/version.php +++ b/include/version.php @@ -5,9 +5,9 @@ date_default_timezone_set('UTC'); $root_dir = dirname(dirname(__FILE__)); - if (is_dir("$root_dir/.git") && file_exists("$root_dir/.git/ORIG_HEAD")) { + if (is_dir("$root_dir/.git") && file_exists("$root_dir/.git/refs/heads/master")) { - $suffix = substr(trim(file_get_contents("$root_dir/.git/ORIG_HEAD")), 0, 7); + $suffix = substr(trim(file_get_contents("$root_dir/.git/refs/heads/master")), 0, 7); return VERSION_STATIC . ".$suffix"; } else { -- cgit v1.2.3 From fac096405338e0f46fa248320318436d862678fc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 27 Jun 2013 21:05:10 +0400 Subject: do not show lone dash in collapsed cdm when content preview is disabled --- classes/feeds.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index 83736925c..33f239ee6 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -361,7 +361,7 @@ class Feeds extends Handler_Protected { make_local_datetime($line["date_entered"], false)); if (get_pref('SHOW_CONTENT_PREVIEW')) { - $content_preview = truncate_string(strip_tags($line["content_preview"]), + $content_preview = " — " . truncate_string(strip_tags($line["content_preview"]), 250); } @@ -456,7 +456,7 @@ class Feeds extends Handler_Protected { if (get_pref('SHOW_CONTENT_PREVIEW')) { if ($content_preview) { - $reply['content'] .= " - $content_preview"; + $reply['content'] .= "$content_preview"; } } @@ -575,7 +575,7 @@ class Feeds extends Handler_Protected { $excerpt_hidden = "style=\"display : none\""; $reply['content'] .= " - $content_preview"; + id=\"CEXC-$id\" class=\"cdmExcerpt\">$content_preview"; $reply['content'] .= ""; if (!get_pref('VFEED_GROUP_BY_FEED')) { -- cgit v1.2.3