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


PHP update_rss_feed函数代码示例

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


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

示例1: format_headlines_list

 private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgr_last_feed = false, $override_order = false, $include_children = false)
 {
     $disable_cache = false;
     $reply = array();
     $timing_info = getmicrotime();
     $topmost_article_ids = array();
     if (!$offset) {
         $offset = 0;
     }
     if ($method == "undefined") {
         $method = "";
     }
     $method_split = explode(":", $method);
     if ($method == "ForceUpdate" && $feed && is_numeric($feed) > 0) {
         include "rssfuncs.php";
         update_rss_feed($this->link, $feed, true);
     }
     if ($method_split[0] == "MarkAllReadGR") {
         catchup_feed($this->link, $method_split[1], false);
     }
     // FIXME: might break tag display?
     if (is_numeric($feed) && $feed > 0 && !$cat_view) {
         $result = db_query($this->link, "SELECT id FROM ttrss_feeds WHERE id = '{$feed}' LIMIT 1");
         if (db_num_rows($result) == 0) {
             $reply['content'] = "<div align='center'>" . __('Feed not found.') . "</div>";
         }
     }
     if (is_numeric($feed) && $feed > 0) {
         $result = db_query($this->link, "SELECT rtl_content FROM ttrss_feeds\r\n\t\t\t\tWHERE id = '{$feed}' AND owner_uid = " . $_SESSION["uid"]);
         if (db_num_rows($result) == 1) {
             $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
         } else {
             $rtl_content = false;
         }
         if ($rtl_content) {
             $rtl_tag = "dir=\"RTL\"";
         } else {
             $rtl_tag = "";
         }
     } else {
         $rtl_tag = "";
         $rtl_content = false;
     }
     @($search = db_escape_string($_REQUEST["query"]));
     if ($search) {
         $disable_cache = true;
     }
     @($search_mode = db_escape_string($_REQUEST["search_mode"]));
     @($match_on = db_escape_string($_REQUEST["match_on"]));
     if (!$match_on) {
         $match_on = "both";
     }
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H0", $timing_info);
     }
     //		error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");
     if ($search_mode == '' && $method != '') {
         $search_mode = $method;
     }
     //		error_log("search_mode: " . $search_mode);
     $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on, $override_order, $offset, 0, false, 0, $include_children);
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H1", $timing_info);
     }
     $result = $qfh_ret[0];
     $feed_title = $qfh_ret[1];
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $vgroup_last_feed = $vgr_last_feed;
     //		if (!$offset) {
     if (db_num_rows($result) > 0) {
         $reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url, $feed_title, $feed, $cat_view, $search, $match_on, $search_mode, $view_mode, $last_error);
     }
     //		}
     $headlines_count = db_num_rows($result);
     if (get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {
         $button_plugins = array();
         foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {
             $pclass = trim("button_{$p}");
             if (class_exists($pclass)) {
                 $plugin = new $pclass($link);
                 array_push($button_plugins, $plugin);
             }
         }
     }
     if (db_num_rows($result) > 0) {
         $lnum = $offset;
         $num_unread = 0;
         $cur_feed_title = '';
         $fresh_intl = get_pref($this->link, "FRESH_ARTICLE_MAX_AGE") * 60 * 60;
         if ($_REQUEST["debug"]) {
             $timing_info = print_checkpoint("PS", $timing_info);
         }
         while ($line = db_fetch_assoc($result)) {
             $class = $lnum % 2 ? "even" : "odd";
             $id = $line["id"];
             $feed_id = $line["feed_id"];
             $label_cache = $line["label_cache"];
             $labels = false;
             if ($label_cache) {
//.........这里部分代码省略.........
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:feeds.php

示例2: subscribe_to_feed

/**
 * @return array (code => Status code, message => error message if available)
 *
 *                 0 - OK, Feed already exists
 *                 1 - OK, Feed added
 *                 2 - Invalid URL
 *                 3 - URL content is HTML, no feeds available
 *                 4 - URL content is HTML which contains multiple feeds.
 *                     Here you should call extractfeedurls in rpc-backend
 *                     to get all possible feeds.
 *                 5 - Couldn't download the URL content.
 *                 6 - Content is an invalid XML.
 */
function subscribe_to_feed($url, $cat_id = 0, $auth_login = '', $auth_pass = '')
{
    global $fetch_last_error;
    require_once "include/rssfuncs.php";
    $url = fix_url($url);
    if (!$url || !validate_feed_url($url)) {
        return array("code" => 2);
    }
    $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass);
    if (!$contents) {
        return array("code" => 5, "message" => $fetch_last_error);
    }
    foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SUBSCRIBE_FEED) as $plugin) {
        $contents = $plugin->hook_subscribe_feed($contents, $url, $auth_login, $auth_pass);
    }
    if (is_html($contents)) {
        $feedUrls = get_feeds_from_html($url, $contents);
        if (count($feedUrls) == 0) {
            return array("code" => 3);
        } else {
            if (count($feedUrls) > 1) {
                return array("code" => 4, "feeds" => $feedUrls);
            }
        }
        //use feed url as new URL
        $url = key($feedUrls);
    }
    if ($cat_id == "0" || !$cat_id) {
        $cat_qpart = "NULL";
    } else {
        $cat_qpart = "'{$cat_id}'";
    }
    $result = db_query("SELECT id FROM ttrss_feeds\n\t\t\tWHERE feed_url = '{$url}' AND owner_uid = " . $_SESSION["uid"]);
    if (strlen(FEED_CRYPT_KEY) > 0) {
        require_once "crypt.php";
        $auth_pass = substr(encrypt_string($auth_pass), 0, 250);
        $auth_pass_encrypted = 'true';
    } else {
        $auth_pass_encrypted = 'false';
    }
    $auth_pass = db_escape_string($auth_pass);
    if (db_num_rows($result) == 0) {
        $result = db_query("INSERT INTO ttrss_feeds\n\t\t\t\t\t(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted)\n\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$url}',\n\t\t\t\t'[Unknown]', {$cat_qpart}, '{$auth_login}', '{$auth_pass}', 0, {$auth_pass_encrypted})");
        $result = db_query("SELECT id FROM ttrss_feeds WHERE feed_url = '{$url}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
        $feed_id = db_fetch_result($result, 0, "id");
        if ($feed_id) {
            update_rss_feed($feed_id, true);
        }
        return array("code" => 1);
    } else {
        return array("code" => 0);
    }
}
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-2,代码行数:66,代码来源:functions.php

示例3: updaterandomfeed

 function updaterandomfeed()
 {
     // Test if the feed need a update (update interval exceded).
     if (DB_TYPE == "pgsql") {
         $update_limit_qpart = "AND ((\n\t\t\t\t\tttrss_feeds.update_interval = 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL)\n\t\t\t\t) OR (\n\t\t\t\t\tttrss_feeds.update_interval > 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL)\n\t\t\t\t) OR ttrss_feeds.last_updated IS NULL\n\t\t\t\tOR last_updated = '1970-01-01 00:00:00')";
     } else {
         $update_limit_qpart = "AND ((\n\t\t\t\t\tttrss_feeds.update_interval = 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(ttrss_user_prefs.value, SIGNED INTEGER) MINUTE)\n\t\t\t\t) OR (\n\t\t\t\t\tttrss_feeds.update_interval > 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE)\n\t\t\t\t) OR ttrss_feeds.last_updated IS NULL\n\t\t\t\tOR last_updated = '1970-01-01 00:00:00')";
     }
     // Test if feed is currently being updated by another process.
     if (DB_TYPE == "pgsql") {
         $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '5 minutes')";
     } else {
         $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 5 MINUTE))";
     }
     $random_qpart = sql_random_function();
     // We search for feed needing update.
     $result = db_query($this->link, "SELECT ttrss_feeds.feed_url,ttrss_feeds.id\n\t\t\tFROM\n\t\t\t\tttrss_feeds, ttrss_users, ttrss_user_prefs\n\t\t\tWHERE\n\t\t\t\tttrss_feeds.owner_uid = ttrss_users.id\n\t\t\t\tAND ttrss_users.id = ttrss_user_prefs.owner_uid\n\t\t\t\tAND ttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL'\n\t\t\t\tAND ttrss_feeds.owner_uid = " . $_SESSION["uid"] . "\n\t\t\t\t{$update_limit_qpart} {$updstart_thresh_qpart}\n\t\t\tORDER BY {$random_qpart} LIMIT 30");
     $feed_id = -1;
     require_once "rssfuncs.php";
     $num_updated = 0;
     $tstart = time();
     while ($line = db_fetch_assoc($result)) {
         $feed_id = $line["id"];
         if (time() - $tstart < ini_get("max_execution_time") * 0.7) {
             update_rss_feed($this->link, $feed_id, true);
             ++$num_updated;
         } else {
             break;
         }
     }
     if ($num_updated > 0) {
         print json_encode(array("message" => "UPDATE_COUNTERS", "num_updated" => $num_updated));
     } else {
         print json_encode(array("message" => "NOTHING_TO_UPDATE"));
     }
 }
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:36,代码来源:rpc.php

示例4: subscribe_to_feed

/**
 * @return array (code => Status code, message => error message if available)
 *
 *                 0 - OK, Feed already exists
 *                 1 - OK, Feed added
 *                 2 - Invalid URL
 *                 3 - URL content is HTML, no feeds available
 *                 4 - URL content is HTML which contains multiple feeds.
 *                     Here you should call extractfeedurls in rpc-backend
 *                     to get all possible feeds.
 *                 5 - Couldn't download the URL content.
 */
function subscribe_to_feed($link, $url, $cat_id = 0, $auth_login = '', $auth_pass = '', $need_auth = false)
{
    global $fetch_last_error;
    require_once "include/rssfuncs.php";
    $url = fix_url($url);
    if (!$url || !validate_feed_url($url)) {
        return array("code" => 2);
    }
    $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass);
    if (!$contents) {
        return array("code" => 5, "message" => $fetch_last_error);
    }
    if (is_html($contents)) {
        $feedUrls = get_feeds_from_html($url, $contents);
        if (count($feedUrls) == 0) {
            return array("code" => 3);
        } else {
            if (count($feedUrls) > 1) {
                return array("code" => 4, "feeds" => $feedUrls);
            }
        }
        //use feed url as new URL
        $url = key($feedUrls);
    }
    if ($cat_id == "0" || !$cat_id) {
        $cat_qpart = "NULL";
    } else {
        $cat_qpart = "'{$cat_id}'";
    }
    $result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\tWHERE feed_url = '{$url}' AND owner_uid = " . $_SESSION["uid"]);
    if (db_num_rows($result) == 0) {
        $result = db_query($link, "INSERT INTO ttrss_feeds\n\t\t\t\t\t(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method)\n\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$url}',\n\t\t\t\t'[Unknown]', {$cat_qpart}, '{$auth_login}', '{$auth_pass}', 0)");
        $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE feed_url = '{$url}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
        $feed_id = db_fetch_result($result, 0, "id");
        if ($feed_id) {
            update_rss_feed($link, $feed_id, true);
        }
        return array("code" => 1);
    } else {
        return array("code" => 0);
    }
}
开发者ID:rclsilver,项目名称:openshift-tt-rss,代码行数:54,代码来源:functions.php

示例5: update_daemon_common

/**
 * Update a feed batch.
 * Used by daemons to update n feeds by run.
 * Only update feed needing a update, and not being processed
 * by another process.
 * 
 * @param mixed $link Database link
 * @param integer $limit Maximum number of feeds in update batch. Default to DAEMON_FEED_LIMIT.
 * @param boolean $from_http Set to true if you call this function from http to disable cli specific code.
 * @param boolean $debug Set to false to disable debug output. Default to true.
 * @return void
 */
function update_daemon_common($link, $limit = DAEMON_FEED_LIMIT, $from_http = false, $debug = true)
{
    // Process all other feeds using last_updated and interval parameters
    // Test if the user has loggued in recently. If not, it does not update its feeds.
    if (DAEMON_UPDATE_LOGIN_LIMIT > 0) {
        if (DB_TYPE == "pgsql") {
            $login_thresh_qpart = "AND ttrss_users.last_login >= NOW() - INTERVAL '" . DAEMON_UPDATE_LOGIN_LIMIT . " days'";
        } else {
            $login_thresh_qpart = "AND ttrss_users.last_login >= DATE_SUB(NOW(), INTERVAL " . DAEMON_UPDATE_LOGIN_LIMIT . " DAY)";
        }
    } else {
        $login_thresh_qpart = "";
    }
    // Test if the feed need a update (update interval exceded).
    if (DB_TYPE == "pgsql") {
        $update_limit_qpart = "AND ((\n\t\t\t\t\tttrss_feeds.update_interval = 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL)\n\t\t\t\t) OR (\n\t\t\t\t\tttrss_feeds.update_interval > 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL)\n\t\t\t\t) OR ttrss_feeds.last_updated IS NULL)";
    } else {
        $update_limit_qpart = "AND ((\n\t\t\t\t\tttrss_feeds.update_interval = 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(ttrss_user_prefs.value, SIGNED INTEGER) MINUTE)\n\t\t\t\t) OR (\n\t\t\t\t\tttrss_feeds.update_interval > 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE)\n\t\t\t\t) OR ttrss_feeds.last_updated IS NULL)";
    }
    // Test if feed is currently being updated by another process.
    if (DB_TYPE == "pgsql") {
        $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '120 seconds')";
    } else {
        $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 120 SECOND))";
    }
    // Test if there is a limit to number of updated feeds
    $query_limit = "";
    if ($limit) {
        $query_limit = sprintf("LIMIT %d", $limit);
    }
    $random_qpart = sql_random_function();
    // We search for feed needing update.
    $result = db_query($link, "SELECT ttrss_feeds.feed_url,ttrss_feeds.id, ttrss_feeds.owner_uid,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(ttrss_feeds.last_updated,1,19) AS last_updated,\n\t\t\t\tttrss_feeds.update_interval \n\t\t\tFROM \n\t\t\t\tttrss_feeds, ttrss_users, ttrss_user_prefs\n\t\t\tWHERE\n\t\t\t\tttrss_feeds.owner_uid = ttrss_users.id\n\t\t\t\tAND ttrss_users.id = ttrss_user_prefs.owner_uid\n\t\t\t\tAND ttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL'\n\t\t\t\t{$login_thresh_qpart} {$update_limit_qpart}\n\t\t\t {$updstart_thresh_qpart}\n\t\t\tORDER BY {$random_qpart} {$query_limit}");
    $user_prefs_cache = array();
    if ($debug) {
        _debug(sprintf("Scheduled %d feeds to update...\n", db_num_rows($result)));
    }
    // Here is a little cache magic in order to minimize risk of double feed updates.
    $feeds_to_update = array();
    while ($line = db_fetch_assoc($result)) {
        $feeds_to_update[$line['id']] = $line;
    }
    // We update the feed last update started date before anything else.
    // There is no lag due to feed contents downloads
    // It prevent an other process to update the same feed.
    $feed_ids = array_keys($feeds_to_update);
    if ($feed_ids) {
        db_query($link, sprintf("UPDATE ttrss_feeds SET last_update_started = NOW()\n\t\t\t\tWHERE id IN (%s)", implode(',', $feed_ids)));
    }
    // For each feed, we call the feed update function.
    while ($line = array_pop($feeds_to_update)) {
        if ($debug) {
            _debug("Feed: " . $line["feed_url"] . ", " . $line["last_updated"]);
        }
        // We setup a alarm to alert if the feed take more than 300s to update.
        // => HANG alarm.
        if (!$from_http && function_exists('pcntl_alarm')) {
            pcntl_alarm(300);
        }
        update_rss_feed($link, $line["id"], true);
        // Cancel the alarm (the update went well)
        if (!$from_http && function_exists('pcntl_alarm')) {
            pcntl_alarm(0);
        }
        sleep(1);
        // prevent flood (FIXME make this an option?)
    }
    // Send feed digests by email if needed.
    if (DAEMON_SENDS_DIGESTS) {
        send_headlines_digests($link);
    }
    purge_orphans($link);
}
开发者ID:wangroot,项目名称:Tiny-Tiny-RSS,代码行数:85,代码来源:functions.php

示例6: format_headlines_list

 private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgr_last_feed = false, $override_order = false, $include_children = false)
 {
     if (isset($_REQUEST["DevForceUpdate"])) {
         header("Content-Type: text/plain; charset=utf-8");
     }
     $disable_cache = false;
     $reply = array();
     $rgba_cache = array();
     $timing_info = microtime(true);
     $topmost_article_ids = array();
     if (!$offset) {
         $offset = 0;
     }
     if ($method == "undefined") {
         $method = "";
     }
     $method_split = explode(":", $method);
     if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
         // Update the feed if required with some basic flood control
         $result = $this->dbh->query("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
         if ($this->dbh->num_rows($result) != 0) {
             $last_updated = strtotime($this->dbh->fetch_result($result, 0, "last_updated"));
             $cache_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "cache_images"));
             if (!$cache_images && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) {
                 include "rssfuncs.php";
                 update_rss_feed($feed, true, true);
             } else {
                 $this->dbh->query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'\n\t\t\t\t\t\t\tWHERE id = '{$feed}'");
             }
         }
     }
     if ($method_split[0] == "MarkAllReadGR") {
         catchup_feed($method_split[1], false);
     }
     // FIXME: might break tag display?
     if (is_numeric($feed) && $feed > 0 && !$cat_view) {
         $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE id = '{$feed}' LIMIT 1");
         if ($this->dbh->num_rows($result) == 0) {
             $reply['content'] = "<div align='center'>" . __('Feed not found.') . "</div>";
         }
     }
     @($search = $this->dbh->escape_string($_REQUEST["query"]));
     if ($search) {
         $disable_cache = true;
     }
     @($search_mode = $this->dbh->escape_string($_REQUEST["search_mode"]));
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H0", $timing_info);
     }
     //		error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");
     if ($search_mode == '' && $method != '') {
         $search_mode = $method;
     }
     //		error_log("search_mode: " . $search_mode);
     if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX && $feed > LABEL_BASE_INDEX) {
         $handler = PluginHost::getInstance()->get_feed_handler(PluginHost::feed_to_pfeed_id($feed));
         //	function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false) {
         if ($handler) {
             $options = array("limit" => $limit, "view_mode" => $view_mode, "cat_view" => $cat_view, "search" => $search, "search_mode" => $search_mode, "override_order" => $override_order, "offset" => $offset, "owner_uid" => $_SESSION["uid"], "filter" => false, "since_id" => 0, "include_children" => $include_children);
             $qfh_ret = $handler->get_headlines(PluginHost::feed_to_pfeed_id($feed), $options);
         }
     } else {
         $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order, $offset, 0, false, 0, $include_children);
     }
     $vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") && $feed != -6;
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H1", $timing_info);
     }
     $result = $qfh_ret[0];
     $feed_title = $qfh_ret[1];
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $last_updated = strpos($qfh_ret[4], '1970-') === FALSE ? make_local_datetime($qfh_ret[4], false) : __("Never");
     $highlight_words = $qfh_ret[5];
     $vgroup_last_feed = $vgr_last_feed;
     $reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url, $feed_title, $feed, $cat_view, $search, $search_mode, $view_mode, $last_error, $last_updated);
     $headlines_count = $this->dbh->num_rows($result);
     /* if (get_pref('COMBINED_DISPLAY_MODE')) {
     			$button_plugins = array();
     			foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {
     				$pclass = "button_" . trim($p);
     
     				if (class_exists($pclass)) {
     					$plugin = new $pclass();
     					array_push($button_plugins, $plugin);
     				}
     			}
     		} */
     if ($offset == 0) {
         foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINES_BEFORE) as $p) {
             $reply['content'] .= $p->hook_headlines_before($feed, $cat_view, $qfh_ret);
         }
     }
     if ($this->dbh->num_rows($result) > 0) {
         $lnum = $offset;
         $num_unread = 0;
         $cur_feed_title = '';
         if ($_REQUEST["debug"]) {
             $timing_info = print_checkpoint("PS", $timing_info);
         }
//.........这里部分代码省略.........
开发者ID:zamentur,项目名称:ttrss_ynh,代码行数:101,代码来源:feeds.php

示例7: updateFeed

 function updateFeed()
 {
     $feed_id = db_escape_string($_REQUEST["feed_id"]);
     update_rss_feed($this->link, $feed_id, true);
     print $this->wrap(self::STATUS_OK, array("status" => "OK"));
 }
开发者ID:rolfkleef,项目名称:Tiny-Tiny-RSS,代码行数:6,代码来源:api.php

示例8: array_push

             array_push($articles, $article);
         }
     }
     print api_wrap_reply(API_STATUS_OK, $seq, $articles);
     break;
 case "getConfig":
     $config = array("icons_dir" => ICONS_DIR, "icons_url" => ICONS_URL);
     $config["daemon_is_running"] = file_is_locked("update_daemon.lock");
     $result = db_query($link, "SELECT COUNT(*) AS cf FROM\n\t\t\t\tttrss_feeds WHERE owner_uid = " . $_SESSION["uid"]);
     $num_feeds = db_fetch_result($result, 0, "cf");
     $config["num_feeds"] = (int) $num_feeds;
     print api_wrap_reply(API_STATUS_OK, $seq, $config);
     break;
 case "updateFeed":
     $feed_id = db_escape_string($_REQUEST["feed_id"]);
     update_rss_feed($link, $feed_id, true);
     print api_wrap_reply(API_STATUS_OK, $seq, array("status" => "OK"));
     break;
 case "catchupFeed":
     $feed_id = db_escape_string($_REQUEST["feed_id"]);
     $is_cat = db_escape_string($_REQUEST["is_cat"]);
     catchup_feed($link, $feed_id, $is_cat);
     print api_wrap_reply(API_STATUS_OK, $seq, array("status" => "OK"));
     break;
 case "getPref":
     $pref_name = db_escape_string($_REQUEST["pref_name"]);
     print api_wrap_reply(API_STATUS_OK, $seq, array("value" => get_pref($link, $pref_name)));
     break;
 default:
     print api_wrap_reply(API_STATUS_ERR, $seq, array("error" => 'UNKNOWN_METHOD'));
     break;
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:31,代码来源:index.php

示例9: header

        $_SESSION['intended_location'] = $_SERVER['PHP_SELF'];
    }
    header('location: http://www.siskiyourappellers.com/admin/index.php');
}
//-------------------------------------------------------------------------------------------
if (isset($_POST['update_text']) && $_POST['update_text'] != '') {
    $current_text = nl2br(htmlentities($_POST['update_text'], ENT_QUOTES));
    $current_sticky = nl2br(htmlentities($_POST['sticky_text'], ENT_QUOTES));
    $current_text = filter_var($current_text, FILTER_SANITIZE_STRING);
    $current_sticky = filter_var($current_sticky, FILTER_SANITIZE_STRING);
    $query = "INSERT INTO current (name, date, status) VALUES('" . $_POST['name'] . "', NOW(), '" . $current_text . "')";
    mydb::cxn()->query($query);
    $query = "UPDATE current_sticky SET name='" . $_POST['name'] . "', date=NOW(), status='" . $current_sticky . "' WHERE 1";
    mydb::cxn()->query($query);
    //update_rss_feed($current_sticky, $current_text, time());
    update_rss_feed();
    header('location: http://www.siskiyourappellers.com/current.php');
    //header('location: http://www.siskiyourappellers.com/admin/update_facebook_wall.php');
    exit;
}
$query_read_sticky = "SELECT name, unix_timestamp(date) as date, status FROM current_sticky WHERE 1";
if (!($result = mydb::cxn()->query($query_read_sticky))) {
    $sticky_text = "Error retrieving sticky post: " . mydb::cxn()->error;
} else {
    $row = $result->fetch_assoc();
    $sticky_text = str_replace("<br />", "", $row['status']);
    $sticky_name = $row['name'];
    $sticky_date = date('d-M-Y H:i', $row['date']);
}
//---------------------------------------------------------------------------------------------------
?>
开发者ID:evanhsu,项目名称:siskiyourappellers,代码行数:31,代码来源:current_update.php

示例10: update_debugger

    function update_debugger()
    {
        header("Content-type: text/html");
        $feed_id = (int) $_REQUEST["feed_id"];
        @($do_update = $_REQUEST["action"] == "do_update");
        $csrf_token = $_REQUEST["csrf_token"];
        $refetch_checked = isset($_REQUEST["force_refetch"]) ? "checked" : "";
        $rehash_checked = isset($_REQUEST["force_rehash"]) ? "checked" : "";
        ?>
		<html>
		<head>
			<link rel="stylesheet" type="text/css" href="css/utility.css">
			<title>Feed Debugger</title>
		</head>
		<body class="small_margins">
		<h1>Feed Debugger: <?php 
        echo "{$feed_id}: " . getFeedTitle($feed_id);
        ?>
</h1>
		<form method="GET" action="">
			<input type="hidden" name="op" value="feeds">
			<input type="hidden" name="method" value="update_debugger">
			<input type="hidden" name="xdebug" value="1">
			<input type="hidden" name="csrf_token" value="<?php 
        echo $csrf_token;
        ?>
">
			<input type="hidden" name="action" value="do_update">
			<input type="hidden" name="feed_id" value="<?php 
        echo $feed_id;
        ?>
">
			<input type="checkbox" name="force_refetch" value="1" <?php 
        echo $refetch_checked;
        ?>
> Force refetch<br/>
			<input type="checkbox" name="force_rehash" value="1" <?php 
        echo $rehash_checked;
        ?>
> Force rehash<br/>

			<p/><button type="submit">Continue</button>
		</form>

		<hr>

		<pre><?php 
        if ($do_update) {
            include "rssfuncs.php";
            update_rss_feed($feed_id, true, true);
        }
        ?>
</pre>

		</body>
		</html>
		<?php 
    }
开发者ID:GregThib,项目名称:Tiny-Tiny-RSS,代码行数:58,代码来源:feeds.php

示例11: updaterandomfeed_real

 static function updaterandomfeed_real($dbh)
 {
     // Test if the feed need a update (update interval exceded).
     if (DB_TYPE == "pgsql") {
         $update_limit_qpart = "AND ((\n                    ttrss_feeds.update_interval = 0\n                    AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL)\n                ) OR (\n                    ttrss_feeds.update_interval > 0\n                    AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL)\n                ) OR ttrss_feeds.last_updated IS NULL\n                OR last_updated = '1970-01-01 00:00:00')";
     } else {
         $update_limit_qpart = "AND ((\n                    ttrss_feeds.update_interval = 0\n                    AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(ttrss_user_prefs.value, SIGNED INTEGER) MINUTE)\n                ) OR (\n                    ttrss_feeds.update_interval > 0\n                    AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE)\n                ) OR ttrss_feeds.last_updated IS NULL\n                OR last_updated = '1970-01-01 00:00:00')";
     }
     // Test if feed is currently being updated by another process.
     if (DB_TYPE == "pgsql") {
         $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '5 minutes')";
     } else {
         $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 5 MINUTE))";
     }
     $random_qpart = sql_random_function();
     // we could be invoked from public.php with no active session
     if ($_SESSION["uid"]) {
         $owner_check_qpart = "AND ttrss_feeds.owner_uid = '" . $_SESSION["uid"] . "'";
     } else {
         $owner_check_qpart = "";
     }
     // We search for feed needing update.
     $result = $dbh->query("SELECT ttrss_feeds.feed_url,ttrss_feeds.id\n            FROM\n                ttrss_feeds, ttrss_users, ttrss_user_prefs\n            WHERE\n                ttrss_feeds.owner_uid = ttrss_users.id\n                AND ttrss_users.id = ttrss_user_prefs.owner_uid\n                AND ttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL'\n                {$owner_check_qpart}\n                {$update_limit_qpart}\n                {$updstart_thresh_qpart}\n            ORDER BY {$random_qpart} LIMIT 30");
     $feed_id = -1;
     require_once "rssfuncs.php";
     $num_updated = 0;
     $tstart = time();
     while ($line = $dbh->fetch_assoc($result)) {
         $feed_id = $line["id"];
         if (time() - $tstart < ini_get("max_execution_time") * 0.7) {
             update_rss_feed($feed_id, true);
             ++$num_updated;
         } else {
             break;
         }
     }
     // Purge orphans and cleanup tags
     purge_orphans();
     cleanup_tags(14, 50000);
     if ($num_updated > 0) {
         print json_encode(array("message" => "UPDATE_COUNTERS", "num_updated" => $num_updated));
     } else {
         print json_encode(array("message" => "NOTHING_TO_UPDATE"));
     }
 }
开发者ID:adrianpietka,项目名称:bfrss,代码行数:45,代码来源:rpc.php

示例12: PluginHost

}
if (isset($options["list-plugins"])) {
    $tmppluginhost = new PluginHost();
    $tmppluginhost->load_all($tmppluginhost::KIND_ALL, false);
    $enabled = array_map("trim", explode(",", PLUGINS));
    echo "List of all available plugins:\n";
    foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
        $about = $plugin->about();
        $status = $about[3] ? "system" : "user";
        if (in_array($name, $enabled)) {
            $name .= "*";
        }
        printf("%-50s %-10s v%.2f (by %s)\n%s\n\n", $name, $status, $about[0], $about[2], $about[1]);
    }
    echo "Plugins marked by * are currently enabled for all users.\n";
}
if (isset($options["debug-feed"])) {
    $feed = $options["debug-feed"];
    if (isset($options["force-refetch"])) {
        $_REQUEST["force_refetch"] = true;
    }
    if (isset($options["force-rehash"])) {
        $_REQUEST["force_rehash"] = true;
    }
    $_REQUEST['xdebug'] = 1;
    update_rss_feed($feed);
}
PluginHost::getInstance()->run_commands($options);
if (file_exists(LOCK_DIRECTORY . "/{$lock_filename}")) {
    unlink(LOCK_DIRECTORY . "/{$lock_filename}");
}
开发者ID:kucrut,项目名称:tt-rss,代码行数:31,代码来源:update.php

示例13: subscribe_to_feed

/**
 * @return integer Status code:
 *                 0 - OK, Feed already exists
 *                 1 - OK, Feed added
 *                 2 - Invalid URL
 *                 3 - URL content is HTML, no feeds available
 *                 4 - URL content is HTML which contains multiple feeds.
 *                     Here you should call extractfeedurls in rpc-backend
 *                     to get all possible feeds.
 *                 5 - Couldn't download the URL content.
 */
function subscribe_to_feed($link, $url, $cat_id = 0, $auth_login = '', $auth_pass = '', $need_auth = false)
{
    require_once "include/rssfuncs.php";
    $url = fix_url($url);
    if (!$url || !validate_feed_url($url)) {
        return 2;
    }
    $update_method = 0;
    $result = db_query($link, "SELECT twitter_oauth FROM ttrss_users\n\t\t\tWHERE id = " . $_SESSION['uid']);
    $has_oauth = db_fetch_result($result, 0, 'twitter_oauth');
    if (!$need_auth || !$has_oauth || strpos($url, '://api.twitter.com') === false) {
        if (!fetch_file_contents($url, false, $auth_login, $auth_pass)) {
            return 5;
        }
        if (url_is_html($url, $auth_login, $auth_pass)) {
            $feedUrls = get_feeds_from_html($url, $auth_login, $auth_pass);
            if (count($feedUrls) == 0) {
                return 3;
            } else {
                if (count($feedUrls) > 1) {
                    return 4;
                }
            }
            //use feed url as new URL
            $url = key($feedUrls);
        }
    } else {
        if (!fetch_twitter_rss($link, $url, $_SESSION['uid'])) {
            return 5;
        }
        $update_method = 3;
    }
    if ($cat_id == "0" || !$cat_id) {
        $cat_qpart = "NULL";
    } else {
        $cat_qpart = "'{$cat_id}'";
    }
    $result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\tWHERE feed_url = '{$url}' AND owner_uid = " . $_SESSION["uid"]);
    if (db_num_rows($result) == 0) {
        $result = db_query($link, "INSERT INTO ttrss_feeds\n\t\t\t\t\t(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method)\n\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$url}',\n\t\t\t\t'[Unknown]', {$cat_qpart}, '{$auth_login}', '{$auth_pass}', '{$update_method}')");
        $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE feed_url = '{$url}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
        $feed_id = db_fetch_result($result, 0, "id");
        if ($feed_id) {
            update_rss_feed($link, $feed_id, true);
        }
        return 1;
    } else {
        return 0;
    }
}
开发者ID:rutgerw,项目名称:Tiny-Tiny-RSS,代码行数:61,代码来源:functions.php

示例14: update_daemon_common

/**
 * Update a feed batch.
 * Used by daemons to update n feeds by run.
 * Only update feed needing a update, and not being processed
 * by another process.
 *
 * @param mixed $link Database link
 * @param integer $limit Maximum number of feeds in update batch. Default to DAEMON_FEED_LIMIT.
 * @param boolean $from_http Set to true if you call this function from http to disable cli specific code.
 * @param boolean $debug Set to false to disable debug output. Default to true.
 * @return void
 */
function update_daemon_common($limit = DAEMON_FEED_LIMIT, $from_http = false, $debug = true)
{
    // Process all other feeds using last_updated and interval parameters
    $schema_version = get_schema_version();
    if ($schema_version != SCHEMA_VERSION) {
        die("Schema version is wrong, please upgrade the database.\n");
    }
    define('PREFS_NO_CACHE', true);
    // Test if the user has loggued in recently. If not, it does not update its feeds.
    if (!SINGLE_USER_MODE && DAEMON_UPDATE_LOGIN_LIMIT > 0) {
        if (DB_TYPE == "pgsql") {
            $login_thresh_qpart = "AND ttrss_users.last_login >= NOW() - INTERVAL '" . DAEMON_UPDATE_LOGIN_LIMIT . " days'";
        } else {
            $login_thresh_qpart = "AND ttrss_users.last_login >= DATE_SUB(NOW(), INTERVAL " . DAEMON_UPDATE_LOGIN_LIMIT . " DAY)";
        }
    } else {
        $login_thresh_qpart = "";
    }
    // Test if the feed need a update (update interval exceded).
    if (DB_TYPE == "pgsql") {
        $update_limit_qpart = "AND ((\n\t\t\t\t\tttrss_feeds.update_interval = 0\n\t\t\t\t\tAND ttrss_user_prefs.value != '-1'\n\t\t\t\t\tAND ttrss_feeds.last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL)\n\t\t\t\t) OR (\n\t\t\t\t\tttrss_feeds.update_interval > 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL)\n\t\t\t\t) OR ttrss_feeds.last_updated IS NULL\n\t\t\t\tOR last_updated = '1970-01-01 00:00:00')";
    } else {
        $update_limit_qpart = "AND ((\n\t\t\t\t\tttrss_feeds.update_interval = 0\n\t\t\t\t\tAND ttrss_user_prefs.value != '-1'\n\t\t\t\t\tAND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(ttrss_user_prefs.value, SIGNED INTEGER) MINUTE)\n\t\t\t\t) OR (\n\t\t\t\t\tttrss_feeds.update_interval > 0\n\t\t\t\t\tAND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE)\n\t\t\t\t) OR ttrss_feeds.last_updated IS NULL\n\t\t\t\tOR last_updated = '1970-01-01 00:00:00')";
    }
    // Test if feed is currently being updated by another process.
    if (DB_TYPE == "pgsql") {
        $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '10 minutes')";
    } else {
        $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 10 MINUTE))";
    }
    // Test if there is a limit to number of updated feeds
    $query_limit = "";
    if ($limit) {
        $query_limit = sprintf("LIMIT %d", $limit);
    }
    $query = "SELECT DISTINCT ttrss_feeds.feed_url, ttrss_feeds.last_updated\n\t\t\tFROM\n\t\t\t\tttrss_feeds, ttrss_users, ttrss_user_prefs\n\t\t\tWHERE\n\t\t\t\tttrss_feeds.owner_uid = ttrss_users.id\n\t\t\t\tAND ttrss_users.id = ttrss_user_prefs.owner_uid\n\t\t\t\tAND ttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL'\n\t\t\t\t{$login_thresh_qpart} {$update_limit_qpart}\n\t\t\t\t{$updstart_thresh_qpart}\n\t\t\t\tORDER BY last_updated {$query_limit}";
    // We search for feed needing update.
    $result = db_query($query);
    if ($debug) {
        _debug(sprintf("Scheduled %d feeds to update...", db_num_rows($result)));
    }
    // Here is a little cache magic in order to minimize risk of double feed updates.
    $feeds_to_update = array();
    while ($line = db_fetch_assoc($result)) {
        array_push($feeds_to_update, db_escape_string($line['feed_url']));
    }
    // We update the feed last update started date before anything else.
    // There is no lag due to feed contents downloads
    // It prevent an other process to update the same feed.
    if (count($feeds_to_update) > 0) {
        $feeds_quoted = array();
        foreach ($feeds_to_update as $feed) {
            array_push($feeds_quoted, "'" . db_escape_string($feed) . "'");
        }
        db_query(sprintf("UPDATE ttrss_feeds SET last_update_started = NOW()\n\t\t\t\tWHERE feed_url IN (%s)", implode(',', $feeds_quoted)));
    }
    $nf = 0;
    // For each feed, we call the feed update function.
    foreach ($feeds_to_update as $feed) {
        if ($debug) {
            _debug("Base feed: {$feed}");
        }
        //update_rss_feed($line["id"], true);
        // since we have the data cached, we can deal with other feeds with the same url
        $tmp_result = db_query("SELECT DISTINCT ttrss_feeds.id,last_updated,ttrss_feeds.owner_uid\n\t\t\tFROM ttrss_feeds, ttrss_users, ttrss_user_prefs WHERE\n\t\t\t\tttrss_user_prefs.owner_uid = ttrss_feeds.owner_uid AND\n\t\t\t\tttrss_users.id = ttrss_user_prefs.owner_uid AND\n\t\t\t\tttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL' AND\n\t\t\t\tfeed_url = '" . db_escape_string($feed) . "' AND\n\t\t\t\t(ttrss_feeds.update_interval > 0 OR\n\t\t\t\t\tttrss_user_prefs.value != '-1')\n\t\t\t\t{$login_thresh_qpart}\n\t\t\tORDER BY ttrss_feeds.id {$query_limit}");
        if (db_num_rows($tmp_result) > 0) {
            while ($tline = db_fetch_assoc($tmp_result)) {
                if ($debug) {
                    _debug(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]);
                }
                update_rss_feed($tline["id"], true);
                ++$nf;
            }
        }
    }
    require_once "digest.php";
    // Send feed digests by email if needed.
    send_headlines_digests($debug);
    return $nf;
}
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:92,代码来源:rssfuncs.php

示例15: subscribe_to_feed

/**
 * @return array (code => Status code, message => error message if available)
 *
 *                 0 - OK, Feed already exists
 *                 1 - OK, Feed added
 *                 2 - Invalid URL
 *                 3 - URL content is HTML, no feeds available
 *                 4 - URL content is HTML which contains multiple feeds.
 *                     Here you should call extractfeedurls in rpc-backend
 *                     to get all possible feeds.
 *                 5 - Couldn't download the URL content.
 *                 6 - Content is an invalid XML.
 */
function subscribe_to_feed($url, $cat_id = 0, $auth_login = '', $auth_pass = '')
{
    global $fetch_last_error;
    require_once "include/rssfuncs.php";
    $url = fix_url($url);
    if (!$url || !validate_feed_url($url)) {
        return array("code" => 2);
    }
    $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass);
    if (!$contents) {
        return array("code" => 5, "message" => $fetch_last_error);
    }
    if (is_html($contents)) {
        $feedUrls = get_feeds_from_html($url, $contents);
        if (count($feedUrls) == 0) {
            return array("code" => 3);
        } else {
            if (count($feedUrls) > 1) {
                return array("code" => 4, "feeds" => $feedUrls);
            }
        }
        //use feed url as new URL
        $url = key($feedUrls);
    }
    /* libxml_use_internal_errors(true);
    		$doc = new DOMDocument();
    		$doc->loadXML($contents);
    		$error = libxml_get_last_error();
    		libxml_clear_errors();
    
    		if ($error) {
    			$error_message = format_libxml_error($error);
    
    			return array("code" => 6, "message" => $error_message);
    		} */
    if ($cat_id == "0" || !$cat_id) {
        $cat_qpart = "NULL";
    } else {
        $cat_qpart = "'{$cat_id}'";
    }
    $result = db_query("SELECT id FROM ttrss_feeds\n\t\t\tWHERE feed_url = '{$url}' AND owner_uid = " . $_SESSION["uid"]);
    if (strlen(FEED_CRYPT_KEY) > 0) {
        require_once "crypt.php";
        $auth_pass = substr(encrypt_string($auth_pass), 0, 250);
        $auth_pass_encrypted = 'true';
    } else {
        $auth_pass_encrypted = 'false';
    }
    $auth_pass = db_escape_string($auth_pass);
    if (db_num_rows($result) == 0) {
        $result = db_query("INSERT INTO ttrss_feeds\n\t\t\t\t\t(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted)\n\t\t\t\tVALUES ('" . $_SESSION["uid"] . "', '{$url}',\n\t\t\t\t'[Unknown]', {$cat_qpart}, '{$auth_login}', '{$auth_pass}', 0, {$auth_pass_encrypted})");
        $result = db_query("SELECT id FROM ttrss_feeds WHERE feed_url = '{$url}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
        $feed_id = db_fetch_result($result, 0, "id");
        if ($feed_id) {
            update_rss_feed($feed_id, true);
        }
        return array("code" => 1);
    } else {
        return array("code" => 0);
    }
}
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:74,代码来源:functions.php


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