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