update to PSR12
This commit is contained in:
parent
b0e2547f1d
commit
92521cdbf9
17 changed files with 625 additions and 566 deletions
|
@ -2,10 +2,11 @@
|
||||||
- [ ] fix disallow self blog feeds
|
- [ ] fix disallow self blog feeds
|
||||||
- [ ] add plugin muppet support (request Mathieu M.)
|
- [ ] add plugin muppet support (request Mathieu M.)
|
||||||
- [ ] add log for errors
|
- [ ] add log for errors
|
||||||
- add generic filters
|
- add generic filters (dc 2.20)
|
||||||
- add user pref for columns and filters options
|
- add user pref for columns and filters options (dc 2.20)
|
||||||
- fix redirections, page title, posts feed form
|
- fix redirections, page title, posts feed form
|
||||||
- update translation
|
- update translation
|
||||||
|
- update to PSR12
|
||||||
|
|
||||||
2021.09.16
|
2021.09.16
|
||||||
- fix Dotclear 2.19 compatibility
|
- fix Dotclear 2.19 compatibility
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +46,6 @@ if ($core->auth->check('admin', $core->blog->id)) {
|
||||||
|
|
||||||
# Take care about tweakurls (thanks Mathieu M.)
|
# Take care about tweakurls (thanks Mathieu M.)
|
||||||
if (version_compare($core->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
|
if (version_compare($core->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
|
||||||
|
|
||||||
$core->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
$core->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,8 +259,7 @@ class zcfsAdminBehaviors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sidebar_items['options-box']['items']['zcfs'] =
|
$sidebar_items['options-box']['items']['zcfs'] = '<div id="zcfs">' .
|
||||||
'<div id="zcfs">'.
|
|
||||||
'<h5>' . __('Feed source') . '</h5>' .
|
'<h5>' . __('Feed source') . '</h5>' .
|
||||||
'<p>' .
|
'<p>' .
|
||||||
'<a href="' . $url . '" title="' . $author . ' - ' . $url . '">' . __('feed URL') . '</a> - ' .
|
'<a href="' . $url . '" title="' . $author . ' - ' . $url . '">' . __('feed URL') . '</a> - ' .
|
||||||
|
@ -283,7 +280,7 @@ class zcfsAdminBehaviors
|
||||||
|
|
||||||
$core->con->execute(
|
$core->con->execute(
|
||||||
'DELETE FROM ' . $core->prefix . 'meta ' .
|
'DELETE FROM ' . $core->prefix . 'meta ' .
|
||||||
'WHERE post_id = ' . ((integer) $post_id) . ' ' .
|
'WHERE post_id = ' . ((int) $post_id) . ' ' .
|
||||||
'AND meta_type ' . $core->con->in([
|
'AND meta_type ' . $core->con->in([
|
||||||
'zoneclearfeed_url',
|
'zoneclearfeed_url',
|
||||||
'zoneclearfeed_author',
|
'zoneclearfeed_author',
|
||||||
|
|
27
_config.php
27
_config.php
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_MODULE')) {
|
if (!defined('DC_CONTEXT_MODULE')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -21,13 +20,13 @@ $redir = empty($_REQUEST['redir']) ? $list->getURL() . '#plugins' : $_REQUEST['r
|
||||||
$core->blog->settings->addNamespace('zoneclearFeedServer');
|
$core->blog->settings->addNamespace('zoneclearFeedServer');
|
||||||
$s = $core->blog->settings->zoneclearFeedServer;
|
$s = $core->blog->settings->zoneclearFeedServer;
|
||||||
|
|
||||||
$active = (boolean) $s->zoneclearFeedServer_active;
|
$active = (bool) $s->zoneclearFeedServer_active;
|
||||||
$pub_active = (boolean) $s->zoneclearFeedServer_pub_active;
|
$pub_active = (bool) $s->zoneclearFeedServer_pub_active;
|
||||||
$post_status_new = (boolean) $s->zoneclearFeedServer_post_status_new;
|
$post_status_new = (bool) $s->zoneclearFeedServer_post_status_new;
|
||||||
$bhv_pub_upd = (integer) $s->zoneclearFeedServer_bhv_pub_upd;
|
$bhv_pub_upd = (int) $s->zoneclearFeedServer_bhv_pub_upd;
|
||||||
$update_limit = (integer) $s->zoneclearFeedServer_update_limit;
|
$update_limit = (int) $s->zoneclearFeedServer_update_limit;
|
||||||
$keep_empty_feed = (boolean) $s->zoneclearFeedServer_keep_empty_feed;
|
$keep_empty_feed = (bool) $s->zoneclearFeedServer_keep_empty_feed;
|
||||||
$tag_case = (integer) $s->zoneclearFeedServer_tag_case;
|
$tag_case = (int) $s->zoneclearFeedServer_tag_case;
|
||||||
$post_full_tpl = @unserialize($s->zoneclearFeedServer_post_full_tpl);
|
$post_full_tpl = @unserialize($s->zoneclearFeedServer_post_full_tpl);
|
||||||
$post_title_redir = @unserialize($s->zoneclearFeedServer_post_title_redir);
|
$post_title_redir = @unserialize($s->zoneclearFeedServer_post_title_redir);
|
||||||
$feeduser = (string) $s->zoneclearFeedServer_user;
|
$feeduser = (string) $s->zoneclearFeedServer_user;
|
||||||
|
@ -50,10 +49,10 @@ if (!empty($_POST['save'])) {
|
||||||
$active = !empty($_POST['active']);
|
$active = !empty($_POST['active']);
|
||||||
$pub_active = !empty($_POST['pub_active']);
|
$pub_active = !empty($_POST['pub_active']);
|
||||||
$post_status_new = !empty($_POST['post_status_new']);
|
$post_status_new = !empty($_POST['post_status_new']);
|
||||||
$bhv_pub_upd = (integer) $_POST['bhv_pub_upd'];
|
$bhv_pub_upd = (int) $_POST['bhv_pub_upd'];
|
||||||
$limit = abs((integer) $_POST['update_limit']);
|
$limit = abs((int) $_POST['update_limit']);
|
||||||
$keep_empty_feed = !empty($_POST['keep_empty_feed']);
|
$keep_empty_feed = !empty($_POST['keep_empty_feed']);
|
||||||
$tag_case = (integer) $_POST['tag_case'];
|
$tag_case = (int) $_POST['tag_case'];
|
||||||
$post_full_tpl = $_POST['post_full_tpl'];
|
$post_full_tpl = $_POST['post_full_tpl'];
|
||||||
$post_title_redir = $_POST['post_title_redir'];
|
$post_title_redir = $_POST['post_title_redir'];
|
||||||
$feeduser = (string) $_POST['feeduser'];
|
$feeduser = (string) $_POST['feeduser'];
|
||||||
|
@ -154,8 +153,10 @@ form::combo('tag_case', $combo_tagcase, $tag_case) . '</p>
|
||||||
<p><label for="bhv_pub_upd">' . __('Update feeds on public side:') . '</label>' .
|
<p><label for="bhv_pub_upd">' . __('Update feeds on public side:') . '</label>' .
|
||||||
form::combo('bhv_pub_upd', $combo_pubupd, $bhv_pub_upd) . '</p>
|
form::combo('bhv_pub_upd', $combo_pubupd, $bhv_pub_upd) . '</p>
|
||||||
|
|
||||||
<p class="classic"><label for="update_limit" class="ib">' . sprintf(__('Update %s feed(s) at a time.'),
|
<p class="classic"><label for="update_limit" class="ib">' . sprintf(
|
||||||
form::number('update_limit', ['min' => 0, 'max' => 20, 'default' => $update_limit])) . '</label></p>
|
__('Update %s feed(s) at a time.'),
|
||||||
|
form::number('update_limit', ['min' => 0, 'max' => 20, 'default' => $update_limit])
|
||||||
|
) . '</label></p>
|
||||||
|
|
||||||
<p><label for="keep_empty_feed">' .
|
<p><label for="keep_empty_feed">' .
|
||||||
form::checkbox('keep_empty_feed', 1, $keep_empty_feed) . __('Keep active empty feeds') . '</label></p>
|
form::checkbox('keep_empty_feed', 1, $keep_empty_feed) . __('Keep active empty feeds') . '</label></p>
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
10
_install.php
10
_install.php
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +32,9 @@ try {
|
||||||
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)
|
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)
|
||||||
) {
|
) {
|
||||||
throw new Exception(sprintf(
|
throw new Exception(sprintf(
|
||||||
'%s requires Dotclear %s', $mod_id, $dc_min
|
'%s requires Dotclear %s',
|
||||||
|
$mod_id,
|
||||||
|
$dc_min
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,14 +80,15 @@ try {
|
||||||
$s->put('zoneclearFeedServer_keep_empty_feed', false, 'boolean', 'Keep active empty feeds', false, true);
|
$s->put('zoneclearFeedServer_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('zoneclearFeedServer_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('zoneclearFeedServer_user', '', 'string', 'User id that has right on post', false, true);
|
||||||
$s->put('zoneclearFeedServer_post_full_tpl', serialize(array('post', 'category', 'tag', 'archive')), 'string', 'List of templates types for full feed', 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('zoneclearFeedServer_post_title_redir', serialize(array('feed')), 'string', 'List of templates types for redirection to original post', false, true);
|
$s->put('zoneclearFeedServer_post_title_redir', serialize(['feed']), 'string', 'List of templates types for redirection to original post', false, true);
|
||||||
|
|
||||||
# Set module version
|
# Set module version
|
||||||
$core->setVersion(
|
$core->setVersion(
|
||||||
$mod_id,
|
$mod_id,
|
||||||
$this->moduleInfo($mod_id, 'version')
|
$this->moduleInfo($mod_id, 'version')
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
65
_public.php
65
_public.php
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +147,7 @@ class zcfsPublicBehaviors
|
||||||
"\n<!-- JS for zoneclearFeedServer --> \n" .
|
"\n<!-- JS for zoneclearFeedServer --> \n" .
|
||||||
dcutils::jsLoad($core->blog->url . $core->url->getBase('zoneclearFeedsPage') . '/zcfsupd.js') .
|
dcutils::jsLoad($core->blog->url . $core->url->getBase('zoneclearFeedsPage') . '/zcfsupd.js') .
|
||||||
"<script type=\"text/javascript\"> \n//<![CDATA[\n" .
|
"<script type=\"text/javascript\"> \n//<![CDATA[\n" .
|
||||||
" \$(function(){if(!document.getElementById){return;} " .
|
' $(function(){if(!document.getElementById){return;} ' .
|
||||||
" $('body').zoneclearFeedServer({blog_url:'" .
|
" $('body').zoneclearFeedServer({blog_url:'" .
|
||||||
$blog_url . "',blog_id:'" . $blog_id . "'}); " .
|
$blog_url . "',blog_id:'" . $blog_id . "'}); " .
|
||||||
" })\n" .
|
" })\n" .
|
||||||
|
@ -227,6 +226,7 @@ class zcfsRsExtPosts extends rsExtPost
|
||||||
public static function getAuthorCN($rs)
|
public static function getAuthorCN($rs)
|
||||||
{
|
{
|
||||||
$author = $rs->zcFeed('author');
|
$author = $rs->zcFeed('author');
|
||||||
|
|
||||||
return $author ?
|
return $author ?
|
||||||
$author :
|
$author :
|
||||||
self::zcFeedBrother('getAuthorCN', [&$rs]);
|
self::zcFeedBrother('getAuthorCN', [&$rs]);
|
||||||
|
@ -265,12 +265,11 @@ class zcfsRsExtPosts extends rsExtPost
|
||||||
$types = @unserialize($rs->core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_post_full_tpl);
|
$types = @unserialize($rs->core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_post_full_tpl);
|
||||||
|
|
||||||
if (is_array($types) && in_array($rs->core->url->type, $types)) {
|
if (is_array($types) && in_array($rs->core->url->type, $types)) {
|
||||||
|
|
||||||
return $content . sprintf(
|
return $content . sprintf(
|
||||||
'<p class="zoneclear-original"><em>%s</em></p>',
|
'<p class="zoneclear-original"><em>%s</em></p>',
|
||||||
sprintf(__('Original post on <a href="%s">%s</a>'), $url, $sitename)
|
sprintf(__('Original post on <a href="%s">%s</a>'), $url, $sitename)
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
$content = context::remove_html($content);
|
$content = context::remove_html($content);
|
||||||
$content = context::cut_string($content, 350);
|
$content = context::cut_string($content, 350);
|
||||||
$content = html::escapeHTML($content);
|
$content = html::escapeHTML($content);
|
||||||
|
@ -283,11 +282,10 @@ class zcfsRsExtPosts extends rsExtPost
|
||||||
__('Continue reading')
|
__('Continue reading')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup DC_PLUGIN_ZONECLEARFEEDSERVER
|
* @ingroup DC_PLUGIN_ZONECLEARFEEDSERVER
|
||||||
|
@ -327,8 +325,8 @@ class zcfsUrlHandler extends dcUrlHandlers
|
||||||
'Feeds updated successfully'
|
'Feeds updated successfully'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
catch (Exception $e) {}
|
|
||||||
}
|
}
|
||||||
if (empty($msg)) {
|
if (empty($msg)) {
|
||||||
$msg = sprintf(
|
$msg = sprintf(
|
||||||
|
@ -389,7 +387,7 @@ class zcfsTemplate
|
||||||
$lastn = -1;
|
$lastn = -1;
|
||||||
$p = '';
|
$p = '';
|
||||||
if (isset($a['lastn'])) {
|
if (isset($a['lastn'])) {
|
||||||
$lastn = abs((integer) $a['lastn']) +0;
|
$lastn = abs((int) $a['lastn']) + 0;
|
||||||
$p .= "\$zcfs_params['limit'] = " . $lastn . ";\n";
|
$p .= "\$zcfs_params['limit'] = " . $lastn . ";\n";
|
||||||
}
|
}
|
||||||
if (isset($a['cat_id'])) {
|
if (isset($a['cat_id'])) {
|
||||||
|
@ -402,7 +400,7 @@ class zcfsTemplate
|
||||||
$p .= "\$zcfs_params['feed_url'] = '" . addslashes($a['site_url']) . "';\n";
|
$p .= "\$zcfs_params['feed_url'] = '" . addslashes($a['site_url']) . "';\n";
|
||||||
}
|
}
|
||||||
if (isset($a['feed_status'])) {
|
if (isset($a['feed_status'])) {
|
||||||
$p .= "\$zcfs_params['feed_status'] = " . ((integer) $a['feed_status']) . ";\n";
|
$p .= "\$zcfs_params['feed_status'] = " . ((int) $a['feed_status']) . ";\n";
|
||||||
} else {
|
} else {
|
||||||
$p .= "\$zcfs_params['feed_status'] = 1;\n";
|
$p .= "\$zcfs_params['feed_status'] = 1;\n";
|
||||||
}
|
}
|
||||||
|
@ -417,17 +415,27 @@ class zcfsTemplate
|
||||||
$order = 'desc';
|
$order = 'desc';
|
||||||
if (isset($a['sortby'])) {
|
if (isset($a['sortby'])) {
|
||||||
switch ($a['sortby']) {
|
switch ($a['sortby']) {
|
||||||
case 'name': $sortby = 'lowername'; break;
|
case 'name': $sortby = 'lowername';
|
||||||
case 'owner' : $sortby = 'feed_owner'; break;
|
|
||||||
case 'date' : $sortby = 'feed_dt'; break;
|
break;
|
||||||
case 'update' : $sortby = 'feed_upddt'; break;
|
case 'owner': $sortby = 'feed_owner';
|
||||||
case 'id' : $sortby = 'feed_id'; break;
|
|
||||||
|
break;
|
||||||
|
case 'date': $sortby = 'feed_dt';
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'update': $sortby = 'feed_upddt';
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'id': $sortby = 'feed_id';
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($a['order']) && preg_match('/^(desc|asc)$/i', $a['order'])) {
|
if (isset($a['order']) && preg_match('/^(desc|asc)$/i', $a['order'])) {
|
||||||
$order = $a['order'];
|
$order = $a['order'];
|
||||||
}
|
}
|
||||||
$p .= "\$zcfs_params['order'] = '" . $sortby . " " . $order . "';\n";
|
$p .= "\$zcfs_params['order'] = '" . $sortby . ' ' . $order . "';\n";
|
||||||
|
|
||||||
return
|
return
|
||||||
'<?php ' . $p .
|
'<?php ' . $p .
|
||||||
|
@ -478,19 +486,19 @@ class zcfsTemplate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($a['first'])) {
|
if (isset($a['first'])) {
|
||||||
$sign = (boolean) $a['first'] ? '=' : '!';
|
$sign = (bool) $a['first'] ? '=' : '!';
|
||||||
$if[] = '$_ctx->feeds->index() ' . $sign . '= 0';
|
$if[] = '$_ctx->feeds->index() ' . $sign . '= 0';
|
||||||
}
|
}
|
||||||
if (isset($a['odd'])) {
|
if (isset($a['odd'])) {
|
||||||
$sign = (boolean) $a['odd'] ? '=' : '!';
|
$sign = (bool) $a['odd'] ? '=' : '!';
|
||||||
$if[] = '($_ctx->feeds->index()+1)%2 ' . $sign . ' = 1';
|
$if[] = '($_ctx->feeds->index()+1)%2 ' . $sign . ' = 1';
|
||||||
}
|
}
|
||||||
if (isset($a['has_category'])) {
|
if (isset($a['has_category'])) {
|
||||||
$sign = (boolean) $a['has_category'] ? '' : '!';
|
$sign = (bool) $a['has_category'] ? '' : '!';
|
||||||
$if[] = $sign . '$_ctx->feeds->cat_id';
|
$if[] = $sign . '$_ctx->feeds->cat_id';
|
||||||
}
|
}
|
||||||
if (isset($a['has_description'])) {
|
if (isset($a['has_description'])) {
|
||||||
$sign = (boolean) $a['has_description'] ? '' : '!';
|
$sign = (bool) $a['has_description'] ? '' : '!';
|
||||||
$if[] = $sign . '$_ctx->feeds->feed_desc';
|
$if[] = $sign . '$_ctx->feeds->feed_desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +509,7 @@ class zcfsTemplate
|
||||||
|
|
||||||
public static function FeedIfFirst($a)
|
public static function FeedIfFirst($a)
|
||||||
{
|
{
|
||||||
$ret = isset($a['return']) ? $a['return'] : 'first';
|
$ret = $a['return'] ?? 'first';
|
||||||
$ret = html::escapeHTML($ret);
|
$ret = html::escapeHTML($ret);
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -511,7 +519,7 @@ class zcfsTemplate
|
||||||
|
|
||||||
public static function FeedIfOdd($a)
|
public static function FeedIfOdd($a)
|
||||||
{
|
{
|
||||||
$ret = isset($a['return']) ? $a['return'] : 'odd';
|
$ret = $a['return'] ?? 'odd';
|
||||||
$ret = html::escapeHTML($ret);
|
$ret = html::escapeHTML($ret);
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -582,12 +590,12 @@ class zcfsTemplate
|
||||||
|
|
||||||
public static function FeedsHeader($a, $c)
|
public static function FeedsHeader($a, $c)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->feeds->isStart()) : ?>" . $c . "<?php endif; ?>";
|
return '<?php if ($_ctx->feeds->isStart()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedsFooter($a, $c)
|
public static function FeedsFooter($a, $c)
|
||||||
{
|
{
|
||||||
return "<?php if (\$_ctx->feeds->isEnd()) : ?>" . $c . "<?php endif; ?>";
|
return '<?php if ($_ctx->feeds->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedsCount($a)
|
public static function FeedsCount($a)
|
||||||
|
@ -614,7 +622,7 @@ class zcfsTemplate
|
||||||
" printf(__('" . $one . "'),\$fcount);\n" .
|
" printf(__('" . $one . "'),\$fcount);\n" .
|
||||||
"} else {\n" .
|
"} else {\n" .
|
||||||
" printf(__('" . $more . "'),\$fcount);\n" .
|
" printf(__('" . $more . "'),\$fcount);\n" .
|
||||||
"} unset(\$fcount); ?>";
|
'} unset($fcount); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedsEntriesCount($a)
|
public static function FeedsEntriesCount($a)
|
||||||
|
@ -636,7 +644,7 @@ class zcfsTemplate
|
||||||
return
|
return
|
||||||
"<?php \$fcount = 0; \$allfeeds = \$_ctx->feeds->zc->getFeeds(); \n" .
|
"<?php \$fcount = 0; \$allfeeds = \$_ctx->feeds->zc->getFeeds(); \n" .
|
||||||
"if (!\$allfeeds->isEmpty()) { \n" .
|
"if (!\$allfeeds->isEmpty()) { \n" .
|
||||||
" while (\$allfeeds->fetch()) { " .
|
' while ($allfeeds->fetch()) { ' .
|
||||||
" \$fcount += (integer) \$_ctx->feeds->zc->getPostsByFeed(array('feed_id'=>\$allfeeds->feed_id),true)->f(0); " .
|
" \$fcount += (integer) \$_ctx->feeds->zc->getPostsByFeed(array('feed_id'=>\$allfeeds->feed_id),true)->f(0); " .
|
||||||
" } \n" .
|
" } \n" .
|
||||||
"} \n" .
|
"} \n" .
|
||||||
|
@ -646,7 +654,7 @@ class zcfsTemplate
|
||||||
" printf(__('" . $one . "'),\$fcount);\n" .
|
" printf(__('" . $one . "'),\$fcount);\n" .
|
||||||
"} else {\n" .
|
"} else {\n" .
|
||||||
" printf(__('" . $more . "'),\$fcount);\n" .
|
" printf(__('" . $more . "'),\$fcount);\n" .
|
||||||
"} unset(\$allfeeds,\$fcount); ?>";
|
'} unset($allfeeds,$fcount); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedEntriesCount($a)
|
public static function FeedEntriesCount($a)
|
||||||
|
@ -673,7 +681,7 @@ class zcfsTemplate
|
||||||
" printf(__('" . $one . "'),\$fcount);\n" .
|
" printf(__('" . $one . "'),\$fcount);\n" .
|
||||||
"} else {\n" .
|
"} else {\n" .
|
||||||
" printf(__('" . $more . "'),\$fcount);\n" .
|
" printf(__('" . $more . "'),\$fcount);\n" .
|
||||||
"} unset(\$fcount); ?>";
|
'} unset($fcount); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getValue($a, $v)
|
protected static function getValue($a, $v)
|
||||||
|
@ -683,8 +691,7 @@ class zcfsTemplate
|
||||||
|
|
||||||
protected static function getOperator($op)
|
protected static function getOperator($op)
|
||||||
{
|
{
|
||||||
switch (strtolower($op))
|
switch (strtolower($op)) {
|
||||||
{
|
|
||||||
case 'or':
|
case 'or':
|
||||||
case '||':
|
case '||':
|
||||||
return '||';
|
return '||';
|
||||||
|
|
105
_uninstall.php
105
_uninstall.php
|
@ -10,72 +10,103 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mod_id = 'zoneclearFeedServer';
|
$mod_id = 'zoneclearFeedServer';
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'settings',
|
/* type */
|
||||||
/* action */ 'delete_all',
|
'settings',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ __('delete all settings')
|
'delete_all',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
__('delete all settings')
|
||||||
);
|
);
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'tables',
|
/* type */
|
||||||
/* action */ 'delete',
|
'tables',
|
||||||
/* ns */ 'zc_feed',
|
/* action */
|
||||||
/* desc */ __('delete table')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'zc_feed',
|
||||||
|
/* desc */
|
||||||
|
__('delete table')
|
||||||
);
|
);
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'plugins',
|
/* type */
|
||||||
/* action */ 'delete',
|
'plugins',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ __('delete plugin files')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
__('delete plugin files')
|
||||||
);
|
);
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'versions',
|
/* type */
|
||||||
/* action */ 'delete',
|
'versions',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ __('delete the version number')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
__('delete the version number')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'settings',
|
/* type */
|
||||||
/* action */ 'delete_all',
|
'settings',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ sprintf(__('delete all %s settings'), $mod_id)
|
'delete_all',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete all %s settings'), $mod_id)
|
||||||
);
|
);
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'tables',
|
/* type */
|
||||||
/* action */ 'delete',
|
'tables',
|
||||||
/* ns */ 'zc_feed',
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s table'), $mod_id)
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'zc_feed',
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s table'), $mod_id)
|
||||||
);
|
);
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'plugins',
|
/* type */
|
||||||
/* action */ 'delete',
|
'plugins',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s plugin files'), $mod_id)
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s plugin files'), $mod_id)
|
||||||
);
|
);
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'versions',
|
/* type */
|
||||||
/* action */ 'delete',
|
'versions',
|
||||||
/* ns */ $mod_id,
|
/* action */
|
||||||
/* desc */ sprintf(__('delete %s version number'), $mod_id)
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
$mod_id,
|
||||||
|
/* desc */
|
||||||
|
sprintf(__('delete %s version number'), $mod_id)
|
||||||
);
|
);
|
||||||
$this->addDirectCallback(
|
$this->addDirectCallback(
|
||||||
/* function */ 'zoneclearfeedServerUninstall',
|
/* function */
|
||||||
/* desc */ 'delete feeds relations'
|
'zoneclearfeedServerUninstall',
|
||||||
|
/* desc */
|
||||||
|
'delete feeds relations'
|
||||||
);
|
);
|
||||||
|
|
||||||
function zoneclearfeedServerUninstall($core, $id)
|
function zoneclearfeedServerUninstall($core, $id)
|
||||||
{
|
{
|
||||||
if ($id != 'zoneclearFeedServer') {
|
if ($id != 'zoneclearFeedServer') {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//...
|
//...
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -108,8 +107,8 @@ class zoneclearFeedServerWidget
|
||||||
)
|
)
|
||||||
->setting(
|
->setting(
|
||||||
'title',
|
'title',
|
||||||
__('Title:')
|
__('Title:'),
|
||||||
,__('Feeds numbers'),
|
__('Feeds numbers'),
|
||||||
'text'
|
'text'
|
||||||
)
|
)
|
||||||
->setting(
|
->setting(
|
||||||
|
@ -166,7 +165,7 @@ class zoneclearFeedServerWidget
|
||||||
$p['order'] = ($w->sortby && in_array($w->sortby, ['feed_upd_last', 'lowername', 'feed_creadt'])) ?
|
$p['order'] = ($w->sortby && in_array($w->sortby, ['feed_upd_last', 'lowername', 'feed_creadt'])) ?
|
||||||
$w->sortby . ' ' : 'feed_upd_last ';
|
$w->sortby . ' ' : 'feed_upd_last ';
|
||||||
$p['order'] .= $w->sort == 'desc' ? 'DESC' : 'ASC';
|
$p['order'] .= $w->sort == 'desc' ? 'DESC' : 'ASC';
|
||||||
$p['limit'] = abs((integer) $w->limit);
|
$p['limit'] = abs((int) $w->limit);
|
||||||
$p['feed_status'] = 1;
|
$p['feed_status'] = 1;
|
||||||
|
|
||||||
$zc = new zoneclearFeedServer($core);
|
$zc = new zoneclearFeedServer($core);
|
||||||
|
@ -257,7 +256,7 @@ class zoneclearFeedServerWidget
|
||||||
|
|
||||||
if (!$feeds->isEmpty()) {
|
if (!$feeds->isEmpty()) {
|
||||||
while ($feeds->fetch()) {
|
while ($feeds->fetch()) {
|
||||||
$count += (integer) $zc->getPostsByFeed(['feed_id' => $feeds->feed_id], true)->f(0);
|
$count += (int) $zc->getPostsByFeed(['feed_id' => $feeds->feed_id], true)->f(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$title = ($w->entry_title ? sprintf(
|
$title = ($w->entry_title ? sprintf(
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class zcfsFeedsActionsPage extends dcActionsPage
|
class zcfsFeedsActionsPage extends dcActionsPage
|
||||||
{
|
{
|
||||||
public $zcfs;
|
public $zcfs;
|
||||||
|
@ -76,7 +75,7 @@ class zcfsFeedsActionsPage extends dcActionsPage
|
||||||
$this->rs = $feeds;
|
$this->rs = $feeds;
|
||||||
} else {
|
} else {
|
||||||
$this->rs = $this->core->con->select(
|
$this->rs = $this->core->con->select(
|
||||||
"SELECT blog_id FROM " . $this->core->prefix . "blog WHERE false"
|
'SELECT blog_id FROM ' . $this->core->prefix . 'blog WHERE false'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,8 +150,7 @@ class zcfsDefaultFeedsActions
|
||||||
'%d feed has been successfully disabled.',
|
'%d feed has been successfully disabled.',
|
||||||
'%d feeds have been successfully disabled.',
|
'%d feeds have been successfully disabled.',
|
||||||
count($ids)
|
count($ids)
|
||||||
)
|
),
|
||||||
,
|
|
||||||
count($ids)
|
count($ids)
|
||||||
));
|
));
|
||||||
$ap->redirect(true);
|
$ap->redirect(true);
|
||||||
|
@ -175,13 +173,11 @@ class zcfsDefaultFeedsActions
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
|
|
||||||
$posts = $ap->zcfs->getPostsByFeed([
|
$posts = $ap->zcfs->getPostsByFeed([
|
||||||
'feed_id' => $id
|
'feed_id' => $id
|
||||||
]);
|
]);
|
||||||
|
|
||||||
while ($posts->fetch()) {
|
while ($posts->fetch()) {
|
||||||
|
|
||||||
$core->blog->delPost($posts->post_id);
|
$core->blog->delPost($posts->post_id);
|
||||||
$core->con->execute(
|
$core->con->execute(
|
||||||
'DELETE FROM ' . $core->prefix . 'meta ' .
|
'DELETE FROM ' . $core->prefix . 'meta ' .
|
||||||
|
@ -278,7 +274,7 @@ class zcfsDefaultFeedsActions
|
||||||
throw new Exception(__('No feeds selected'));
|
throw new Exception(__('No feeds selected'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cat_id = abs((integer) $post['upd_cat_id']);
|
$cat_id = abs((int) $post['upd_cat_id']);
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$cur = $ap->zcfs->openCursor();
|
$cur = $ap->zcfs->openCursor();
|
||||||
|
@ -306,7 +302,8 @@ class zcfsDefaultFeedsActions
|
||||||
__('Feeds server') => '',
|
__('Feeds server') => '',
|
||||||
$ap->getCallerTitle() => $ap->getRedirection(true),
|
$ap->getCallerTitle() => $ap->getRedirection(true),
|
||||||
__('Change category for this selection') => ''
|
__('Change category for this selection') => ''
|
||||||
]));
|
])
|
||||||
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<form action="' . $ap->getURI() . '" method="post">' .
|
'<form action="' . $ap->getURI() . '" method="post">' .
|
||||||
|
@ -332,7 +329,7 @@ class zcfsDefaultFeedsActions
|
||||||
throw new Exception(__('No feeds selected'));
|
throw new Exception(__('No feeds selected'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$upd_int = abs((integer) $post['upd_upd_int']);
|
$upd_int = abs((int) $post['upd_upd_int']);
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$cur = $ap->zcfs->openCursor();
|
$cur = $ap->zcfs->openCursor();
|
||||||
|
@ -349,9 +346,7 @@ class zcfsDefaultFeedsActions
|
||||||
count($ids)
|
count($ids)
|
||||||
));
|
));
|
||||||
$ap->redirect(true);
|
$ap->redirect(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
$ap->beginPage(
|
$ap->beginPage(
|
||||||
dcPage::breadcrumb(
|
dcPage::breadcrumb(
|
||||||
[
|
[
|
||||||
|
@ -359,7 +354,9 @@ class zcfsDefaultFeedsActions
|
||||||
__('Feeds server') => '',
|
__('Feeds server') => '',
|
||||||
$ap->getCallerTitle() => $ap->getRedirection(true),
|
$ap->getCallerTitle() => $ap->getRedirection(true),
|
||||||
__('Change update frequency for this selection') => ''
|
__('Change update frequency for this selection') => ''
|
||||||
]));
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<form action="' . $ap->getURI() . '" method="post">' .
|
'<form action="' . $ap->getURI() . '" method="post">' .
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +65,7 @@ class zoneclearFeedServer
|
||||||
$this->con->writeLock($this->table);
|
$this->con->writeLock($this->table);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$id = (integer) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
if ($id < 1) {
|
if ($id < 1) {
|
||||||
throw new Exception(__('No such ID'));
|
throw new Exception(__('No such ID'));
|
||||||
|
@ -83,6 +82,7 @@ class zoneclearFeedServer
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,7 @@ class zoneclearFeedServer
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +132,7 @@ class zoneclearFeedServer
|
||||||
public function enableFeed($id, $enable = true, $time = null)
|
public function enableFeed($id, $enable = true, $time = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$id = (integer) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
if ($id < 1) {
|
if ($id < 1) {
|
||||||
throw new Exception(__('No such ID'));
|
throw new Exception(__('No such ID'));
|
||||||
|
@ -141,9 +142,9 @@ class zoneclearFeedServer
|
||||||
$this->con->writeLock($this->table);
|
$this->con->writeLock($this->table);
|
||||||
|
|
||||||
$cur->feed_upddt = date('Y-m-d H:i:s');
|
$cur->feed_upddt = date('Y-m-d H:i:s');
|
||||||
$cur->feed_status = (integer) $enable;
|
$cur->feed_status = (int) $enable;
|
||||||
if (null !== $time) {
|
if (null !== $time) {
|
||||||
$cur->feed_upd_last = (integer) $time;
|
$cur->feed_upd_last = (int) $time;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cur->update(sprintf(
|
$cur->update(sprintf(
|
||||||
|
@ -155,6 +156,7 @@ class zoneclearFeedServer
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +172,7 @@ class zoneclearFeedServer
|
||||||
*/
|
*/
|
||||||
public function delFeed($id)
|
public function delFeed($id)
|
||||||
{
|
{
|
||||||
$id = (integer) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
if ($id < 1) {
|
if ($id < 1) {
|
||||||
throw new Exception(__('No such ID'));
|
throw new Exception(__('No such ID'));
|
||||||
|
@ -195,17 +197,15 @@ class zoneclearFeedServer
|
||||||
* @param boolean $count_only Return only result count
|
* @param boolean $count_only Return only result count
|
||||||
* @return record record instance
|
* @return record record instance
|
||||||
*/
|
*/
|
||||||
public function getPostsByFeed($params = array(), $count_only = false)
|
public function getPostsByFeed($params = [], $count_only = false)
|
||||||
{
|
{
|
||||||
if (!isset($params['feed_id'])) {
|
if (!isset($params['feed_id'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params['from'] =
|
$params['from'] = 'LEFT JOIN ' . $this->core->prefix . 'meta F ' .
|
||||||
'LEFT JOIN ' . $this->core->prefix . 'meta F ' .
|
|
||||||
'ON P.post_id = F.post_id ';
|
'ON P.post_id = F.post_id ';
|
||||||
$params['sql'] =
|
$params['sql'] = "AND P.blog_id = '" . $this->blog . "' " .
|
||||||
"AND P.blog_id = '" . $this->blog . "' " .
|
|
||||||
"AND F.meta_type = 'zoneclearfeed_id' " .
|
"AND F.meta_type = 'zoneclearfeed_id' " .
|
||||||
"AND F.meta_id = '" . $this->con->escape($params['feed_id']) . "' ";
|
"AND F.meta_id = '" . $this->con->escape($params['feed_id']) . "' ";
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ class zoneclearFeedServer
|
||||||
* @param boolean $count_only Return only result count
|
* @param boolean $count_only Return only result count
|
||||||
* @return record record instance
|
* @return record record instance
|
||||||
*/
|
*/
|
||||||
public function getFeeds($params = array(), $count_only = false)
|
public function getFeeds($params = [], $count_only = false)
|
||||||
{
|
{
|
||||||
if ($count_only) {
|
if ($count_only) {
|
||||||
$strReq = 'SELECT count(Z.feed_id) ';
|
$strReq = 'SELECT count(Z.feed_id) ';
|
||||||
|
@ -231,8 +231,7 @@ class zoneclearFeedServer
|
||||||
$content_req .= implode(', ', $params['columns']) . ', ';
|
$content_req .= implode(', ', $params['columns']) . ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strReq =
|
$strReq = 'SELECT Z.feed_id, Z.feed_creadt, Z.feed_upddt, Z.feed_type, ' .
|
||||||
'SELECT Z.feed_id, Z.feed_creadt, Z.feed_upddt, Z.feed_type, ' .
|
|
||||||
'Z.blog_id, Z.cat_id, ' .
|
'Z.blog_id, Z.cat_id, ' .
|
||||||
'Z.feed_upd_int, Z.feed_upd_last, Z.feed_status, ' .
|
'Z.feed_upd_int, Z.feed_upd_last, Z.feed_status, ' .
|
||||||
$content_req .
|
$content_req .
|
||||||
|
@ -243,8 +242,7 @@ class zoneclearFeedServer
|
||||||
'C.cat_title, C.cat_url, C.cat_desc ';
|
'C.cat_title, C.cat_url, C.cat_desc ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strReq .=
|
$strReq .= 'FROM ' . $this->table . ' Z ' .
|
||||||
'FROM ' . $this->table . ' Z ' .
|
|
||||||
'LEFT OUTER JOIN ' . $this->core->prefix . 'category C ON Z.cat_id = C.cat_id ';
|
'LEFT OUTER JOIN ' . $this->core->prefix . 'category C ON Z.cat_id = C.cat_id ';
|
||||||
|
|
||||||
if (!empty($params['from'])) {
|
if (!empty($params['from'])) {
|
||||||
|
@ -261,9 +259,9 @@ class zoneclearFeedServer
|
||||||
|
|
||||||
if (!empty($params['feed_id'])) {
|
if (!empty($params['feed_id'])) {
|
||||||
if (is_array($params['feed_id'])) {
|
if (is_array($params['feed_id'])) {
|
||||||
array_walk($params['feed_id'], function(&$v, $k) { if($v !== null) { $v = (integer) $v; }});
|
array_walk($params['feed_id'], function (&$v, $k) { if ($v !== null) { $v = (int) $v; }});
|
||||||
} else {
|
} else {
|
||||||
$params['feed_id'] = [(integer) $params['feed_id']];
|
$params['feed_id'] = [(int) $params['feed_id']];
|
||||||
}
|
}
|
||||||
$strReq .= 'AND Z.feed_id ' . $this->con->in($params['feed_id']);
|
$strReq .= 'AND Z.feed_id ' . $this->con->in($params['feed_id']);
|
||||||
}
|
}
|
||||||
|
@ -275,7 +273,7 @@ class zoneclearFeedServer
|
||||||
$strReq .= "AND Z.feed_url = '" . $this->con->escape($params['feed_url']) . "' ";
|
$strReq .= "AND Z.feed_url = '" . $this->con->escape($params['feed_url']) . "' ";
|
||||||
}
|
}
|
||||||
if (isset($params['feed_status'])) {
|
if (isset($params['feed_status'])) {
|
||||||
$strReq .= "AND Z.feed_status = " . ((integer) $params['feed_status']) . " ";
|
$strReq .= 'AND Z.feed_status = ' . ((int) $params['feed_status']) . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($params['q'])) {
|
if (!empty($params['q'])) {
|
||||||
|
@ -327,7 +325,7 @@ class zoneclearFeedServer
|
||||||
try {
|
try {
|
||||||
# Need flock function
|
# Need flock function
|
||||||
if (!function_exists('flock')) {
|
if (!function_exists('flock')) {
|
||||||
throw New Exception("Can't call php function named flock");
|
throw new Exception("Can't call php function named flock");
|
||||||
}
|
}
|
||||||
# Cache writable ?
|
# Cache writable ?
|
||||||
if (!is_writable(DC_TPL_CACHE)) {
|
if (!is_writable(DC_TPL_CACHE)) {
|
||||||
|
@ -353,18 +351,18 @@ class zoneclearFeedServer
|
||||||
if (!file_exists($cached_file)) {
|
if (!file_exists($cached_file)) {
|
||||||
!$fp = @fopen($cached_file, 'w');
|
!$fp = @fopen($cached_file, 'w');
|
||||||
if ($fp === false) {
|
if ($fp === false) {
|
||||||
throw New Exception("Can't create file");
|
throw new Exception("Can't create file");
|
||||||
}
|
}
|
||||||
fwrite($fp, '1', strlen('1'));
|
fwrite($fp, '1', strlen('1'));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
# Open file
|
# Open file
|
||||||
if (!($fp = @fopen($cached_file, 'r+'))) {
|
if (!($fp = @fopen($cached_file, 'r+'))) {
|
||||||
throw New Exception("Can't open file");
|
throw new Exception("Can't open file");
|
||||||
}
|
}
|
||||||
# Lock file
|
# Lock file
|
||||||
if (!flock($fp, LOCK_EX)) {
|
if (!flock($fp, LOCK_EX)) {
|
||||||
throw New Exception("Can't lock file");
|
throw new Exception("Can't lock file");
|
||||||
}
|
}
|
||||||
$this->lock = $fp;
|
$this->lock = $fp;
|
||||||
|
|
||||||
|
@ -378,7 +376,6 @@ class zoneclearFeedServer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlock file of update process.
|
* Unlock file of update process.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function unlockUpdate()
|
public function unlockUpdate()
|
||||||
{
|
{
|
||||||
|
@ -426,7 +423,7 @@ class zoneclearFeedServer
|
||||||
$updates = false;
|
$updates = false;
|
||||||
$loop_mem = [];
|
$loop_mem = [];
|
||||||
|
|
||||||
$limit = abs((integer) $s->zoneclearFeedServer_update_limit);
|
$limit = abs((int) $s->zoneclearFeedServer_update_limit);
|
||||||
if ($limit < 1) {
|
if ($limit < 1) {
|
||||||
$limit = 10;
|
$limit = 10;
|
||||||
}
|
}
|
||||||
|
@ -523,7 +520,7 @@ class zoneclearFeedServer
|
||||||
# Post
|
# Post
|
||||||
$cur_post->user_id = $this->core->auth->userID();
|
$cur_post->user_id = $this->core->auth->userID();
|
||||||
$cur_post->post_format = 'xhtml';
|
$cur_post->post_format = 'xhtml';
|
||||||
$cur_post->post_status = (integer) $s->zoneclearFeedServer_post_status_new;
|
$cur_post->post_status = (int) $s->zoneclearFeedServer_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;
|
||||||
|
|
||||||
|
@ -637,10 +634,16 @@ class zoneclearFeedServer
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
|
|
||||||
# Change tags case
|
# Change tags case
|
||||||
switch((integer) $s->zoneclearFeedServer_tag_case) {
|
switch ((int) $s->zoneclearFeedServer_tag_case) {
|
||||||
case 3: $tag = strtoupper($tag); break;
|
case 3: $tag = strtoupper($tag);
|
||||||
case 2: $tag = strtolower($tag); break;
|
|
||||||
case 1: $tag = ucfirst(strtolower($tag)); break;
|
break;
|
||||||
|
case 2: $tag = strtolower($tag);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 1: $tag = ucfirst(strtolower($tag));
|
||||||
|
|
||||||
|
break;
|
||||||
default: /* do nothing */ break;
|
default: /* do nothing */ break;
|
||||||
}
|
}
|
||||||
if (!in_array($tag, $formated_tags)) {
|
if (!in_array($tag, $formated_tags)) {
|
||||||
|
@ -663,11 +666,11 @@ class zoneclearFeedServer
|
||||||
$cur_post,
|
$cur_post,
|
||||||
$meta
|
$meta
|
||||||
);
|
);
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->rollback();
|
$this->con->rollback();
|
||||||
$this->enableUser(false);
|
$this->enableUser(false);
|
||||||
$this->unlockUpdate();
|
$this->unlockUpdate();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
$updates = true;
|
$updates = true;
|
||||||
|
@ -710,7 +713,7 @@ class zoneclearFeedServer
|
||||||
public static function readFeed($f)
|
public static function readFeed($f)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$feed_reader = new feedReader;
|
$feed_reader = new feedReader();
|
||||||
$feed_reader->setCacheDir(DC_TPL_CACHE);
|
$feed_reader->setCacheDir(DC_TPL_CACHE);
|
||||||
$feed_reader->setTimeout(self::$nethttp_timeout);
|
$feed_reader->setTimeout(self::$nethttp_timeout);
|
||||||
$feed_reader->setMaxRedirects(self::$nethttp_maxredirect);
|
$feed_reader->setMaxRedirects(self::$nethttp_maxredirect);
|
||||||
|
@ -868,7 +871,7 @@ class zoneclearFeedServer
|
||||||
*/
|
*/
|
||||||
public static function getPublicUrlTypes(dcCore $core)
|
public static function getPublicUrlTypes(dcCore $core)
|
||||||
{
|
{
|
||||||
$types = array();
|
$types = [];
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerPublicUrlTypes
|
# --BEHAVIOR-- zoneclearFeedServerPublicUrlTypes
|
||||||
$core->callBehavior('zoneclearFeedServerPublicUrlTypes', $types);
|
$core->callBehavior('zoneclearFeedServerPublicUrlTypes', $types);
|
||||||
|
@ -893,6 +896,6 @@ class zoneclearFeedServer
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
$cur->post_url = tweakUrls::tweakBlogURL($cur->post_url);
|
$cur->post_url = tweakUrls::tweakBlogURL($cur->post_url);
|
||||||
$core->auth->sudo(array($core->blog, 'updPost'), $id, $cur);
|
$core->auth->sudo([$core->blog, 'updPost'], $id, $cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -36,13 +35,13 @@ class zcfsFeedsList extends adminGenericList
|
||||||
$entries = [];
|
$entries = [];
|
||||||
if (isset($_REQUEST['feeds'])) {
|
if (isset($_REQUEST['feeds'])) {
|
||||||
foreach ($_REQUEST['feeds'] as $v) {
|
foreach ($_REQUEST['feeds'] as $v) {
|
||||||
$entries[(integer) $v] = true;
|
$entries[(int) $v] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$html_block =
|
$html_block = '<div class="table-outer">' .
|
||||||
'<div class="table-outer">' .
|
|
||||||
'<table>' .
|
'<table>' .
|
||||||
'<caption>' . ($filter ?
|
'<caption>' . (
|
||||||
|
$filter ?
|
||||||
sprintf(__('List of %s feeds matching the filter.'), $this->rs_count) :
|
sprintf(__('List of %s feeds matching the filter.'), $this->rs_count) :
|
||||||
sprintf(__('List of feeds (%s)'), $this->rs_count)
|
sprintf(__('List of feeds (%s)'), $this->rs_count)
|
||||||
) . '</caption>';
|
) . '</caption>';
|
||||||
|
@ -112,12 +111,14 @@ class zcfsFeedsList extends adminGenericList
|
||||||
array_search($this->rs->feed_upd_int, $combo_upd_int) .
|
array_search($this->rs->feed_upd_int, $combo_upd_int) .
|
||||||
'</td>',
|
'</td>',
|
||||||
'update' => '<td class="nowrap minimal count">' .
|
'update' => '<td class="nowrap minimal count">' .
|
||||||
($this->rs->feed_upd_last < 1 ?
|
(
|
||||||
|
$this->rs->feed_upd_last < 1 ?
|
||||||
__('never') :
|
__('never') :
|
||||||
dt::str(__('%Y-%m-%d %H:%M'), $this->rs->feed_upd_last, $this->rs->zc->core->auth->getInfo('user_tz'))
|
dt::str(__('%Y-%m-%d %H:%M'), $this->rs->feed_upd_last, $this->rs->zc->core->auth->getInfo('user_tz'))
|
||||||
) . '</td>',
|
) . '</td>',
|
||||||
'entries' => '<td class="nowrap minimal count">' .
|
'entries' => '<td class="nowrap minimal count">' .
|
||||||
($entries_count ?
|
(
|
||||||
|
$entries_count ?
|
||||||
'<a href="' . $url . '#entries" title="' . __('View entries') . '">' . $entries_count . '</a>' :
|
'<a href="' . $url . '#entries" title="' . __('View entries') . '">' . $entries_count . '</a>' :
|
||||||
$entries_count
|
$entries_count
|
||||||
) . '</td>',
|
) . '</td>',
|
||||||
|
@ -147,7 +148,8 @@ class zcfsEntriesList extends adminGenericList
|
||||||
public function display($page, $nb_per_page, $base_url, $enclose_block = '', $filter = false)
|
public function display($page, $nb_per_page, $base_url, $enclose_block = '', $filter = false)
|
||||||
{
|
{
|
||||||
if ($this->rs->isEmpty()) {
|
if ($this->rs->isEmpty()) {
|
||||||
echo '<p><strong>' . ($filter ?
|
echo '<p><strong>' . (
|
||||||
|
$filter ?
|
||||||
__('No entries matches the filter') :
|
__('No entries matches the filter') :
|
||||||
__('No entries')
|
__('No entries')
|
||||||
) . '</strong></p>';
|
) . '</strong></p>';
|
||||||
|
@ -158,13 +160,14 @@ class zcfsEntriesList extends adminGenericList
|
||||||
$entries = [];
|
$entries = [];
|
||||||
if (isset($_REQUEST['feeds'])) {
|
if (isset($_REQUEST['feeds'])) {
|
||||||
foreach ($_REQUEST['feeds'] as $v) {
|
foreach ($_REQUEST['feeds'] as $v) {
|
||||||
$entries[(integer) $v] = true;
|
$entries[(int) $v] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$html_block = '<div class="table-outer clear">' .
|
$html_block = '<div class="table-outer clear">' .
|
||||||
'<table>' .
|
'<table>' .
|
||||||
'<caption>' . ($filter ?
|
'<caption>' . (
|
||||||
|
$filter ?
|
||||||
sprintf(__('List of %s entries matching the filter.'), $this->rs_count) :
|
sprintf(__('List of %s entries matching the filter.'), $this->rs_count) :
|
||||||
sprintf(__('List of entries (%s)'), $this->rs_count)
|
sprintf(__('List of entries (%s)'), $this->rs_count)
|
||||||
) . '</caption>';
|
) . '</caption>';
|
||||||
|
@ -244,7 +247,7 @@ class zcfsEntriesList extends adminGenericList
|
||||||
|
|
||||||
$cols = [
|
$cols = [
|
||||||
'check' => '<td class="nowrap minimal">' .
|
'check' => '<td class="nowrap minimal">' .
|
||||||
form::checkbox(array('entries[]'), $this->rs->post_id, '', '', '', !$this->rs->isEditable()).'</td>',
|
form::checkbox(['entries[]'], $this->rs->post_id, '', '', '', !$this->rs->isEditable()) . '</td>',
|
||||||
'title' => '<td scope="row" class="maximal"><a href="' .
|
'title' => '<td scope="row" class="maximal"><a href="' .
|
||||||
$this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '" ' .
|
$this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '" ' .
|
||||||
'title="' . html::escapeHTML($this->rs->getURL()) . '">' .
|
'title="' . html::escapeHTML($this->rs->getURL()) . '">' .
|
||||||
|
@ -301,6 +304,7 @@ class adminZcfsPostFilter extends adminGenericFilter
|
||||||
public function getPostUserFilter(): ?dcAdminFilter
|
public function getPostUserFilter(): ?dcAdminFilter
|
||||||
{
|
{
|
||||||
$users = null;
|
$users = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$users = $this->core->blog->getPostsUsers();
|
$users = $this->core->blog->getPostsUsers();
|
||||||
if ($users->isEmpty()) {
|
if ($users->isEmpty()) {
|
||||||
|
@ -308,6 +312,7 @@ class adminZcfsPostFilter extends adminGenericFilter
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->core->error->add($e->getMessage());
|
$this->core->error->add($e->getMessage());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +335,7 @@ class adminZcfsPostFilter extends adminGenericFilter
|
||||||
public function getPostCategoriesFilter(): ?dcAdminFilter
|
public function getPostCategoriesFilter(): ?dcAdminFilter
|
||||||
{
|
{
|
||||||
$categories = null;
|
$categories = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$categories = $this->core->blog->getCategories();
|
$categories = $this->core->blog->getCategories();
|
||||||
if ($categories->isEmpty()) {
|
if ($categories->isEmpty()) {
|
||||||
|
@ -337,6 +343,7 @@ class adminZcfsPostFilter extends adminGenericFilter
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->core->error->add($e->getMessage());
|
$this->core->error->add($e->getMessage());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +385,7 @@ class adminZcfsPostFilter extends adminGenericFilter
|
||||||
public function getPostMonthFilter(): ?dcAdminFilter
|
public function getPostMonthFilter(): ?dcAdminFilter
|
||||||
{
|
{
|
||||||
$dates = null;
|
$dates = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dates = $this->core->blog->getDates(['type' => 'month']);
|
$dates = $this->core->blog->getDates(['type' => 'month']);
|
||||||
if ($dates->isEmpty()) {
|
if ($dates->isEmpty()) {
|
||||||
|
@ -385,6 +393,7 @@ class adminZcfsPostFilter extends adminGenericFilter
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->core->error->add($e->getMessage());
|
$this->core->error->add($e->getMessage());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
69
index.php
69
index.php
|
@ -10,13 +10,11 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($core->getVersion('zoneclearFeedServer') !=
|
if ($core->getVersion('zoneclearFeedServer') != $core->plugins->moduleInfo('zoneclearFeedServer', 'version')
|
||||||
$core->plugins->moduleInfo('zoneclearFeedServer', 'version')
|
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +56,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
$combo_status = $zcfs->getAllStatus();
|
$combo_status = $zcfs->getAllStatus();
|
||||||
$combo_upd_int = $zcfs->getAllUpdateInterval();
|
$combo_upd_int = $zcfs->getAllUpdateInterval();
|
||||||
$combo_categories = ['-' => ''];
|
$combo_categories = ['-' => ''];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$categories = $core->blog->getCategories(['post_type' => 'post']);
|
$categories = $core->blog->getCategories(['post_type' => 'post']);
|
||||||
while ($categories->fetch()) {
|
while ($categories->fetch()) {
|
||||||
|
@ -92,29 +91,45 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
$feed_status = $feed->feed_status;
|
$feed_status = $feed->feed_status;
|
||||||
$feed_upd_int = $feed->feed_upd_int;
|
$feed_upd_int = $feed->feed_upd_int;
|
||||||
|
|
||||||
$next_params = array(
|
$next_params = [
|
||||||
'sql' => 'AND feed_id < ' . $feed_id . ' ',
|
'sql' => 'AND feed_id < ' . $feed_id . ' ',
|
||||||
'limit' => 1
|
'limit' => 1
|
||||||
);
|
];
|
||||||
$next_rs = $zcfs->getFeeds($next_params);
|
$next_rs = $zcfs->getFeeds($next_params);
|
||||||
$prev_params = array(
|
$prev_params = [
|
||||||
'sql' => 'AND feed_id > ' . $feed_id . ' ',
|
'sql' => 'AND feed_id > ' . $feed_id . ' ',
|
||||||
'limit' => 1
|
'limit' => 1
|
||||||
);
|
];
|
||||||
$prev_rs = $zcfs->getFeeds($prev_params);
|
$prev_rs = $zcfs->getFeeds($prev_params);
|
||||||
|
|
||||||
if (!$next_rs->isEmpty()) {
|
if (!$next_rs->isEmpty()) {
|
||||||
$next_link = sprintf($feed_link, $next_rs->feed_id,
|
$next_link = sprintf(
|
||||||
html::escapeHTML($next_rs->feed_name), __('next feed') . ' »');
|
$feed_link,
|
||||||
$next_headlink = sprintf($feed_headlink, 'next',
|
$next_rs->feed_id,
|
||||||
html::escapeHTML($next_rs->feed_name), $next_rs->feed_id);
|
html::escapeHTML($next_rs->feed_name),
|
||||||
|
__('next feed') . ' »'
|
||||||
|
);
|
||||||
|
$next_headlink = sprintf(
|
||||||
|
$feed_headlink,
|
||||||
|
'next',
|
||||||
|
html::escapeHTML($next_rs->feed_name),
|
||||||
|
$next_rs->feed_id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$prev_rs->isEmpty()) {
|
if (!$prev_rs->isEmpty()) {
|
||||||
$prev_link = sprintf($feed_link, $prev_rs->feed_id,
|
$prev_link = sprintf(
|
||||||
html::escapeHTML($prev_rs->feed_name), '« ' . __('previous feed'));
|
$feed_link,
|
||||||
$prev_headlink = sprintf($feed_headlink, 'previous',
|
$prev_rs->feed_id,
|
||||||
html::escapeHTML($prev_rs->feed_name), $prev_rs->feed_id);
|
html::escapeHTML($prev_rs->feed_name),
|
||||||
|
'« ' . __('previous feed')
|
||||||
|
);
|
||||||
|
$prev_headlink = sprintf(
|
||||||
|
$feed_headlink,
|
||||||
|
'previous',
|
||||||
|
html::escapeHTML($prev_rs->feed_name),
|
||||||
|
$prev_rs->feed_id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +148,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
$feed_cat_id = $_POST['feed_cat_id'];
|
$feed_cat_id = $_POST['feed_cat_id'];
|
||||||
$feed_upd_int = $_POST['feed_upd_int'];
|
$feed_upd_int = $_POST['feed_upd_int'];
|
||||||
if (isset($_POST['feed_status'])) {
|
if (isset($_POST['feed_status'])) {
|
||||||
$feed_status = (integer) $_POST['feed_status'];
|
$feed_status = (int) $_POST['feed_status'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$testfeed_params['feed_feed'] = $feed_feed;
|
$testfeed_params['feed_feed'] = $feed_feed;
|
||||||
|
@ -174,10 +189,10 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
$cur->feed_feed = $feed_feed;
|
$cur->feed_feed = $feed_feed;
|
||||||
$cur->feed_lang = $feed_lang;
|
$cur->feed_lang = $feed_lang;
|
||||||
$cur->feed_tags = $feed_tags;
|
$cur->feed_tags = $feed_tags;
|
||||||
$cur->feed_get_tags = (integer) $feed_get_tags;
|
$cur->feed_get_tags = (int) $feed_get_tags;
|
||||||
$cur->cat_id = $feed_cat_id != '' ? (integer) $feed_cat_id : null;
|
$cur->cat_id = $feed_cat_id != '' ? (int) $feed_cat_id : null;
|
||||||
$cur->feed_status = (integer) $feed_status;
|
$cur->feed_status = (int) $feed_status;
|
||||||
$cur->feed_upd_int = (integer) $feed_upd_int;
|
$cur->feed_upd_int = (int) $feed_upd_int;
|
||||||
|
|
||||||
# Update feed
|
# Update feed
|
||||||
if ($feed_id) {
|
if ($feed_id) {
|
||||||
|
@ -194,7 +209,8 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
__('Feed successfully updated.')
|
__('Feed successfully updated.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect(
|
$core->adminurl->redirect(
|
||||||
'admin.plugin.zoneclearFeedServer', ['part' => 'feed', 'feed_id' => $feed_id]
|
'admin.plugin.zoneclearFeedServer',
|
||||||
|
['part' => 'feed', 'feed_id' => $feed_id]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
|
@ -213,7 +229,8 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
__('Feed successfully created.')
|
__('Feed successfully created.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect(
|
$core->adminurl->redirect(
|
||||||
'admin.plugin.zoneclearFeedServer', ['part' => 'feed', 'feed_id' => $return_id]
|
'admin.plugin.zoneclearFeedServer',
|
||||||
|
['part' => 'feed', 'feed_id' => $return_id]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
|
@ -411,7 +428,8 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
echo '<div class="multi-part" title="' . __('Entries') . '" id="entries">';
|
echo '<div class="multi-part" title="' . __('Entries') . '" id="entries">';
|
||||||
|
|
||||||
# show filters
|
# show filters
|
||||||
$post_filter->display(['admin.plugin.zoneclearFeedServer','#entries'],
|
$post_filter->display(
|
||||||
|
['admin.plugin.zoneclearFeedServer','#entries'],
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
|
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
|
||||||
'part' => 'feed',
|
'part' => 'feed',
|
||||||
'feed_id' => $feed_id
|
'feed_id' => $feed_id
|
||||||
|
@ -453,7 +471,6 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
# All feeds
|
# All feeds
|
||||||
#
|
#
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
# actions
|
# actions
|
||||||
$feeds_actions_page = new zcfsFeedsActionsPage(
|
$feeds_actions_page = new zcfsFeedsActionsPage(
|
||||||
|
@ -512,7 +529,9 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', ['part', 'feeds'])
|
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', ['part', 'feeds'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$feeds_list->feedsDisplay($feeds_filter->page, $feeds_filter->nb,
|
$feeds_list->feedsDisplay(
|
||||||
|
$feeds_filter->page,
|
||||||
|
$feeds_filter->nb,
|
||||||
'<form action="' . $core->adminurl->get('admin.plugin.zoneclearFeedServer', ['part', 'feeds']) . '" method="post" id="form-actions">' .
|
'<form action="' . $core->adminurl->get('admin.plugin.zoneclearFeedServer', ['part', 'feeds']) . '" method="post" id="form-actions">' .
|
||||||
'%s' .
|
'%s' .
|
||||||
'<div class="two-cols">' .
|
'<div class="two-cols">' .
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
#
|
* @brief zoneclearFeedServer, a plugin for Dotclear 2
|
||||||
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
|
*
|
||||||
#
|
* @package Dotclear
|
||||||
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
#
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
*/
|
||||||
|
if (!isset($__resources['help']['zoneclearFeedServer'])) {
|
||||||
if (!isset($__resources['help']['zoneclearFeedServer']))
|
|
||||||
{
|
|
||||||
$__resources['help']['zoneclearFeedServer'] = dirname(__FILE__) . '/help/zoneclearFeedServer.html';
|
$__resources['help']['zoneclearFeedServer'] = dirname(__FILE__) . '/help/zoneclearFeedServer.html';
|
||||||
}
|
}
|
|
@ -1,17 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
#
|
* @brief zoneclearFeedServer, a plugin for Dotclear 2
|
||||||
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
|
*
|
||||||
#
|
* @package Dotclear
|
||||||
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Christian Denis
|
||||||
#
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
*/
|
||||||
|
if (!isset($__resources['help']['zoneclearFeedServer'])) {
|
||||||
if (!isset($__resources['help']['zoneclearFeedServer']))
|
|
||||||
{
|
|
||||||
$__resources['help']['zoneclearFeedServer'] = dirname(__FILE__) . '/help/zoneclearFeedServer.html';
|
$__resources['help']['zoneclearFeedServer'] = dirname(__FILE__) . '/help/zoneclearFeedServer.html';
|
||||||
}
|
}
|
Loading…
Reference in a new issue