コード例 #1
0
function insert_feed($tag, $title, $htmlurl, $xmlurl, $type)
{
    global $user_id;
    global $mysql_host;
    global $mysql_user;
    global $mysql_passwd;
    $tag = addslashes($tag);
    $title = addslashes($title);
    $result = mysql_query("select * from feeds where xmlurl = '{$xmlurl}'");
    if (mysql_num_rows($result) == 0) {
        # not in the DB yet
        mysql_query("insert into feeds values ('','{$type}',NULL,'{$xmlurl}','{$htmlurl}',NULL,NULL,'60','')");
        $feed_title = get_rss_feed_title($xmlurl);
        mysql_query("update feeds set title = '{$feed_title}' where xmlurl = '{$xmlurl}'");
    }
    $result = mysql_query("select * from feeds where xmlurl = '{$xmlurl}'");
    while ($row = mysql_fetch_assoc($result)) {
        $feed_id = $row['id'];
    }
    mysql_query("insert into user_feed values ('','{$user_id}','{$feed_id}',NULL,'{$tag}','{$title}',NULL,NULL)");
    mysql_query("insert into user_feed values ('','0','{$feed_id}',NULL,'',NULL,NULL,NULL)");
}
コード例 #2
0
ファイル: reset_feeds.php プロジェクト: scumola/rsshose.com
#!/usr/bin/php
<?php 
include_once 'config.php';
include_once '../website/get_rss_feed_title.php';
$my_conn = mysql_connect($mysql_host, $mysql_user, $mysql_passwd);
if (!mysql_select_db("rsshose", $my_conn)) {
    $error_string = "ERROR: can't connect to the DB\n";
    print "{$error_string}";
    exit(1);
}
$result = mysql_query("select xmlurl,alturl from feeds where title is NULL or title = ''");
while ($row = mysql_fetch_assoc($result)) {
    $xmlurl = $row['xmlurl'];
    $alturl = $row['alturl'];
    if ($alturl != "") {
        $xmlurl = $alturl;
    }
    $feed_title = addslashes(get_rss_feed_title($xmlurl));
    if ($alturl != "") {
        mysql_query("update feeds set title = '{$feed_title}' where alturl = '{$xmlurl}'");
    } else {
        mysql_query("update feeds set title = '{$feed_title}' where xmlurl = '{$xmlurl}'");
    }
    print "Found title of {$feed_title}\n";
}
$result = mysql_query("update feeds set type = 'rss' where type = 'unknown'");