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/classes/feeds.php b/classes/feeds.php index fd4c7fe53..85276a4b1 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -363,12 +363,15 @@ class Feeds extends Handler_Protected { $date_entered_fmt = T_sprintf("Imported at %s", make_local_datetime($line["date_entered"], false)); - if (get_pref('SHOW_CONTENT_PREVIEW') ) { - if(isset($line["modified_preview"])) - $content_preview = strip_tags($line["content_preview"]); - else - $content_preview = truncate_string(strip_tags($line["content_preview"]), - 250); +# if (get_pref('SHOW_CONTENT_PREVIEW') ) { +# if(isset($line["modified_preview"])) +# $content_preview = strip_tags($line["content_preview"]); +# else +# $content_preview = truncate_string(strip_tags($line["content_preview"]), +# 250); + if (get_pref('SHOW_CONTENT_PREVIEW')) { + $content_preview = " — " . truncate_string(strip_tags($line["content_preview"]), + 250); } $score = $line["score"]; @@ -462,7 +465,7 @@ class Feeds extends Handler_Protected { if (get_pref('SHOW_CONTENT_PREVIEW')) { if ($content_preview) { - $reply['content'] .= " - $content_preview"; + $reply['content'] .= "$content_preview"; } } @@ -581,7 +584,11 @@ class Feeds extends Handler_Protected { $excerpt_hidden = "style=\"display : none\""; $reply['content'] .= " -" . $content_preview . ""; +======= + id=\"CEXC-$id\" class=\"cdmExcerpt\">$content_preview"; +>>>>>>> origin $reply['content'] .= ""; if (!get_pref('VFEED_GROUP_BY_FEED')) { 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/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 "
"; diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 099c88252..63318033e 100644 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -590,14 +590,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"]); diff --git a/css/tt-rss.css b/css/tt-rss.css index e8382ff05..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 { @@ -1123,10 +1124,9 @@ 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; + text-shadow : 1px 1px rgba(0,0,0,0.2); } #feedTree .dijitTreeRow { 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) { 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 { diff --git a/lib/floIcon.php b/lib/floIcon.php new file mode 100644 index 000000000..11a102b50 --- /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