]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pref/feeds.php
php: remove trailing whitespaces
[tt-rss.git] / classes / pref / feeds.php
index 5cd07b3efd7592720b04f24fe8f7f390f0ee03cc..5127b19c33a35e048990cde558463f2cb4d445ca 100755 (executable)
@@ -69,9 +69,9 @@ class Pref_Feeds extends Handler_Protected {
                }
 
                $fsth = $this->pdo->prepare("SELECT id, title, last_error,
-                       ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
+                       ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated, update_interval
                        FROM ttrss_feeds
-                       WHERE cat_id = :cat AND 
+                       WHERE cat_id = :cat AND
                        owner_uid = :uid AND
                        (:search = '' OR (LOWER(title) LIKE :search OR LOWER(feed_url) LIKE :search))
                        ORDER BY order_id, title");
@@ -90,6 +90,7 @@ class Pref_Feeds extends Handler_Protected {
                        $feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
                        $feed['param'] = make_local_datetime(
                                $feed_line['last_updated'], true);
+                       $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0);
 
                        array_push($items, $feed);
                }
@@ -237,9 +238,9 @@ class Pref_Feeds extends Handler_Protected {
                        $cat['child_unread'] = 0;
 
                        $fsth = $this->pdo->prepare("SELECT id, title,last_error,
-                               ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
+                               ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated, update_interval
                                FROM ttrss_feeds
-                               WHERE cat_id IS NULL AND 
+                               WHERE cat_id IS NULL AND
                                owner_uid = :uid AND
                                (:search = '' OR (LOWER(title) LIKE :search OR LOWER(feed_url) LIKE :search))
                                ORDER BY order_id, title");
@@ -258,6 +259,7 @@ class Pref_Feeds extends Handler_Protected {
                                        $feed_line['last_updated'], true);
                                $feed['unread'] = 0;
                                $feed['type'] = 'feed';
+                               $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0);
 
                                array_push($cat['items'], $feed);
                        }
@@ -272,7 +274,7 @@ class Pref_Feeds extends Handler_Protected {
 
                } else {
                        $fsth = $this->pdo->prepare("SELECT id, title, last_error,
-                               ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
+                               ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated, update_interval
                                FROM ttrss_feeds
                                WHERE owner_uid = :uid AND
                                (:search = '' OR (LOWER(title) LIKE :search OR LOWER(feed_url) LIKE :search))
@@ -292,6 +294,7 @@ class Pref_Feeds extends Handler_Protected {
                                        $feed_line['last_updated'], true);
                                $feed['unread'] = 0;
                                $feed['type'] = 'feed';
+                               $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0);
 
                                array_push($root['items'], $feed);
                        }
@@ -510,8 +513,6 @@ class Pref_Feeds extends Handler_Protected {
                        print '<div dojoType="dijit.layout.TabContainer" style="height : 450px">
                        <div dojoType="dijit.layout.ContentPane" title="'.__('General').'">';
 
-                       $auth_pass_encrypted = $row["auth_pass_encrypted"];
-
                        $title = htmlspecialchars($row["title"]);
 
                        print_hidden("id", "$feed_id");
@@ -562,6 +563,18 @@ class Pref_Feeds extends Handler_Protected {
                                        'dojoType="dijit.form.Select"');
                        }
 
+                       /* Site URL  */
+
+                       $site_url = htmlspecialchars($row["site_url"]);
+
+                       print "<hr/>";
+
+                       print __('Site URL:') . " ";
+                       print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
+                       placeHolder=\"".__("Site URL")."\"
+                       regExp='^(http|https)://.*' style=\"width : 15em\"
+                       name=\"site_url\" value=\"$site_url\">";
+
                        /* FTS Stemming Language */
 
                        if (DB_TYPE == "pgsql") {
@@ -600,14 +613,8 @@ class Pref_Feeds extends Handler_Protected {
                        print "</div>";
 
                        $auth_login = htmlspecialchars($row["auth_login"]);
-                       $auth_pass = $row["auth_pass"];
+                       $auth_pass = htmlspecialchars($row["auth_pass"]);
 
-                       if ($auth_pass_encrypted && function_exists("mcrypt_decrypt")) {
-                               require_once "crypt.php";
-                               $auth_pass = decrypt_string($auth_pass);
-                       }
-
-                       $auth_pass = htmlspecialchars($auth_pass);
                        $auth_enabled = $auth_login !== '' || $auth_pass !== '';
 
                        $auth_style = $auth_enabled ? '' : 'display: none';
@@ -620,7 +627,6 @@ class Pref_Feeds extends Handler_Protected {
                        autocomplete=\"new-password\"
                        name=\"auth_login\" value=\"$auth_login\"><hr/>";
 
-
                        print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" name=\"auth_pass\"
                        autocomplete=\"new-password\"
                        placeHolder=\"".__("Password")."\"
@@ -691,7 +697,7 @@ class Pref_Feeds extends Handler_Protected {
                        print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"hide_images\"
                name=\"hide_images\"
                        $checked>&nbsp;<label for=\"hide_images\">".
-                               __('Do not embed images')."</label>";
+                               __('Do not embed media')."</label>";
 
                        $cache_images = $row["cache_images"];
 
@@ -739,7 +745,7 @@ class Pref_Feeds extends Handler_Protected {
                        </label>
                        <input type=\"hidden\" name=\"op\" value=\"pref-feeds\">
                        <input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\">
-                       <input type=\"hidden\" name=\"method\" value=\"uploadicon\">                    
+                       <input type=\"hidden\" name=\"method\" value=\"uploadicon\">
                        <button class=\"\" dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\"
                                type=\"submit\">".__('Replace')."</button>
                        <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon($feed_id);\"
@@ -882,7 +888,7 @@ class Pref_Feeds extends Handler_Protected {
                        name=\"hide_images\"
                        dojoType=\"dijit.form.CheckBox\">&nbsp;<label class='insensitive' id=\"hide_images_l\"
                        for=\"hide_images\">".
-               __('Do not embed images')."</label>";
+               __('Do not embed media')."</label>";
 
                print "&nbsp;"; $this->batch_edit_cbox("hide_images", "hide_images_l");
 
@@ -926,6 +932,7 @@ class Pref_Feeds extends Handler_Protected {
 
                $feed_title = trim(clean($_POST["title"]));
                $feed_url = trim(clean($_POST["feed_url"]));
+               $site_url = trim(clean($_POST["site_url"]));
                $upd_intl = (int) clean($_POST["update_interval"]);
                $purge_intl = (int) clean($_POST["purge_interval"]);
                $feed_id = (int) clean($_POST["id"]); /* editSave */
@@ -954,17 +961,17 @@ class Pref_Feeds extends Handler_Protected {
                                $auth_pass = '';
                        }
 
-                       $sth = $this->pdo->prepare("SELECT feed_url FROM ttrss_feeds WHERE id = ?");
+                       /* $sth = $this->pdo->prepare("SELECT feed_url FROM ttrss_feeds WHERE id = ?");
                        $sth->execute([$feed_id]);
-                       $row = $sth->fetch();
-                       $orig_feed_url = $row["feed_url"];
+                       $row = $sth->fetch();$orig_feed_url = $row["feed_url"];
 
-                       $reset_basic_info = $orig_feed_url != $feed_url;
+                       $reset_basic_info = $orig_feed_url != $feed_url; */
 
                        $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET
                                cat_id = :cat_id,
-                               title = :title, 
+                               title = :title,
                                feed_url = :feed_url,
+                               site_url = :site_url,
                                update_interval = :upd_intl,
                                purge_interval = :purge_intl,
                                auth_login = :auth_login,
@@ -982,6 +989,7 @@ class Pref_Feeds extends Handler_Protected {
                        $sth->execute([":title" => $feed_title,
                                        ":cat_id" => $cat_id ? $cat_id : null,
                                        ":feed_url" => $feed_url,
+                                       ":site_url" => $site_url,
                                        ":upd_intl" => $upd_intl,
                                        ":purge_intl" => $purge_intl,
                                        ":auth_login" => $auth_login,
@@ -996,9 +1004,9 @@ class Pref_Feeds extends Handler_Protected {
                                        ":id" => $feed_id,
                                        ":uid" => $_SESSION['uid']]);
 
-                       if ($reset_basic_info) {
+/*                     if ($reset_basic_info) {
                                RSSUtils::set_basic_feed_info($feed_id);
-                       }
+                       } */
 
                        PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_SAVE_FEED,
                                "hook_prefs_save_feed", $feed_id);
@@ -1221,6 +1229,8 @@ class Pref_Feeds extends Handler_Protected {
                <img src='images/indicator_tiny.gif'>".
                 __("Loading, please wait...")."</div>";
 
+               $auto_expand = $feed_search != "" ? "true" : "false";
+
                print "<div dojoType=\"fox.PrefFeedStore\" jsId=\"feedStore\"
                        url=\"backend.php?op=pref-feeds&method=getfeedtree\">
                </div>
@@ -1231,7 +1241,7 @@ class Pref_Feeds extends Handler_Protected {
                <div dojoType=\"fox.PrefFeedTree\" id=\"feedTree\"
                        dndController=\"dijit.tree.dndSource\"
                        betweenThreshold=\"5\"
-                       autoExpand='false'
+                       autoExpand='$auto_expand'
                        model=\"feedModel\" openOnClick=\"false\">
                <script type=\"dojo/method\" event=\"onClick\" args=\"item\">
                        var id = String(item.id);
@@ -1305,25 +1315,6 @@ class Pref_Feeds extends Handler_Protected {
 
                print "</div>"; # pane
 
-               if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false) {
-
-                       print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Firefox integration')."\">";
-
-                       print_notice(__('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.'));
-
-                       print "<p>";
-
-                       print "<button onclick='window.navigator.registerContentHandler(" .
-                      "\"application/vnd.mozilla.maybe.feed\", " .
-                      "\"" . $this->subscribe_to_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" .
-                                                        __('Click here to register this site as a feed reader.') .
-                               "</button>";
-
-                       print "</p>";
-
-                       print "</div>"; # pane
-               }
-
                print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Published & shared articles / Generated feeds')."\">";
 
                print "<p>" . __('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.') . "</p>";