Merge branch 'master' of git.tt-rss.org:fox/tt-rss
This commit is contained in:
commit
f851cdf362
|
@ -351,7 +351,7 @@ msgstr "Déconnexion"
|
||||||
|
|
||||||
#: index.php:274
|
#: index.php:274
|
||||||
msgid "Updates are available from Git."
|
msgid "Updates are available from Git."
|
||||||
msgstr "Des mises à jour sont disponible via Git"
|
msgstr "Des mises à jour sont disponibles via Git"
|
||||||
|
|
||||||
#: prefs.php:33
|
#: prefs.php:33
|
||||||
#: prefs.php:140
|
#: prefs.php:140
|
||||||
|
@ -533,11 +533,11 @@ msgstr "Ouvrir l'article précédent (ne pas faire défiler les articles longs)"
|
||||||
|
|
||||||
#: include/functions.php:1155
|
#: include/functions.php:1155
|
||||||
msgid "Move to next article (don't expand or mark read)"
|
msgid "Move to next article (don't expand or mark read)"
|
||||||
msgstr "Aller à l'article suivant (ne pas développer ou marqué lu)"
|
msgstr "Aller à l'article suivant (ne pas développer ou marquer comme lu)"
|
||||||
|
|
||||||
#: include/functions.php:1156
|
#: include/functions.php:1156
|
||||||
msgid "Move to previous article (don't expand or mark read)"
|
msgid "Move to previous article (don't expand or mark read)"
|
||||||
msgstr "Aller à l'article précédent (ne pas développer ou marqué lu)"
|
msgstr "Aller à l'article précédent (ne pas développer ou marquer comme lu)"
|
||||||
|
|
||||||
#: include/functions.php:1157
|
#: include/functions.php:1157
|
||||||
msgid "Show search dialog"
|
msgid "Show search dialog"
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Af_Comics extends Plugin {
|
||||||
return $feed_data;
|
return $feed_data;
|
||||||
|
|
||||||
if (preg_match('#^https?://(?:feeds\.feedburner\.com/uclick|www\.gocomics\.com)/([-a-z0-9]+)$#i', $fetch_url, $comic)) {
|
if (preg_match('#^https?://(?:feeds\.feedburner\.com/uclick|www\.gocomics\.com)/([-a-z0-9]+)$#i', $fetch_url, $comic)) {
|
||||||
$site_url = 'http://www.gocomics.com/' . $comic[1];
|
$site_url = 'https://www.gocomics.com/' . $comic[1];
|
||||||
|
|
||||||
$article_link = $site_url . date('/Y/m/d');
|
$article_link = $site_url . date('/Y/m/d');
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
|
|
||||||
function init($host) {
|
function init($host) {
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
|
$this->pdo = Db::pdo();
|
||||||
|
|
||||||
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
||||||
$host->add_command("xml-import", "import articles from XML", $this, ":", "FILE");
|
$host->add_command("xml-import", "import articles from XML", $this, ":", "FILE");
|
||||||
|
@ -34,14 +35,15 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
|
|
||||||
_debug("importing $filename for user $username...\n");
|
_debug("importing $filename for user $username...\n");
|
||||||
|
|
||||||
$result = db_query("SELECT id FROM ttrss_users WHERE login = '$username'");
|
$sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE login = ?");
|
||||||
|
$sth->execute([$username]);
|
||||||
|
|
||||||
if (db_num_rows($result) == 0) {
|
if ($sth->rowCount() == 0) {
|
||||||
print "error: could not find user $username.\n";
|
print "error: could not find user $username.\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$owner_uid = db_fetch_result($result, 0, "id");
|
$owner_uid = $sth->fetchColumn(0);
|
||||||
|
|
||||||
$this->perform_data_import($filename, $owner_uid);
|
$this->perform_data_import($filename, $owner_uid);
|
||||||
}
|
}
|
||||||
|
@ -131,12 +133,12 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportrun() {
|
function exportrun() {
|
||||||
$offset = (int) db_escape_string($_REQUEST['offset']);
|
$offset = (int) $_REQUEST['offset'];
|
||||||
$exported = 0;
|
$exported = 0;
|
||||||
$limit = 250;
|
$limit = 250;
|
||||||
|
|
||||||
if ($offset < 10000 && is_writable(CACHE_DIR . "/export")) {
|
if ($offset < 10000 && is_writable(CACHE_DIR . "/export")) {
|
||||||
$result = db_query("SELECT
|
$sth = $this->pdo->prepare("SELECT
|
||||||
ttrss_entries.guid,
|
ttrss_entries.guid,
|
||||||
ttrss_entries.title,
|
ttrss_entries.title,
|
||||||
content,
|
content,
|
||||||
|
@ -156,8 +158,9 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
WHERE
|
WHERE
|
||||||
(marked = true OR feed_id IS NULL) AND
|
(marked = true OR feed_id IS NULL) AND
|
||||||
ref_id = ttrss_entries.id AND
|
ref_id = ttrss_entries.id AND
|
||||||
ttrss_user_entries.owner_uid = " . $_SESSION['uid'] . "
|
ttrss_user_entries.owner_uid = ?
|
||||||
ORDER BY ttrss_entries.id LIMIT $limit OFFSET $offset");
|
ORDER BY ttrss_entries.id LIMIT ? OFFSET ?");
|
||||||
|
$sth->execute([$_SESSION['uid'], $limit, $offset]);
|
||||||
|
|
||||||
$exportname = sha1($_SESSION['uid'] . $_SESSION['login']);
|
$exportname = sha1($_SESSION['uid'] . $_SESSION['login']);
|
||||||
|
|
||||||
|
@ -170,7 +173,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
|
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = $sth->fetch(PDO::FETCH_ASSOC)) {
|
||||||
fputs($fp, "<article>");
|
fputs($fp, "<article>");
|
||||||
|
|
||||||
foreach ($line as $k => $v) {
|
foreach ($line as $k => $v) {
|
||||||
|
@ -181,7 +184,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
fputs($fp, "</article>");
|
fputs($fp, "</article>");
|
||||||
}
|
}
|
||||||
|
|
||||||
$exported = db_num_rows($result);
|
$exported = $sth->rowCount();
|
||||||
|
|
||||||
if ($exported < $limit && $exported > 0) {
|
if ($exported < $limit && $exported > 0) {
|
||||||
fputs($fp, "</articles>");
|
fputs($fp, "</articles>");
|
||||||
|
@ -270,12 +273,13 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
|
|
||||||
//print 'GUID:' . $article['guid'] . "\n";
|
//print 'GUID:' . $article['guid'] . "\n";
|
||||||
|
|
||||||
$result = db_query("SELECT id FROM ttrss_entries
|
$sth = $this->pdo->prepare("SELECT id FROM ttrss_entries
|
||||||
WHERE guid = '".$article['guid']."'");
|
WHERE guid = ?");
|
||||||
|
$sth->execute([$article['guid']]);
|
||||||
|
|
||||||
if (db_num_rows($result) == 0) {
|
if ($sth->rowCount() == 0) {
|
||||||
|
|
||||||
$result = db_query(
|
$sth = $this->pdo->prepare(
|
||||||
"INSERT INTO ttrss_entries
|
"INSERT INTO ttrss_entries
|
||||||
(title,
|
(title,
|
||||||
guid,
|
guid,
|
||||||
|
@ -290,28 +294,37 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
num_comments,
|
num_comments,
|
||||||
author)
|
author)
|
||||||
VALUES
|
VALUES
|
||||||
('".$article['title']."',
|
(?,
|
||||||
'".$article['guid']."',
|
?,
|
||||||
'".$article['link']."',
|
?,
|
||||||
'".$article['updated']."',
|
?,
|
||||||
'".$article['content']."',
|
?,
|
||||||
'".sha1($article['content'])."',
|
?,
|
||||||
false,
|
false,
|
||||||
NOW(),
|
NOW(),
|
||||||
NOW(),
|
NOW(),
|
||||||
'',
|
'',
|
||||||
'0',
|
'0',
|
||||||
'')");
|
'')");
|
||||||
|
$sth->execute([
|
||||||
|
$article['title'],
|
||||||
|
$article['guid'],
|
||||||
|
$article['link'],
|
||||||
|
$article['updated'],
|
||||||
|
$article['content'],
|
||||||
|
sha1($article['content'])
|
||||||
|
]);
|
||||||
|
|
||||||
$result = db_query("SELECT id FROM ttrss_entries
|
$sth = $this->pdo->prepare("SELECT id FROM ttrss_entries
|
||||||
WHERE guid = '".$article['guid']."'");
|
WHERE guid = ?");
|
||||||
|
$sth->execute([$article['guid']]);
|
||||||
|
|
||||||
if (db_num_rows($result) != 0) {
|
if ($sth->rowCount() != 0) {
|
||||||
$ref_id = db_fetch_result($result, 0, "id");
|
$ref_id = $sth->fetchColumn(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$ref_id = db_fetch_result($result, 0, "id");
|
$ref_id = $sth->fetchColumn(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print "Got ref ID: $ref_id\n";
|
//print "Got ref ID: $ref_id\n";
|
||||||
|
@ -324,24 +337,27 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
$feed = 'NULL';
|
$feed = 'NULL';
|
||||||
|
|
||||||
if ($feed_url && $feed_title) {
|
if ($feed_url && $feed_title) {
|
||||||
$result = db_query("SELECT id FROM ttrss_feeds
|
$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds
|
||||||
WHERE feed_url = '$feed_url' AND owner_uid = '$owner_uid'");
|
WHERE feed_url = ? AND owner_uid = ?");
|
||||||
|
$sth->execute([$feed_url, $owner_uid]);
|
||||||
|
|
||||||
if (db_num_rows($result) != 0) {
|
if ($sth->rowCount() != 0) {
|
||||||
$feed = db_fetch_result($result, 0, "id");
|
$feed = $sth->fetchColumn(0);
|
||||||
} else {
|
} else {
|
||||||
// try autocreating feed in Uncategorized...
|
// try autocreating feed in Uncategorized...
|
||||||
|
|
||||||
$result = db_query("INSERT INTO ttrss_feeds (owner_uid,
|
$sth = $this->pdo->prepare("INSERT INTO ttrss_feeds (owner_uid,
|
||||||
feed_url, title) VALUES ($owner_uid, '$feed_url', '$feed_title')");
|
feed_url, title) VALUES (?, ?, ?)");
|
||||||
|
$sth->execute([$owner_uid, $feed_url, $feed_title]);
|
||||||
|
|
||||||
$result = db_query("SELECT id FROM ttrss_feeds
|
$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds
|
||||||
WHERE feed_url = '$feed_url' AND owner_uid = '$owner_uid'");
|
WHERE feed_url = ? AND owner_uid = ?");
|
||||||
|
$sth->execute([$feed_url, $owner_uid]);
|
||||||
|
|
||||||
if (db_num_rows($result) != 0) {
|
if ($sth->rowCount() != 0) {
|
||||||
++$num_feeds_created;
|
++$num_feeds_created;
|
||||||
|
|
||||||
$feed = db_fetch_result($result, 0, "id");
|
$feed = $sth->fetchColumn(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,10 +369,11 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
|
|
||||||
//print "$ref_id / $feed / " . $article['title'] . "\n";
|
//print "$ref_id / $feed / " . $article['title'] . "\n";
|
||||||
|
|
||||||
$result = db_query("SELECT int_id FROM ttrss_user_entries
|
$sth = $this->pdo->prepare("SELECT int_id FROM ttrss_user_entries
|
||||||
WHERE ref_id = '$ref_id' AND owner_uid = '$owner_uid' AND $feed_qpart");
|
WHERE ref_id = ? AND owner_uid = ? AND ?");
|
||||||
|
$sth->execute([$ref_id, $owner_uid, $feed_qpart]);
|
||||||
|
|
||||||
if (db_num_rows($result) == 0) {
|
if ($sth->rowCount() == 0) {
|
||||||
|
|
||||||
$marked = $this->bool_to_sql_bool(sql_bool_to_bool($article['marked']));
|
$marked = $this->bool_to_sql_bool(sql_bool_to_bool($article['marked']));
|
||||||
$published = $this->bool_to_sql_bool(sql_bool_to_bool($article['published']));
|
$published = $this->bool_to_sql_bool(sql_bool_to_bool($article['published']));
|
||||||
|
@ -369,13 +386,14 @@ class Import_Export extends Plugin implements IHandler {
|
||||||
|
|
||||||
++$num_imported;
|
++$num_imported;
|
||||||
|
|
||||||
$result = db_query(
|
$sth = $this->pdo->prepare(
|
||||||
"INSERT INTO ttrss_user_entries
|
"INSERT INTO ttrss_user_entries
|
||||||
(ref_id, owner_uid, feed_id, unread, last_read, marked,
|
(ref_id, owner_uid, feed_id, unread, last_read, marked,
|
||||||
published, score, tag_cache, label_cache, uuid, note)
|
published, score, tag_cache, label_cache, uuid, note)
|
||||||
VALUES ($ref_id, $owner_uid, $feed, false,
|
VALUES (?, ?, ?, false,
|
||||||
NULL, $marked, $published, $score, '$tag_cache',
|
NULL, ?, ?, ?, ?,
|
||||||
'', '', '$note')");
|
'', '', ?)");
|
||||||
|
$sth->execute([$ref_id, $owner_uid, $feed, $marked, $published, $score, $tag_cache, $note]);
|
||||||
|
|
||||||
$label_cache = json_decode($article['label_cache'], true);
|
$label_cache = json_decode($article['label_cache'], true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue