update settings ids to shorter ones
This commit is contained in:
parent
c29fa6fc91
commit
ec3b92b997
12
CHANGELOG.md
12
CHANGELOG.md
@ -3,6 +3,18 @@
|
|||||||
- [ ] add plugin muppet support (request Mathieu M.)
|
- [ ] add plugin muppet support (request Mathieu M.)
|
||||||
- [ ] add log for errors
|
- [ ] add log for errors
|
||||||
|
|
||||||
|
- fix posts owner on feeds update
|
||||||
|
- fix permissions
|
||||||
|
- enhance feed update
|
||||||
|
- use constant for table name
|
||||||
|
- use new behaviors names
|
||||||
|
- use dc methods in widget
|
||||||
|
- use abstract plugin name
|
||||||
|
- split file by class
|
||||||
|
- clean prepend file
|
||||||
|
- clean install file
|
||||||
|
- update translation
|
||||||
|
|
||||||
2022.11.26
|
2022.11.26
|
||||||
- use SVG icon
|
- use SVG icon
|
||||||
- fix missing dcCore (resources)
|
- fix missing dcCore (resources)
|
||||||
|
@ -42,7 +42,7 @@ Once it's done you can manage your feeds from menu
|
|||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Jean-Christian Denis
|
* Jean-Christian Denis (author)
|
||||||
* BG
|
* BG
|
||||||
* Pierre Van Glabeke
|
* Pierre Van Glabeke
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ $perm = dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
|||||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
dcAuth::PERMISSION_CONTENT_ADMIN,
|
||||||
]), dcCore::app()->blog->id);
|
]), dcCore::app()->blog->id);
|
||||||
|
|
||||||
if (dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_active
|
if (dcCore::app()->blog->settings->__get(basename(__DIR__))->active
|
||||||
&& '' != dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_user
|
&& '' != dcCore::app()->blog->settings->__get(basename(__DIR__))->user
|
||||||
) {
|
) {
|
||||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
__('Feeds server'),
|
__('Feeds server'),
|
||||||
|
42
_config.php
42
_config.php
@ -20,16 +20,16 @@ $redir = empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#pl
|
|||||||
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||||
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
||||||
|
|
||||||
$active = (bool) $s->zoneclearFeedServer_active;
|
$active = (bool) $s->active;
|
||||||
$pub_active = (bool) $s->zoneclearFeedServer_pub_active;
|
$pub_active = (bool) $s->pub_active;
|
||||||
$post_status_new = (bool) $s->zoneclearFeedServer_post_status_new;
|
$post_status_new = (bool) $s->post_status_new;
|
||||||
$bhv_pub_upd = (int) $s->zoneclearFeedServer_bhv_pub_upd;
|
$bhv_pub_upd = (int) $s->bhv_pub_upd;
|
||||||
$update_limit = (int) $s->zoneclearFeedServer_update_limit;
|
$update_limit = (int) $s->update_limit;
|
||||||
$keep_empty_feed = (bool) $s->zoneclearFeedServer_keep_empty_feed;
|
$keep_empty_feed = (bool) $s->keep_empty_feed;
|
||||||
$tag_case = (int) $s->zoneclearFeedServer_tag_case;
|
$tag_case = (int) $s->tag_case;
|
||||||
$post_full_tpl = @unserialize($s->zoneclearFeedServer_post_full_tpl);
|
$post_full_tpl = @unserialize($s->post_full_tpl);
|
||||||
$post_title_redir = @unserialize($s->zoneclearFeedServer_post_title_redir);
|
$post_title_redir = @unserialize($s->post_title_redir);
|
||||||
$feeduser = (string) $s->zoneclearFeedServer_user;
|
$feeduser = (string) $s->user;
|
||||||
|
|
||||||
if ($update_limit < 1) {
|
if ($update_limit < 1) {
|
||||||
$update_limit = 10;
|
$update_limit = 10;
|
||||||
@ -61,16 +61,16 @@ if (!empty($_POST['save'])) {
|
|||||||
$limit = 10;
|
$limit = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
$s->put('zoneclearFeedServer_active', $active);
|
$s->put('active', $active);
|
||||||
$s->put('zoneclearFeedServer_pub_active', $pub_active);
|
$s->put('pub_active', $pub_active);
|
||||||
$s->put('zoneclearFeedServer_post_status_new', $post_status_new);
|
$s->put('post_status_new', $post_status_new);
|
||||||
$s->put('zoneclearFeedServer_bhv_pub_upd', $bhv_pub_upd);
|
$s->put('bhv_pub_upd', $bhv_pub_upd);
|
||||||
$s->put('zoneclearFeedServer_update_limit', $limit);
|
$s->put('update_limit', $limit);
|
||||||
$s->put('zoneclearFeedServer_keep_empty_feed', $keep_empty_feed);
|
$s->put('keep_empty_feed', $keep_empty_feed);
|
||||||
$s->put('zoneclearFeedServer_tag_case', $tag_case);
|
$s->put('tag_case', $tag_case);
|
||||||
$s->put('zoneclearFeedServer_post_full_tpl', serialize($post_full_tpl));
|
$s->put('post_full_tpl', serialize($post_full_tpl));
|
||||||
$s->put('zoneclearFeedServer_post_title_redir', serialize($post_title_redir));
|
$s->put('post_title_redir', serialize($post_title_redir));
|
||||||
$s->put('zoneclearFeedServer_user', $feeduser);
|
$s->put('user', $feeduser);
|
||||||
|
|
||||||
dcCore::app()->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ __('Enable plugin') . '</label></p>
|
|||||||
|
|
||||||
<div class="fieldset">';
|
<div class="fieldset">';
|
||||||
|
|
||||||
if ($s->zoneclearFeedServer_pub_active) {
|
if ($s->pub_active) {
|
||||||
echo sprintf(
|
echo sprintf(
|
||||||
'<p><a class="onblog_link outgoing" href="%s" title="%s">%s <img alt="" src="images/outgoing-link.svg"></a></p>',
|
'<p><a class="onblog_link outgoing" href="%s" title="%s">%s <img alt="" src="images/outgoing-link.svg"></a></p>',
|
||||||
$pub_page_url,
|
$pub_page_url,
|
||||||
|
@ -18,7 +18,7 @@ $this->registerModule(
|
|||||||
'Feeds server',
|
'Feeds server',
|
||||||
'Mix your blog with a feeds planet',
|
'Mix your blog with a feeds planet',
|
||||||
'Jean-Christian Denis, BG, Pierre Van Glabeke',
|
'Jean-Christian Denis, BG, Pierre Van Glabeke',
|
||||||
'2022.11.26',
|
'2022.12.11',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.24']],
|
'requires' => [['core', '2.24']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
|
29
_install.php
29
_install.php
@ -15,7 +15,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Check module version
|
// Check module version
|
||||||
if (!dcCore::app()->newVersion(
|
if (!dcCore::app()->newVersion(
|
||||||
basename(__DIR__),
|
basename(__DIR__),
|
||||||
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
|
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
|
||||||
@ -23,7 +23,10 @@ try {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tables
|
// Upgrade existing install
|
||||||
|
zcfsUpgrade::preUpgrade();
|
||||||
|
|
||||||
|
// Tables
|
||||||
$t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
$t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||||
$t->{initZoneclearFeedServer::TABLE_NAME}
|
$t->{initZoneclearFeedServer::TABLE_NAME}
|
||||||
->feed_id('bigint', 0, false)
|
->feed_id('bigint', 0, false)
|
||||||
@ -54,19 +57,19 @@ try {
|
|||||||
$ti = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
$ti = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||||
$changes = $ti->synchronize($t);
|
$changes = $ti->synchronize($t);
|
||||||
|
|
||||||
# Settings
|
// Settings
|
||||||
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||||
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
||||||
$s->put('zoneclearFeedServer_active', false, 'boolean', 'Enable zoneclearBlogServer', false, true);
|
$s->put('active', false, 'boolean', 'Enable zoneclearBlogServer', false, true);
|
||||||
$s->put('zoneclearFeedServer_pub_active', false, 'boolean', 'Enable public page of list of feeds', false, true);
|
$s->put('pub_active', false, 'boolean', 'Enable public page of list of feeds', false, true);
|
||||||
$s->put('zoneclearFeedServer_post_status_new', true, 'boolean', 'Enable auto publish new posts', false, true);
|
$s->put('post_status_new', true, 'boolean', 'Enable auto publish new posts', false, true);
|
||||||
$s->put('zoneclearFeedServer_bhv_pub_upd', 2, 'string', 'Auto update on public side (disable/before/after)', false, true);
|
$s->put('bhv_pub_upd', 2, 'string', 'Auto update on public side (disable/before/after)', false, true);
|
||||||
$s->put('zoneclearFeedServer_update_limit', 1, 'integer', 'Number of feeds to update at one time', false, true);
|
$s->put('update_limit', 1, 'integer', 'Number of feeds to update at one time', false, true);
|
||||||
$s->put('zoneclearFeedServer_keep_empty_feed', false, 'boolean', 'Keep active empty feeds', false, true);
|
$s->put('keep_empty_feed', false, 'boolean', 'Keep active empty feeds', false, true);
|
||||||
$s->put('zoneclearFeedServer_tag_case', 0, 'integer', 'How to transform imported tags', false, true);
|
$s->put('tag_case', 0, 'integer', 'How to transform imported tags', false, true);
|
||||||
$s->put('zoneclearFeedServer_user', '', 'string', 'User id that has right on post', false, true);
|
$s->put('user', '', 'string', 'User id that has right on post', false, true);
|
||||||
$s->put('zoneclearFeedServer_post_full_tpl', serialize(['post', 'category', 'tag', 'archive']), 'string', 'List of templates types for full feed', false, true);
|
$s->put('post_full_tpl', serialize(['post', 'category', 'tag', 'archive']), 'string', 'List of templates types for full feed', false, true);
|
||||||
$s->put('zoneclearFeedServer_post_title_redir', serialize(['feed']), 'string', 'List of templates types for redirection to original post', false, true);
|
$s->put('post_title_redir', serialize(['feed']), 'string', 'List of templates types for redirection to original post', false, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -27,6 +27,7 @@ Clearbricks::lib()->autoload([
|
|||||||
'zcfsRsExtPosts' => __DIR__ . '/inc/class.zcfsrsextposts.php',
|
'zcfsRsExtPosts' => __DIR__ . '/inc/class.zcfsrsextposts.php',
|
||||||
'zcfsUrlHandler' => __DIR__ . '/inc/class.zcfsurlhandler.php',
|
'zcfsUrlHandler' => __DIR__ . '/inc/class.zcfsurlhandler.php',
|
||||||
'zcfsActivityReportBehaviors' => __DIR__ . '/inc/class.zcfsactivityreportbehaviors.php',
|
'zcfsActivityReportBehaviors' => __DIR__ . '/inc/class.zcfsactivityreportbehaviors.php',
|
||||||
|
'zcfsUpgrade' => __DIR__ . '/inc/class.zcfsupgrade.php',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// public url for page of description of the flux
|
// public url for page of description of the flux
|
||||||
|
@ -23,14 +23,14 @@ require_once __DIR__ . '/_widgets.php';
|
|||||||
|
|
||||||
dcCore::app()->addBehavior('coreBlogGetPosts', ['zcfsPublicBehaviors', 'coreBlogGetPosts']);
|
dcCore::app()->addBehavior('coreBlogGetPosts', ['zcfsPublicBehaviors', 'coreBlogGetPosts']);
|
||||||
|
|
||||||
if (!$s->zoneclearFeedServer_active) {
|
if (!$s->active) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (1 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
if (1 == $s->bhv_pub_upd) {
|
||||||
dcCore::app()->addBehavior('publicBeforeDocumentV2', ['zcfsPublicBehaviors', 'publicDocumentV2']);
|
dcCore::app()->addBehavior('publicBeforeDocumentV2', ['zcfsPublicBehaviors', 'publicDocumentV2']);
|
||||||
} elseif (2 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
} elseif (2 == $s->bhv_pub_upd) {
|
||||||
dcCore::app()->addBehavior('publicAfterDocumentV2', ['zcfsPublicBehaviors', 'publicAfterDocumentV2']);
|
dcCore::app()->addBehavior('publicAfterDocumentV2', ['zcfsPublicBehaviors', 'publicAfterDocumentV2']);
|
||||||
} elseif (3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
} elseif (3 == $s->bhv_pub_upd) {
|
||||||
dcCore::app()->addBehavior('publicHeadContent', ['zcfsPublicBehaviors', 'publicHeadContent']);
|
dcCore::app()->addBehavior('publicHeadContent', ['zcfsPublicBehaviors', 'publicHeadContent']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class zoneclearFeedServerWidget
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_active
|
if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->active
|
||||||
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
@ -184,7 +184,7 @@ class zoneclearFeedServerWidget
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$pub = '';
|
$pub = '';
|
||||||
if ($w->pagelink && dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_pub_active) {
|
if ($w->pagelink && dcCore::app()->blog->settings->__get(basename(__DIR__))->pub_active) {
|
||||||
$pub = sprintf(
|
$pub = sprintf(
|
||||||
'<p><strong><a href="%s">%s</a></strong></p>',
|
'<p><strong><a href="%s">%s</a></strong></p>',
|
||||||
dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage'),
|
dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage'),
|
||||||
@ -212,7 +212,7 @@ class zoneclearFeedServerWidget
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_active
|
if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->active
|
||||||
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
@ -232,7 +232,7 @@ class zoneclearFeedServerWidget
|
|||||||
|
|
||||||
$text = $count ? sprintf(__('one source', '%d sources', $count), $count) : __('no sources');
|
$text = $count ? sprintf(__('one source', '%d sources', $count), $count) : __('no sources');
|
||||||
|
|
||||||
if (dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_pub_active) {
|
if (dcCore::app()->blog->settings->__get(basename(__DIR__))->pub_active) {
|
||||||
$text = sprintf(
|
$text = sprintf(
|
||||||
'<a href="%s">%s</a>',
|
'<a href="%s">%s</a>',
|
||||||
dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage'),
|
dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage'),
|
||||||
|
@ -82,7 +82,7 @@ if (!isset($opts['u']) || !dcCore::app()->auth->checkUser($opts['u'])) {
|
|||||||
|
|
||||||
dcCore::app()->plugins->loadModules(DC_PLUGINS_ROOT);
|
dcCore::app()->plugins->loadModules(DC_PLUGINS_ROOT);
|
||||||
|
|
||||||
dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
|
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$zc = new zoneclearFeedServer();
|
$zc = new zoneclearFeedServer();
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="zoneclearFeedServer">
|
<module id="zoneclearFeedServer">
|
||||||
<name>Feeds server</name>
|
<name>Feeds server</name>
|
||||||
<version>2022.11.26</version>
|
<version>2022.12.11</version>
|
||||||
<author>Jean-Christian Denis, BG, Pierre Van Glabeke</author>
|
<author>Jean-Christian Denis, BG, Pierre Van Glabeke</author>
|
||||||
<desc>Mix your blog with a feeds planet</desc>
|
<desc>Mix your blog with a feeds planet</desc>
|
||||||
<file>https://github.com/JcDenis/zoneclearFeedServer/releases/download/v2022.11.26/plugin-zoneclearFeedServer.zip</file>
|
<file>https://github.com/JcDenis/zoneclearFeedServer/releases/download/v2022.12.11/plugin-zoneclearFeedServer.zip</file>
|
||||||
<da:dcmin>2.24</da:dcmin>
|
<da:dcmin>2.24</da:dcmin>
|
||||||
<da:details>https://plugins.dotaddict.org/dc2/details/pacKman</da:details>
|
<da:details>https://plugins.dotaddict.org/dc2/details/zoneclearFeedServer</da:details>
|
||||||
<da:support>https://github.com/JcDenis/zoneclearFeedServer</da:support>
|
<da:support>https://github.com/JcDenis/zoneclearFeedServer</da:support>
|
||||||
</module>
|
</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
@ -106,7 +106,7 @@ class zcfsRsExtPosts extends rsExtPost
|
|||||||
public static function getURL(dcRecord $rs): string
|
public static function getURL(dcRecord $rs): string
|
||||||
{
|
{
|
||||||
$url = $rs->zcFeed('url');
|
$url = $rs->zcFeed('url');
|
||||||
$types = @unserialize(dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)))->zoneclearFeedServer_post_title_redir);
|
$types = @unserialize(dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)))->post_title_redir);
|
||||||
$full = is_array($types) && in_array(dcCore::app()->url->type, $types);
|
$full = is_array($types) && in_array(dcCore::app()->url->type, $types);
|
||||||
|
|
||||||
return $url && $full ?
|
return $url && $full ?
|
||||||
@ -127,7 +127,7 @@ class zcfsRsExtPosts extends rsExtPost
|
|||||||
$content = self::zcFeedBrother('getContent', [&$rs, $absolute_urls]);
|
$content = self::zcFeedBrother('getContent', [&$rs, $absolute_urls]);
|
||||||
|
|
||||||
if ($url && $sitename && $rs->post_type == 'post') {
|
if ($url && $sitename && $rs->post_type == 'post') {
|
||||||
$types = @unserialize(dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)))->zoneclearFeedServer_post_full_tpl);
|
$types = @unserialize(dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)))->post_full_tpl);
|
||||||
|
|
||||||
if (is_array($types) && in_array(dcCore::app()->url->type, $types)) {
|
if (is_array($types) && in_array(dcCore::app()->url->type, $types)) {
|
||||||
return $content . sprintf(
|
return $content . sprintf(
|
||||||
|
54
inc/class.zcfsupgrade.php
Normal file
54
inc/class.zcfsupgrade.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @brief zoneclearFeedServer, a plugin for Dotclear 2
|
||||||
|
*
|
||||||
|
* @package Dotclear
|
||||||
|
* @subpackage Plugin
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
|
||||||
|
*
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
class zcfsUpgrade
|
||||||
|
{
|
||||||
|
public static function preUpgrade()
|
||||||
|
{
|
||||||
|
//$current = dcCore::app()->plugins->moduleInfo(basename(dirname('../' . __DIR__)), 'version');
|
||||||
|
$current = dcCore::app()->getVersion(basename(dirname('../' . __DIR__)));
|
||||||
|
if ($current && version_compare($current, '2022.12.10', '<')) {
|
||||||
|
self::preUpgrade20221210();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function postUpgrade()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename settings
|
||||||
|
protected static function preUpgrade20221210()
|
||||||
|
{
|
||||||
|
$settings_ids = [
|
||||||
|
'zoneclearFeedServer_active' => 'active',
|
||||||
|
'zoneclearFeedServer_pub_active' => 'pub_active',
|
||||||
|
'zoneclearFeedServer_post_status_new' => 'psot_new_status',
|
||||||
|
'zoneclearFeedServer_bhv_pub_upd' => 'bhv_pub_upd',
|
||||||
|
'zoneclearFeedServer_update_limit' => 'update_limit',
|
||||||
|
'zoneclearFeedServer_keep_empty_feed' => 'keep_empty_feed',
|
||||||
|
'zoneclearFeedServer_tag_case' => 'tag_case',
|
||||||
|
'zoneclearFeedServer_user' => 'user',
|
||||||
|
'zoneclearFeedServer_post_full_tpl' => 'post_full_tpl',
|
||||||
|
'zoneclearFeedServer_post_title_redir' => 'post_title_redir',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($settings_ids as $old => $new) {
|
||||||
|
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
|
||||||
|
$cur->setting_id = $new;
|
||||||
|
$cur->update("WHERE setting_id = '" . $old . "' and setting_ns = 'zoneclearFeedServer' ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -32,14 +32,14 @@ class zcfsUrlHandler extends dcUrlHandlers
|
|||||||
$s = dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)));
|
$s = dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)));
|
||||||
|
|
||||||
# Not active
|
# Not active
|
||||||
if (!$s->zoneclearFeedServer_active) {
|
if (!$s->active) {
|
||||||
self::p404();
|
self::p404();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update feeds (from ajax or other post resquest)
|
# Update feeds (from ajax or other post resquest)
|
||||||
if ($args == '/zcfsupd' && 3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
if ($args == '/zcfsupd' && 3 == $s->bhv_pub_upd) {
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (!empty($_POST['blogId']) && html::escapeJS(dcCore::app()->blog->id) == $_POST['blogId']) {
|
if (!empty($_POST['blogId']) && html::escapeJS(dcCore::app()->blog->id) == $_POST['blogId']) {
|
||||||
try {
|
try {
|
||||||
@ -72,7 +72,7 @@ class zcfsUrlHandler extends dcUrlHandlers
|
|||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
# Server js
|
# Server js
|
||||||
} elseif ($args == '/zcfsupd.js' && 3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
} elseif ($args == '/zcfsupd.js' && 3 == $s->bhv_pub_upd) {
|
||||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), __DIR__ . '/default-templates');
|
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), __DIR__ . '/default-templates');
|
||||||
self::serveDocument(
|
self::serveDocument(
|
||||||
'zcfsupd.js',
|
'zcfsupd.js',
|
||||||
@ -82,7 +82,7 @@ class zcfsUrlHandler extends dcUrlHandlers
|
|||||||
);
|
);
|
||||||
|
|
||||||
# Server feeds description page
|
# Server feeds description page
|
||||||
} elseif (in_array($args, ['', '/']) && $s->zoneclearFeedServer_pub_active) {
|
} elseif (in_array($args, ['', '/']) && $s->pub_active) {
|
||||||
$tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->system->theme, 'tplset');
|
$tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->system->theme, 'tplset');
|
||||||
$path = __DIR__ . '/default-templates/';
|
$path = __DIR__ . '/default-templates/';
|
||||||
if (!empty($tplset) && is_dir($path . $tplset)) {
|
if (!empty($tplset) && is_dir($path . $tplset)) {
|
||||||
|
@ -398,7 +398,7 @@ class zoneclearFeedServer
|
|||||||
$s = dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)));
|
$s = dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)));
|
||||||
|
|
||||||
# Not configured
|
# Not configured
|
||||||
if (!$s->zoneclearFeedServer_active || !$s->zoneclearFeedServer_user) {
|
if (!$s->active || !$s->user) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,11 +426,11 @@ class zoneclearFeedServer
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$enabled = false;
|
$enabled = false;
|
||||||
$updates = false;
|
$updates = false;
|
||||||
$loop_mem = [];
|
$loop_mem = [];
|
||||||
|
|
||||||
$limit = abs((int) $s->zoneclearFeedServer_update_limit);
|
$limit = abs((int) $s->update_limit);
|
||||||
if ($limit < 1) {
|
if ($limit < 1) {
|
||||||
$limit = 10;
|
$limit = 10;
|
||||||
}
|
}
|
||||||
@ -455,7 +455,7 @@ class zoneclearFeedServer
|
|||||||
# Nothing to parse
|
# Nothing to parse
|
||||||
if (!$feed) {
|
if (!$feed) {
|
||||||
# Keep active empty feed or disable it ?
|
# Keep active empty feed or disable it ?
|
||||||
if (!$s->zoneclearFeedServer_keep_empty_feed) {
|
if (!$s->keep_empty_feed) {
|
||||||
$this->enableFeed($f->feed_id, false);
|
$this->enableFeed($f->feed_id, false);
|
||||||
} else {
|
} else {
|
||||||
# Set update time of this feed
|
# Set update time of this feed
|
||||||
@ -533,7 +533,7 @@ class zoneclearFeedServer
|
|||||||
# Post
|
# Post
|
||||||
$cur_post->user_id = dcCore::app()->auth->userID();
|
$cur_post->user_id = dcCore::app()->auth->userID();
|
||||||
$cur_post->post_format = 'xhtml';
|
$cur_post->post_format = 'xhtml';
|
||||||
$cur_post->post_status = (int) $s->zoneclearFeedServer_post_status_new;
|
$cur_post->post_status = (int) $s->post_status_new;
|
||||||
$cur_post->post_open_comment = 0;
|
$cur_post->post_open_comment = 0;
|
||||||
$cur_post->post_open_tb = 0;
|
$cur_post->post_open_tb = 0;
|
||||||
|
|
||||||
@ -646,7 +646,7 @@ class zoneclearFeedServer
|
|||||||
$formated_tags = [];
|
$formated_tags = [];
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
# Change tags case
|
# Change tags case
|
||||||
switch ((int) $s->zoneclearFeedServer_tag_case) {
|
switch ((int) $s->tag_case) {
|
||||||
case 3: $tag = strtoupper($tag);
|
case 3: $tag = strtoupper($tag);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -716,7 +716,7 @@ class zoneclearFeedServer
|
|||||||
// backup current user
|
// backup current user
|
||||||
$this->user = dcCore::app()->auth->userID();
|
$this->user = dcCore::app()->auth->userID();
|
||||||
// set zcfs posts user
|
// set zcfs posts user
|
||||||
if (!dcCore::app()->auth->checkUser((string) dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)))->zoneclearFeedServer_user)) {
|
if (!dcCore::app()->auth->checkUser((string) dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)))->user)) {
|
||||||
throw new Exception('Unable to set user');
|
throw new Exception('Unable to set user');
|
||||||
}
|
}
|
||||||
# Disable
|
# Disable
|
||||||
|
@ -28,8 +28,8 @@ dcPage::check(dcCore::app()->auth->makePermissions([
|
|||||||
$zcfs = new zoneclearFeedServer();
|
$zcfs = new zoneclearFeedServer();
|
||||||
|
|
||||||
# Not configured
|
# Not configured
|
||||||
if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_active
|
if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->active
|
||||||
|| !dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_user
|
|| !dcCore::app()->blog->settings->__get(basename(__DIR__))->user
|
||||||
) {
|
) {
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Feeds server') . '</title></head><body>' .
|
'<html><head><title>' . __('Feeds server') . '</title></head><body>' .
|
||||||
|
Loading…
Reference in New Issue
Block a user