diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/colors.php | 7 | ||||
-rw-r--r-- | include/digest.php | 2 | ||||
-rw-r--r-- | include/functions.php | 52 | ||||
-rw-r--r-- | include/login_form.php | 34 | ||||
-rw-r--r-- | include/rssfuncs.php | 36 | ||||
-rw-r--r-- | include/sanity_check.php | 2 |
6 files changed, 70 insertions, 63 deletions
diff --git a/include/colors.php b/include/colors.php index 41bf7b819..91eaa2dc2 100644 --- a/include/colors.php +++ b/include/colors.php @@ -1,6 +1,8 @@ <?php -require_once "lib/floIcon.php"; +if (file_exists("lib/floIcon.php")) { + require_once "lib/floIcon.php"; +} function _resolve_htmlcolor($color) { $htmlcolors = array ("aliceblue" => "#f0f8ff", @@ -286,7 +288,8 @@ function hsl2rgb($arr) { $size = @getimagesize($imageFile); - if (!defined('_DISABLE_FLOICON') && strtolower($size['mime']) == 'image/vnd.microsoft.icon') { + if (strtolower($size['mime']) == 'image/vnd.microsoft.icon' && class_exists("floIcon")) { + $ico = new floIcon(); @$ico->readICO($imageFile); diff --git a/include/digest.php b/include/digest.php index 965fd1a79..4427936e5 100644 --- a/include/digest.php +++ b/include/digest.php @@ -26,7 +26,7 @@ while ($line = db_fetch_assoc($result)) { - if (get_pref('DIGEST_ENABLE', $line['id'], false)) { + if (@get_pref('DIGEST_ENABLE', $line['id'], false)) { $preferred_ts = strtotime(get_pref('DIGEST_PREFERRED_TIME', $line['id'], '00:00')); // try to send digests within 2 hours of preferred time diff --git a/include/functions.php b/include/functions.php index 5296f9e61..bad01eb96 100644 --- a/include/functions.php +++ b/include/functions.php @@ -961,23 +961,28 @@ } function file_is_locked($filename) { - if (function_exists('flock')) { - $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r"); - if ($fp) { - if (flock($fp, LOCK_EX | LOCK_NB)) { - flock($fp, LOCK_UN); + if (file_exists(LOCK_DIRECTORY . "/$filename")) { + if (function_exists('flock')) { + $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r"); + if ($fp) { + if (flock($fp, LOCK_EX | LOCK_NB)) { + flock($fp, LOCK_UN); + fclose($fp); + return false; + } fclose($fp); + return true; + } else { return false; } - fclose($fp); - return true; - } else { - return false; } + return true; // consider the file always locked and skip the test + } else { + return false; } - return true; // consider the file always locked and skip the test } + function make_lockfile($filename) { $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); @@ -1493,11 +1498,13 @@ $owner_uid = $_SESSION["uid"]; - $result = db_query("SELECT id,caption,COUNT(unread) AS unread + $result = db_query("SELECT id,caption,COUNT(u1.unread) AS unread,COUNT(u2.unread) AS total FROM ttrss_labels2 LEFT JOIN ttrss_user_labels2 ON (ttrss_labels2.id = label_id) - LEFT JOIN ttrss_user_entries ON (ref_id = article_id AND unread = true - AND ttrss_user_entries.owner_uid = $owner_uid) + LEFT JOIN ttrss_user_entries AS u1 ON (u1.ref_id = article_id AND u1.unread = true + AND u1.owner_uid = $owner_uid) + LEFT JOIN ttrss_user_entries AS u2 ON (u2.ref_id = article_id AND u2.unread = false + AND u2.owner_uid = $owner_uid) WHERE ttrss_labels2.owner_uid = $owner_uid GROUP BY ttrss_labels2.id, ttrss_labels2.caption"); @@ -1505,17 +1512,12 @@ $id = label_to_feed_id($line["id"]); - $label_name = $line["caption"]; - $count = $line["unread"]; - $cv = array("id" => $id, - "counter" => (int) $count); + "counter" => (int) $line["unread"], + "auxcounter" => (int) $line["total"]); if ($descriptions) - $cv["description"] = $label_name; - -// if (get_pref('EXTENDED_FEEDLIST')) -// $cv["xmsg"] = getFeedArticles($id)." ".__("total"); + $cv["description"] = $line["caption"]; array_push($ret_arr, $cv); } @@ -2334,8 +2336,10 @@ $filter_query_part = filter_to_sql($filter, $owner_uid); // Try to check if SQL regexp implementation chokes on a valid regexp + + $result = db_query("SELECT true AS true_val FROM ttrss_entries, - ttrss_user_entries, ttrss_feeds, ttrss_feed_categories + ttrss_user_entries, ttrss_feeds WHERE $filter_query_part LIMIT 1", false); if ($result) { @@ -3124,7 +3128,7 @@ $rv['content'] .= "<html><head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/> <title>Tiny Tiny RSS - ".$line["title"]."</title> - <link rel=\"stylesheet\" type=\"text/css\" href=\"tt-rss.css\"> + <link rel=\"stylesheet\" type=\"text/css\" href=\"css/tt-rss.css\"> </head><body id=\"ttrssZoom\">"; } @@ -4167,7 +4171,7 @@ } function calculate_dep_timestamp() { - $files = array_merge(glob("js/*.js"), glob("*.css")); + $files = array_merge(glob("js/*.js"), glob("css/*.css")); $max_ts = -1; diff --git a/include/login_form.php b/include/login_form.php index b7dae1016..891e25e13 100644 --- a/include/login_form.php +++ b/include/login_form.php @@ -1,17 +1,18 @@ +<?php startup_gettext(); ?> <html> <head> <title>Tiny Tiny RSS : Login</title> <link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/> - <link rel="stylesheet" type="text/css" href="tt-rss.css"> + <link rel="stylesheet" type="text/css" href="css/tt-rss.css"> <link rel="shortcut icon" type="image/png" href="images/favicon.png"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="lib/dojo/dojo.js"></script> - <script type="text/javascript" src="lib/dijit/dijit.js"></script> <script type="text/javascript" src="lib/dojo/tt-rss-layer.js"></script> <script type="text/javascript" src="lib/prototype.js"></script> <script type="text/javascript" src="js/functions.js"></script> <script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script> <script type="text/javascript"> + require({cache:{}}); Event.observe(window, 'load', function() { init(); }); @@ -104,20 +105,19 @@ <script type="text/javascript"> function init() { - dojo.require("dijit.form.Button"); - dojo.require("dijit.form.CheckBox"); - dojo.require("dijit.form.Form"); - dojo.require("dijit.form.Select"); - dojo.require("dijit.form.TextBox"); - dojo.require("dijit.form.ValidationTextBox"); - dojo.parser.parse(); + require(['dojo/parser','dijit/form/Button','dijit/form/CheckBox','dijit/form/Form', + 'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser){ + parser.parse(); + //show tooltip node only after this widget is instaniated. + dojo.query('div[dojoType="dijit.Tooltip"]').style({ + display:'' + }); + fetchProfiles(); + dijit.byId("bw_limit").attr("checked", getCookie("ttrss_bwlimit") == 'true'); + document.forms.loginForm.login.focus(); + }); - fetchProfiles(); - - dijit.byId("bw_limit").attr("checked", getCookie("ttrss_bwlimit") == 'true'); - - document.forms.loginForm.login.focus(); } function fetchProfiles() { @@ -188,7 +188,6 @@ function bwLimitChange(elem) { value="<?php echo $_SESSION["fake_login"] ?>" /> </div> - <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?> <div class="row"> <label><?php echo __("Password:") ?></label> @@ -196,10 +195,11 @@ function bwLimitChange(elem) { style="width : 220px" class="input" value="<?php echo $_SESSION["fake_password"] ?>"/> <label></label> + <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?> <a class='forgotpass' href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a> + <?php } ?> </div> - <?php } ?> <div class="row"> <label><?php echo __("Profile:") ?></label> @@ -217,7 +217,7 @@ function bwLimitChange(elem) { <label id="bw_limit_label" style='display : inline' for="bw_limit"><?php echo __("Use less traffic") ?></label> </div> - <div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below"> + <div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none"> <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?> </div> diff --git a/include/rssfuncs.php b/include/rssfuncs.php index 612c914c0..4c3e86123 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -190,8 +190,7 @@ } // function update_daemon_common // ignore_daemon is not used - function update_rss_feed($feed, $ignore_daemon = false, $no_cache = false, - $override_url = false) { + function update_rss_feed($feed, $ignore_daemon = false, $no_cache = false) { $debug_enabled = defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']; @@ -239,15 +238,20 @@ $feed = db_escape_string($feed); - if ($override_url) $fetch_url = $override_url; - $date_feed_processed = date('Y-m-d H:i'); $cache_filename = CACHE_DIR . "/simplepie/" . sha1($fetch_url) . ".xml"; + $pluginhost = new PluginHost(); + $pluginhost->set_debug($debug_enabled); + $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); + + $pluginhost->load(PLUGINS, PluginHost::KIND_ALL); + $pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid); + $pluginhost->load_data(); + $rss = false; $rss_hash = false; - $cache_timestamp = file_exists($cache_filename) ? filemtime($cache_filename) : 0; $force_refetch = isset($_REQUEST["force_refetch"]); @@ -270,6 +274,10 @@ if (!$rss) { + foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) { + $feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed); + } + if (!$feed_data) { _debug("fetching [$fetch_url]...", $debug_enabled); _debug("If-Modified-Since: ".gmdate('D, d M Y H:i:s \G\M\T', $last_article_timestamp), $debug_enabled); @@ -291,7 +299,7 @@ _debug("fetch done.", $debug_enabled); - if ($feed_data) { + /* if ($feed_data) { $error = verify_feed_xml($feed_data); if ($error) { @@ -307,7 +315,7 @@ if ($error) $feed_data = ''; } } - } + } */ } if (!$feed_data) { @@ -333,16 +341,8 @@ } } - $pluginhost = new PluginHost(); - $pluginhost->set_debug($debug_enabled); - $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); - - $pluginhost->load(PLUGINS, PluginHost::KIND_ALL); - $pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid); - $pluginhost->load_data(); - foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) { - $feed_data = $plugin->hook_feed_fetched($feed_data); + $feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed); } // set last update to now so if anything *simplepie* crashes later we won't be @@ -1349,14 +1349,14 @@ mb_strtolower(strip_tags($title), 'utf-8')); } - function verify_feed_xml($feed_data) { + /* function verify_feed_xml($feed_data) { libxml_use_internal_errors(true); $doc = new DOMDocument(); $doc->loadXML($feed_data); $error = libxml_get_last_error(); libxml_clear_errors(); return $error; - } + } */ function housekeeping_common($debug) { expire_cached_files($debug); diff --git a/include/sanity_check.php b/include/sanity_check.php index b2888b1d7..29e53fa33 100644 --- a/include/sanity_check.php +++ b/include/sanity_check.php @@ -160,7 +160,7 @@ <head> <title>Startup failed</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <link rel="stylesheet" type="text/css" href="utility.css"> + <link rel="stylesheet" type="text/css" href="css/utility.css"> </head> <body> <div class="floatingLogo"><img src="images/logo_small.png"></div> |