diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/functions.php | 53 | ||||
-rw-r--r-- | include/localized_schema.php | 4 | ||||
-rw-r--r-- | include/rssfuncs.php | 9 | ||||
-rw-r--r-- | include/sanity_check.php | 8 |
4 files changed, 61 insertions, 13 deletions
diff --git a/include/functions.php b/include/functions.php index f17828d1d..8c2ced801 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,6 +1,6 @@ <?php define('EXPECTED_CONFIG_VERSION', 26); - define('SCHEMA_VERSION', 104); + define('SCHEMA_VERSION', 105); $fetch_last_error = false; $pluginhost = false; @@ -852,7 +852,7 @@ } function sql_bool_to_bool($s) { - if ($s == "t" || $s == "1" || $s == "true") { + if ($s == "t" || $s == "1" || strtolower($s) == "true") { return true; } else { return false; @@ -2310,6 +2310,8 @@ $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; $allow_archived = true; + if (!$override_order) $override_order = "last_marked DESC, updated DESC"; + } else if ($feed == -2) { // published virtual feed OR labels category if (!$cat_view) { @@ -2317,7 +2319,7 @@ $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; $allow_archived = true; - if (!$override_order) $override_order = "last_read DESC, updated DESC"; + if (!$override_order) $override_order = "last_published DESC, updated DESC"; } else { $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; @@ -2450,6 +2452,7 @@ comments, int_id, unread,feed_id,marked,published,link,last_read,orig_feed_id, + last_marked, last_published, ".SUBSTRING_FOR_DATE."(last_read,1,19) as last_read_noms, $vfeed_query_part $content_query_part @@ -2492,6 +2495,7 @@ "label_cache," . "link," . "last_read," . + "last_marked, last_published, " . SUBSTRING_FOR_DATE . "(last_read,1,19) as last_read_noms," . $since_id_part . $vfeed_query_part . @@ -2551,10 +2555,6 @@ $res = trim($str); if (!$res) return ''; - $config = array('safe' => 1, 'deny_attribute' => 'style, width, height, class, id', 'comment' => 1, 'cdata' => 1, 'balance' => 0); - $spec = 'img=width,height'; - $res = htmLawed($res, $config, $spec); - if (get_pref($link, "STRIP_IMAGES", $owner)) { $res = preg_replace('/<img[^>]+>/is', '', $res); } @@ -2595,9 +2595,16 @@ } } - $node = $doc->getElementsByTagName('body')->item(0); + //$node = $doc->getElementsByTagName('body')->item(0); + + $doc->removeChild($doc->firstChild); //remove doctype + $res = $doc->saveHTML(); - return $doc->saveXML($node); + $config = array('safe' => 1, 'deny_attribute' => 'style, width, height, class, id', 'comment' => 1, 'cdata' => 1, 'balance' => 0); + $spec = 'img=width,height'; + $res = htmLawed($res, $config, $spec); + + return $res; } function check_for_update($link) { @@ -3900,4 +3907,32 @@ return in_array($interface, class_implements($class)); } + function get_minified_js($files) { + require_once 'lib/jshrink/Minifier.php'; + + $rv = ''; + + foreach ($files as $js) { + if (!isset($_GET['debug'])) { + $cached_file = CACHE_DIR . "/js/$js.js"; + + if (file_exists($cached_file) && + is_readable($cached_file) && + filemtime($cached_file) >= filemtime("js/$js.js")) { + + $rv .= file_get_contents($cached_file); + + } else { + $minified = JShrink\Minifier::minify(file_get_contents("js/$js.js")); + file_put_contents($cached_file, $minified); + $rv .= $minified; + } + } else { + $rv .= file_get_contents("js/$js.js"); + } + } + + return $rv; + } + ?> diff --git a/include/localized_schema.php b/include/localized_schema.php index 3497c9c27..0aecc45c9 100644 --- a/include/localized_schema.php +++ b/include/localized_schema.php @@ -1,4 +1,4 @@ -<?php # This file has been generated at: Sun Feb 17 13:58:53 MSK 2013 +<?php # This file has been generated at: Sun Mar 17 19:37:50 MSK 2013 __("Title"); __("Title or Content"); @@ -54,7 +54,7 @@ __('Automatically expand articles in combined mode'); __('Purge unread articles'); __('Show special feeds when hiding read feeds'); __('Group headlines in virtual feeds'); -__('Do not show images in articles'); +__('Hide images in articles'); __('Enable external API'); __('User timezone'); __('Customize stylesheet'); diff --git a/include/rssfuncs.php b/include/rssfuncs.php index 5c49008c5..a95280a31 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -766,12 +766,17 @@ } } + $last_marked = ($marked == 'true') ? 'NOW()' : 'NULL'; + $last_published = ($published == 'true') ? 'NOW()' : 'NULL'; + $result = db_query($link, "INSERT INTO ttrss_user_entries (ref_id, owner_uid, feed_id, unread, last_read, marked, - published, score, tag_cache, label_cache, uuid) + published, score, tag_cache, label_cache, uuid, + last_marked, last_published) VALUES ('$ref_id', '$owner_uid', '$feed', $unread, - $last_read_qpart, $marked, $published, '$score', '', '', '')"); + $last_read_qpart, $marked, $published, '$score', '', '', + '', $last_marked, $last_published)"); if (PUBSUBHUBBUB_HUB && $published == 'true') { $rss_link = get_self_url_prefix() . diff --git a/include/sanity_check.php b/include/sanity_check.php index 5cb556746..4925486a3 100644 --- a/include/sanity_check.php +++ b/include/sanity_check.php @@ -36,6 +36,10 @@ array_push($errors, "Data export cache is not writable (chmod -R 777 ".CACHE_DIR."/export)"); } + if (!is_writable(CACHE_DIR . "/js")) { + array_push($errors, "Javascript cache is not writable (chmod -R 777 ".CACHE_DIR."/js)"); + } + if (GENERATED_CONFIG_CHECK != EXPECTED_CONFIG_VERSION) { array_push($errors, "Configuration option checker sanity_config.php is outdated, please recreate it using ./utils/regen_config_checks.sh"); @@ -117,6 +121,10 @@ array_push($errors, "PHP support for ctype functions are required by HTMLPurifier."); } + if (!function_exists("iconv")) { + array_push($errors, "PHP support for iconv is required to handle multiple charsets."); + } + if (ini_get("safe_mode")) { array_push($errors, "PHP safe mode setting is not supported."); } |