当前位置: 首页>>代码示例>>PHP>>正文


PHP get_feed_access_key函数代码示例

本文整理汇总了PHP中get_feed_access_key函数的典型用法代码示例。如果您正苦于以下问题:PHP get_feed_access_key函数的具体用法?PHP get_feed_access_key怎么用?PHP get_feed_access_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_feed_access_key函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_feed_access_key

 private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false)
 {
     if (!$owner_uid) {
         $owner_uid = $_SESSION["uid"];
     }
     $sql_is_cat = bool_to_sql_bool($is_cat);
     $result = $this->dbh->query("SELECT access_key FROM ttrss_access_keys\n\t\t\tWHERE feed_id = '{$feed_id}'\tAND is_cat = {$sql_is_cat}\n\t\t\tAND owner_uid = " . $owner_uid);
     if ($this->dbh->num_rows($result) == 1) {
         $key = $this->dbh->escape_string(uniqid_short());
         $this->dbh->query("UPDATE ttrss_access_keys SET access_key = '{$key}'\n\t\t\t\tWHERE feed_id = '{$feed_id}' AND is_cat = {$sql_is_cat}\n\t\t\t\tAND owner_uid = " . $owner_uid);
         return $key;
     } else {
         return get_feed_access_key($feed_id, $is_cat, $owner_uid);
     }
 }
开发者ID:AHinMaine,项目名称:ttrss,代码行数:15,代码来源:feeds.php

示例2: update_rss_feed


//.........这里部分代码省略.........
                // okay it doesn't exist - create user entry
                if (db_num_rows($result) == 0) {
                    _debug("user record not found, creating...", $debug_enabled);
                    if ($score >= -500 && !find_article_filter($article_filters, 'catchup')) {
                        $unread = 'true';
                        $last_read_qpart = 'NULL';
                    } else {
                        $unread = 'false';
                        $last_read_qpart = 'NOW()';
                    }
                    if (find_article_filter($article_filters, 'mark') || $score > 1000) {
                        $marked = 'true';
                    } else {
                        $marked = 'false';
                    }
                    if (find_article_filter($article_filters, 'publish')) {
                        $published = 'true';
                    } else {
                        $published = 'false';
                    }
                    // N-grams
                    if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) {
                        $result = db_query("SELECT COUNT(*) AS similar FROM\n\t\t\t\t\t\t\t\t\tttrss_entries,ttrss_user_entries\n\t\t\t\t\t\t\t\tWHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'\n\t\t\t\t\t\t\t\t\tAND similarity(title, '{$entry_title}') >= " . _NGRAM_TITLE_DUPLICATE_THRESHOLD . "\n\t\t\t\t\t\t\t\t\tAND owner_uid = {$owner_uid}");
                        $ngram_similar = db_fetch_result($result, 0, "similar");
                        _debug("N-gram similar results: {$ngram_similar}", $debug_enabled);
                        if ($ngram_similar > 0) {
                            $unread = 'false';
                        }
                    }
                    $last_marked = $marked == 'true' ? 'NOW()' : 'NULL';
                    $last_published = $published == 'true' ? 'NOW()' : 'NULL';
                    $result = db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid,\n\t\t\t\t\t\t\t\tlast_marked, last_published)\n\t\t\t\t\t\t\tVALUES ('{$ref_id}', '{$owner_uid}', '{$feed}', {$unread},\n\t\t\t\t\t\t\t\t{$last_read_qpart}, {$marked}, {$published}, '{$score}', '', '',\n\t\t\t\t\t\t\t\t'', {$last_marked}, {$last_published})");
                    if (PUBSUBHUBBUB_HUB && $published == 'true') {
                        $rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key(-2, false, $owner_uid);
                        $p = new Publisher(PUBSUBHUBBUB_HUB);
                        $pubsub_result = $p->publish_update($rss_link);
                    }
                    $result = db_query("SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\t\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND\n\t\t\t\t\t\t\t\tfeed_id = '{$feed}' LIMIT 1");
                    if (db_num_rows($result) == 1) {
                        $entry_int_id = db_fetch_result($result, 0, "int_id");
                    }
                } else {
                    _debug("user record FOUND", $debug_enabled);
                    $entry_ref_id = db_fetch_result($result, 0, "ref_id");
                    $entry_int_id = db_fetch_result($result, 0, "int_id");
                }
                _debug("RID: {$entry_ref_id}, IID: {$entry_int_id}", $debug_enabled);
                $post_needs_update = false;
                $update_insignificant = false;
                if ($orig_num_comments != $num_comments) {
                    $post_needs_update = true;
                    $update_insignificant = true;
                }
                if ($entry_plugin_data != $orig_plugin_data) {
                    $post_needs_update = true;
                    $update_insignificant = true;
                }
                if ($content_hash != $orig_content_hash) {
                    $post_needs_update = true;
                    $update_insignificant = false;
                }
                if (db_escape_string($orig_title) != $entry_title) {
                    $post_needs_update = true;
                    $update_insignificant = false;
                }
                // if post needs update, update it and mark all user entries
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:67,代码来源:rssfuncs.php

示例3: updateArticle

 function updateArticle()
 {
     $article_ids = array_filter(explode(",", $this->dbh->escape_string($_REQUEST["article_ids"])), is_numeric);
     $mode = (int) $this->dbh->escape_string($_REQUEST["mode"]);
     $data = $this->dbh->escape_string($_REQUEST["data"]);
     $field_raw = (int) $this->dbh->escape_string($_REQUEST["field"]);
     $field = "";
     $set_to = "";
     switch ($field_raw) {
         case 0:
             $field = "marked";
             $additional_fields = ",last_marked = NOW()";
             break;
         case 1:
             $field = "published";
             $additional_fields = ",last_published = NOW()";
             break;
         case 2:
             $field = "unread";
             $additional_fields = ",last_read = NOW()";
             break;
         case 3:
             $field = "note";
     }
     switch ($mode) {
         case 1:
             $set_to = "true";
             break;
         case 0:
             $set_to = "false";
             break;
         case 2:
             $set_to = "NOT {$field}";
             break;
     }
     if ($field == "note") {
         $set_to = "'{$data}'";
     }
     if ($field && $set_to && count($article_ids) > 0) {
         $article_ids = join(", ", $article_ids);
         $result = $this->dbh->query("UPDATE ttrss_user_entries SET {$field} = {$set_to} {$additional_fields} WHERE ref_id IN ({$article_ids}) AND owner_uid = " . $_SESSION["uid"]);
         $num_updated = $this->dbh->affected_rows($result);
         if ($num_updated > 0 && $field == "unread") {
             $result = $this->dbh->query("SELECT DISTINCT feed_id FROM ttrss_user_entries\n\t\t\t\t\tWHERE ref_id IN ({$article_ids})");
             while ($line = $this->dbh->fetch_assoc($result)) {
                 ccache_update($line["feed_id"], $_SESSION["uid"]);
             }
         }
         if ($num_updated > 0 && $field == "published") {
             if (PUBSUBHUBBUB_HUB) {
                 $rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key(-2, false);
                 $p = new Publisher(PUBSUBHUBBUB_HUB);
                 $pubsub_result = $p->publish_update($rss_link);
             }
         }
         $this->wrap(self::STATUS_OK, array("status" => "OK", "updated" => $num_updated));
     } else {
         $this->wrap(self::STATUS_ERR, array("error" => 'INCORRECT_USAGE'));
     }
 }
开发者ID:Verisor,项目名称:tt-rss,代码行数:60,代码来源:api.php

示例4: generatedFeed

 function generatedFeed()
 {
     $this->params = explode(":", $this->param, 3);
     $feed_id = $this->dbh->escape_string($this->params[0]);
     $is_cat = (bool) $this->params[1];
     $key = get_feed_access_key($feed_id, $is_cat);
     $url_path = htmlspecialchars($this->params[2]) . "&key=" . $key;
     print "<h2>" . __("You can view this feed as RSS using the following URL:") . "</h2>";
     print "<div class=\"tagCloudContainer\">";
     print "<a id='gen_feed_url' href='{$url_path}' target='_blank'>{$url_path}</a>";
     print "</div>";
     print "<div align='center'>";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('{$feed_id}', '{$is_cat}')\">" . __('Generate new URL') . "</button> ";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>";
     print "</div>";
     //return;
 }
开发者ID:pabl0,项目名称:Tiny-Tiny-RSS,代码行数:17,代码来源:dlg.php

示例5: publ

 function publ()
 {
     $pub = $_REQUEST["pub"];
     $id = db_escape_string($_REQUEST["id"]);
     $note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
     if ($pub == "1") {
         $pub = "true";
     } else {
         $pub = "false";
     }
     $result = db_query($this->link, "UPDATE ttrss_user_entries SET\n\t\t\tpublished = {$pub}\n\t\t\tWHERE ref_id = '{$id}' AND owner_uid = " . $_SESSION["uid"]);
     $pubsub_result = false;
     if (PUBSUBHUBBUB_HUB) {
         $rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($this->link, -2, false);
         $p = new Publisher(PUBSUBHUBBUB_HUB);
         $pubsub_result = $p->publish_update($rss_link);
     }
     print json_encode(array("message" => "UPDATE_COUNTERS", "pubsub_result" => $pubsub_result));
 }
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:19,代码来源:rpc.php

示例6: generate_syndicated_feed

 private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $offset, $search, $search_mode, $view_mode = false, $format = 'atom', $order = false, $orig_guid = false)
 {
     require_once "lib/MiniTemplator.class.php";
     $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;";
     if (!$limit) {
         $limit = 60;
     }
     $date_sort_field = "date_entered DESC, updated DESC";
     if ($feed == -2) {
         $date_sort_field = "last_published DESC";
     } else {
         if ($feed == -1) {
             $date_sort_field = "last_marked DESC";
         }
     }
     switch ($order) {
         case "title":
             $date_sort_field = "ttrss_entries.title";
             break;
         case "date_reverse":
             $date_sort_field = "date_entered, updated";
             break;
         case "feed_dates":
             $date_sort_field = "updated DESC";
             break;
     }
     $qfh_ret = queryFeedHeadlines($feed, 1, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, false, 0, false, true);
     $result = $qfh_ret[0];
     if ($this->dbh->num_rows($result) != 0) {
         $ts = strtotime($this->dbh->fetch_result($result, 0, "date_entered"));
         if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $ts) {
             header('HTTP/1.0 304 Not Modified');
             return;
         }
         $last_modified = gmdate("D, d M Y H:i:s", $ts) . " GMT";
         header("Last-Modified: {$last_modified}", true);
     }
     $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, false, 0, false, true);
     $result = $qfh_ret[0];
     $feed_title = htmlspecialchars($qfh_ret[1]);
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id={$feed}&key=" . get_feed_access_key($feed, false, $owner_uid);
     if (!$feed_site_url) {
         $feed_site_url = get_self_url_prefix();
     }
     if ($format == 'atom') {
         $tpl = new MiniTemplator();
         $tpl->readTemplateFromFile("templates/generated_feed.txt");
         $tpl->setVariable('FEED_TITLE', $feed_title, true);
         $tpl->setVariable('VERSION', VERSION, true);
         $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
         if (PUBSUBHUBBUB_HUB && $feed == -2) {
             $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
             $tpl->addBlock('feed_hub');
         }
         $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
         $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
         while ($line = $this->dbh->fetch_assoc($result)) {
             foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
                 $line = $p->hook_query_headlines($line);
             }
             $tpl->setVariable('ARTICLE_ID', htmlspecialchars($orig_guid ? $line['link'] : get_self_url_prefix() . "/public.php?url=" . urlencode($line['link'])), true);
             $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
             $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
             $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true);
             $content = sanitize($line["content"], false, $owner_uid);
             if ($line['note']) {
                 $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content;
                 $tpl->setVariable('ARTICLE_NOTE', htmlspecialchars($line['note']), true);
             }
             $tpl->setVariable('ARTICLE_CONTENT', $content, true);
             $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true);
             $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true);
             $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
             $tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url']), true);
             $tpl->setVariable('ARTICLE_SOURCE_TITLE', htmlspecialchars($line['feed_title']), true);
             $tags = get_article_tags($line["id"], $owner_uid);
             foreach ($tags as $tag) {
                 $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
                 $tpl->addBlock('category');
             }
             $enclosures = get_article_enclosures($line["id"]);
             foreach ($enclosures as $e) {
                 $type = htmlspecialchars($e['content_type']);
                 $url = htmlspecialchars($e['content_url']);
                 $length = $e['duration'];
                 $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true);
                 $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true);
                 $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true);
                 $tpl->addBlock('enclosure');
             }
             $tpl->addBlock('entry');
         }
         $tmp = "";
         $tpl->addBlock('feed');
         $tpl->generateOutputToString($tmp);
         if (@(!$_REQUEST["noxml"])) {
             header("Content-Type: text/xml; charset=utf-8");
         } else {
//.........这里部分代码省略.........
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:101,代码来源:public.php

示例7: publishArticlesById

 private function publishArticlesById($link, $ids, $cmode)
 {
     $tmp_ids = array();
     foreach ($ids as $id) {
         array_push($tmp_ids, "ref_id = '{$id}'");
     }
     $ids_qpart = join(" OR ", $tmp_ids);
     if ($cmode == 0) {
         db_query($link, "UPDATE ttrss_user_entries SET\n\t\t\tpublished = false,last_read = NOW()\n\t\t\tWHERE ({$ids_qpart}) AND owner_uid = " . $_SESSION["uid"]);
     } else {
         if ($cmode == 1) {
             db_query($link, "UPDATE ttrss_user_entries SET\n\t\t\tpublished = true,last_read = NOW()\n\t\t\tWHERE ({$ids_qpart}) AND owner_uid = " . $_SESSION["uid"]);
         } else {
             db_query($link, "UPDATE ttrss_user_entries SET\n\t\t\tpublished = NOT published,last_read = NOW()\n\t\t\tWHERE ({$ids_qpart}) AND owner_uid = " . $_SESSION["uid"]);
         }
     }
     if (PUBSUBHUBBUB_HUB) {
         $rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($link, -2, false);
         $p = new Publisher(PUBSUBHUBBUB_HUB);
         $pubsub_result = $p->publish_update($rss_link);
     }
 }
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:22,代码来源:rpc.php

示例8: opml_publish_url

 static function opml_publish_url($link)
 {
     $url_path = get_self_url_prefix();
     $url_path .= "/opml.php?op=publish&key=" . get_feed_access_key($link, 'OPML:Publish', false, $_SESSION["uid"]);
     return $url_path;
 }
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:6,代码来源:opml.php

示例9: generate_syndicated_feed

 private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $offset, $search, $search_mode, $match_on, $view_mode = false, $format = 'atom')
 {
     require_once "lib/MiniTemplator.class.php";
     $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;";
     if (!$limit) {
         $limit = 100;
     }
     if (get_pref($this->link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {
         $date_sort_field = "updated";
     } else {
         $date_sort_field = "date_entered";
     }
     if ($feed == -2) {
         $date_sort_field = "last_read";
     }
     $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, "{$date_sort_field} DESC", $offset, $owner_uid, false, 0, false, true);
     $result = $qfh_ret[0];
     $feed_title = htmlspecialchars($qfh_ret[1]);
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($this->link, -2, false, $owner_uid);
     if (!$feed_site_url) {
         $feed_site_url = get_self_url_prefix();
     }
     if ($format == 'atom') {
         $tpl = new MiniTemplator();
         $tpl->readTemplateFromFile("templates/generated_feed.txt");
         $tpl->setVariable('FEED_TITLE', $feed_title, true);
         $tpl->setVariable('VERSION', VERSION, true);
         $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
         if (PUBSUBHUBBUB_HUB && $feed == -2) {
             $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
             $tpl->addBlock('feed_hub');
         }
         $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
         while ($line = db_fetch_assoc($result)) {
             $tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true);
             $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
             $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
             $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content_preview"]), 100, '...'), true);
             $content = sanitize($this->link, $line["content_preview"], false, $owner_uid);
             if ($line['note']) {
                 $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content;
             }
             $tpl->setVariable('ARTICLE_CONTENT', $content, true);
             $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true);
             $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true);
             $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
             $tags = get_article_tags($this->link, $line["id"], $owner_uid);
             foreach ($tags as $tag) {
                 $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
                 $tpl->addBlock('category');
             }
             $enclosures = get_article_enclosures($this->link, $line["id"]);
             foreach ($enclosures as $e) {
                 $type = htmlspecialchars($e['content_type']);
                 $url = htmlspecialchars($e['content_url']);
                 $length = $e['duration'];
                 $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true);
                 $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true);
                 $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true);
                 $tpl->addBlock('enclosure');
             }
             $tpl->addBlock('entry');
         }
         $tmp = "";
         $tpl->addBlock('feed');
         $tpl->generateOutputToString($tmp);
         if (@(!$_REQUEST["noxml"])) {
             header("Content-Type: text/xml; charset=utf-8");
         } else {
             header("Content-Type: text/plain; charset=utf-8");
         }
         print $tmp;
     } else {
         if ($format == 'json') {
             $feed = array();
             $feed['title'] = $feed_title;
             $feed['version'] = VERSION;
             $feed['feed_url'] = $feed_self_url;
             if (PUBSUBHUBBUB_HUB && $feed == -2) {
                 $feed['hub_url'] = PUBSUBHUBBUB_HUB;
             }
             $feed['self_url'] = get_self_url_prefix();
             $feed['articles'] = array();
             while ($line = db_fetch_assoc($result)) {
                 $article = array();
                 $article['id'] = $line['link'];
                 $article['link'] = $line['link'];
                 $article['title'] = $line['title'];
                 $article['excerpt'] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
                 $article['content'] = sanitize($this->link, $line["content_preview"], false, $owner_uid);
                 $article['updated'] = date('c', strtotime($line["updated"]));
                 if ($line['note']) {
                     $article['note'] = $line['note'];
                 }
                 if ($article['author']) {
                     $article['author'] = $line['author'];
                 }
                 $tags = get_article_tags($this->link, $line["id"], $owner_uid);
//.........这里部分代码省略.........
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:101,代码来源:public.php

示例10: module_popup_dialog


//.........这里部分代码省略.........
            $tpl->addBlock('article');
        }
        $tpl->addBlock('email');
        $content = "";
        $tpl->generateOutputToString($content);
        print "<table width='100%'><tr><td>";
        print __('From:');
        print "</td><td>";
        print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\"\n\t\t\t\t\tvalue=\"{$user_name} <{$user_email}>\">";
        print "</td></tr><tr><td>";
        print __('To:');
        print "</td><td>";
        print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"\n\t\t\t\t\tstyle=\"width : 30em;\"\n\t\t\t\t\tname=\"destination\" id=\"emailArticleDlg_destination\">";
        print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\"\n\t\t\t\t\tstyle=\"z-index: 30; display : none\"></div>";
        print "</td></tr><tr><td>";
        print __('Subject:');
        print "</td><td>";
        print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"\n\t\t\t\t\tstyle=\"width : 30em;\"\n\t\t\t\t\tname=\"subject\" value=\"{$subject}\" id=\"subject\">";
        print "</td></tr>";
        print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\"\n\t\t\t\tname='content'>{$content}</textarea>";
        print "</td></tr></table>";
        print "<div class='dlgButtons'>";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">" . __('Send e-mail') . "</button> ";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">" . __('Cancel') . "</button>";
        print "</div>";
        //return;
    }
    if ($id == "generatedFeed") {
        print "<title>" . __('View as RSS') . "</title>";
        print "<content><![CDATA[";
        $params = explode(":", $param, 3);
        $feed_id = db_escape_string($params[0]);
        $is_cat = (bool) $params[1];
        $key = get_feed_access_key($link, $feed_id, $is_cat);
        $url_path = htmlspecialchars($params[2]) . "&key=" . $key;
        print __("You can view this feed as RSS using the following URL:");
        print "<div class=\"tagCloudContainer\">";
        print "<a id='gen_feed_url' href='{$url_path}' target='_blank'>{$url_path}</a>";
        print "</div>";
        print "<div align='center'>";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('{$feed_id}', '{$is_cat}')\">" . __('Generate new URL') . "</button> ";
        print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>";
        print "</div>";
        print "]]></content>";
        //return;
    }
    if ($id == "newVersion") {
        $version_data = check_for_update($link);
        $version = $version_data['version'];
        $id = $version_data['version_id'];
        print "<div class='tagCloudContainer'>";
        print T_sprintf("New version of Tiny Tiny RSS is available (%s).", "<b>{$version}</b>");
        print "</div>";
        $details = "http://tt-rss.org/redmine/versions/show/{$id}";
        $download = "http://tt-rss.org/#Download";
        print "<div style='text-align : center'>";
        print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return window.open('{$details}')\">" . __("Details") . "</button>";
        print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return window.open('{$download}')\">" . __("Download") . "</button>";
        print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return dijit.byId('newVersionDlg').hide()\">" . __('Close this window') . "</button>";
        print "</div>";
    }
    if ($id == "customizeCSS") {
        $value = get_pref($link, "USER_STYLESHEET");
        $value = str_replace("<br/>", "\n", $value);
        print T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "tt-rss.css");
        print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:67,代码来源:popup-dialog.php

示例11: update_rss_feed


//.........这里部分代码省略.........
                    if ($debug_enabled) {
                        _debug("update_rss_feed: user record not found, creating...");
                    }
                    if ($score >= -500 && !find_article_filter($article_filters, 'catchup')) {
                        $unread = 'true';
                        $last_read_qpart = 'NULL';
                    } else {
                        $unread = 'false';
                        $last_read_qpart = 'NOW()';
                    }
                    if (find_article_filter($article_filters, 'mark') || $score > 1000) {
                        $marked = 'true';
                    } else {
                        $marked = 'false';
                    }
                    if (find_article_filter($article_filters, 'publish')) {
                        $published = 'true';
                    } else {
                        $published = 'false';
                    }
                    // N-grams
                    if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) {
                        $result = db_query($link, "SELECT COUNT(*) AS similar FROM\n\t\t\t\t\t\t\t\t\tttrss_entries,ttrss_user_entries\n\t\t\t\t\t\t\t\tWHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'\n\t\t\t\t\t\t\t\t\tAND similarity(title, '{$entry_title}') >= " . _NGRAM_TITLE_DUPLICATE_THRESHOLD . "\n\t\t\t\t\t\t\t\t\tAND owner_uid = {$owner_uid}");
                        $ngram_similar = db_fetch_result($result, 0, "similar");
                        if ($debug_enabled) {
                            _debug("update_rss_feed: N-gram similar results: {$ngram_similar}");
                        }
                        if ($ngram_similar > 0) {
                            $unread = 'false';
                        }
                    }
                    $result = db_query($link, "INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid)\n\t\t\t\t\t\t\tVALUES ('{$ref_id}', '{$owner_uid}', '{$feed}', {$unread},\n\t\t\t\t\t\t\t\t{$last_read_qpart}, {$marked}, {$published}, '{$score}', '', '', '')");
                    if (PUBSUBHUBBUB_HUB && $published == 'true') {
                        $rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($link, -2, false, $owner_uid);
                        $p = new Publisher(PUBSUBHUBBUB_HUB);
                        $pubsub_result = $p->publish_update($rss_link);
                    }
                    $result = db_query($link, "SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\t\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND\n\t\t\t\t\t\t\t\tfeed_id = '{$feed}' LIMIT 1");
                    if (db_num_rows($result) == 1) {
                        $entry_int_id = db_fetch_result($result, 0, "int_id");
                    }
                } else {
                    if ($debug_enabled) {
                        _debug("update_rss_feed: user record FOUND");
                    }
                    $entry_ref_id = db_fetch_result($result, 0, "ref_id");
                    $entry_int_id = db_fetch_result($result, 0, "int_id");
                }
                if ($debug_enabled) {
                    _debug("update_rss_feed: RID: {$entry_ref_id}, IID: {$entry_int_id}");
                }
                $post_needs_update = false;
                $update_insignificant = false;
                if ($orig_num_comments != $num_comments) {
                    $post_needs_update = true;
                    $update_insignificant = true;
                }
                if ($content_hash != $orig_content_hash) {
                    $post_needs_update = true;
                    $update_insignificant = false;
                }
                if (db_escape_string($orig_title) != $entry_title) {
                    $post_needs_update = true;
                    $update_insignificant = false;
                }
                // if post needs update, update it and mark all user entries
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:67,代码来源:rssfuncs.php

示例12: publishArticlesById

 private function publishArticlesById($ids, $cmode)
 {
     $tmp_ids = array();
     foreach ($ids as $id) {
         array_push($tmp_ids, "ref_id = '{$id}'");
     }
     $ids_qpart = join(" OR ", $tmp_ids);
     if ($cmode == 0) {
         $newValuepublished = "false";
     } elseif ($cmode == 1) {
         $newValuepublished = "true";
     } else {
         $newValuepublished = "published";
     }
     $this->dbh->query("UPDATE ttrss_user_entries SET\n            published = " . $newValue . ",last_published = NOW()\n            WHERE ({$ids_qpart}) AND owner_uid = " . $_SESSION["uid"]);
     if (PUBSUBHUBBUB_HUB) {
         $rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key(-2, false);
         $p = new Publisher(PUBSUBHUBBUB_HUB);
         /* $pubsub_result = */
         $p->publish_update($rss_link);
     }
 }
开发者ID:adrianpietka,项目名称:bfrss,代码行数:22,代码来源:rpc.php

示例13: update_rss_feed


//.........这里部分代码省略.........
                        $last_read_qpart = 'NOW()';
                    }
                    if (find_article_filter($article_filters, 'mark') || $score > 1000) {
                        $marked = 'true';
                    } else {
                        $marked = 'false';
                    }
                    if (find_article_filter($article_filters, 'publish')) {
                        $published = 'true';
                    } else {
                        $published = 'false';
                    }
                    // N-grams
                    /* if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) {
                    
                    							$result = db_query("SELECT COUNT(*) AS similar FROM
                    									ttrss_entries,ttrss_user_entries
                    								WHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'
                    									AND similarity(title, '$entry_title') >= "._NGRAM_TITLE_DUPLICATE_THRESHOLD."
                    									AND owner_uid = $owner_uid");
                    
                    							$ngram_similar = db_fetch_result($result, 0, "similar");
                    
                    							_debug("N-gram similar results: $ngram_similar", $debug_enabled);
                    
                    							if ($ngram_similar > 0) {
                    								$unread = 'false';
                    							}
                    						} */
                    $last_marked = $marked == 'true' ? 'NOW()' : 'NULL';
                    $last_published = $published == 'true' ? 'NOW()' : 'NULL';
                    $result = db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid,\n\t\t\t\t\t\t\t\tlast_marked, last_published)\n\t\t\t\t\t\t\tVALUES ('{$ref_id}', '{$owner_uid}', '{$feed}', {$unread},\n\t\t\t\t\t\t\t\t{$last_read_qpart}, {$marked}, {$published}, '{$score}', '', '',\n\t\t\t\t\t\t\t\t'', {$last_marked}, {$last_published})");
                    if (PUBSUBHUBBUB_HUB && $published == 'true') {
                        $rss_link = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key(-2, false, $owner_uid);
                        $p = new Publisher(PUBSUBHUBBUB_HUB);
                        /* $pubsub_result = */
                        $p->publish_update($rss_link);
                    }
                    $result = db_query("SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\t\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND\n\t\t\t\t\t\t\t\tfeed_id = '{$feed}' LIMIT 1");
                    if (db_num_rows($result) == 1) {
                        $entry_int_id = db_fetch_result($result, 0, "int_id");
                    }
                } else {
                    _debug("user record FOUND", $debug_enabled);
                    $entry_ref_id = db_fetch_result($result, 0, "ref_id");
                    $entry_int_id = db_fetch_result($result, 0, "int_id");
                }
                _debug("RID: {$entry_ref_id}, IID: {$entry_int_id}", $debug_enabled);
                if (DB_TYPE == "pgsql") {
                    $tsvector_combined = db_escape_string(mb_substr($entry_title . ' ' . strip_tags($entry_content), 0, 1000000));
                    $tsvector_qpart = "tsvector_combined = to_tsvector('{$feed_language}', '{$tsvector_combined}'),";
                } else {
                    $tsvector_qpart = "";
                }
                db_query("UPDATE ttrss_entries\n\t\t\t\t\t\tSET title = '{$entry_title}',\n\t\t\t\t\t\t\tcontent = '{$entry_content}',\n\t\t\t\t\t\t\tcontent_hash = '{$entry_current_hash}',\n\t\t\t\t\t\t\tupdated = '{$entry_timestamp_fmt}',\n\t\t\t\t\t\t\t{$tsvector_qpart}\n\t\t\t\t\t\t\tnum_comments = '{$num_comments}',\n\t\t\t\t\t\t\tplugin_data = '{$entry_plugin_data}',\n\t\t\t\t\t\t\tauthor = '{$entry_author}',\n\t\t\t\t\t\t\tlang = '{$entry_language}'\n\t\t\t\t\t\tWHERE id = '{$ref_id}'");
                // update aux data
                db_query("UPDATE ttrss_user_entries\n\t\t\t\t\t\t\tSET score = '{$score}' WHERE ref_id = '{$ref_id}'");
                if ($mark_unread_on_update) {
                    db_query("UPDATE ttrss_user_entries\n\t\t\t\t\t\t\tSET last_read = null, unread = true WHERE ref_id = '{$ref_id}'");
                }
            }
            db_query("COMMIT");
            _debug("assigning labels [other]...", $debug_enabled);
            foreach ($article_labels as $label) {
                label_add_article($entry_ref_id, $label[1], $owner_uid);
            }
开发者ID:rnavarro,项目名称:tt-rss,代码行数:67,代码来源:rssfuncs.php

示例14: update_feed_access_key

function update_feed_access_key($link, $feed_id, $is_cat, $owner_uid = false)
{
    if (!$owner_uid) {
        $owner_uid = $_SESSION["uid"];
    }
    $sql_is_cat = bool_to_sql_bool($is_cat);
    $result = db_query($link, "SELECT access_key FROM ttrss_access_keys\n\t\t\tWHERE feed_id = '{$feed_id}'\tAND is_cat = {$sql_is_cat}\n\t\t\tAND owner_uid = " . $owner_uid);
    if (db_num_rows($result) == 1) {
        $key = db_escape_string(sha1(uniqid(rand(), true)));
        db_query($link, "UPDATE ttrss_access_keys SET access_key = '{$key}'\n\t\t\t\tWHERE feed_id = '{$feed_id}' AND is_cat = {$sql_is_cat}\n\t\t\t\tAND owner_uid = " . $owner_uid);
        return $key;
    } else {
        return get_feed_access_key($link, $feed_id, $is_cat, $owner_uid);
    }
}
开发者ID:rolfkleef,项目名称:Tiny-Tiny-RSS,代码行数:15,代码来源:functions.php

示例15: generate_syndicated_feed

 private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $search, $search_mode, $match_on, $view_mode = false)
 {
     require_once "lib/MiniTemplator.class.php";
     $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;";
     if (!$limit) {
         $limit = 30;
     }
     if (get_pref($this->link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {
         $date_sort_field = "updated";
     } else {
         $date_sort_field = "date_entered";
     }
     $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, "{$date_sort_field} DESC", 0, $owner_uid);
     $result = $qfh_ret[0];
     $feed_title = htmlspecialchars($qfh_ret[1]);
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($this->link, -2, false, $owner_uid);
     if (!$feed_site_url) {
         $feed_site_url = get_self_url_prefix();
     }
     $tpl = new MiniTemplator();
     $tpl->readTemplateFromFile("templates/generated_feed.txt");
     $tpl->setVariable('FEED_TITLE', $feed_title, true);
     $tpl->setVariable('VERSION', VERSION, true);
     $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
     if (PUBSUBHUBBUB_HUB && $feed == -2) {
         $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
         $tpl->addBlock('feed_hub');
     }
     $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
     while ($line = db_fetch_assoc($result)) {
         $tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true);
         $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
         $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
         $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content_preview"]), 100, '...'), true);
         $content = sanitize($this->link, $line["content_preview"], false, $owner_uid);
         if ($line['note']) {
             $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content;
         }
         $tpl->setVariable('ARTICLE_CONTENT', $content, true);
         $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true);
         $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true);
         $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
         $tags = get_article_tags($this->link, $line["id"], $owner_uid);
         foreach ($tags as $tag) {
             $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
             $tpl->addBlock('category');
         }
         $enclosures = get_article_enclosures($this->link, $line["id"]);
         foreach ($enclosures as $e) {
             $type = htmlspecialchars($e['content_type']);
             $url = htmlspecialchars($e['content_url']);
             $length = $e['duration'];
             $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true);
             $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true);
             $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true);
             $tpl->addBlock('enclosure');
         }
         $tpl->addBlock('entry');
     }
     $tmp = "";
     $tpl->addBlock('feed');
     $tpl->generateOutputToString($tmp);
     print $tmp;
 }
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:66,代码来源:public.php


注:本文中的get_feed_access_key函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。