Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Feeds
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Feeds
Commits
ebff9ef7
Commit
ebff9ef7
authored
12 years ago
by
Andrew Dolgov
Browse files
Options
Downloads
Patches
Plain Diff
instances: add fbexport method
parent
7a866114
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/handler/public.php
+0
-30
0 additions, 30 deletions
classes/handler/public.php
plugins/instances/instances.php
+32
-0
32 additions, 0 deletions
plugins/instances/instances.php
with
32 additions
and
30 deletions
classes/handler/public.php
+
0
−
30
View file @
ebff9ef7
...
@@ -280,36 +280,6 @@ class Handler_Public extends Handler {
...
@@ -280,36 +280,6 @@ class Handler_Public extends Handler {
header
(
"Location: index.php"
);
header
(
"Location: index.php"
);
}
}
function
fbexport
()
{
$access_key
=
db_escape_string
(
$_POST
[
"key"
]);
// TODO: rate limit checking using last_connected
$result
=
db_query
(
$this
->
link
,
"SELECT id FROM ttrss_linked_instances
WHERE access_key = '
$access_key
'"
);
if
(
db_num_rows
(
$result
)
==
1
)
{
$instance_id
=
db_fetch_result
(
$result
,
0
,
"id"
);
$result
=
db_query
(
$this
->
link
,
"SELECT feed_url, site_url, title, subscribers
FROM ttrss_feedbrowser_cache ORDER BY subscribers DESC LIMIT 100"
);
$feeds
=
array
();
while
(
$line
=
db_fetch_assoc
(
$result
))
{
array_push
(
$feeds
,
$line
);
}
db_query
(
$this
->
link
,
"UPDATE ttrss_linked_instances SET
last_status_in = 1 WHERE id = '
$instance_id
'"
);
print
json_encode
(
array
(
"feeds"
=>
$feeds
));
}
else
{
print
json_encode
(
array
(
"error"
=>
array
(
"code"
=>
6
)));
}
}
function
share
()
{
function
share
()
{
$uuid
=
db_escape_string
(
$_REQUEST
[
"key"
]);
$uuid
=
db_escape_string
(
$_REQUEST
[
"key"
]);
...
...
This diff is collapsed.
Click to expand it.
plugins/instances/instances.php
+
32
−
0
View file @
ebff9ef7
...
@@ -22,6 +22,7 @@ class Instances extends Plugin implements IHandler {
...
@@ -22,6 +22,7 @@ class Instances extends Plugin implements IHandler {
$host
->
add_hook
(
$host
::
HOOK_PREFS_TABS
,
$this
);
$host
->
add_hook
(
$host
::
HOOK_PREFS_TABS
,
$this
);
$host
->
add_handler
(
"pref-instances"
,
"*"
,
$this
);
$host
->
add_handler
(
"pref-instances"
,
"*"
,
$this
);
$host
->
add_handler
(
"public"
,
"fbexport"
,
$this
);
$host
->
add_command
(
"get-feeds"
,
"receive popular feeds from linked instances"
,
$this
);
$host
->
add_command
(
"get-feeds"
,
"receive popular feeds from linked instances"
,
$this
);
$host
->
add_hook
(
$host
::
HOOK_UPDATE_TASK
,
$this
);
$host
->
add_hook
(
$host
::
HOOK_UPDATE_TASK
,
$this
);
}
}
...
@@ -360,6 +361,37 @@ class Instances extends Plugin implements IHandler {
...
@@ -360,6 +361,37 @@ class Instances extends Plugin implements IHandler {
}
}
function
fbexport
()
{
$access_key
=
db_escape_string
(
$_POST
[
"key"
]);
// TODO: rate limit checking using last_connected
$result
=
db_query
(
$this
->
link
,
"SELECT id FROM ttrss_linked_instances
WHERE access_key = '
$access_key
'"
);
if
(
db_num_rows
(
$result
)
==
1
)
{
$instance_id
=
db_fetch_result
(
$result
,
0
,
"id"
);
$result
=
db_query
(
$this
->
link
,
"SELECT feed_url, site_url, title, subscribers
FROM ttrss_feedbrowser_cache ORDER BY subscribers DESC LIMIT 100"
);
$feeds
=
array
();
while
(
$line
=
db_fetch_assoc
(
$result
))
{
array_push
(
$feeds
,
$line
);
}
db_query
(
$this
->
link
,
"UPDATE ttrss_linked_instances SET
last_status_in = 1 WHERE id = '
$instance_id
'"
);
print
json_encode
(
array
(
"feeds"
=>
$feeds
));
}
else
{
print
json_encode
(
array
(
"error"
=>
array
(
"code"
=>
6
)));
}
}
}
}
?>
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment