Browse Source

add separated import/export settings

main
ghost 1 year ago
parent
commit
a232e24d0c
  1. 25
      example/environment/env.example.php
  2. 26
      src/crontab/export/feed.php
  3. 2
      src/public/action.php
  4. 2
      src/public/download.php
  5. 2
      src/public/edit.php
  6. 2
      src/public/faq.php
  7. 2
      src/public/index.php
  8. 2
      src/public/magnet.php
  9. 2
      src/public/node.php
  10. 2
      src/public/welcome.php

25
example/environment/env.example.php

@ -123,11 +123,20 @@ define('NODE_RULE_LANGUAGES', 'All'); @@ -123,11 +123,20 @@ define('NODE_RULE_LANGUAGES', 'All');
// API
define('API_VERSION', 1);
define('API_ENABLED', true);
define('API_FEED_USERS_ENABLED', true);
define('API_FEED_MAGNETS_ENABLED', true);
define('API_FEED_DOWNLOADS_ENABLED', true);
define('API_FEED_COMMENTS_ENABLED', true);
define('API_FEED_STARS_ENABLED', true);
define('API_FEED_VIEWS_ENABLED', true);
define('API_EXPORT_ENABLED', true);
define('API_EXPORT_USERS_ENABLED', true);
define('API_EXPORT_MAGNETS_ENABLED', true);
define('API_EXPORT_DOWNLOADS_ENABLED', true);
define('API_EXPORT_COMMENTS_ENABLED', true);
define('API_EXPORT_STARS_ENABLED', true);
define('API_EXPORT_VIEWS_ENABLED', true);
define('API_IMPORT_ENABLED', true);
define('API_IMPORT_USERS_ENABLED', true);
define('API_IMPORT_MAGNETS_ENABLED', true);
define('API_IMPORT_DOWNLOADS_ENABLED', true);
define('API_IMPORT_COMMENTS_ENABLED', true);
define('API_IMPORT_STARS_ENABLED', true);
define('API_IMPORT_VIEWS_ENABLED', true);

26
src/crontab/export/feed.php

@ -45,7 +45,7 @@ try @@ -45,7 +45,7 @@ try
@unlink(__DIR__ . '/../public/api/stars.json');
@unlink(__DIR__ . '/../public/api/views.json');
if (API_ENABLED)
if (API_EXPORT_ENABLED)
{
// Manifest
$manifest =
@ -91,12 +91,12 @@ try @@ -91,12 +91,12 @@ try
'MAGNET_STOP_WORDS_SIMILAR' => MAGNET_STOP_WORDS_SIMILAR,
],
'users' => API_FEED_USERS_ENABLED ? sprintf('%s/api/users.json', WEBSITE_URL) : false,
'magnets' => API_FEED_MAGNETS_ENABLED ? sprintf('%s/api/magnets.json', WEBSITE_URL) : false,
'downloads' => API_FEED_DOWNLOADS_ENABLED ? sprintf('%s/api/downloads.json', WEBSITE_URL) : false,
'comments' => API_FEED_COMMENTS_ENABLED ? sprintf('%s/api/comments.json', WEBSITE_URL) : false,
'stars' => API_FEED_STARS_ENABLED ? sprintf('%s/api/stars.json', WEBSITE_URL) : false,
'views' => API_FEED_VIEWS_ENABLED ? sprintf('%s/api/views.json', WEBSITE_URL) : false,
'users' => API_EXPORT_USERS_ENABLED ? sprintf('%s/api/users.json', WEBSITE_URL) : false,
'magnets' => API_EXPORT_MAGNETS_ENABLED ? sprintf('%s/api/magnets.json', WEBSITE_URL) : false,
'downloads' => API_EXPORT_DOWNLOADS_ENABLED ? sprintf('%s/api/downloads.json', WEBSITE_URL) : false,
'comments' => API_EXPORT_COMMENTS_ENABLED ? sprintf('%s/api/comments.json', WEBSITE_URL) : false,
'stars' => API_EXPORT_STARS_ENABLED ? sprintf('%s/api/stars.json', WEBSITE_URL) : false,
'views' => API_EXPORT_VIEWS_ENABLED ? sprintf('%s/api/views.json', WEBSITE_URL) : false,
'totals' =>
[
@ -144,7 +144,7 @@ try @@ -144,7 +144,7 @@ try
}
// Users
if (API_FEED_USERS_ENABLED)
if (API_EXPORT_USERS_ENABLED)
{
$users = [];
@ -181,7 +181,7 @@ try @@ -181,7 +181,7 @@ try
}
// Magnets
if (API_FEED_MAGNETS_ENABLED)
if (API_EXPORT_MAGNETS_ENABLED)
{
$magnets = [];
@ -320,7 +320,7 @@ try @@ -320,7 +320,7 @@ try
}
// Downloads
if (API_FEED_DOWNLOADS_ENABLED)
if (API_EXPORT_DOWNLOADS_ENABLED)
{
$downloads = [];
@ -349,7 +349,7 @@ try @@ -349,7 +349,7 @@ try
}
// Comments
if (API_FEED_COMMENTS_ENABLED)
if (API_EXPORT_COMMENTS_ENABLED)
{
$comments = [];
@ -378,7 +378,7 @@ try @@ -378,7 +378,7 @@ try
}
// Stars
if (API_FEED_STARS_ENABLED)
if (API_EXPORT_STARS_ENABLED)
{
$stars = [];
@ -407,7 +407,7 @@ try @@ -407,7 +407,7 @@ try
}
}
// Views
if (API_FEED_VIEWS_ENABLED)
if (API_EXPORT_VIEWS_ENABLED)
{
$views = [];

2
src/public/action.php

@ -707,7 +707,7 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false) @@ -707,7 +707,7 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a>
<?php if (API_ENABLED) { ?>
<?php if (API_EXPORT_ENABLED) { ?>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a>
<?php } ?>

2
src/public/download.php

@ -309,7 +309,7 @@ else @@ -309,7 +309,7 @@ else
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a>
<?php if (API_ENABLED) { ?>
<?php if (API_EXPORT_ENABLED) { ?>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a>
<?php } ?>

2
src/public/edit.php

@ -862,7 +862,7 @@ else { @@ -862,7 +862,7 @@ else {
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a>
<?php if (API_ENABLED) { ?>
<?php if (API_EXPORT_ENABLED) { ?>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a>
<?php } ?>

2
src/public/faq.php

@ -226,7 +226,7 @@ else if (is_null($user->public)) @@ -226,7 +226,7 @@ else if (is_null($user->public))
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a>
<?php if (API_ENABLED) { ?>
<?php if (API_EXPORT_ENABLED) { ?>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a>
<?php } ?>

2
src/public/index.php

@ -424,7 +424,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?> @@ -424,7 +424,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss<?php echo $request->query ? sprintf('&query=%s', urlencode($request->query)) : false ?>"><?php echo _('RSS') ?></a>
<?php if (API_ENABLED) { ?>
<?php if (API_EXPORT_ENABLED) { ?>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a>
<?php } ?>

2
src/public/magnet.php

@ -499,7 +499,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?> @@ -499,7 +499,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a>
<?php if (API_ENABLED) { ?>
<?php if (API_EXPORT_ENABLED) { ?>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a>
<?php } ?>

2
src/public/node.php

@ -470,7 +470,7 @@ else if (is_null($user->public)) @@ -470,7 +470,7 @@ else if (is_null($user->public))
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a>
<?php if (API_ENABLED) { ?>
<?php if (API_EXPORT_ENABLED) { ?>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a>
<?php } ?>

2
src/public/welcome.php

@ -144,7 +144,7 @@ else if (isset($_POST['public'])) @@ -144,7 +144,7 @@ else if (isset($_POST['public']))
<a href="<?php echo WEBSITE_URL ?>/node.php"><?php echo _('Node') ?></a>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/index.php?rss"><?php echo _('RSS') ?></a>
<?php if (API_ENABLED) { ?>
<?php if (API_EXPORT_ENABLED) { ?>
|
<a rel="nofollow" href="<?php echo WEBSITE_URL ?>/api/manifest.json"><?php echo _('API') ?></a>
<?php } ?>

Loading…
Cancel
Save