prepare to DC 2.24, fix feed update
This commit is contained in:
parent
e55c5c5661
commit
9be9f44757
105
_admin.php
105
_admin.php
@ -14,39 +14,38 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('zoneclearFeedServer');
|
dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/_widgets.php';
|
require_once __DIR__ . '/_widgets.php';
|
||||||
|
|
||||||
$_menu['Plugins']->addItem(
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
__('Feeds server'),
|
__('Feeds server'),
|
||||||
$core->adminurl->get('admin.plugin.zoneclearFeedServer'),
|
dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer'),
|
||||||
dcPage::getPF('zoneclearFeedServer/icon.png'),
|
dcPage::getPF('zoneclearFeedServer/icon.png'),
|
||||||
preg_match(
|
preg_match(
|
||||||
'/' . preg_quote($core->adminurl->get('admin.plugin.zoneclearFeedServer')) . '(&.*)?$/',
|
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer')) . '(&.*)?$/',
|
||||||
$_SERVER['REQUEST_URI']
|
$_SERVER['REQUEST_URI']
|
||||||
),
|
),
|
||||||
$core->auth->check('admin', $core->blog->id)
|
dcCore::app()->auth->check('admin', dcCore::app()->blog->id)
|
||||||
);
|
);
|
||||||
|
|
||||||
# Delete related info about feed post in meta table
|
# Delete related info about feed post in meta table
|
||||||
$core->addBehavior('adminBeforePostDelete', ['zcfsAdminBehaviors', 'adminBeforePostDelete']);
|
dcCore::app()->addBehavior('adminBeforePostDelete', ['zcfsAdminBehaviors', 'adminBeforePostDelete']);
|
||||||
|
|
||||||
if ($core->auth->check('admin', $core->blog->id)) {
|
|
||||||
|
|
||||||
|
if (dcCore::app()->auth->check('admin', dcCore::app()->blog->id)) {
|
||||||
# Dashboard icon
|
# Dashboard icon
|
||||||
$core->addBehavior('adminDashboardFavorites', ['zcfsAdminBehaviors', 'adminDashboardFavorites']);
|
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['zcfsAdminBehaviors', 'adminDashboardFavorites']);
|
||||||
# User pref
|
# User pref
|
||||||
$core->addBehavior('adminColumnsLists', ['zcfsAdminBehaviors', 'adminColumnsLists']);
|
dcCore::app()->addBehavior('adminColumnsListsV2', ['zcfsAdminBehaviors', 'adminColumnsLists']);
|
||||||
$core->addBehavior('adminFiltersLists', ['zcfsAdminBehaviors', 'adminFiltersLists']);
|
dcCore::app()->addBehavior('adminFiltersListsV2', ['zcfsAdminBehaviors', 'adminFiltersLists']);
|
||||||
# Add info about feed on post page sidebar
|
# Add info about feed on post page sidebar
|
||||||
$core->addBehavior('adminPostHeaders', ['zcfsAdminBehaviors', 'adminPostHeaders']);
|
dcCore::app()->addBehavior('adminPostHeaders', ['zcfsAdminBehaviors', 'adminPostHeaders']);
|
||||||
$core->addBehavior('adminPostFormItems', ['zcfsAdminBehaviors', 'adminPostFormItems']);
|
dcCore::app()->addBehavior('adminPostFormItems', ['zcfsAdminBehaviors', 'adminPostFormItems']);
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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(dcCore::app()->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
|
||||||
$core->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
dcCore::app()->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +62,7 @@ class zcfsAdminBehaviors
|
|||||||
__('Name') => 'lowername',
|
__('Name') => 'lowername',
|
||||||
__('Frequency') => 'feed_upd_int',
|
__('Frequency') => 'feed_upd_int',
|
||||||
__('Update date') => 'feed_upd_last',
|
__('Update date') => 'feed_upd_last',
|
||||||
__('Status') => 'feed_status'
|
__('Status') => 'feed_status',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,26 +73,25 @@ class zcfsAdminBehaviors
|
|||||||
__('Title') => 'post_title',
|
__('Title') => 'post_title',
|
||||||
__('Category') => 'cat_title',
|
__('Category') => 'cat_title',
|
||||||
__('Author') => 'user_id',
|
__('Author') => 'user_id',
|
||||||
__('Status') => 'post_status'
|
__('Status') => 'post_status',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Favorites.
|
* Favorites.
|
||||||
*
|
*
|
||||||
* @param dcCore $core dcCore instance
|
* @param dcFavorites $favs Array of favorites
|
||||||
* @param arrayObject $favs Array of favorites
|
|
||||||
*/
|
*/
|
||||||
public static function adminDashboardFavorites(dcCore $core, dcFavorites $favs)
|
public static function adminDashboardFavorites(dcFavorites $favs)
|
||||||
{
|
{
|
||||||
$favs->register('zcfs', [
|
$favs->register('zcfs', [
|
||||||
'title' => __('Feeds server'),
|
'title' => __('Feeds server'),
|
||||||
'url' => $core->adminurl->get('admin.plugin.zoneclearFeedServer'),
|
'url' => dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer'),
|
||||||
'small-icon' => dcPage::getPF('zoneclearFeedServer/icon.png'),
|
'small-icon' => dcPage::getPF('zoneclearFeedServer/icon.png'),
|
||||||
'large-icon' => dcPage::getPF('zoneclearFeedServer/icon-big.png'),
|
'large-icon' => dcPage::getPF('zoneclearFeedServer/icon-big.png'),
|
||||||
'permissions' => 'usage,contentadmin',
|
'permissions' => 'usage,contentadmin',
|
||||||
'active_cb' => ['zcfsAdminBehaviors', 'adminDashboardFavoritesActive'],
|
'active_cb' => ['zcfsAdminBehaviors', 'adminDashboardFavoritesActive'],
|
||||||
'dashboard_cb' => ['zcfsAdminBehaviors', 'adminDashboardFavoritesCallback']
|
'dashboard_cb' => ['zcfsAdminBehaviors', 'adminDashboardFavoritesCallback'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,12 +111,11 @@ class zcfsAdminBehaviors
|
|||||||
/**
|
/**
|
||||||
* Favorites hack.
|
* Favorites hack.
|
||||||
*
|
*
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
* @param arrayObject $fav Fav attributes
|
* @param arrayObject $fav Fav attributes
|
||||||
*/
|
*/
|
||||||
public static function adminDashboardFavoritesCallback(dcCore $core, $fav)
|
public static function adminDashboardFavoritesCallback($fav)
|
||||||
{
|
{
|
||||||
$zcfs = new zoneclearFeedServer($core);
|
$zcfs = new zoneclearFeedServer();
|
||||||
|
|
||||||
$count = $zcfs->getFeeds(['feed_status' => '0'], true)->f(0);
|
$count = $zcfs->getFeeds(['feed_status' => '0'], true)->f(0);
|
||||||
if (!$count) {
|
if (!$count) {
|
||||||
@ -127,7 +124,7 @@ class zcfsAdminBehaviors
|
|||||||
|
|
||||||
$fav['title'] .= '<br />' . sprintf(__('%s feed disabled', '%s feeds disabled', $count), $count);
|
$fav['title'] .= '<br />' . sprintf(__('%s feed disabled', '%s feeds disabled', $count), $count);
|
||||||
$fav['large-icon'] = dcPage::getPF('zoneclearFeedServer/icon-big-update.png');
|
$fav['large-icon'] = dcPage::getPF('zoneclearFeedServer/icon-big-update.png');
|
||||||
$fav['url'] = $core->adminurl->get(
|
$fav['url'] = dcCore::app()->adminurl->get(
|
||||||
'admin.plugin.zoneclearFeedServer',
|
'admin.plugin.zoneclearFeedServer',
|
||||||
['part' => 'feeds', 'sortby' => 'feed_status', 'order' => 'asc']
|
['part' => 'feeds', 'sortby' => 'feed_status', 'order' => 'asc']
|
||||||
);
|
);
|
||||||
@ -136,10 +133,9 @@ class zcfsAdminBehaviors
|
|||||||
/**
|
/**
|
||||||
* User pref columns lists.
|
* User pref columns lists.
|
||||||
*
|
*
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
* @param arrayObject $cols Columns
|
* @param arrayObject $cols Columns
|
||||||
*/
|
*/
|
||||||
public static function adminColumnsLists(dcCore $core, $cols)
|
public static function adminColumnsLists($cols)
|
||||||
{
|
{
|
||||||
$cols['zcfs_feeds'] = [
|
$cols['zcfs_feeds'] = [
|
||||||
__('Feeds server: Feeds'),
|
__('Feeds server: Feeds'),
|
||||||
@ -147,40 +143,39 @@ class zcfsAdminBehaviors
|
|||||||
'desc' => [true, __('Feed')],
|
'desc' => [true, __('Feed')],
|
||||||
'period' => [true, __('Frequency')],
|
'period' => [true, __('Frequency')],
|
||||||
'update' => [true, __('Last update')],
|
'update' => [true, __('Last update')],
|
||||||
'entries' => [true, __('Entries')]
|
'entries' => [true, __('Entries')],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
$cols['zcfs_entries'] = [
|
$cols['zcfs_entries'] = [
|
||||||
__('Feeds server: Entries'),
|
__('Feeds server: Entries'),
|
||||||
[
|
[
|
||||||
'date' => [true, __('Date')],
|
'date' => [true, __('Date')],
|
||||||
'category' => [true, __('Category')],
|
'category' => [true, __('Category')],
|
||||||
'author' => [true, __('Author')]
|
'author' => [true, __('Author')],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User pref filters options.
|
* User pref filters options.
|
||||||
*
|
*
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
* @param arrayObject $sorts Sort options
|
* @param arrayObject $sorts Sort options
|
||||||
*/
|
*/
|
||||||
public static function adminFiltersLists(dcCore $core, $sorts)
|
public static function adminFiltersLists($sorts)
|
||||||
{
|
{
|
||||||
$sorts['zcfs_feeds'] = [
|
$sorts['zcfs_feeds'] = [
|
||||||
__('Feeds server: Feeds'),
|
__('Feeds server: Feeds'),
|
||||||
self::feedsSortbyCombo(),
|
self::feedsSortbyCombo(),
|
||||||
'lowername',
|
'lowername',
|
||||||
'asc',
|
'asc',
|
||||||
[__('feeds per page'), 30]
|
[__('feeds per page'), 30],
|
||||||
];
|
];
|
||||||
$sorts['zcfs_entries'] = [
|
$sorts['zcfs_entries'] = [
|
||||||
__('Feeds server: Entries'),
|
__('Feeds server: Entries'),
|
||||||
self::entriesSortbyCombo(),
|
self::entriesSortbyCombo(),
|
||||||
'post_dt',
|
'post_dt',
|
||||||
'desc',
|
'desc',
|
||||||
[__('entries per page'), 30]
|
[__('entries per page'), 30],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,50 +202,48 @@ class zcfsAdminBehaviors
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $core;
|
$url = dcCore::app()->meta->getMetadata([
|
||||||
|
|
||||||
$url = $core->meta->getMetadata([
|
|
||||||
'post_id' => $post->post_id,
|
'post_id' => $post->post_id,
|
||||||
'meta_type' => 'zoneclearfeed_url',
|
'meta_type' => 'zoneclearfeed_url',
|
||||||
'limit' => 1
|
'limit' => 1,
|
||||||
]);
|
]);
|
||||||
$url = $url->isEmpty() ? '' : $url->meta_id;
|
$url = $url->isEmpty() ? '' : $url->meta_id;
|
||||||
if (!$url) {
|
if (!$url) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$author = $core->meta->getMetadata([
|
$author = dcCore::app()->meta->getMetadata([
|
||||||
'post_id' => $post->post_id,
|
'post_id' => $post->post_id,
|
||||||
'meta_type' => 'zoneclearfeed_author',
|
'meta_type' => 'zoneclearfeed_author',
|
||||||
'limit' => 1
|
'limit' => 1,
|
||||||
]);
|
]);
|
||||||
$author = $author->isEmpty() ? '' : $author->meta_id;
|
$author = $author->isEmpty() ? '' : $author->meta_id;
|
||||||
|
|
||||||
$site = $core->meta->getMetadata([
|
$site = dcCore::app()->meta->getMetadata([
|
||||||
'post_id' => $post->post_id,
|
'post_id' => $post->post_id,
|
||||||
'meta_type' => 'zoneclearfeed_site',
|
'meta_type' => 'zoneclearfeed_site',
|
||||||
'limit' => 1
|
'limit' => 1,
|
||||||
]);
|
]);
|
||||||
$site = $site->isEmpty() ? '' : $site->meta_id;
|
$site = $site->isEmpty() ? '' : $site->meta_id;
|
||||||
|
|
||||||
$sitename = $core->meta->getMetadata([
|
$sitename = dcCore::app()->meta->getMetadata([
|
||||||
'post_id' => $post->post_id,
|
'post_id' => $post->post_id,
|
||||||
'meta_type' => 'zoneclearfeed_sitename',
|
'meta_type' => 'zoneclearfeed_sitename',
|
||||||
'limit' => 1
|
'limit' => 1,
|
||||||
]);
|
]);
|
||||||
$sitename = $sitename->isEmpty() ? '' : $sitename->meta_id;
|
$sitename = $sitename->isEmpty() ? '' : $sitename->meta_id;
|
||||||
|
|
||||||
$edit = '';
|
$edit = '';
|
||||||
if ($core->auth->check('admin', $core->blog->id)) {
|
if (dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)) {
|
||||||
$fid = $core->meta->getMetadata([
|
$fid = dcCore::app()->meta->getMetadata([
|
||||||
'post_id' => $post->post_id,
|
'post_id' => $post->post_id,
|
||||||
'meta_type' => 'zoneclearfeed_id',
|
'meta_type' => 'zoneclearfeed_id',
|
||||||
'limit' => 1
|
'limit' => 1,
|
||||||
]);
|
]);
|
||||||
if (!$fid->isEmpty()) {
|
if (!$fid->isEmpty()) {
|
||||||
$edit = sprintf(
|
$edit = sprintf(
|
||||||
'<p><a href="%s">%s</a></p>',
|
'<p><a href="%s">%s</a></p>',
|
||||||
$core->adminurl->get(
|
dcCore::app()->adminurl->get(
|
||||||
'admin.plugin.zoneclearFeedServer',
|
'admin.plugin.zoneclearFeedServer',
|
||||||
['part' => 'feed', 'feed_id' => $fid->meta_id]
|
['part' => 'feed', 'feed_id' => $fid->meta_id]
|
||||||
),
|
),
|
||||||
@ -276,17 +269,15 @@ class zcfsAdminBehaviors
|
|||||||
*/
|
*/
|
||||||
public static function adminBeforePostDelete($post_id)
|
public static function adminBeforePostDelete($post_id)
|
||||||
{
|
{
|
||||||
global $core;
|
dcCore::app()->con->execute(
|
||||||
|
'DELETE FROM ' . dcCore::app()->prefix . dcMeta::META_TABLE_NAME . ' ' .
|
||||||
$core->con->execute(
|
|
||||||
'DELETE FROM ' . $core->prefix . 'meta ' .
|
|
||||||
'WHERE post_id = ' . ((int) $post_id) . ' ' .
|
'WHERE post_id = ' . ((int) $post_id) . ' ' .
|
||||||
'AND meta_type ' . $core->con->in([
|
'AND meta_type ' . dcCore::app()->con->in([
|
||||||
'zoneclearfeed_url',
|
'zoneclearfeed_url',
|
||||||
'zoneclearfeed_author',
|
'zoneclearfeed_author',
|
||||||
'zoneclearfeed_site',
|
'zoneclearfeed_site',
|
||||||
'zoneclearfeed_sitename',
|
'zoneclearfeed_sitename',
|
||||||
'zoneclearfeed_id'
|
'zoneclearfeed_id',
|
||||||
]) . ' '
|
]) . ' '
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
32
_config.php
32
_config.php
@ -14,11 +14,11 @@ if (!defined('DC_CONTEXT_MODULE')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$redir = empty($_REQUEST['redir']) ? $list->getURL() . '#plugins' : $_REQUEST['redir'];
|
$redir = empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];
|
||||||
|
|
||||||
# -- Get settings --
|
# -- Get settings --
|
||||||
$core->blog->settings->addNamespace('zoneclearFeedServer');
|
dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
|
||||||
$s = $core->blog->settings->zoneclearFeedServer;
|
$s = dcCore::app()->blog->settings->zoneclearFeedServer;
|
||||||
|
|
||||||
$active = (bool) $s->zoneclearFeedServer_active;
|
$active = (bool) $s->zoneclearFeedServer_active;
|
||||||
$pub_active = (bool) $s->zoneclearFeedServer_pub_active;
|
$pub_active = (bool) $s->zoneclearFeedServer_pub_active;
|
||||||
@ -41,7 +41,7 @@ if (!is_array($post_title_redir)) {
|
|||||||
$post_title_redir = [];
|
$post_title_redir = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$zc = new zoneclearFeedServer($core);
|
$zc = new zoneclearFeedServer();
|
||||||
|
|
||||||
# -- Set settings --
|
# -- Set settings --
|
||||||
if (!empty($_POST['save'])) {
|
if (!empty($_POST['save'])) {
|
||||||
@ -72,17 +72,17 @@ if (!empty($_POST['save'])) {
|
|||||||
$s->put('zoneclearFeedServer_post_title_redir', serialize($post_title_redir));
|
$s->put('zoneclearFeedServer_post_title_redir', serialize($post_title_redir));
|
||||||
$s->put('zoneclearFeedServer_user', $feeduser);
|
$s->put('zoneclearFeedServer_user', $feeduser);
|
||||||
|
|
||||||
$core->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Configuration successfully updated.')
|
__('Configuration successfully updated.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect(
|
dcCore::app()->adminurl->redirect(
|
||||||
'admin.plugins',
|
'admin.plugins',
|
||||||
['module' => 'zoneclearFeedServer', 'conf' => 1, 'redir' => $list->getRedir()]
|
['module' => 'zoneclearFeedServer', 'conf' => 1, 'redir' => dcCore::app()->admin->list->getRedir()]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,20 +92,20 @@ $combo_pubupd = [
|
|||||||
__('Disable') => 0,
|
__('Disable') => 0,
|
||||||
__('Before display') => 1,
|
__('Before display') => 1,
|
||||||
__('After display') => 2,
|
__('After display') => 2,
|
||||||
__('Through Ajax') => 3
|
__('Through Ajax') => 3,
|
||||||
];
|
];
|
||||||
$combo_status = [
|
$combo_status = [
|
||||||
__('Unpublished') => 0,
|
__('Unpublished') => 0,
|
||||||
__('Published') => 1
|
__('Published') => 1,
|
||||||
];
|
];
|
||||||
$combo_tagcase = [
|
$combo_tagcase = [
|
||||||
__('Keep source case') => 0,
|
__('Keep source case') => 0,
|
||||||
__('First upper case') => 1,
|
__('First upper case') => 1,
|
||||||
__('All lower case') => 2,
|
__('All lower case') => 2,
|
||||||
__('All upper case') => 3
|
__('All upper case') => 3,
|
||||||
];
|
];
|
||||||
|
|
||||||
$pub_page_url = $core->blog->url . $core->url->getBase('zoneclearFeedsPage');
|
$pub_page_url = dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage');
|
||||||
|
|
||||||
# -- Display form --
|
# -- Display form --
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ __('Enable plugin') . '</label></p>
|
|||||||
|
|
||||||
<div class="fieldset">';
|
<div class="fieldset">';
|
||||||
|
|
||||||
if ($core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
|
if (dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
|
||||||
echo sprintf(
|
echo sprintf(
|
||||||
'<p><a class="onblog_link outgoing" href="%s" title="%s">%s <img alt="" src="images/outgoing-link.svg"></a></p>',
|
'<p><a class="onblog_link outgoing" href="%s" title="%s">%s <img alt="" src="images/outgoing-link.svg"></a></p>',
|
||||||
$pub_page_url,
|
$pub_page_url,
|
||||||
@ -168,7 +168,7 @@ form::checkbox('pub_active', 1, $pub_active) . __('Enable public page') . '</lab
|
|||||||
|
|
||||||
<p>' . __('Redirect to original post on:') . '</p><ul>';
|
<p>' . __('Redirect to original post on:') . '</p><ul>';
|
||||||
|
|
||||||
foreach ($zc->getPublicUrlTypes($core) as $k => $v) {
|
foreach ($zc->getPublicUrlTypes() as $k => $v) {
|
||||||
echo sprintf(
|
echo sprintf(
|
||||||
'<li><label for="post_title_redir_%s">%s%s</label></li>',
|
'<li><label for="post_title_redir_%s">%s%s</label></li>',
|
||||||
$v,
|
$v,
|
||||||
@ -183,7 +183,7 @@ echo '
|
|||||||
|
|
||||||
<p>' . __('Show full content on:') . '</p><ul>';
|
<p>' . __('Show full content on:') . '</p><ul>';
|
||||||
|
|
||||||
foreach ($zc->getPublicUrlTypes($core) as $k => $v) {
|
foreach ($zc->getPublicUrlTypes() as $k => $v) {
|
||||||
echo sprintf(
|
echo sprintf(
|
||||||
'<li><label for="post_full_tpl_%s">%s%s</label></li>',
|
'<li><label for="post_full_tpl_%s">%s%s</label></li>',
|
||||||
$v,
|
$v,
|
||||||
|
@ -18,13 +18,13 @@ $this->registerModule(
|
|||||||
'Feeds server',
|
'Feeds server',
|
||||||
'Mix your blog with a feeds planet',
|
'Mix your blog with a feeds planet',
|
||||||
'Jean-Christian Denis, BG, Pierre Van Glabeke',
|
'Jean-Christian Denis, BG, Pierre Van Glabeke',
|
||||||
'2022.02.13',
|
'2022.11.12',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.21']],
|
'requires' => [['core', '2.24']],
|
||||||
'permissions' => 'admin',
|
'permissions' => dcAuth::PERMISSION_CONTENT_ADMIN,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://github.com/JcDenis/zoneclearFeedServer',
|
'support' => 'https://github.com/JcDenis/zoneclearFeedServer',
|
||||||
'details' => 'https://plugins.dotaddict.org/dc2/details/pacKman',
|
'details' => 'https://plugins.dotaddict.org/dc2/details/pacKman',
|
||||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/zoneclearFeedServer/master/dcstore.xml'
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/zoneclearFeedServer/master/dcstore.xml',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
14
_install.php
14
_install.php
@ -20,7 +20,7 @@ $dc_min = $this->modules[$mod_id]['requires'][0][1];
|
|||||||
try {
|
try {
|
||||||
# Check module version
|
# Check module version
|
||||||
if (version_compare(
|
if (version_compare(
|
||||||
$core->getVersion($mod_id),
|
dcCore::app()->getVersion($mod_id),
|
||||||
$this->moduleInfo($mod_id, 'version'),
|
$this->moduleInfo($mod_id, 'version'),
|
||||||
'>='
|
'>='
|
||||||
)) {
|
)) {
|
||||||
@ -39,7 +39,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Tables
|
# Tables
|
||||||
$t = new dbStruct($core->con, $core->prefix);
|
$t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||||
$t->zc_feed
|
$t->zc_feed
|
||||||
->feed_id('bigint', 0, false)
|
->feed_id('bigint', 0, false)
|
||||||
->feed_creadt('timestamp', 0, false, 'now()')
|
->feed_creadt('timestamp', 0, false, 'now()')
|
||||||
@ -66,12 +66,12 @@ try {
|
|||||||
->index('idx_zcfs_type', 'btree', 'feed_type')
|
->index('idx_zcfs_type', 'btree', 'feed_type')
|
||||||
->index('idx_zcfs_blog', 'btree', 'blog_id');
|
->index('idx_zcfs_blog', 'btree', 'blog_id');
|
||||||
|
|
||||||
$ti = new dbStruct($core->con, $core->prefix);
|
$ti = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||||
$changes = $ti->synchronize($t);
|
$changes = $ti->synchronize($t);
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
$core->blog->settings->addNamespace('zoneclearFeedServer');
|
dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
|
||||||
$s = $core->blog->settings->zoneclearFeedServer;
|
$s = dcCore::app()->blog->settings->zoneclearFeedServer;
|
||||||
$s->put('zoneclearFeedServer_active', false, 'boolean', 'Enable zoneclearBlogServer', false, true);
|
$s->put('zoneclearFeedServer_active', false, 'boolean', 'Enable zoneclearBlogServer', false, true);
|
||||||
$s->put('zoneclearFeedServer_pub_active', false, 'boolean', 'Enable public page of list of feeds', false, true);
|
$s->put('zoneclearFeedServer_pub_active', false, 'boolean', 'Enable public page of list of feeds', false, true);
|
||||||
$s->put('zoneclearFeedServer_post_status_new', true, 'boolean', 'Enable auto publish new posts', false, true);
|
$s->put('zoneclearFeedServer_post_status_new', true, 'boolean', 'Enable auto publish new posts', false, true);
|
||||||
@ -84,14 +84,14 @@ try {
|
|||||||
$s->put('zoneclearFeedServer_post_title_redir', serialize(['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(
|
dcCore::app()->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());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
18
_prepend.php
18
_prepend.php
@ -14,17 +14,15 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$d = dirname(__FILE__) . '/inc/';
|
Clearbricks::lib()->autoload(['zoneclearFeedServer' => __DIR__ . '/inc/class.zoneclear.feed.server.php']);
|
||||||
|
Clearbricks::lib()->autoload(['zcfsFeedsList' => __DIR__ . '/inc/lib.zcfs.list.php']);
|
||||||
$__autoload['zoneclearFeedServer'] = $d . 'class.zoneclear.feed.server.php';
|
Clearbricks::lib()->autoload(['zcfsEntriesList' => __DIR__ . '/inc/lib.zcfs.list.php']);
|
||||||
$__autoload['zcfsFeedsList'] = $d . 'lib.zcfs.list.php';
|
Clearbricks::lib()->autoload(['adminZcfsPostFilter' => __DIR__ . '/inc/lib.zcfs.list.php']);
|
||||||
$__autoload['zcfsEntriesList'] = $d . 'lib.zcfs.list.php';
|
Clearbricks::lib()->autoload(['zcfsFeedsActionsPage' => __DIR__ . '/inc/class.zcfs.feedsactions.php']);
|
||||||
$__autoload['adminZcfsPostFilter'] = $d . 'lib.zcfs.list.php';
|
Clearbricks::lib()->autoload(['zcfsDefaultFeedsActions' => __DIR__ . '/inc/class.zcfs.feedsactions.php']);
|
||||||
$__autoload['zcfsFeedsActionsPage'] = $d . 'class.zcfs.feedsactions.php';
|
|
||||||
$__autoload['zcfsDefaultFeedsActions'] = $d . 'class.zcfs.feedsactions.php';
|
|
||||||
|
|
||||||
// public url for page of description of the flux
|
// public url for page of description of the flux
|
||||||
$core->url->register(
|
dcCore::app()->url->register(
|
||||||
'zoneclearFeedsPage',
|
'zoneclearFeedsPage',
|
||||||
'zcfeeds',
|
'zcfeeds',
|
||||||
'^zcfeeds(.*?)$',
|
'^zcfeeds(.*?)$',
|
||||||
@ -33,5 +31,5 @@ $core->url->register(
|
|||||||
|
|
||||||
// Add to report on plugin activityReport
|
// Add to report on plugin activityReport
|
||||||
if (defined('ACTIVITY_REPORT')) {
|
if (defined('ACTIVITY_REPORT')) {
|
||||||
require_once $d . 'lib.zcfs.activityreport.php';
|
require_once __DIR__ . '/inc/lib.zcfs.activityreport.php';
|
||||||
}
|
}
|
||||||
|
205
_public.php
205
_public.php
@ -15,28 +15,28 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Namespace for settings
|
# Namespace for settings
|
||||||
$core->blog->settings->addNamespace('zoneclearFeedServer');
|
dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
|
||||||
$s = $core->blog->settings->zoneclearFeedServer;
|
$s = dcCore::app()->blog->settings->zoneclearFeedServer;
|
||||||
|
|
||||||
# Widgets
|
# Widgets
|
||||||
require_once dirname(__FILE__) . '/_widgets.php';
|
require_once __DIR__ . '/_widgets.php';
|
||||||
|
|
||||||
$core->addBehavior('coreBlogGetPosts', ['zcfsPublicBehaviors', 'coreBlogGetPosts']);
|
dcCore::app()->addBehavior('coreBlogGetPosts', ['zcfsPublicBehaviors', 'coreBlogGetPosts']);
|
||||||
|
|
||||||
if (!$s->zoneclearFeedServer_active) {
|
if (!$s->zoneclearFeedServer_active) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (1 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
if (1 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
||||||
$core->addBehavior('publicBeforeDocument', ['zcfsPublicBehaviors', 'publicDocument']);
|
dcCore::app()->addBehavior('publicBeforeDocument', ['zcfsPublicBehaviors', 'publicDocument']);
|
||||||
} elseif (2 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
} elseif (2 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
||||||
$core->addBehavior('publicAfterDocument', ['zcfsPublicBehaviors', 'publicAfterDocument']);
|
dcCore::app()->addBehavior('publicAfterDocument', ['zcfsPublicBehaviors', 'publicAfterDocument']);
|
||||||
} elseif (3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
} elseif (3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
||||||
$core->addBehavior('publicHeadContent', ['zcfsPublicBehaviors', 'publicHeadContent']);
|
dcCore::app()->addBehavior('publicHeadContent', ['zcfsPublicBehaviors', 'publicHeadContent']);
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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(dcCore::app()->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
|
||||||
$core->addbehavior('zoneclearFeedServerAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
dcCore::app()->addbehavior('zoneclearFeedServerAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Register tempalte blocks
|
# Register tempalte blocks
|
||||||
@ -44,10 +44,10 @@ $tpl_blocks = [
|
|||||||
'Feeds',
|
'Feeds',
|
||||||
'FeedsFooter',
|
'FeedsFooter',
|
||||||
'FeedsHeader',
|
'FeedsHeader',
|
||||||
'FeedIf'
|
'FeedIf',
|
||||||
];
|
];
|
||||||
foreach ($tpl_blocks as $v) {
|
foreach ($tpl_blocks as $v) {
|
||||||
$core->tpl->addBlock('zc' . $v, ['zcfsTemplate', $v]);
|
dcCore::app()->tpl->addBlock('zc' . $v, ['zcfsTemplate', $v]);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Register tempalte values
|
# Register tempalte values
|
||||||
@ -67,10 +67,10 @@ $tpl_values = [
|
|||||||
'FeedOwner',
|
'FeedOwner',
|
||||||
'FeedDesc',
|
'FeedDesc',
|
||||||
'FeedSiteURL',
|
'FeedSiteURL',
|
||||||
'FeedFeedURL'
|
'FeedFeedURL',
|
||||||
];
|
];
|
||||||
foreach ($tpl_values as $v) {
|
foreach ($tpl_values as $v) {
|
||||||
$core->tpl->addValue('zc' . $v, ['zcfsTemplate', $v]);
|
dcCore::app()->tpl->addValue('zc' . $v, ['zcfsTemplate', $v]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,9 +83,9 @@ class zcfsPublicBehaviors
|
|||||||
/**
|
/**
|
||||||
* Remember others post extension.
|
* Remember others post extension.
|
||||||
*
|
*
|
||||||
* @param record $rs record instance
|
* @param dcRecord $rs record instance
|
||||||
*/
|
*/
|
||||||
public static function coreBlogGetPosts(record $rs)
|
public static function coreBlogGetPosts(dcRecord $rs)
|
||||||
{
|
{
|
||||||
$GLOBALS['beforeZcFeedRsExt'] = $rs->extensions();
|
$GLOBALS['beforeZcFeedRsExt'] = $rs->extensions();
|
||||||
$rs->extend('zcfsRsExtPosts');
|
$rs->extend('zcfsRsExtPosts');
|
||||||
@ -94,29 +94,25 @@ class zcfsPublicBehaviors
|
|||||||
/**
|
/**
|
||||||
* Update feeds after contents.
|
* Update feeds after contents.
|
||||||
*
|
*
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
* @return string Document
|
|
||||||
*/
|
*/
|
||||||
public static function publicAfterDocument(dcCore $core)
|
public static function publicAfterDocument()
|
||||||
{
|
{
|
||||||
# Limit feeds update to home page et feed page
|
# Limit feeds update to home page et feed page
|
||||||
# Like publishScheduledEntries
|
# Like publishScheduledEntries
|
||||||
if (!in_array($core->url->type, ['default', 'feed'])) {
|
if (!in_array(dcCore::app()->url->type, ['default', 'feed'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::publicDocument($core);
|
self::publicDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic behavior for before and after public content.
|
* Generic behavior for before and after public content.
|
||||||
*
|
*
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
* @return null NULL
|
|
||||||
*/
|
*/
|
||||||
public static function publicDocument(dcCore $core)
|
public static function publicDocument()
|
||||||
{
|
{
|
||||||
$zc = new zoneclearFeedServer($core);
|
$zc = new zoneclearFeedServer();
|
||||||
$zc->checkFeedsUpdate();
|
$zc->checkFeedsUpdate();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -124,28 +120,24 @@ class zcfsPublicBehaviors
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update feeds by an Ajax request (background).
|
* Update feeds by an Ajax request (background).
|
||||||
*
|
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
* @param context $_ctx context instance
|
|
||||||
* @return string HTML content
|
|
||||||
*/
|
*/
|
||||||
public static function publicHeadContent(dcCore $core, context $_ctx)
|
public static function publicHeadContent()
|
||||||
{
|
{
|
||||||
# Limit update to home page
|
# Limit update to home page
|
||||||
if ($core->url->type != 'default') {
|
if (dcCore::app()->url->type != 'default') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$blog_url = html::escapeJS(
|
$blog_url = html::escapeJS(
|
||||||
$core->blog->url .
|
dcCore::app()->blog->url .
|
||||||
$core->url->getBase('zoneclearFeedsPage') .
|
dcCore::app()->url->getBase('zoneclearFeedsPage') .
|
||||||
'/zcfsupd'
|
'/zcfsupd'
|
||||||
);
|
);
|
||||||
$blog_id = html::escapeJS($core->blog->id);
|
$blog_id = html::escapeJS(dcCore::app()->blog->id);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
"\n<!-- JS for zoneclearFeedServer --> \n" .
|
"\n<!-- JS for zoneclearFeedServer --> \n" .
|
||||||
dcutils::jsLoad($core->blog->url . $core->url->getBase('zoneclearFeedsPage') . '/zcfsupd.js') .
|
dcUtils::jsLoad(dcCore::app()->blog->url . dcCore::app()->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:'" .
|
||||||
@ -162,19 +154,24 @@ class zcfsPublicBehaviors
|
|||||||
*/
|
*/
|
||||||
class zcfsRsExtPosts extends rsExtPost
|
class zcfsRsExtPosts extends rsExtPost
|
||||||
{
|
{
|
||||||
|
public static function zc()
|
||||||
|
{
|
||||||
|
return new zonclearFeedServer();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get feed meta.
|
* Get feed meta.
|
||||||
*
|
*
|
||||||
* @param record $rs record instance
|
* @param dcRecord $rs record instance
|
||||||
* @param string $info Feed info key
|
* @param string $info Feed info key
|
||||||
* @return string Feed info value
|
* @return string Feed info value
|
||||||
*/
|
*/
|
||||||
public static function zcFeed($rs, $info)
|
public static function zcFeed($rs, $info)
|
||||||
{
|
{
|
||||||
$meta = $rs->core->meta->getMetadata([
|
$meta = dcCore::app()->meta->getMetadata([
|
||||||
'post_id' => $rs->post_id,
|
'post_id' => $rs->post_id,
|
||||||
'meta_type' => 'zoneclearfeed_' . $info,
|
'meta_type' => 'zoneclearfeed_' . $info,
|
||||||
'limit' => 1
|
'limit' => 1,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $meta->isEmpty() ? null : $meta->meta_id;
|
return $meta->isEmpty() ? null : $meta->meta_id;
|
||||||
@ -203,10 +200,10 @@ class zcfsRsExtPosts extends rsExtPost
|
|||||||
/**
|
/**
|
||||||
* Get author link from post to feed.
|
* Get author link from post to feed.
|
||||||
*
|
*
|
||||||
* @param record $rs record instance
|
* @param dcRecord $rs record instance
|
||||||
* @return string Author link
|
* @return string Author link
|
||||||
*/
|
*/
|
||||||
public static function getAuthorLink($rs)
|
public static function getAuthorLink(dcRecord $rs): string
|
||||||
{
|
{
|
||||||
$author = $rs->zcFeed('author');
|
$author = $rs->zcFeed('author');
|
||||||
$site = $rs->zcFeed('site');
|
$site = $rs->zcFeed('site');
|
||||||
@ -220,10 +217,10 @@ class zcfsRsExtPosts extends rsExtPost
|
|||||||
/**
|
/**
|
||||||
* Get author CN from post to feed.
|
* Get author CN from post to feed.
|
||||||
*
|
*
|
||||||
* @param record $rs record instance
|
* @param dcRecord $rs record instance
|
||||||
* @return string Author CN
|
* @return string Author CN
|
||||||
*/
|
*/
|
||||||
public static function getAuthorCN($rs)
|
public static function getAuthorCN(dcRecord $rs): string
|
||||||
{
|
{
|
||||||
$author = $rs->zcFeed('author');
|
$author = $rs->zcFeed('author');
|
||||||
|
|
||||||
@ -235,14 +232,14 @@ class zcfsRsExtPosts extends rsExtPost
|
|||||||
/**
|
/**
|
||||||
* Get post link from post to feed.
|
* Get post link from post to feed.
|
||||||
*
|
*
|
||||||
* @param record $rs record instance
|
* @param dcRecord $rs record instance
|
||||||
* @return string Post link
|
* @return string Post link
|
||||||
*/
|
*/
|
||||||
public static function getURL($rs)
|
public static function getURL(dcRecord $rs): string
|
||||||
{
|
{
|
||||||
$url = $rs->zcFeed('url');
|
$url = $rs->zcFeed('url');
|
||||||
$types = @unserialize($rs->core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_post_title_redir);
|
$types = @unserialize(dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_post_title_redir);
|
||||||
$full = is_array($types) && in_array($rs->core->url->type, $types);
|
$full = is_array($types) && in_array(dcCore::app()->url->type, $types);
|
||||||
|
|
||||||
return $url && $full ?
|
return $url && $full ?
|
||||||
zoneclearFeedServer::absoluteURL($rs->zcFeed('site'), $url) :
|
zoneclearFeedServer::absoluteURL($rs->zcFeed('site'), $url) :
|
||||||
@ -255,16 +252,16 @@ class zcfsRsExtPosts extends rsExtPost
|
|||||||
* @param record $rs record instance
|
* @param record $rs record instance
|
||||||
* @return string Post content
|
* @return string Post content
|
||||||
*/
|
*/
|
||||||
public static function getContent($rs, $absolute_urls = false)
|
public static function getContent(dcRecord $rs, bool $absolute_urls = false): string
|
||||||
{
|
{
|
||||||
$url = $rs->zcFeed('url');
|
$url = $rs->zcFeed('url');
|
||||||
$sitename = $rs->zcFeed('sitename');
|
$sitename = $rs->zcFeed('sitename');
|
||||||
$content = self::zcFeedBrother('getContent', [&$rs, $absolute_urls]);
|
$content = self::zcFeedBrother('getContent', [&$rs, $absolute_urls]);
|
||||||
|
|
||||||
if ($url && $sitename && $rs->post_type == 'post') {
|
if ($url && $sitename && $rs->post_type == 'post') {
|
||||||
$types = @unserialize($rs->core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_post_full_tpl);
|
$types = @unserialize(dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_post_full_tpl);
|
||||||
|
|
||||||
if (is_array($types) && in_array($rs->core->url->type, $types)) {
|
if (is_array($types) && in_array(dcCore::app()->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)
|
||||||
@ -302,8 +299,7 @@ class zcfsUrlHandler extends dcUrlHandlers
|
|||||||
*/
|
*/
|
||||||
public static function zcFeedsPage($args)
|
public static function zcFeedsPage($args)
|
||||||
{
|
{
|
||||||
global $core, $_ctx;
|
$s = dcCore::app()->blog->settings->zoneclearFeedServer;
|
||||||
$s = $core->blog->settings->zoneclearFeedServer;
|
|
||||||
|
|
||||||
# Not active
|
# Not active
|
||||||
if (!$s->zoneclearFeedServer_active) {
|
if (!$s->zoneclearFeedServer_active) {
|
||||||
@ -315,9 +311,9 @@ class zcfsUrlHandler extends dcUrlHandlers
|
|||||||
# Update feeds (from ajax or other post resquest)
|
# Update feeds (from ajax or other post resquest)
|
||||||
if ($args == '/zcfsupd' && 3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
if ($args == '/zcfsupd' && 3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (!empty($_POST['blogId']) && html::escapeJS($core->blog->id) == $_POST['blogId']) {
|
if (!empty($_POST['blogId']) && html::escapeJS(dcCore::app()->blog->id) == $_POST['blogId']) {
|
||||||
try {
|
try {
|
||||||
$zc = new zoneclearFeedServer($core);
|
$zc = new zoneclearFeedServer();
|
||||||
if ($zc->checkFeedsUpdate()) {
|
if ($zc->checkFeedsUpdate()) {
|
||||||
$msg = sprintf(
|
$msg = sprintf(
|
||||||
'<status>%s</status><message>s%</message>',
|
'<status>%s</status><message>s%</message>',
|
||||||
@ -347,7 +343,7 @@ class zcfsUrlHandler extends dcUrlHandlers
|
|||||||
|
|
||||||
# Server js
|
# Server js
|
||||||
} elseif ($args == '/zcfsupd.js' && 3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
} elseif ($args == '/zcfsupd.js' && 3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
||||||
$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__) . '/default-templates');
|
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), __DIR__ . '/default-templates');
|
||||||
self::serveDocument(
|
self::serveDocument(
|
||||||
'zcfsupd.js',
|
'zcfsupd.js',
|
||||||
'text/javascript',
|
'text/javascript',
|
||||||
@ -357,12 +353,12 @@ class zcfsUrlHandler extends dcUrlHandlers
|
|||||||
|
|
||||||
# Server feeds description page
|
# Server feeds description page
|
||||||
} elseif (in_array($args, ['', '/']) && $s->zoneclearFeedServer_pub_active) {
|
} elseif (in_array($args, ['', '/']) && $s->zoneclearFeedServer_pub_active) {
|
||||||
$tplset = $core->themes->moduleInfo($core->blog->settings->system->theme, 'tplset');
|
$tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->system->theme, 'tplset');
|
||||||
$path = dirname(__FILE__) . '/default-templates/';
|
$path = __DIR__ . '/default-templates/';
|
||||||
if (!empty($tplset) && is_dir($path . $tplset)) {
|
if (!empty($tplset) && is_dir($path . $tplset)) {
|
||||||
$core->tpl->setPath($core->tpl->getPath(), $path . $tplset);
|
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), $path . $tplset);
|
||||||
} else {
|
} else {
|
||||||
$core->tpl->setPath($core->tpl->getPath(), $path . DC_DEFAULT_TPLSET);
|
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), $path . DC_DEFAULT_TPLSET);
|
||||||
}
|
}
|
||||||
self::serveDocument('zcfeeds.html');
|
self::serveDocument('zcfeeds.html');
|
||||||
}
|
}
|
||||||
@ -417,19 +413,19 @@ class zcfsTemplate
|
|||||||
switch ($a['sortby']) {
|
switch ($a['sortby']) {
|
||||||
case 'name': $sortby = 'lowername';
|
case 'name': $sortby = 'lowername';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'owner': $sortby = 'feed_owner';
|
case 'owner': $sortby = 'feed_owner';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'date': $sortby = 'feed_dt';
|
case 'date': $sortby = 'feed_dt';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'update': $sortby = 'feed_upddt';
|
case 'update': $sortby = 'feed_upddt';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'id': $sortby = 'feed_id';
|
case 'id': $sortby = 'feed_id';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($a['order']) && preg_match('/^(desc|asc)$/i', $a['order'])) {
|
if (isset($a['order']) && preg_match('/^(desc|asc)$/i', $a['order'])) {
|
||||||
@ -439,12 +435,12 @@ break;
|
|||||||
|
|
||||||
return
|
return
|
||||||
'<?php ' . $p .
|
'<?php ' . $p .
|
||||||
'$_ctx->feeds_params = $zcfs_params;' . "\n" .
|
'dcCore::app()->ctx->feeds_params = $zcfs_params;' . "\n" .
|
||||||
'$zcfs = new zoneclearFeedServer($core);' . "\n" .
|
'$zcfs = new zoneclearFeedServer();' . "\n" .
|
||||||
'$_ctx->feeds = $zcfs->getFeeds($zcfs_params); unset($zcfs_params,$zcfs);' . "\n" .
|
'dcCore::app()->ctx->feeds = $zcfs->getFeeds($zcfs_params); unset($zcfs_params,$zcfs);' . "\n" .
|
||||||
"?>\n" .
|
"?>\n" .
|
||||||
'<?php while ($_ctx->feeds->fetch()) : ?>' . $c . '<?php endwhile; ' .
|
'<?php while (dcCore::app()->ctx->feeds->fetch()) : ?>' . $c . '<?php endwhile; ' .
|
||||||
'$_ctx->feeds = null; $_ctx->feeds_params = null; ?>';
|
'dcCore::app()->ctx->feeds = null; dcCore::app()->ctx->feeds_params = null; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedIf($a, $c)
|
public static function FeedIf($a, $c)
|
||||||
@ -456,50 +452,50 @@ break;
|
|||||||
if (isset($a['type'])) {
|
if (isset($a['type'])) {
|
||||||
$type = trim($a['type']);
|
$type = trim($a['type']);
|
||||||
$type = !empty($type) ? $type : 'feed';
|
$type = !empty($type) ? $type : 'feed';
|
||||||
$if[] = '$_ctx->feeds->feed_type == "' . addslashes($type) . '"';
|
$if[] = 'dcCore::app()->ctx->feeds->feed_type == "' . addslashes($type) . '"';
|
||||||
}
|
}
|
||||||
if (isset($a['site_url'])) {
|
if (isset($a['site_url'])) {
|
||||||
$url = trim($a['feed_url']);
|
$url = trim($a['feed_url']);
|
||||||
if (substr($url, 0, 1) == '!') {
|
if (substr($url, 0, 1) == '!') {
|
||||||
$url = substr($url, 1);
|
$url = substr($url, 1);
|
||||||
$if[] = '$_ctx->feeds->feed_url != "' . addslashes($url) . '"';
|
$if[] = 'dcCore::app()->ctx->feeds->feed_url != "' . addslashes($url) . '"';
|
||||||
} else {
|
} else {
|
||||||
$if[] = '$_ctx->feeds->feed_url == "' . addslashes($url) . '"';
|
$if[] = 'dcCore::app()->ctx->feeds->feed_url == "' . addslashes($url) . '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($a['feed_url'])) {
|
if (isset($a['feed_url'])) {
|
||||||
$url = trim($a['feed_feed']);
|
$url = trim($a['feed_feed']);
|
||||||
if (substr($url, 0, 1) == '!') {
|
if (substr($url, 0, 1) == '!') {
|
||||||
$url = substr($url, 1);
|
$url = substr($url, 1);
|
||||||
$if[] = '$_ctx->feeds->feed_feed != "' . addslashes($url) . '"';
|
$if[] = 'dcCore::app()->ctx->feeds->feed_feed != "' . addslashes($url) . '"';
|
||||||
} else {
|
} else {
|
||||||
$if[] = '$_ctx->feeds->feed_feed == "' . addslashes($url) . '"';
|
$if[] = 'dcCore::app()->ctx->feeds->feed_feed == "' . addslashes($url) . '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($a['category'])) {
|
if (isset($a['category'])) {
|
||||||
$category = addslashes(trim($a['category']));
|
$category = addslashes(trim($a['category']));
|
||||||
if (substr($category, 0, 1) == '!') {
|
if (substr($category, 0, 1) == '!') {
|
||||||
$category = substr($category, 1);
|
$category = substr($category, 1);
|
||||||
$if[] = '($_ctx->feeds->cat_url != "' . $category . '")';
|
$if[] = '(dcCore::app()->ctx->feeds->cat_url != "' . $category . '")';
|
||||||
} else {
|
} else {
|
||||||
$if[] = '($_ctx->feeds->cat_url == "' . $category . '")';
|
$if[] = '(dcCore::app()->ctx->feeds->cat_url == "' . $category . '")';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($a['first'])) {
|
if (isset($a['first'])) {
|
||||||
$sign = (bool) $a['first'] ? '=' : '!';
|
$sign = (bool) $a['first'] ? '=' : '!';
|
||||||
$if[] = '$_ctx->feeds->index() ' . $sign . '= 0';
|
$if[] = 'dcCore::app()->ctx->feeds->index() ' . $sign . '= 0';
|
||||||
}
|
}
|
||||||
if (isset($a['odd'])) {
|
if (isset($a['odd'])) {
|
||||||
$sign = (bool) $a['odd'] ? '=' : '!';
|
$sign = (bool) $a['odd'] ? '=' : '!';
|
||||||
$if[] = '($_ctx->feeds->index()+1)%2 ' . $sign . ' = 1';
|
$if[] = '(dcCore::app()->ctx->feeds->index()+1)%2 ' . $sign . ' = 1';
|
||||||
}
|
}
|
||||||
if (isset($a['has_category'])) {
|
if (isset($a['has_category'])) {
|
||||||
$sign = (bool) $a['has_category'] ? '' : '!';
|
$sign = (bool) $a['has_category'] ? '' : '!';
|
||||||
$if[] = $sign . '$_ctx->feeds->cat_id';
|
$if[] = $sign . 'dcCore::app()->ctx->feeds->cat_id';
|
||||||
}
|
}
|
||||||
if (isset($a['has_description'])) {
|
if (isset($a['has_description'])) {
|
||||||
$sign = (bool) $a['has_description'] ? '' : '!';
|
$sign = (bool) $a['has_description'] ? '' : '!';
|
||||||
$if[] = $sign . '$_ctx->feeds->feed_desc';
|
$if[] = $sign . 'dcCore::app()->ctx->feeds->feed_desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($if) ?
|
return empty($if) ?
|
||||||
@ -513,7 +509,7 @@ break;
|
|||||||
$ret = html::escapeHTML($ret);
|
$ret = html::escapeHTML($ret);
|
||||||
|
|
||||||
return
|
return
|
||||||
'<?php if ($_ctx->feeds->index() == 0) { ' .
|
'<?php if (dcCore::app()->ctx->feeds->index() == 0) { ' .
|
||||||
"echo '" . addslashes($ret) . "'; } ?>";
|
"echo '" . addslashes($ret) . "'; } ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,79 +519,79 @@ break;
|
|||||||
$ret = html::escapeHTML($ret);
|
$ret = html::escapeHTML($ret);
|
||||||
|
|
||||||
return
|
return
|
||||||
'<?php if (($_ctx->feeds->index()+1)%2 == 1) { ' .
|
'<?php if ((dcCore::app()->ctx->feeds->index()+1)%2 == 1) { ' .
|
||||||
"echo '" . addslashes($ret) . "'; } ?>";
|
"echo '" . addslashes($ret) . "'; } ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedDesc($a)
|
public static function FeedDesc($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->feed_desc');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->feed_desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedOwner($a)
|
public static function FeedOwner($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->feed_owner');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->feed_owner');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedCategory($a)
|
public static function FeedCategory($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->cat_title');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->cat_title');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedCategoryID($a)
|
public static function FeedCategoryID($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->cat_id');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->cat_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedCategoryURL($a)
|
public static function FeedCategoryURL($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$core->blog->url.$core->url->getBase(\'category\').\'/\'.html::sanitizeURL($_ctx->feeds->cat_url)');
|
return self::getValue($a, 'dcCore::app()->blog->url.dcCore::app()->url->getBase(\'category\').\'/\'.html::sanitizeURL(dcCore::app()->ctx->feeds->cat_url)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedCategoryShortURL($a)
|
public static function FeedCategoryShortURL($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->cat_url');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->cat_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedID($a)
|
public static function FeedID($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->feed_id');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->feed_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedLang($a)
|
public static function FeedLang($a)
|
||||||
{
|
{
|
||||||
$f = $GLOBALS['core']->tpl->getFilters($a);
|
$f = dcCore::app()->tpl->getFilters($a);
|
||||||
|
|
||||||
return empty($a['full']) ?
|
return empty($a['full']) ?
|
||||||
'<?php echo ' . sprintf($f, '$_ctx->feeds->feed_lang') . '; ?>' :
|
'<?php echo ' . sprintf($f, 'dcCore::app()->ctx->feeds->feed_lang') . '; ?>' :
|
||||||
'<?php $langs = l10n::getISOcodes(); if (isset($langs[$_ctx->feeds->feed_lang])) { echo ' .
|
'<?php $langs = l10n::getISOcodes(); if (isset($langs[dcCore::app()->ctx->feeds->feed_lang])) { echo ' .
|
||||||
sprintf($f, '$langs[$_ctx->feeds->feed_lang]') . '; } else { echo ' .
|
sprintf($f, '$langs[dcCore::app()->ctx->feeds->feed_lang]') . '; } else { echo ' .
|
||||||
sprintf($f, '$_ctx->feeds->feed_lang') . '; } unset($langs); ?>';
|
sprintf($f, 'dcCore::app()->ctx->feeds->feed_lang') . '; } unset($langs); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedName($a)
|
public static function FeedName($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->feed_name');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->feed_name');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedSiteURL($a)
|
public static function FeedSiteURL($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->feed_url');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->feed_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedFeedURL($a)
|
public static function FeedFeedURL($a)
|
||||||
{
|
{
|
||||||
return self::getValue($a, '$_ctx->feeds->feed_feed');
|
return self::getValue($a, 'dcCore::app()->ctx->feeds->feed_feed');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedsHeader($a, $c)
|
public static function FeedsHeader($a, $c)
|
||||||
{
|
{
|
||||||
return '<?php if ($_ctx->feeds->isStart()) : ?>' . $c . '<?php endif; ?>';
|
return '<?php if (dcCore::app()->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 (dcCore::app()->ctx->feeds->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function FeedsCount($a)
|
public static function FeedsCount($a)
|
||||||
@ -615,7 +611,7 @@ break;
|
|||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
"<?php \$fcount = \$_ctx->feeds->count(); \n" .
|
"<?php \$fcount = dcCore::app()->ctx->feeds->count(); \n" .
|
||||||
"if (\$fcount == 0) {\n" .
|
"if (\$fcount == 0) {\n" .
|
||||||
" printf(__('" . $none . "'),\$fcount);\n" .
|
" printf(__('" . $none . "'),\$fcount);\n" .
|
||||||
"} elseif (\$fcount == 1) {\n" .
|
"} elseif (\$fcount == 1) {\n" .
|
||||||
@ -642,10 +638,12 @@ break;
|
|||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
"<?php \$fcount = 0; \$allfeeds = \$_ctx->feeds->zc->getFeeds(); \n" .
|
"<?php \$fcount = 0; \n" .
|
||||||
|
'$zc = new zoneclearFeedServer();' . "\n" .
|
||||||
|
"\$allfeeds = \$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) \$zc->getPostsByFeed(array('feed_id'=>\$allfeeds->feed_id),true)->f(0); " .
|
||||||
" } \n" .
|
" } \n" .
|
||||||
"} \n" .
|
"} \n" .
|
||||||
"if (\$fcount == 0) {\n" .
|
"if (\$fcount == 0) {\n" .
|
||||||
@ -674,7 +672,8 @@ break;
|
|||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
"<?php \$fcount = \$_ctx->feeds->zc->getPostsByFeed(array('feed_id'=>\$_ctx->feeds->feed_id),true)->f(0); \n" .
|
"<?php \$zcfs = new zoneclearFeedServer(); \n" .
|
||||||
|
"\$fcount = \$zc->getPostsByFeed(array('feed_id'=>dcCore::app()->ctx->feeds->feed_id),true)->f(0); \n" .
|
||||||
"if (\$fcount == 0) {\n" .
|
"if (\$fcount == 0) {\n" .
|
||||||
" printf(__('" . $none . "'),\$fcount);\n" .
|
" printf(__('" . $none . "'),\$fcount);\n" .
|
||||||
"} elseif (\$fcount == 1) {\n" .
|
"} elseif (\$fcount == 1) {\n" .
|
||||||
@ -686,7 +685,7 @@ break;
|
|||||||
|
|
||||||
protected static function getValue($a, $v)
|
protected static function getValue($a, $v)
|
||||||
{
|
{
|
||||||
return '<?php echo ' . sprintf($GLOBALS['core']->tpl->getFilters($a), $v) . '; ?>';
|
return '<?php echo ' . sprintf(dcCore::app()->tpl->getFilters($a), $v) . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getOperator($op)
|
protected static function getOperator($op)
|
||||||
@ -703,7 +702,7 @@ break;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$core->addBehavior('publicBreadcrumb', ['extZcfeeds', 'publicBreadcrumb']);
|
dcCore::app()->addBehavior('publicBreadcrumb', ['extZcfeeds', 'publicBreadcrumb']);
|
||||||
|
|
||||||
class extZcfeeds
|
class extZcfeeds
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ $this->addDirectCallback(
|
|||||||
'delete feeds relations'
|
'delete feeds relations'
|
||||||
);
|
);
|
||||||
|
|
||||||
function zoneclearfeedServerUninstall($core, $id)
|
function zoneclearfeedServerUninstall($id)
|
||||||
{
|
{
|
||||||
if ($id != 'zoneclearFeedServer') {
|
if ($id != 'zoneclearFeedServer') {
|
||||||
return null;
|
return null;
|
||||||
|
40
_widgets.php
40
_widgets.php
@ -14,11 +14,11 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'initWidgets',
|
'initWidgets',
|
||||||
['zoneclearFeedServerWidget', 'adminSource']
|
['zoneclearFeedServerWidget', 'adminSource']
|
||||||
);
|
);
|
||||||
$core->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'initWidgets',
|
'initWidgets',
|
||||||
['zoneclearFeedServerWidget', 'adminNumber']
|
['zoneclearFeedServerWidget', 'adminNumber']
|
||||||
);
|
);
|
||||||
@ -33,7 +33,7 @@ class zoneclearFeedServerWidget
|
|||||||
/**
|
/**
|
||||||
* Widget configuration for sources list.
|
* Widget configuration for sources list.
|
||||||
*
|
*
|
||||||
* @param dcWidget $w dcWidget instance
|
* @param dcWidgets $w dcWidgets instance
|
||||||
*/
|
*/
|
||||||
public static function adminSource($w)
|
public static function adminSource($w)
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ class zoneclearFeedServerWidget
|
|||||||
[
|
[
|
||||||
__('Last update') => 'feed_upd_last',
|
__('Last update') => 'feed_upd_last',
|
||||||
__('Name') => 'lowername',
|
__('Name') => 'lowername',
|
||||||
__('Create date') => 'feed_creadt'
|
__('Create date') => 'feed_creadt',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->setting(
|
->setting(
|
||||||
@ -66,7 +66,7 @@ class zoneclearFeedServerWidget
|
|||||||
'combo',
|
'combo',
|
||||||
[
|
[
|
||||||
__('Ascending') => 'asc',
|
__('Ascending') => 'asc',
|
||||||
__('Descending') => 'desc'
|
__('Descending') => 'desc',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->setting(
|
->setting(
|
||||||
@ -90,7 +90,7 @@ class zoneclearFeedServerWidget
|
|||||||
/**
|
/**
|
||||||
* Widget configuration for feeds info.
|
* Widget configuration for feeds info.
|
||||||
*
|
*
|
||||||
* @param dcWidget $w dcWidget instance
|
* @param dcWidgets $w dcWidgets instance
|
||||||
*/
|
*/
|
||||||
public static function adminNumber($w)
|
public static function adminNumber($w)
|
||||||
{
|
{
|
||||||
@ -148,15 +148,13 @@ class zoneclearFeedServerWidget
|
|||||||
*/
|
*/
|
||||||
public static function publicSource($w)
|
public static function publicSource($w)
|
||||||
{
|
{
|
||||||
global $core;
|
|
||||||
|
|
||||||
if ($w->offline) {
|
if ($w->offline) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|
if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|
||||||
|| $w->homeonly == 1 && !$core->url->isHome($core->url->type)
|
|| $w->homeonly == 1 && !dcCore::app()->url->isHome(dcCore::app()->url->type)
|
||||||
|| $w->homeonly == 2 && $core->url->isHome($core->url->type)
|
|| $w->homeonly == 2 && dcCore::app()->url->isHome(dcCore::app()->url->type)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -168,7 +166,7 @@ class zoneclearFeedServerWidget
|
|||||||
$p['limit'] = abs((int) $w->limit);
|
$p['limit'] = abs((int) $w->limit);
|
||||||
$p['feed_status'] = 1;
|
$p['feed_status'] = 1;
|
||||||
|
|
||||||
$zc = new zoneclearFeedServer($core);
|
$zc = new zoneclearFeedServer();
|
||||||
$rs = $zc->getFeeds($p);
|
$rs = $zc->getFeeds($p);
|
||||||
|
|
||||||
if ($rs->isEmpty()) {
|
if ($rs->isEmpty()) {
|
||||||
@ -187,10 +185,10 @@ class zoneclearFeedServerWidget
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$pub = '';
|
$pub = '';
|
||||||
if ($w->pagelink && $core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
|
if ($w->pagelink && dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
|
||||||
$pub = sprintf(
|
$pub = sprintf(
|
||||||
'<p><strong><a href="%s">%s</a></strong></p>',
|
'<p><strong><a href="%s">%s</a></strong></p>',
|
||||||
$core->blog->url . $core->url->getBase('zoneclearFeedsPage'),
|
dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage'),
|
||||||
html::escapeHTML($w->pagelink)
|
html::escapeHTML($w->pagelink)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -211,20 +209,18 @@ class zoneclearFeedServerWidget
|
|||||||
*/
|
*/
|
||||||
public static function publicNumber($w)
|
public static function publicNumber($w)
|
||||||
{
|
{
|
||||||
global $core;
|
|
||||||
|
|
||||||
if ($w->offline) {
|
if ($w->offline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|
if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|
||||||
|| $w->homeonly == 1 && !$core->url->isHome($core->url->type)
|
|| $w->homeonly == 1 && !dcCore::app()->url->isHome(dcCore::app()->url->type)
|
||||||
|| $w->homeonly == 2 && $core->url->isHome($core->url->type)
|
|| $w->homeonly == 2 && dcCore::app()->url->isHome(dcCore::app()->url->type)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$zc = new zoneclearFeedServer($core);
|
$zc = new zoneclearFeedServer();
|
||||||
$content = '';
|
$content = '';
|
||||||
|
|
||||||
# Feed
|
# Feed
|
||||||
@ -238,10 +234,10 @@ class zoneclearFeedServerWidget
|
|||||||
|
|
||||||
$text = $count ? sprintf(__('one source', '%d sources', $count), $count) : __('no sources');
|
$text = $count ? sprintf(__('one source', '%d sources', $count), $count) : __('no sources');
|
||||||
|
|
||||||
if ($core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
|
if (dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
|
||||||
$text = sprintf(
|
$text = sprintf(
|
||||||
'<a href="%s">%s</a>',
|
'<a href="%s">%s</a>',
|
||||||
$core->blog->url . $core->url->getBase('zoneclearFeedsPage'),
|
dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage'),
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
$opts = getopt('d:c:b:u:h');
|
$opts = getopt('d:c:b:u:h');
|
||||||
|
|
||||||
function help($status = 0)
|
function zchelp($status = 0)
|
||||||
{
|
{
|
||||||
echo
|
echo
|
||||||
"Options: \n" .
|
"Options: \n" .
|
||||||
@ -20,7 +20,7 @@ function help($status = 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($opts['h'])) {
|
if (isset($opts['h'])) {
|
||||||
help();
|
zchelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
$dc_root = null;
|
$dc_root = null;
|
||||||
@ -47,17 +47,17 @@ if (isset($opts['b'])) {
|
|||||||
|
|
||||||
if (!$dc_root || !is_dir($dc_root)) {
|
if (!$dc_root || !is_dir($dc_root)) {
|
||||||
fwrite(STDERR, "DotClear root path is not defined\n\n");
|
fwrite(STDERR, "DotClear root path is not defined\n\n");
|
||||||
help(1);
|
zchelp(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$dc_conf || !is_readable($dc_conf)) {
|
if (!$dc_conf || !is_readable($dc_conf)) {
|
||||||
fwrite(STDERR, "DotClear configuration not found\n\n");
|
fwrite(STDERR, "DotClear configuration not found\n\n");
|
||||||
help(1);
|
zchelp(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$blog_id) {
|
if (!$blog_id) {
|
||||||
fwrite(STDERR, "Blog ID is not defined\n\n");
|
fwrite(STDERR, "Blog ID is not defined\n\n");
|
||||||
help(1);
|
zchelp(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SERVER['DC_RC_PATH'] = $dc_conf;
|
$_SERVER['DC_RC_PATH'] = $dc_conf;
|
||||||
@ -69,23 +69,23 @@ unset($blog_id);
|
|||||||
require $dc_root . '/inc/prepend.php';
|
require $dc_root . '/inc/prepend.php';
|
||||||
unset($dc_root);
|
unset($dc_root);
|
||||||
|
|
||||||
$core->setBlog(DC_BLOG_ID);
|
dcCore::app()->setBlog(DC_BLOG_ID);
|
||||||
if ($core->blog->id == null) {
|
if (dcCore::app()->blog->id == null) {
|
||||||
fwrite(STDERR, "Blog is not defined\n");
|
fwrite(STDERR, "Blog is not defined\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($opts['u']) || !$core->auth->checkUser($opts['u'])) {
|
if (!isset($opts['u']) || !dcCore::app()->auth->checkUser($opts['u'])) {
|
||||||
fwrite(STDERR, "Unable to set user\n");
|
fwrite(STDERR, "Unable to set user\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$core->plugins->loadModules(DC_PLUGINS_ROOT);
|
dcCore::app()->plugins->loadModules(DC_PLUGINS_ROOT);
|
||||||
|
|
||||||
$core->blog->settings->addNamespace('zoneclearFeedServer');
|
dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$zc = new zoneclearFeedServer($core);
|
$zc = new zoneclearFeedServer();
|
||||||
$zc->checkFeedsUpdate();
|
$zc->checkFeedsUpdate();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
fwrite(STDERR, $e->getMessage() . "\n");
|
fwrite(STDERR, $e->getMessage() . "\n");
|
||||||
|
@ -10,17 +10,17 @@
|
|||||||
* @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 dcActions
|
||||||
{
|
{
|
||||||
public $zcfs;
|
public $zcfs;
|
||||||
|
|
||||||
public function __construct(dcCore $core, $uri, $redirect_args = [])
|
public function __construct($uri, $redirect_args = [])
|
||||||
{
|
{
|
||||||
$this->zcfs = new zoneclearFeedServer($core);
|
$this->zcfs = new zoneclearFeedServer();
|
||||||
|
|
||||||
parent::__construct($core, $uri, $redirect_args);
|
parent::__construct($uri, $redirect_args);
|
||||||
$this->redirect_fields = [
|
$this->redirect_fields = [
|
||||||
'sortby', 'order', 'page', 'nb'
|
'sortby', 'order', 'page', 'nb',
|
||||||
];
|
];
|
||||||
$this->field_entries = 'feeds';
|
$this->field_entries = 'feeds';
|
||||||
$this->caller_title = __('Feeds');
|
$this->caller_title = __('Feeds');
|
||||||
@ -29,8 +29,8 @@ class zcfsFeedsActionsPage extends dcActionsPage
|
|||||||
|
|
||||||
protected function loadDefaults()
|
protected function loadDefaults()
|
||||||
{
|
{
|
||||||
zcfsDefaultFeedsActions::zcfsFeedsActionsPage($this->core, $this);
|
zcfsDefaultFeedsActions::zcfsFeedsActionsPage($this);
|
||||||
$this->core->callBehavior('zcfsFeedsActionsPage', $this->core, $this);
|
dcCore::app()->callBehavior('zcfsFeedsActionsPage', $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beginPage($breadcrumb = '', $head = '')
|
public function beginPage($breadcrumb = '', $head = '')
|
||||||
@ -52,12 +52,12 @@ class zcfsFeedsActionsPage extends dcActionsPage
|
|||||||
|
|
||||||
public function error(Exception $e)
|
public function error(Exception $e)
|
||||||
{
|
{
|
||||||
$this->core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
$this->beginPage(
|
$this->beginPage(
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
html::escapeHTML($this->core->blog->name) => '',
|
html::escapeHTML(dcCore::app()->blog->name) => '',
|
||||||
$this->getCallerTitle() => $this->getRedirection(true),
|
$this->getCallerTitle() => $this->getRedirection(true),
|
||||||
__('Feeds actions') => ''
|
__('Feeds actions') => '',
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
$this->endPage();
|
$this->endPage();
|
||||||
@ -74,8 +74,8 @@ class zcfsFeedsActionsPage extends dcActionsPage
|
|||||||
}
|
}
|
||||||
$this->rs = $feeds;
|
$this->rs = $feeds;
|
||||||
} else {
|
} else {
|
||||||
$this->rs = $this->core->con->select(
|
$this->rs = dcCore::app()->con->select(
|
||||||
'SELECT blog_id FROM ' . $this->core->prefix . 'blog WHERE false'
|
'SELECT blog_id FROM ' . dcCore::app()->prefix . 'blog WHERE false'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ class zcfsFeedsActionsPage extends dcActionsPage
|
|||||||
*/
|
*/
|
||||||
class zcfsDefaultFeedsActions
|
class zcfsDefaultFeedsActions
|
||||||
{
|
{
|
||||||
public static function zcfsFeedsActionsPage(dcCore $core, zcfsFeedsActionsPage $ap)
|
public static function zcfsFeedsActionsPage(zcfsFeedsActionsPage $ap)
|
||||||
{
|
{
|
||||||
$ap->addAction(
|
$ap->addAction(
|
||||||
[__('Change category') => 'changecat'],
|
[__('Change category') => 'changecat'],
|
||||||
@ -125,7 +125,7 @@ class zcfsDefaultFeedsActions
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function doEnableFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
|
public static function doEnableFeed(zcfsFeedsActionsPage $ap, $post)
|
||||||
{
|
{
|
||||||
$enable = $ap->getAction() == 'enablefeed';
|
$enable = $ap->getAction() == 'enablefeed';
|
||||||
$ids = $ap->getIDs();
|
$ids = $ap->getIDs();
|
||||||
@ -138,7 +138,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->zcfs->enableFeed($id, $enable);
|
$ap->zcfs->enableFeed($id, $enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(sprintf(
|
dcAdminNotices::addSuccessNotice(sprintf(
|
||||||
$enable ?
|
$enable ?
|
||||||
__(
|
__(
|
||||||
'%d feed has been successfully enabled.',
|
'%d feed has been successfully enabled.',
|
||||||
@ -156,14 +156,14 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->redirect(true);
|
$ap->redirect(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function doDeletePost(dcCore $core, zcfsFeedsActionsPage $ap, $post)
|
public static function doDeletePost(zcfsFeedsActionsPage $ap, $post)
|
||||||
{
|
{
|
||||||
$types = [
|
$types = [
|
||||||
'zoneclearfeed_url',
|
'zoneclearfeed_url',
|
||||||
'zoneclearfeed_author',
|
'zoneclearfeed_author',
|
||||||
'zoneclearfeed_site',
|
'zoneclearfeed_site',
|
||||||
'zoneclearfeed_sitename',
|
'zoneclearfeed_sitename',
|
||||||
'zoneclearfeed_id'
|
'zoneclearfeed_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
$ids = $ap->getIDs();
|
$ids = $ap->getIDs();
|
||||||
@ -174,26 +174,26 @@ 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);
|
dcCore::app()->blog->delPost($posts->post_id);
|
||||||
$core->con->execute(
|
dcCore::app()->con->execute(
|
||||||
'DELETE FROM ' . $core->prefix . 'meta ' .
|
'DELETE FROM ' . dcCore::app()->prefix . dcMeta::META_TABLE_NAME . ' ' .
|
||||||
'WHERE post_id = ' . $posts->post_id . ' ' .
|
'WHERE post_id = ' . $posts->post_id . ' ' .
|
||||||
'AND meta_type ' . $core->con->in($types) . ' '
|
'AND meta_type ' . dcCore::app()->con->in($types) . ' '
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Entries have been successfully deleted.')
|
__('Entries have been successfully deleted.')
|
||||||
);
|
);
|
||||||
$ap->redirect(true);
|
$ap->redirect(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function doDeleteFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
|
public static function doDeleteFeed(zcfsFeedsActionsPage $ap, $post)
|
||||||
{
|
{
|
||||||
$ids = $ap->getIDs();
|
$ids = $ap->getIDs();
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->zcfs->delFeed($id);
|
$ap->zcfs->delFeed($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(sprintf(
|
dcAdminNotices::addSuccessNotice(sprintf(
|
||||||
__(
|
__(
|
||||||
'%d feed has been successfully deleted.',
|
'%d feed has been successfully deleted.',
|
||||||
'%d feeds have been successfully deleted.',
|
'%d feeds have been successfully deleted.',
|
||||||
@ -216,7 +216,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->redirect(true);
|
$ap->redirect(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function doUpdateFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
|
public static function doUpdateFeed(zcfsFeedsActionsPage $ap, $post)
|
||||||
{
|
{
|
||||||
$ids = $ap->getIDs();
|
$ids = $ap->getIDs();
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->zcfs->checkFeedsUpdate($id, true);
|
$ap->zcfs->checkFeedsUpdate($id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(sprintf(
|
dcAdminNotices::addSuccessNotice(sprintf(
|
||||||
__(
|
__(
|
||||||
'%d feed has been successfully updated.',
|
'%d feed has been successfully updated.',
|
||||||
'%d feeds have been successfully updated.',
|
'%d feeds have been successfully updated.',
|
||||||
@ -239,7 +239,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->redirect(true);
|
$ap->redirect(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function doResetUpdate(dcCore $core, zcfsFeedsActionsPage $ap, $post)
|
public static function doResetUpdate(zcfsFeedsActionsPage $ap, $post)
|
||||||
{
|
{
|
||||||
$ids = $ap->getIDs();
|
$ids = $ap->getIDs();
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->zcfs->checkFeedsUpdate($id, true);
|
$ap->zcfs->checkFeedsUpdate($id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(sprintf(
|
dcAdminNotices::addSuccessNotice(sprintf(
|
||||||
__(
|
__(
|
||||||
'Last update of %s feed successfully reseted.',
|
'Last update of %s feed successfully reseted.',
|
||||||
'Last update of %s feeds successfully reseted.',
|
'Last update of %s feeds successfully reseted.',
|
||||||
@ -265,7 +265,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->redirect(true);
|
$ap->redirect(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function doChangeCategory(dcCore $core, zcfsFeedsActionsPage $ap, $post)
|
public static function doChangeCategory(zcfsFeedsActionsPage $ap, $post)
|
||||||
{
|
{
|
||||||
if (isset($post['upd_cat_id'])) {
|
if (isset($post['upd_cat_id'])) {
|
||||||
$ids = $ap->getIDs();
|
$ids = $ap->getIDs();
|
||||||
@ -282,7 +282,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->zcfs->updFeed($id, $cur);
|
$ap->zcfs->updFeed($id, $cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(sprintf(
|
dcAdminNotices::addSuccessNotice(sprintf(
|
||||||
__(
|
__(
|
||||||
'Category of %s feed successfully changed.',
|
'Category of %s feed successfully changed.',
|
||||||
'Category of %s feeds successfully changed.',
|
'Category of %s feeds successfully changed.',
|
||||||
@ -293,15 +293,15 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->redirect(true);
|
$ap->redirect(true);
|
||||||
} else {
|
} else {
|
||||||
$categories_combo = dcAdminCombos::getCategoriesCombo(
|
$categories_combo = dcAdminCombos::getCategoriesCombo(
|
||||||
$core->blog->getCategories()
|
dcCore::app()->blog->getCategories()
|
||||||
);
|
);
|
||||||
|
|
||||||
$ap->beginPage(
|
$ap->beginPage(
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
html::escapeHTML($core->blog->name) => '',
|
html::escapeHTML(dcCore::app()->blog->name) => '',
|
||||||
__('Feeds server') => '',
|
__('Feeds server') => '',
|
||||||
$ap->getCallerTitle() => $ap->getRedirection(true),
|
$ap->getCallerTitle() => $ap->getRedirection(true),
|
||||||
__('Change category for this selection') => ''
|
__('Change category for this selection') => '',
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->getCheckboxes() .
|
$ap->getCheckboxes() .
|
||||||
'<p><label for="upd_cat_id" class="classic">' . __('Category:') . '</label> ' .
|
'<p><label for="upd_cat_id" class="classic">' . __('Category:') . '</label> ' .
|
||||||
form::combo(['upd_cat_id'], $categories_combo, '') .
|
form::combo(['upd_cat_id'], $categories_combo, '') .
|
||||||
$core->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
$ap->getHiddenFields() .
|
$ap->getHiddenFields() .
|
||||||
form::hidden(['action'], 'changecat') .
|
form::hidden(['action'], 'changecat') .
|
||||||
'<input type="submit" value="' . __('Save') . '" /></p>' .
|
'<input type="submit" value="' . __('Save') . '" /></p>' .
|
||||||
@ -320,7 +320,7 @@ class zcfsDefaultFeedsActions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function doChangeInterval(dcCore $core, zcfsFeedsActionsPage $ap, $post)
|
public static function doChangeInterval(zcfsFeedsActionsPage $ap, $post)
|
||||||
{
|
{
|
||||||
if (isset($post['upd_upd_int'])) {
|
if (isset($post['upd_upd_int'])) {
|
||||||
$ids = $ap->getIDs();
|
$ids = $ap->getIDs();
|
||||||
@ -337,7 +337,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->zcfs->updFeed($id, $cur);
|
$ap->zcfs->updFeed($id, $cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(sprintf(
|
dcAdminNotices::addSuccessNotice(sprintf(
|
||||||
__(
|
__(
|
||||||
'Update frequency of %s feed successfully changed.',
|
'Update frequency of %s feed successfully changed.',
|
||||||
'Update frequency of %s feeds successfully changed.',
|
'Update frequency of %s feeds successfully changed.',
|
||||||
@ -350,10 +350,10 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->beginPage(
|
$ap->beginPage(
|
||||||
dcPage::breadcrumb(
|
dcPage::breadcrumb(
|
||||||
[
|
[
|
||||||
html::escapeHTML($core->blog->name) => '',
|
html::escapeHTML(dcCore::app()->blog->name) => '',
|
||||||
__('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') => '',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -363,7 +363,7 @@ class zcfsDefaultFeedsActions
|
|||||||
$ap->getCheckboxes() .
|
$ap->getCheckboxes() .
|
||||||
'<p><label for="upd_upd_int" class="classic">' . __('Frequency:') . '</label> ' .
|
'<p><label for="upd_upd_int" class="classic">' . __('Frequency:') . '</label> ' .
|
||||||
form::combo(['upd_upd_int'], $ap->zcfs->getAllUpdateInterval(), '') .
|
form::combo(['upd_upd_int'], $ap->zcfs->getAllUpdateInterval(), '') .
|
||||||
$core->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
$ap->getHiddenFields() .
|
$ap->getHiddenFields() .
|
||||||
form::hidden(['action'], 'changeint') .
|
form::hidden(['action'], 'changeint') .
|
||||||
'<input type="submit" value="' . __('Save') . '" /></p>' .
|
'<input type="submit" value="' . __('Save') . '" /></p>' .
|
||||||
|
@ -25,23 +25,20 @@ class zoneclearFeedServer
|
|||||||
public static $nethttp_agent = 'zoneclearFeedServer - http://zoneclear.org';
|
public static $nethttp_agent = 'zoneclearFeedServer - http://zoneclear.org';
|
||||||
public static $nethttp_maxredirect = 2;
|
public static $nethttp_maxredirect = 2;
|
||||||
|
|
||||||
public $core;
|
|
||||||
public $con;
|
public $con;
|
||||||
private $blog;
|
private $blog;
|
||||||
private $table;
|
private $table;
|
||||||
private $lock = null;
|
private $lock = null;
|
||||||
|
private $user = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
*/
|
*/
|
||||||
public function __construct(dcCore $core)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->core = $core;
|
$this->con = dcCore::app()->con;
|
||||||
$this->con = $core->con;
|
$this->blog = dcCore::app()->con->escape(dcCore::app()->blog->id);
|
||||||
$this->blog = $core->con->escape($core->blog->id);
|
$this->table = dcCore::app()->prefix . 'zc_feed';
|
||||||
$this->table = $core->prefix . 'zc_feed';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,7 +84,7 @@ class zoneclearFeedServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerAfterUpdFeed
|
# --BEHAVIOR-- zoneclearFeedServerAfterUpdFeed
|
||||||
$this->core->callBehavior('zoneclearFeedServerAfterUpdFeed', $cur, $id);
|
dcCore::app()->callBehavior('zoneclearFeedServerAfterUpdFeed', $cur, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,7 +114,7 @@ class zoneclearFeedServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerAfterAddFeed
|
# --BEHAVIOR-- zoneclearFeedServerAfterAddFeed
|
||||||
$this->core->callBehavior('zoneclearFeedServerAfterAddFeed', $cur);
|
dcCore::app()->callBehavior('zoneclearFeedServerAfterAddFeed', $cur);
|
||||||
|
|
||||||
return $cur->feed_id;
|
return $cur->feed_id;
|
||||||
}
|
}
|
||||||
@ -161,7 +158,7 @@ class zoneclearFeedServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerAfterEnableFeed
|
# --BEHAVIOR-- zoneclearFeedServerAfterEnableFeed
|
||||||
$this->core->callBehavior('zoneclearFeedServerAfterEnableFeed', $id, $enable, $time);
|
dcCore::app()->callBehavior('zoneclearFeedServerAfterEnableFeed', $id, $enable, $time);
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -179,7 +176,7 @@ class zoneclearFeedServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerBeforeDelFeed
|
# --BEHAVIOR-- zoneclearFeedServerBeforeDelFeed
|
||||||
$this->core->callBehavior('zoneclearFeedServerBeforeDelFeed', $id);
|
dcCore::app()->callBehavior('zoneclearFeedServerBeforeDelFeed', $id);
|
||||||
|
|
||||||
$this->con->execute(sprintf(
|
$this->con->execute(sprintf(
|
||||||
"DELETE FROM %s WHERE feed_id = %s AND blog_id = '%s' ",
|
"DELETE FROM %s WHERE feed_id = %s AND blog_id = '%s' ",
|
||||||
@ -195,7 +192,7 @@ class zoneclearFeedServer
|
|||||||
*
|
*
|
||||||
* @param array $params Query params
|
* @param array $params Query params
|
||||||
* @param boolean $count_only Return only result count
|
* @param boolean $count_only Return only result count
|
||||||
* @return record record instance
|
* @return null|dcRecord record instance
|
||||||
*/
|
*/
|
||||||
public function getPostsByFeed($params = [], $count_only = false)
|
public function getPostsByFeed($params = [], $count_only = false)
|
||||||
{
|
{
|
||||||
@ -203,10 +200,11 @@ class zoneclearFeedServer
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = new dcSelectStatement($this->core, 'zcfs');
|
$sql = new dcSelectStatement();
|
||||||
$sql->join((new dcJoinStatement($this->core, 'zcfs'))
|
$sql->join(
|
||||||
|
(new dcJoinStatement())
|
||||||
->type('LEFT')
|
->type('LEFT')
|
||||||
->from($this->core->prefix . 'meta F')
|
->from(dcCore::app()->prefix . dcMeta::META_TABLE_NAME . ' F')
|
||||||
->on('P.post_id = F.post_id')
|
->on('P.post_id = F.post_id')
|
||||||
->statement()
|
->statement()
|
||||||
);
|
);
|
||||||
@ -217,7 +215,7 @@ class zoneclearFeedServer
|
|||||||
|
|
||||||
unset($params['feed_id']);
|
unset($params['feed_id']);
|
||||||
|
|
||||||
return $this->core->blog->getPosts($params, $count_only, $sql);
|
return dcCore::app()->blog->getPosts($params, $count_only, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,7 +223,7 @@ class zoneclearFeedServer
|
|||||||
*
|
*
|
||||||
* @param array $params Query params
|
* @param array $params Query params
|
||||||
* @param boolean $count_only Return only result count
|
* @param boolean $count_only Return only result count
|
||||||
* @return record record instance
|
* @return dcRecord record instance
|
||||||
*/
|
*/
|
||||||
public function getFeeds($params = [], $count_only = false)
|
public function getFeeds($params = [], $count_only = false)
|
||||||
{
|
{
|
||||||
@ -249,7 +247,7 @@ class zoneclearFeedServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
$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 ';
|
'LEFT OUTER JOIN ' . dcCore::app()->prefix . 'category C ON Z.cat_id = C.cat_id ';
|
||||||
|
|
||||||
if (!empty($params['from'])) {
|
if (!empty($params['from'])) {
|
||||||
$strReq .= $params['from'] . ' ';
|
$strReq .= $params['from'] . ' ';
|
||||||
@ -304,7 +302,6 @@ class zoneclearFeedServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rs = $this->con->select($strReq);
|
$rs = $this->con->select($strReq);
|
||||||
$rs->zc = $this;
|
|
||||||
|
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
@ -312,7 +309,7 @@ class zoneclearFeedServer
|
|||||||
/**
|
/**
|
||||||
* Get next table id.
|
* Get next table id.
|
||||||
*
|
*
|
||||||
* @return record record instance
|
* @return integer Next id
|
||||||
*/
|
*/
|
||||||
private function getNextId()
|
private function getNextId()
|
||||||
{
|
{
|
||||||
@ -409,9 +406,9 @@ class zoneclearFeedServer
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dt::setTZ($this->core->blog->settings->system->blog_timezone);
|
dt::setTZ(dcCore::app()->blog->settings->system->blog_timezone);
|
||||||
$time = time();
|
$time = time();
|
||||||
$s = $this->core->blog->settings->zoneclearFeedServer;
|
$s = dcCore::app()->blog->settings->zoneclearFeedServer;
|
||||||
|
|
||||||
# All feeds or only one (from admin)
|
# All feeds or only one (from admin)
|
||||||
$f = !$id ?
|
$f = !$id ?
|
||||||
@ -435,13 +432,13 @@ class zoneclearFeedServer
|
|||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$cur_post = $this->con->openCursor($this->core->prefix . 'post');
|
$cur_post = $this->con->openCursor(dcCore::app()->prefix . dcBlog::POST_TABLE_NAME);
|
||||||
$cur_meta = $this->con->openCursor($this->core->prefix . 'meta');
|
$cur_meta = $this->con->openCursor(dcCore::app()->prefix . dcMeta::META_TABLE_NAME);
|
||||||
|
|
||||||
while ($f->fetch()) {
|
while ($f->fetch()) {
|
||||||
# Check if feed need update
|
# Check if feed need update
|
||||||
if ($id || $i < $limit && $f->feed_status == 1
|
if ($id || $i < $limit && $f->feed_status == 1
|
||||||
&& $time > $f->feed_upd_last + $f->feed_upd_int
|
&& $time > $f->feed_upd_last + $f->feed_upd_int
|
||||||
) {
|
) {
|
||||||
$i++;
|
$i++;
|
||||||
$feed = self::readFeed($f->feed_feed);
|
$feed = self::readFeed($f->feed_feed);
|
||||||
@ -501,8 +498,8 @@ class zoneclearFeedServer
|
|||||||
# Check if entry exists
|
# Check if entry exists
|
||||||
$old_post = $this->con->select(
|
$old_post = $this->con->select(
|
||||||
'SELECT P.post_id, P.post_status ' .
|
'SELECT P.post_id, P.post_status ' .
|
||||||
'FROM ' . $this->core->prefix . 'post P ' .
|
'FROM ' . dcCore::app()->prefix . dcBlog::POST_TABLE_NAME . ' P ' .
|
||||||
'INNER JOIN ' . $this->core->prefix . 'meta M ' .
|
'INNER JOIN ' . dcCore::app()->prefix . dcMeta::META_TABLE_NAME . ' M ' .
|
||||||
'ON P.post_id = M.post_id ' .
|
'ON P.post_id = M.post_id ' .
|
||||||
"WHERE blog_id='" . $this->blog . "' " .
|
"WHERE blog_id='" . $this->blog . "' " .
|
||||||
"AND meta_type = 'zoneclearfeed_url' " .
|
"AND meta_type = 'zoneclearfeed_url' " .
|
||||||
@ -516,6 +513,7 @@ class zoneclearFeedServer
|
|||||||
$cur_post->cat_id = $f->cat_id;
|
$cur_post->cat_id = $f->cat_id;
|
||||||
}
|
}
|
||||||
$post_content = $item->content ? $item->content : $item->description;
|
$post_content = $item->content ? $item->content : $item->description;
|
||||||
|
$cur_post->post_format = 'xhtml';
|
||||||
$cur_post->post_content = html::absoluteURLs($post_content, $feed->link);
|
$cur_post->post_content = html::absoluteURLs($post_content, $feed->link);
|
||||||
$cur_post->post_title = $item->title ? $item->title : text::cutString(html::clean($cur_post->post_content), 60);
|
$cur_post->post_title = $item->title ? $item->title : text::cutString(html::clean($cur_post->post_content), 60);
|
||||||
$creator = $item->creator ? $item->creator : $f->feed_owner;
|
$creator = $item->creator ? $item->creator : $f->feed_owner;
|
||||||
@ -524,25 +522,25 @@ class zoneclearFeedServer
|
|||||||
# Create entry
|
# Create entry
|
||||||
if ($old_post->isEmpty()) {
|
if ($old_post->isEmpty()) {
|
||||||
# Post
|
# Post
|
||||||
$cur_post->user_id = $this->core->auth->userID();
|
$cur_post->user_id = dcCore::app()->auth->userID();
|
||||||
$cur_post->post_format = 'xhtml';
|
$cur_post->post_format = 'xhtml';
|
||||||
$cur_post->post_status = (int) $s->zoneclearFeedServer_post_status_new;
|
$cur_post->post_status = (int) $s->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;
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerBeforePostCreate
|
# --BEHAVIOR-- zoneclearFeedServerBeforePostCreate
|
||||||
$this->core->callBehavior(
|
dcCore::app()->callBehavior(
|
||||||
'zoneclearFeedServerBeforePostCreate',
|
'zoneclearFeedServerBeforePostCreate',
|
||||||
$cur_post
|
$cur_post
|
||||||
);
|
);
|
||||||
|
|
||||||
$post_id = $this->core->auth->sudo(
|
$post_id = dcCore::app()->auth->sudo(
|
||||||
[$this->core->blog, 'addPost'],
|
[dcCore::app()->blog, 'addPost'],
|
||||||
$cur_post
|
$cur_post
|
||||||
);
|
);
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerAfterPostCreate
|
# --BEHAVIOR-- zoneclearFeedServerAfterPostCreate
|
||||||
$this->core->callBehavior(
|
dcCore::app()->callBehavior(
|
||||||
'zoneclearFeedServerAfterPostCreate',
|
'zoneclearFeedServerAfterPostCreate',
|
||||||
$cur_post,
|
$cur_post,
|
||||||
$post_id
|
$post_id
|
||||||
@ -553,38 +551,39 @@ class zoneclearFeedServer
|
|||||||
$is_new_published_entry = true;
|
$is_new_published_entry = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update entry
|
# Update entry
|
||||||
} else {
|
} else {
|
||||||
$post_id = $old_post->post_id;
|
$post_id = $old_post->post_id;
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerBeforePostUpdate
|
# --BEHAVIOR-- zoneclearFeedServerBeforePostUpdate
|
||||||
$this->core->callBehavior(
|
dcCore::app()->callBehavior(
|
||||||
'zoneclearFeedServerBeforePostUpdate',
|
'zoneclearFeedServerBeforePostUpdate',
|
||||||
$cur_post,
|
$cur_post,
|
||||||
$post_id
|
$post_id
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->core->auth->sudo(
|
dcCore::app()->auth->sudo(
|
||||||
[$this->core->blog, 'updPost'],
|
[dcCore::app()->blog, 'updPost'],
|
||||||
$post_id,
|
$post_id,
|
||||||
$cur_post
|
$cur_post
|
||||||
);
|
);
|
||||||
|
|
||||||
# Quick delete old meta
|
# Quick delete old meta
|
||||||
$this->con->execute(
|
$this->con->execute(
|
||||||
'DELETE FROM ' . $this->core->prefix . 'meta ' .
|
'DELETE FROM ' . dcCore::app()->prefix . dcMeta::META_TABLE_NAME . ' ' .
|
||||||
'WHERE post_id = ' . $post_id . ' ' .
|
'WHERE post_id = ' . $post_id . ' ' .
|
||||||
"AND meta_type LIKE 'zoneclearfeed_%' "
|
"AND meta_type LIKE 'zoneclearfeed_%' "
|
||||||
);
|
);
|
||||||
|
|
||||||
# Delete old tags
|
# Delete old tags
|
||||||
$this->core->auth->sudo(
|
dcCore::app()->auth->sudo(
|
||||||
[$this->core->meta, 'delPostMeta'],
|
[dcCore::app()->meta, 'delPostMeta'],
|
||||||
$post_id,
|
$post_id,
|
||||||
'tag'
|
'tag'
|
||||||
);
|
);
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerAfterPostUpdate
|
# --BEHAVIOR-- zoneclearFeedServerAfterPostUpdate
|
||||||
$this->core->callBehavior(
|
dcCore::app()->callBehavior(
|
||||||
'zoneclearFeedServerAfterPostUpdate',
|
'zoneclearFeedServerAfterPostUpdate',
|
||||||
$cur_post,
|
$cur_post,
|
||||||
$post_id
|
$post_id
|
||||||
@ -598,64 +597,68 @@ class zoneclearFeedServer
|
|||||||
$cur_meta->clean();
|
$cur_meta->clean();
|
||||||
$cur_meta->post_id = $post_id;
|
$cur_meta->post_id = $post_id;
|
||||||
$cur_meta->meta_type = 'zoneclearfeed_url';
|
$cur_meta->meta_type = 'zoneclearfeed_url';
|
||||||
$cur_meta->meta_id = $meta->url = $item_link;
|
$cur_meta->meta_id = $meta->url = $item_link;
|
||||||
$cur_meta->insert();
|
$cur_meta->insert();
|
||||||
|
|
||||||
$cur_meta->clean();
|
$cur_meta->clean();
|
||||||
$cur_meta->post_id = $post_id;
|
$cur_meta->post_id = $post_id;
|
||||||
$cur_meta->meta_type = 'zoneclearfeed_author';
|
$cur_meta->meta_type = 'zoneclearfeed_author';
|
||||||
$cur_meta->meta_id = $meta->author = $creator;
|
$cur_meta->meta_id = $meta->author = $creator;
|
||||||
$cur_meta->insert();
|
$cur_meta->insert();
|
||||||
|
|
||||||
$cur_meta->clean();
|
$cur_meta->clean();
|
||||||
$cur_meta->post_id = $post_id;
|
$cur_meta->post_id = $post_id;
|
||||||
$cur_meta->meta_type = 'zoneclearfeed_site';
|
$cur_meta->meta_type = 'zoneclearfeed_site';
|
||||||
$cur_meta->meta_id = $meta->site = $f->feed_url;
|
$cur_meta->meta_id = $meta->site = $f->feed_url;
|
||||||
$cur_meta->insert();
|
$cur_meta->insert();
|
||||||
|
|
||||||
$cur_meta->clean();
|
$cur_meta->clean();
|
||||||
$cur_meta->post_id = $post_id;
|
$cur_meta->post_id = $post_id;
|
||||||
$cur_meta->meta_type = 'zoneclearfeed_sitename';
|
$cur_meta->meta_type = 'zoneclearfeed_sitename';
|
||||||
$cur_meta->meta_id = $meta->sitename = $f->feed_name;
|
$cur_meta->meta_id = $meta->sitename = $f->feed_name;
|
||||||
$cur_meta->insert();
|
$cur_meta->insert();
|
||||||
|
|
||||||
$cur_meta->clean();
|
$cur_meta->clean();
|
||||||
$cur_meta->post_id = $post_id;
|
$cur_meta->post_id = $post_id;
|
||||||
$cur_meta->meta_type = 'zoneclearfeed_id';
|
$cur_meta->meta_type = 'zoneclearfeed_id';
|
||||||
$cur_meta->meta_id = $meta->id = $f->feed_id;
|
$cur_meta->meta_id = $meta->id = $f->feed_id;
|
||||||
$cur_meta->insert();
|
$cur_meta->insert();
|
||||||
|
|
||||||
# Add new tags
|
# Add new tags
|
||||||
$tags = $this->core->meta->splitMetaValues($f->feed_tags);
|
$tags = dcCore::app()->meta->splitMetaValues($f->feed_tags);
|
||||||
if ($f->feed_get_tags) {
|
if ($f->feed_get_tags) {
|
||||||
|
|
||||||
# Some feed subjects contains more than one tag
|
# Some feed subjects contains more than one tag
|
||||||
foreach ($item->subject as $subjects) {
|
foreach ($item->subject as $subjects) {
|
||||||
$tmp = $this->core->meta->splitMetaValues($subjects);
|
$tmp = dcCore::app()->meta->splitMetaValues($subjects);
|
||||||
$tags = array_merge($tags, $tmp);
|
$tags = array_merge($tags, $tmp);
|
||||||
}
|
}
|
||||||
$tags = array_unique($tags);
|
$tags = array_unique($tags);
|
||||||
}
|
}
|
||||||
$formated_tags = [];
|
$formated_tags = [];
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
|
|
||||||
# Change tags case
|
# Change tags case
|
||||||
switch ((int) $s->zoneclearFeedServer_tag_case) {
|
switch ((int) $s->zoneclearFeedServer_tag_case) {
|
||||||
case 3: $tag = strtoupper($tag);
|
case 3: $tag = strtoupper($tag);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2: $tag = strtolower($tag);
|
case 2: $tag = strtolower($tag);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1: $tag = ucfirst(strtolower($tag));
|
case 1: $tag = ucfirst(strtolower($tag));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default: /* do nothing */ break;
|
default: /* do nothing */ break;
|
||||||
}
|
}
|
||||||
if (!in_array($tag, $formated_tags)) {
|
if (!in_array($tag, $formated_tags)) {
|
||||||
$formated_tags[] = $tag;
|
$formated_tags[] = $tag;
|
||||||
$this->core->auth->sudo(
|
dcCore::app()->auth->sudo(
|
||||||
[$this->core->meta, 'setPostMeta'],
|
[dcCore::app()->meta, 'delPostMeta'],
|
||||||
|
$post_id,
|
||||||
|
'tag',
|
||||||
|
dcMeta::sanitizeMetaID($tag)
|
||||||
|
);
|
||||||
|
dcCore::app()->auth->sudo(
|
||||||
|
[dcCore::app()->meta, 'setPostMeta'],
|
||||||
$post_id,
|
$post_id,
|
||||||
'tag',
|
'tag',
|
||||||
dcMeta::sanitizeMetaID($tag)
|
dcMeta::sanitizeMetaID($tag)
|
||||||
@ -665,9 +668,8 @@ break;
|
|||||||
$meta->tags = $formated_tags;
|
$meta->tags = $formated_tags;
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerAfterFeedUpdate
|
# --BEHAVIOR-- zoneclearFeedServerAfterFeedUpdate
|
||||||
$this->core->callBehavior(
|
dcCore::app()->callBehavior(
|
||||||
'zoneclearFeedServerAfterFeedUpdate',
|
'zoneclearFeedServerAfterFeedUpdate',
|
||||||
$this->core,
|
|
||||||
$is_new_published_entry,
|
$is_new_published_entry,
|
||||||
$cur_post,
|
$cur_post,
|
||||||
$meta
|
$meta
|
||||||
@ -700,13 +702,15 @@ break;
|
|||||||
{
|
{
|
||||||
# Enable
|
# Enable
|
||||||
if ($enable) {
|
if ($enable) {
|
||||||
if (!$this->core->auth->checkUser($enable)) {
|
$this->user = dcCore::app()->auth->userID();
|
||||||
|
if (!dcCore::app()->auth->checkUser($enable)) {
|
||||||
throw new Exception('Unable to set user');
|
throw new Exception('Unable to set user');
|
||||||
}
|
}
|
||||||
# Disable
|
# Disable
|
||||||
} else {
|
} else {
|
||||||
$this->core->auth = null;
|
dcCore::app()->auth = null;
|
||||||
$this->core->auth = new dcAuth($this->core);
|
dcCore::app()->auth = new dcAuth();
|
||||||
|
dcCore::app()->auth->checkUser($this->user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,7 +740,7 @@ break;
|
|||||||
*/
|
*/
|
||||||
private function trigger()
|
private function trigger()
|
||||||
{
|
{
|
||||||
$this->core->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -794,7 +798,7 @@ break;
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
__('Disabled') => '0',
|
__('Disabled') => '0',
|
||||||
__('Enabled') => '1'
|
__('Enabled') => '1',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -811,7 +815,7 @@ break;
|
|||||||
__('Two times per day') => 43200,
|
__('Two times per day') => 43200,
|
||||||
__('Every day') => 86400,
|
__('Every day') => 86400,
|
||||||
__('Every two days') => 172800,
|
__('Every two days') => 172800,
|
||||||
__('Every week') => 604800
|
__('Every week') => 604800,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +831,7 @@ break;
|
|||||||
# Get super admins
|
# Get super admins
|
||||||
$rs = $this->con->select(
|
$rs = $this->con->select(
|
||||||
'SELECT user_id, user_super, user_name, user_firstname, user_displayname ' .
|
'SELECT user_id, user_super, user_name, user_firstname, user_displayname ' .
|
||||||
'FROM ' . $this->con->escapeSystem($this->core->prefix . 'user') . ' ' .
|
'FROM ' . $this->con->escapeSystem(dcCore::app()->prefix . 'user') . ' ' .
|
||||||
'WHERE user_super = 1 AND user_status = 1 '
|
'WHERE user_super = 1 AND user_status = 1 '
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -846,8 +850,8 @@ break;
|
|||||||
# Get admins
|
# Get admins
|
||||||
$rs = $this->con->select(
|
$rs = $this->con->select(
|
||||||
'SELECT U.user_id, U.user_super, U.user_name, U.user_firstname, U.user_displayname ' .
|
'SELECT U.user_id, U.user_super, U.user_name, U.user_firstname, U.user_displayname ' .
|
||||||
'FROM ' . $this->con->escapeSystem($this->core->prefix . 'user') . ' U ' .
|
'FROM ' . $this->con->escapeSystem(dcCore::app()->prefix . 'user') . ' U ' .
|
||||||
'LEFT JOIN ' . $this->con->escapeSystem($this->core->prefix . 'permissions') . ' P ' .
|
'LEFT JOIN ' . $this->con->escapeSystem(dcCore::app()->prefix . 'permissions') . ' P ' .
|
||||||
'ON U.user_id=P.user_id ' .
|
'ON U.user_id=P.user_id ' .
|
||||||
'WHERE U.user_status = 1 ' .
|
'WHERE U.user_status = 1 ' .
|
||||||
"AND P.blog_id = '" . $this->blog . "' " .
|
"AND P.blog_id = '" . $this->blog . "' " .
|
||||||
@ -872,15 +876,14 @@ break;
|
|||||||
/**
|
/**
|
||||||
* Get list of urls where entries could be hacked.
|
* Get list of urls where entries could be hacked.
|
||||||
*
|
*
|
||||||
* @param dcCore $core dcCore instance
|
|
||||||
* @return array List of names/types of URLs
|
* @return array List of names/types of URLs
|
||||||
*/
|
*/
|
||||||
public static function getPublicUrlTypes(dcCore $core)
|
public static function getPublicUrlTypes()
|
||||||
{
|
{
|
||||||
$types = [];
|
$types = [];
|
||||||
|
|
||||||
# --BEHAVIOR-- zoneclearFeedServerPublicUrlTypes
|
# --BEHAVIOR-- zoneclearFeedServerPublicUrlTypes
|
||||||
$core->callBehavior('zoneclearFeedServerPublicUrlTypes', $types);
|
dcCore::app()->callBehavior('zoneclearFeedServerPublicUrlTypes', $types);
|
||||||
|
|
||||||
$types[__('Home page')] = 'default';
|
$types[__('Home page')] = 'default';
|
||||||
$types[__('Entries pages')] = 'post';
|
$types[__('Entries pages')] = 'post';
|
||||||
@ -900,8 +903,7 @@ break;
|
|||||||
*/
|
*/
|
||||||
public static function tweakurlsAfterPostCreate(cursor $cur, $id)
|
public static function tweakurlsAfterPostCreate(cursor $cur, $id)
|
||||||
{
|
{
|
||||||
global $core;
|
|
||||||
$cur->post_url = tweakUrls::tweakBlogURL($cur->post_url);
|
$cur->post_url = tweakUrls::tweakBlogURL($cur->post_url);
|
||||||
$core->auth->sudo([$core->blog, 'updPost'], $id, $cur);
|
dcCore::app()->auth->sudo([dcCore::app()->blog, 'updPost'], $id, $cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# This file is used with plugin activityReport
|
# This file is used with plugin activityReport
|
||||||
$core->activityReport->addGroup(
|
dcCore::app()->activityReport->addGroup(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
__('Plugin zoneclearFeedServer')
|
__('Plugin zoneclearFeedServer')
|
||||||
);
|
);
|
||||||
|
|
||||||
# from BEHAVIOR zoneclearFeedServerAfterAddFeed in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
# from BEHAVIOR zoneclearFeedServerAfterAddFeed in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
||||||
$core->activityReport->addAction(
|
dcCore::app()->activityReport->addAction(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'create',
|
'create',
|
||||||
__('feed creation'),
|
__('feed creation'),
|
||||||
@ -30,7 +30,7 @@ $core->activityReport->addAction(
|
|||||||
['zoneclearFeedServerActivityReportBehaviors', 'addFeed']
|
['zoneclearFeedServerActivityReportBehaviors', 'addFeed']
|
||||||
);
|
);
|
||||||
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
||||||
$core->activityReport->addAction(
|
dcCore::app()->activityReport->addAction(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'updatefeedinfo',
|
'updatefeedinfo',
|
||||||
__('updating feed info'),
|
__('updating feed info'),
|
||||||
@ -39,7 +39,7 @@ $core->activityReport->addAction(
|
|||||||
['zoneclearFeedServerActivityReportBehaviors', 'updFeedInfo']
|
['zoneclearFeedServerActivityReportBehaviors', 'updFeedInfo']
|
||||||
);
|
);
|
||||||
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
||||||
$core->activityReport->addAction(
|
dcCore::app()->activityReport->addAction(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'updatefeedrecords',
|
'updatefeedrecords',
|
||||||
__('updating feed records'),
|
__('updating feed records'),
|
||||||
@ -48,7 +48,7 @@ $core->activityReport->addAction(
|
|||||||
['zoneclearFeedServerActivityReportBehaviors', 'updFeedRecord']
|
['zoneclearFeedServerActivityReportBehaviors', 'updFeedRecord']
|
||||||
);
|
);
|
||||||
# from BEHAVIOR zoneclearFeedServerAfterDelFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
# from BEHAVIOR zoneclearFeedServerAfterDelFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
||||||
$core->activityReport->addAction(
|
dcCore::app()->activityReport->addAction(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'delete',
|
'delete',
|
||||||
__('feed deletion'),
|
__('feed deletion'),
|
||||||
@ -57,7 +57,7 @@ $core->activityReport->addAction(
|
|||||||
['zoneclearFeedServerActivityReportBehaviors', 'delFeed']
|
['zoneclearFeedServerActivityReportBehaviors', 'delFeed']
|
||||||
);
|
);
|
||||||
# from BEHAVIOR zoneclearFeedServerAfterEnableFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
# from BEHAVIOR zoneclearFeedServerAfterEnableFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
|
||||||
$core->activityReport->addAction(
|
dcCore::app()->activityReport->addAction(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'status',
|
'status',
|
||||||
__('feed status'),
|
__('feed status'),
|
||||||
@ -70,15 +70,13 @@ class zoneclearFeedServerActivityReportBehaviors
|
|||||||
{
|
{
|
||||||
public static function addFeed($cur)
|
public static function addFeed($cur)
|
||||||
{
|
{
|
||||||
global $core;
|
|
||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$cur->feed_name,
|
$cur->feed_name,
|
||||||
$cur->feed_feed,
|
$cur->feed_feed,
|
||||||
$core->auth->getInfo('user_cn')
|
dcCore::app()->auth->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$core->activityReport->addLog(
|
dcCore::app()->activityReport->addLog(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'create',
|
'create',
|
||||||
$logs
|
$logs
|
||||||
@ -88,17 +86,16 @@ class zoneclearFeedServerActivityReportBehaviors
|
|||||||
public static function updFeedInfo($cur, $id)
|
public static function updFeedInfo($cur, $id)
|
||||||
{
|
{
|
||||||
if (defined('DC_CONTEXT_ADMIN')) {
|
if (defined('DC_CONTEXT_ADMIN')) {
|
||||||
global $core;
|
$zc = new zoneclearFeedServer();
|
||||||
$zc = new zoneclearFeedServer($core);
|
|
||||||
$rs = $zc->getFeeds(['feed_id' => $id]);
|
$rs = $zc->getFeeds(['feed_id' => $id]);
|
||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$rs->feed_name,
|
$rs->feed_name,
|
||||||
$rs->feed_feed,
|
$rs->feed_feed,
|
||||||
$core->auth->getInfo('user_cn')
|
dcCore::app()->auth->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$core->activityReport->addLog(
|
dcCore::app()->activityReport->addLog(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'updatefeedinfo',
|
'updatefeedinfo',
|
||||||
$logs
|
$logs
|
||||||
@ -109,15 +106,14 @@ class zoneclearFeedServerActivityReportBehaviors
|
|||||||
public static function updFeedRecord($cur, $id)
|
public static function updFeedRecord($cur, $id)
|
||||||
{
|
{
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
global $core;
|
$zc = new zoneclearFeedServer();
|
||||||
$zc = new zoneclearFeedServer($core);
|
|
||||||
$rs = $zc->getFeeds(['feed_id' => $id]);
|
$rs = $zc->getFeeds(['feed_id' => $id]);
|
||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$rs->feed_name
|
$rs->feed_name,
|
||||||
];
|
];
|
||||||
|
|
||||||
$core->activityReport->addLog(
|
dcCore::app()->activityReport->addLog(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'updatefeedrecords',
|
'updatefeedrecords',
|
||||||
$logs
|
$logs
|
||||||
@ -127,18 +123,16 @@ class zoneclearFeedServerActivityReportBehaviors
|
|||||||
|
|
||||||
public static function delFeed($id)
|
public static function delFeed($id)
|
||||||
{
|
{
|
||||||
global $core;
|
$zc = new zoneclearFeedServer();
|
||||||
|
|
||||||
$zc = new zoneclearFeedServer($core);
|
|
||||||
$rs = $zc->getFeeds(['feed_id' => $id]);
|
$rs = $zc->getFeeds(['feed_id' => $id]);
|
||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$rs->feed_name,
|
$rs->feed_name,
|
||||||
$rs->feed_feed,
|
$rs->feed_feed,
|
||||||
$core->auth->getInfo('user_cn')
|
dcCore::app()->auth->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$core->activityReport->addLog(
|
dcCore::app()->activityReport->addLog(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'delete',
|
'delete',
|
||||||
$logs
|
$logs
|
||||||
@ -147,18 +141,16 @@ class zoneclearFeedServerActivityReportBehaviors
|
|||||||
|
|
||||||
public static function enableFeed($id, $enable, $time)
|
public static function enableFeed($id, $enable, $time)
|
||||||
{
|
{
|
||||||
global $core;
|
$zc = new zoneclearFeedServer();
|
||||||
|
|
||||||
$zc = new zoneclearFeedServer($core);
|
|
||||||
$rs = $zc->getFeeds(['feed_id' => $id]);
|
$rs = $zc->getFeeds(['feed_id' => $id]);
|
||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$rs->feed_name,
|
$rs->feed_name,
|
||||||
$rs->feed_feed,
|
$rs->feed_feed,
|
||||||
$enable ? 'enable' : 'disable'
|
$enable ? 'enable' : 'disable',
|
||||||
];
|
];
|
||||||
|
|
||||||
$core->activityReport->addLog(
|
dcCore::app()->activityReport->addLog(
|
||||||
'zoneclearFeedServer',
|
'zoneclearFeedServer',
|
||||||
'status',
|
'status',
|
||||||
$logs
|
$logs
|
||||||
|
@ -22,6 +22,8 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
*/
|
*/
|
||||||
class zcfsFeedsList extends adminGenericList
|
class zcfsFeedsList extends adminGenericList
|
||||||
{
|
{
|
||||||
|
private $zc = null;
|
||||||
|
|
||||||
public function feedsDisplay($page, $nb_per_page, $enclose_block = '', $filter = false)
|
public function feedsDisplay($page, $nb_per_page, $enclose_block = '', $filter = false)
|
||||||
{
|
{
|
||||||
if ($this->rs->isEmpty()) {
|
if ($this->rs->isEmpty()) {
|
||||||
@ -31,8 +33,9 @@ class zcfsFeedsList extends adminGenericList
|
|||||||
echo '<p><strong>' . __('No feeds') . '</strong></p>';
|
echo '<p><strong>' . __('No feeds') . '</strong></p>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
|
$this->zc = new zoneclearFeedServer();
|
||||||
$entries = [];
|
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
|
||||||
|
$entries = [];
|
||||||
if (isset($_REQUEST['feeds'])) {
|
if (isset($_REQUEST['feeds'])) {
|
||||||
foreach ($_REQUEST['feeds'] as $v) {
|
foreach ($_REQUEST['feeds'] as $v) {
|
||||||
$entries[(int) $v] = true;
|
$entries[(int) $v] = true;
|
||||||
@ -52,11 +55,11 @@ class zcfsFeedsList extends adminGenericList
|
|||||||
'period' => '<th scope="col">' . __('Frequency') . '</th>',
|
'period' => '<th scope="col">' . __('Frequency') . '</th>',
|
||||||
'update' => '<th scope="col">' . __('Last update') . '</th>',
|
'update' => '<th scope="col">' . __('Last update') . '</th>',
|
||||||
'entries' => '<th scope="col">' . __('Entries') . '</th>',
|
'entries' => '<th scope="col">' . __('Entries') . '</th>',
|
||||||
'status' => '<th scope="col">' . __('Status') . '</th>'
|
'status' => '<th scope="col">' . __('Status') . '</th>',
|
||||||
];
|
];
|
||||||
$cols = new ArrayObject($cols);
|
$cols = new ArrayObject($cols);
|
||||||
|
|
||||||
$this->core->callBehavior('adminZcfsFeedsListHeader', $this->core, $this->rs, $cols);
|
dcCore::app()->callBehavior('adminZcfsFeedsListHeader', $this->rs, $cols);
|
||||||
|
|
||||||
$this->userColumns('zcfs_feeds', $cols);
|
$this->userColumns('zcfs_feeds', $cols);
|
||||||
|
|
||||||
@ -89,7 +92,7 @@ class zcfsFeedsList extends adminGenericList
|
|||||||
'<img src="images/check-on.png" alt="enable" />' :
|
'<img src="images/check-on.png" alt="enable" />' :
|
||||||
'<img src="images/check-off.png" alt="disable" />';
|
'<img src="images/check-off.png" alt="disable" />';
|
||||||
|
|
||||||
$entries_count = $this->rs->zc->getPostsByFeed(['feed_id' => $this->rs->feed_id], true)->f(0);
|
$entries_count = $this->zc->getPostsByFeed(['feed_id' => $this->rs->feed_id], true)->f(0);
|
||||||
$shunk_feed = $this->rs->feed_feed;
|
$shunk_feed = $this->rs->feed_feed;
|
||||||
if (strlen($shunk_feed) > 83) {
|
if (strlen($shunk_feed) > 83) {
|
||||||
$shunk_feed = substr($shunk_feed, 0, 50) . '...' . substr($shunk_feed, -20);
|
$shunk_feed = substr($shunk_feed, 0, 50) . '...' . substr($shunk_feed, -20);
|
||||||
@ -114,7 +117,7 @@ class zcfsFeedsList extends adminGenericList
|
|||||||
(
|
(
|
||||||
$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'), (int) $this->rs->feed_upd_last, dcCore::app()->auth->getInfo('user_tz'))
|
||||||
) . '</td>',
|
) . '</td>',
|
||||||
'entries' => '<td class="nowrap minimal count">' .
|
'entries' => '<td class="nowrap minimal count">' .
|
||||||
(
|
(
|
||||||
@ -122,11 +125,11 @@ class zcfsFeedsList extends adminGenericList
|
|||||||
'<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>',
|
||||||
'status' => '<td class="nowrap minimal status">' . $status . '</td>'
|
'status' => '<td class="nowrap minimal status">' . $status . '</td>',
|
||||||
];
|
];
|
||||||
|
|
||||||
$cols = new ArrayObject($cols);
|
$cols = new ArrayObject($cols);
|
||||||
$this->core->callBehavior('adminZcfsFeedsListValue', $this->core, $this->rs, $cols);
|
dcCore::app()->callBehavior('adminZcfsFeedsListValue', $this->rs, $cols);
|
||||||
|
|
||||||
$this->userColumns('zcfs_feeds', $cols);
|
$this->userColumns('zcfs_feeds', $cols);
|
||||||
|
|
||||||
@ -177,11 +180,11 @@ class zcfsEntriesList extends adminGenericList
|
|||||||
'date' => '<th scope="col">' . __('Date') . '</th>',
|
'date' => '<th scope="col">' . __('Date') . '</th>',
|
||||||
'author' => '<th scope="col">' . __('Author') . '</th>',
|
'author' => '<th scope="col">' . __('Author') . '</th>',
|
||||||
'category' => '<th scope="col">' . __('Category') . '</th>',
|
'category' => '<th scope="col">' . __('Category') . '</th>',
|
||||||
'status' => '<th scope="col">' . __('Status') . '</th>'
|
'status' => '<th scope="col">' . __('Status') . '</th>',
|
||||||
];
|
];
|
||||||
|
|
||||||
$cols = new ArrayObject($cols);
|
$cols = new ArrayObject($cols);
|
||||||
$this->core->callBehavior('adminZcfsPostListHeader', $this->core, $this->rs, $cols);
|
dcCore::app()->callBehavior('adminZcfsPostListHeader', $this->rs, $cols);
|
||||||
|
|
||||||
$this->userColumns('zcfs_entries', $cols);
|
$this->userColumns('zcfs_entries', $cols);
|
||||||
|
|
||||||
@ -197,7 +200,7 @@ class zcfsEntriesList extends adminGenericList
|
|||||||
echo $blocks[0];
|
echo $blocks[0];
|
||||||
|
|
||||||
while ($this->rs->fetch()) {
|
while ($this->rs->fetch()) {
|
||||||
echo $this->postLine(isset($entries[$this->rs->post_id]));
|
echo $this->postLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $blocks[1];
|
echo $blocks[1];
|
||||||
@ -208,7 +211,7 @@ class zcfsEntriesList extends adminGenericList
|
|||||||
|
|
||||||
private function postLine()
|
private function postLine()
|
||||||
{
|
{
|
||||||
$cat_link = $this->core->auth->check('categories', $this->core->blog->id) ?
|
$cat_link = dcCore::app()->auth->check('categories', dcCore::app()->blog->id) ?
|
||||||
'<a href="category.php?id=%s" title="' . __('Edit category') . '">%s</a>'
|
'<a href="category.php?id=%s" title="' . __('Edit category') . '">%s</a>'
|
||||||
: '%2$s';
|
: '%2$s';
|
||||||
|
|
||||||
@ -249,17 +252,17 @@ class zcfsEntriesList extends adminGenericList
|
|||||||
'check' => '<td class="nowrap minimal">' .
|
'check' => '<td class="nowrap minimal">' .
|
||||||
form::checkbox(['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) . '" ' .
|
dcCore::app()->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '" ' .
|
||||||
'title="' . html::escapeHTML($this->rs->getURL()) . '">' .
|
'title="' . html::escapeHTML($this->rs->getURL()) . '">' .
|
||||||
html::escapeHTML(trim(html::clean($this->rs->post_title))) . '</a></td>',
|
html::escapeHTML(trim(html::clean($this->rs->post_title))) . '</a></td>',
|
||||||
'date' => '<td class="nowrap count">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>',
|
'date' => '<td class="nowrap count">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>',
|
||||||
'author' => '<td class="nowrap">' . html::escapeHTML($this->rs->user_id) . '</td>',
|
'author' => '<td class="nowrap">' . html::escapeHTML($this->rs->user_id) . '</td>',
|
||||||
'category' => '<td class="nowrap">' . $cat_title . '</td>',
|
'category' => '<td class="nowrap">' . $cat_title . '</td>',
|
||||||
'status' => '<td class="nowrap status">' . $img_status . '</td>'
|
'status' => '<td class="nowrap status">' . $img_status . '</td>',
|
||||||
];
|
];
|
||||||
|
|
||||||
$cols = new ArrayObject($cols);
|
$cols = new ArrayObject($cols);
|
||||||
$this->core->callBehavior('adminZcfsPostListValue', $this->core, $this->rs, $cols);
|
dcCore::app()->callBehavior('adminZcfsPostListValue', $this->rs, $cols);
|
||||||
|
|
||||||
$this->userColumns('zcfs_entries', $cols);
|
$this->userColumns('zcfs_entries', $cols);
|
||||||
|
|
||||||
@ -278,20 +281,20 @@ class zcfsEntriesList extends adminGenericList
|
|||||||
*/
|
*/
|
||||||
class adminZcfsPostFilter extends adminGenericFilter
|
class adminZcfsPostFilter extends adminGenericFilter
|
||||||
{
|
{
|
||||||
public function __construct(dcCore $core)
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct($core, 'zcfs_entries');
|
parent::__construct(dcCore::app(), 'zcfs_entries');
|
||||||
|
|
||||||
$filters = new arrayObject([
|
$filters = new arrayObject([
|
||||||
dcAdminFilters::getPageFilter(),
|
dcAdminFilters::getPageFilter(),
|
||||||
$this->getPostUserFilter(),
|
$this->getPostUserFilter(),
|
||||||
$this->getPostCategoriesFilter(),
|
$this->getPostCategoriesFilter(),
|
||||||
$this->getPostStatusFilter(),
|
$this->getPostStatusFilter(),
|
||||||
$this->getPostMonthFilter()
|
$this->getPostMonthFilter(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
# --BEHAVIOR-- adminPostFilter
|
# --BEHAVIOR-- adminPostFilter
|
||||||
$core->callBehavior('adminZcfsPostFilter', $core, $filters);
|
dcCore::app()->callBehavior('adminZcfsPostFilter', $filters);
|
||||||
|
|
||||||
$filters = $filters->getArrayCopy();
|
$filters = $filters->getArrayCopy();
|
||||||
|
|
||||||
@ -306,12 +309,12 @@ class adminZcfsPostFilter extends adminGenericFilter
|
|||||||
$users = null;
|
$users = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$users = $this->core->blog->getPostsUsers();
|
$users = dcCore::app()->blog->getPostsUsers();
|
||||||
if ($users->isEmpty()) {
|
if ($users->isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -337,19 +340,19 @@ class adminZcfsPostFilter extends adminGenericFilter
|
|||||||
$categories = null;
|
$categories = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$categories = $this->core->blog->getCategories();
|
$categories = dcCore::app()->blog->getCategories();
|
||||||
if ($categories->isEmpty()) {
|
if ($categories->isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$combo = [
|
$combo = [
|
||||||
'-' => '',
|
'-' => '',
|
||||||
__('(No cat)') => 'NULL'
|
__('(No cat)') => 'NULL',
|
||||||
];
|
];
|
||||||
while ($categories->fetch()) {
|
while ($categories->fetch()) {
|
||||||
$combo[
|
$combo[
|
||||||
@ -387,12 +390,12 @@ class adminZcfsPostFilter extends adminGenericFilter
|
|||||||
$dates = null;
|
$dates = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dates = $this->core->blog->getDates(['type' => 'month']);
|
$dates = dcCore::app()->blog->getDates(['type' => 'month']);
|
||||||
if ($dates->isEmpty()) {
|
if ($dates->isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
122
index.php
122
index.php
@ -14,14 +14,14 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($core->getVersion('zoneclearFeedServer') != $core->plugins->moduleInfo('zoneclearFeedServer', 'version')
|
if (dcCore::app()->getVersion('zoneclearFeedServer') != dcCore::app()->plugins->moduleInfo('zoneclearFeedServer', 'version')
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::check('admin');
|
dcPage::check('admin');
|
||||||
|
|
||||||
$zcfs = new zoneclearFeedServer($core);
|
$zcfs = new zoneclearFeedServer();
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
#
|
#
|
||||||
@ -37,7 +37,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
$feed_tweeter = '';
|
$feed_tweeter = '';
|
||||||
$feed_url = '';
|
$feed_url = '';
|
||||||
$feed_feed = '';
|
$feed_feed = '';
|
||||||
$feed_lang = $core->auth->getInfo('user_lang');
|
$feed_lang = dcCore::app()->auth->getInfo('user_lang');
|
||||||
$feed_tags = '';
|
$feed_tags = '';
|
||||||
$feed_get_tags = '0';
|
$feed_get_tags = '0';
|
||||||
$feed_cat_id = '';
|
$feed_cat_id = '';
|
||||||
@ -46,8 +46,8 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
|
|
||||||
$can_view_page = true;
|
$can_view_page = true;
|
||||||
|
|
||||||
$feed_headlink = '<link rel="%s" title="%s" href="' . $p_url . '&part=feed&feed_id=%s" />';
|
$feed_headlink = '<link rel="%s" title="%s" href="' . dcCore::app()->admin->getPageURL() . '&part=feed&feed_id=%s" />';
|
||||||
$feed_link = '<a href="' . $p_url . '&part=feed&feed_id=%s" title="%s">%s</a>';
|
$feed_link = '<a href="' . dcCore::app()->admin->getPageURL() . '&part=feed&feed_id=%s" title="%s">%s</a>';
|
||||||
|
|
||||||
$next_link = $prev_link = $next_headlink = $prev_headlink = null;
|
$next_link = $prev_link = $next_headlink = $prev_headlink = null;
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
$combo_categories = ['-' => ''];
|
$combo_categories = ['-' => ''];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$categories = $core->blog->getCategories(['post_type' => 'post']);
|
$categories = dcCore::app()->blog->getCategories(['post_type' => 'post']);
|
||||||
while ($categories->fetch()) {
|
while ($categories->fetch()) {
|
||||||
$combo_categories[
|
$combo_categories[
|
||||||
str_repeat(' ', $categories->level - 1) .
|
str_repeat(' ', $categories->level - 1) .
|
||||||
@ -66,7 +66,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
] = $categories->cat_id;
|
] = $categories->cat_id;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get entry informations
|
# Get entry informations
|
||||||
@ -74,7 +74,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
$feed = $zcfs->getFeeds(['feed_id' => $_REQUEST['feed_id']]);
|
$feed = $zcfs->getFeeds(['feed_id' => $_REQUEST['feed_id']]);
|
||||||
|
|
||||||
if ($feed->isEmpty()) {
|
if ($feed->isEmpty()) {
|
||||||
$core->error->add(__('This feed does not exist.'));
|
dcCore::app()->error->add(__('This feed does not exist.'));
|
||||||
$can_view_page = false;
|
$can_view_page = false;
|
||||||
} else {
|
} else {
|
||||||
$feed_id = $feed->feed_id;
|
$feed_id = $feed->feed_id;
|
||||||
@ -93,12 +93,12 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
|
|
||||||
$next_params = [
|
$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 = [
|
$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);
|
||||||
|
|
||||||
@ -170,16 +170,16 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
if (!zoneclearFeedServer::validateURL($feed_feed)) {
|
if (!zoneclearFeedServer::validateURL($feed_feed)) {
|
||||||
throw new Exception(__('You must provide valid feed URL.'));
|
throw new Exception(__('You must provide valid feed URL.'));
|
||||||
}
|
}
|
||||||
$get_feed_cat_id = $core->blog->getCategory($feed_cat_id);
|
$get_feed_cat_id = dcCore::app()->blog->getCategory($feed_cat_id);
|
||||||
if ($feed_cat_id != '' && !$get_feed_cat_id) {
|
if ($feed_cat_id != '' && !$get_feed_cat_id) {
|
||||||
throw new Exception(__('You must provide valid category.'));
|
throw new Exception(__('You must provide valid category.'));
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_POST['action']) && $_POST['action'] == 'savefeed' && !$core->error->flag()) {
|
if (!empty($_POST['action']) && $_POST['action'] == 'savefeed' && !dcCore::app()->error->flag()) {
|
||||||
$cur = $zcfs->openCursor();
|
$cur = $zcfs->openCursor();
|
||||||
$cur->feed_name = $feed_name;
|
$cur->feed_name = $feed_name;
|
||||||
$cur->feed_desc = $feed_desc;
|
$cur->feed_desc = $feed_desc;
|
||||||
@ -198,42 +198,42 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
if ($feed_id) {
|
if ($feed_id) {
|
||||||
try {
|
try {
|
||||||
# --BEHAVIOR-- adminBeforeZoneclearFeedServerFeedUpdate
|
# --BEHAVIOR-- adminBeforeZoneclearFeedServerFeedUpdate
|
||||||
$core->callBehavior('adminBeforeZoneclearFeedServerFeedUpdate', $cur, $feed_id);
|
dcCore::app()->callBehavior('adminBeforeZoneclearFeedServerFeedUpdate', $cur, $feed_id);
|
||||||
|
|
||||||
$zcfs->updFeed($feed_id, $cur);
|
$zcfs->updFeed($feed_id, $cur);
|
||||||
|
|
||||||
# --BEHAVIOR-- adminAfterZoneclearFeedServerFeedUpdate
|
# --BEHAVIOR-- adminAfterZoneclearFeedServerFeedUpdate
|
||||||
$core->callBehavior('adminAfterZoneclearFeedServerFeedUpdate', $cur, $feed_id);
|
dcCore::app()->callBehavior('adminAfterZoneclearFeedServerFeedUpdate', $cur, $feed_id);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Feed successfully updated.')
|
__('Feed successfully updated.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect(
|
dcCore::app()->adminurl->redirect(
|
||||||
'admin.plugin.zoneclearFeedServer',
|
'admin.plugin.zoneclearFeedServer',
|
||||||
['part' => 'feed', 'feed_id' => $feed_id]
|
['part' => 'feed', 'feed_id' => $feed_id]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
# --BEHAVIOR-- adminBeforeZoneclearFeedServerFeedCreate
|
# --BEHAVIOR-- adminBeforeZoneclearFeedServerFeedCreate
|
||||||
$core->callBehavior('adminBeforeZoneclearFeedServerFeedCreate', $cur);
|
dcCore::app()->callBehavior('adminBeforeZoneclearFeedServerFeedCreate', $cur);
|
||||||
|
|
||||||
$return_id = $zcfs->addFeed($cur);
|
$return_id = $zcfs->addFeed($cur);
|
||||||
|
|
||||||
# --BEHAVIOR-- adminAfterZoneclearFeedServerFeedCreate
|
# --BEHAVIOR-- adminAfterZoneclearFeedServerFeedCreate
|
||||||
$core->callBehavior('adminAfterZoneclearFeedServerFeedCreate', $cur, $return_id);
|
dcCore::app()->callBehavior('adminAfterZoneclearFeedServerFeedCreate', $cur, $return_id);
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
dcAdminNotices::addSuccessNotice(
|
||||||
__('Feed successfully created.')
|
__('Feed successfully created.')
|
||||||
);
|
);
|
||||||
$core->adminurl->redirect(
|
dcCore::app()->adminurl->redirect(
|
||||||
'admin.plugin.zoneclearFeedServer',
|
'admin.plugin.zoneclearFeedServer',
|
||||||
['part' => 'feed', 'feed_id' => $return_id]
|
['part' => 'feed', 'feed_id' => $return_id]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,14 +241,13 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
# Prepared entries list
|
# Prepared entries list
|
||||||
if ($feed_id && $can_view_page) {
|
if ($feed_id && $can_view_page) {
|
||||||
# action
|
# action
|
||||||
$posts_actions_page = new dcPostsActionsPage(
|
$posts_actions_page = new dcPostsActions(
|
||||||
$core,
|
|
||||||
'plugin.php',
|
'plugin.php',
|
||||||
[
|
[
|
||||||
'p' => 'zoneclearFeedServer',
|
'p' => 'zoneclearFeedServer',
|
||||||
'part' => 'feed',
|
'part' => 'feed',
|
||||||
'feed_id' => $feed_id,
|
'feed_id' => $feed_id,
|
||||||
'_ANCHOR' => 'entries'
|
'_ANCHOR' => 'entries',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
if ($posts_actions_page->process()) {
|
if ($posts_actions_page->process()) {
|
||||||
@ -256,7 +255,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# filters
|
# filters
|
||||||
$post_filter = new adminZcfsPostFilter($core);
|
$post_filter = new adminZcfsPostFilter();
|
||||||
$post_filter->add('part', 'feed');
|
$post_filter->add('part', 'feed');
|
||||||
$post_filter->add('feed_id', $feed_id);
|
$post_filter->add('feed_id', $feed_id);
|
||||||
$params = $post_filter->params();
|
$params = $post_filter->params();
|
||||||
@ -266,15 +265,15 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
// key in sorty_combo (see above) => field in SQL request
|
// key in sorty_combo (see above) => field in SQL request
|
||||||
'post_title' => 'post_title',
|
'post_title' => 'post_title',
|
||||||
'cat_title' => 'cat_title',
|
'cat_title' => 'cat_title',
|
||||||
'user_id' => 'P.user_id'];
|
'user_id' => 'P.user_id', ];
|
||||||
|
|
||||||
# --BEHAVIOR-- adminPostsSortbyLexCombo
|
# --BEHAVIOR-- adminPostsSortbyLexCombo
|
||||||
$core->callBehavior('adminPostsSortbyLexCombo', [& $sortby_lex]);
|
dcCore::app()->callBehavior('adminPostsSortbyLexCombo', [& $sortby_lex]);
|
||||||
|
|
||||||
$params['no_content'] = true;
|
$params['no_content'] = true;
|
||||||
$params['feed_id'] = $feed_id;
|
$params['feed_id'] = $feed_id;
|
||||||
$params['order'] = (array_key_exists($post_filter->sortby, $sortby_lex) ?
|
$params['order'] = (array_key_exists($post_filter->sortby, $sortby_lex) ?
|
||||||
$core->con->lexFields($sortby_lex[$post_filter->sortby]) :
|
dcCore::app()->con->lexFields($sortby_lex[$post_filter->sortby]) :
|
||||||
$post_filter->sortby) . ' ' . $post_filter->order;
|
$post_filter->sortby) . ' ' . $post_filter->order;
|
||||||
|
|
||||||
# posts
|
# posts
|
||||||
@ -282,34 +281,34 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
$posts = $zcfs->getPostsByFeed($params);
|
$posts = $zcfs->getPostsByFeed($params);
|
||||||
$counter = $zcfs->getPostsByFeed($params, true);
|
$counter = $zcfs->getPostsByFeed($params, true);
|
||||||
$post_list = new zcfsEntriesList(
|
$post_list = new zcfsEntriesList(
|
||||||
$core,
|
dcCore::app(),
|
||||||
$posts,
|
$posts,
|
||||||
$counter->f(0)
|
$counter->f(0)
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# display
|
# display
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Feeds server') . '</title>' .
|
'<html><head><title>' . __('Feeds server') . '</title>' .
|
||||||
($feed_id && !$core->error->flag() ?
|
($feed_id && !dcCore::app()->error->flag() ?
|
||||||
$post_filter->js($core->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feed', 'feed_id' => $feed_id], '&') . '#entries') .
|
$post_filter->js(dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feed', 'feed_id' => $feed_id], '&') . '#entries') .
|
||||||
dcPage::jsLoad(dcPage::getPF('zoneclearFeedServer/js/list.js'))
|
dcPage::jsLoad(dcPage::getPF('zoneclearFeedServer/js/list.js'))
|
||||||
: '') .
|
: '') .
|
||||||
dcPage::jsPageTabs() .
|
dcPage::jsPageTabs() .
|
||||||
$next_headlink . "\n" . $prev_headlink .
|
$next_headlink . "\n" . $prev_headlink .
|
||||||
|
|
||||||
# --BEHAVIOR-- adminZoneclearFeedServerHeader
|
# --BEHAVIOR-- adminZoneclearFeedServerHeader
|
||||||
$core->callBehavior('adminZoneclearFeedServerHeader', $core) .
|
dcCore::app()->callBehavior('adminZoneclearFeedServerHeader') .
|
||||||
|
|
||||||
'</head><body>' .
|
'</head><body>' .
|
||||||
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Feeds server') => $p_url,
|
__('Feeds server') => dcCore::app()->admin->getPageURL(),
|
||||||
($feed_id ? __('Edit feed') : __('New feed')) => ''
|
($feed_id ? __('Edit feed') : __('New feed')) => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
($feed_id ? '<h3>' . sprintf(__('Edit feed "%s"'), $feed_name) . '</h3>' : '');
|
($feed_id ? '<h3>' . sprintf(__('Edit feed "%s"'), $feed_name) . '</h3>' : '');
|
||||||
@ -379,7 +378,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
'</p>' .
|
'</p>' .
|
||||||
|
|
||||||
# --BEHAVIOR-- adminZoneclearFeedServerFeedForm
|
# --BEHAVIOR-- adminZoneclearFeedServerFeedForm
|
||||||
$core->callBehavior('adminZoneclearFeedServerFeedForm', $core, $feed_id) .
|
dcCore::app()->callBehavior('adminZoneclearFeedServerFeedForm', $feed_id) .
|
||||||
|
|
||||||
'</div>' .
|
'</div>' .
|
||||||
|
|
||||||
@ -412,27 +411,27 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
|
|
||||||
'<p class="clear">
|
'<p class="clear">
|
||||||
<input type="submit" name="save" value="' . __('Save') . ' (s)" accesskey="s"/>' .
|
<input type="submit" name="save" value="' . __('Save') . ' (s)" accesskey="s"/>' .
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
|
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
|
||||||
'part' => 'feed',
|
'part' => 'feed',
|
||||||
'feed_id' => $feed_id,
|
'feed_id' => $feed_id,
|
||||||
'action' => 'savefeed'
|
'action' => 'savefeed',
|
||||||
]) .
|
]) .
|
||||||
$core->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
'</p>
|
'</p>
|
||||||
</form>
|
</form>
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
# entries
|
# entries
|
||||||
if ($feed_id && $can_view_page && !$core->error->flag()) {
|
if ($feed_id && $can_view_page && !dcCore::app()->error->flag()) {
|
||||||
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(
|
$post_filter->display(
|
||||||
['admin.plugin.zoneclearFeedServer','#entries'],
|
['admin.plugin.zoneclearFeedServer','#entries'],
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
|
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
|
||||||
'part' => 'feed',
|
'part' => 'feed',
|
||||||
'feed_id' => $feed_id
|
'feed_id' => $feed_id,
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -445,8 +444,8 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
$post_list->display(
|
$post_list->display(
|
||||||
$post_filter->page,
|
$post_filter->page,
|
||||||
$post_filter->nb,
|
$post_filter->nb,
|
||||||
$core->adminurl->get('admin.plugin.zoneclearFeedServer', $args, '&') . '#entries',
|
dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', $args, '&') . '#entries',
|
||||||
'<form action="' . $core->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feed']) . '#entries" method="post" id="form-entries">' .
|
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feed']) . '#entries" method="post" id="form-entries">' .
|
||||||
'%s' .
|
'%s' .
|
||||||
|
|
||||||
'<div class="two-cols">' .
|
'<div class="two-cols">' .
|
||||||
@ -455,9 +454,9 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
'<p class="col right">' . __('Selected entries action:') . ' ' .
|
'<p class="col right">' . __('Selected entries action:') . ' ' .
|
||||||
form::combo('action', $posts_actions_page->getCombo()) .
|
form::combo('action', $posts_actions_page->getCombo()) .
|
||||||
'<input type="submit" name="save" value="' . __('ok') . '" /></p>' .
|
'<input type="submit" name="save" value="' . __('ok') . '" /></p>' .
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', $post_filter->values()) .
|
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', $post_filter->values()) .
|
||||||
form::hidden('redir', $core->adminurl->get('admin.plugin.zoneclearFeedServer', $post_filter->values())) .
|
form::hidden('redir', dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', $post_filter->values())) .
|
||||||
$core->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
'</div>' .
|
'</div>' .
|
||||||
'</form>',
|
'</form>',
|
||||||
$post_filter->show()
|
$post_filter->show()
|
||||||
@ -466,7 +465,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
#
|
#
|
||||||
# All feeds
|
# All feeds
|
||||||
#
|
#
|
||||||
@ -474,7 +473,6 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
} else {
|
} else {
|
||||||
# actions
|
# actions
|
||||||
$feeds_actions_page = new zcfsFeedsActionsPage(
|
$feeds_actions_page = new zcfsFeedsActionsPage(
|
||||||
$core,
|
|
||||||
'plugin.php',
|
'plugin.php',
|
||||||
['p' => 'zoneclearFeedServer', 'part' => 'feeds']
|
['p' => 'zoneclearFeedServer', 'part' => 'feeds']
|
||||||
);
|
);
|
||||||
@ -483,7 +481,7 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# filters
|
# filters
|
||||||
$feeds_filter = new adminGenericFilter($core, 'zcfs_feeds');
|
$feeds_filter = new adminGenericFilter(dcCore::app(), 'zcfs_feeds');
|
||||||
$feeds_filter->add('part', 'feeds');
|
$feeds_filter->add('part', 'feeds');
|
||||||
$feeds_filter->add(dcAdminFilters::getPageFilter());
|
$feeds_filter->add(dcAdminFilters::getPageFilter());
|
||||||
$feeds_filter->add(dcAdminFilters::getSearchFilter());
|
$feeds_filter->add(dcAdminFilters::getSearchFilter());
|
||||||
@ -494,53 +492,53 @@ if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
|||||||
$feeds = $zcfs->getFeeds($params);
|
$feeds = $zcfs->getFeeds($params);
|
||||||
$feeds_counter = $zcfs->getFeeds($params, true)->f(0);
|
$feeds_counter = $zcfs->getFeeds($params, true)->f(0);
|
||||||
$feeds_list = new zcfsFeedsList(
|
$feeds_list = new zcfsFeedsList(
|
||||||
$core,
|
dcCore::app(),
|
||||||
$feeds,
|
$feeds,
|
||||||
$feeds_counter
|
$feeds_counter
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
# display
|
# display
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Feeds server') . '</title>' .
|
'<html><head><title>' . __('Feeds server') . '</title>' .
|
||||||
$feeds_filter->js($core->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feeds'], '&')) .
|
$feeds_filter->js(dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feeds'], '&')) .
|
||||||
dcPage::jsLoad(dcPage::getPF('zoneclearFeedServer/js/list.js')) .
|
dcPage::jsLoad(dcPage::getPF('zoneclearFeedServer/js/list.js')) .
|
||||||
dcPage::jsPageTabs() .
|
dcPage::jsPageTabs() .
|
||||||
|
|
||||||
# --BEHAVIOR-- adminZoneclearFeedServerHeader
|
# --BEHAVIOR-- adminZoneclearFeedServerHeader
|
||||||
$core->callBehavior('adminZoneclearFeedServerHeader', $core) .
|
dcCore::app()->callBehavior('adminZoneclearFeedServerHeader') .
|
||||||
|
|
||||||
'</head><body>' .
|
'</head><body>' .
|
||||||
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Feeds server') => ''
|
__('Feeds server') => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
'<p class="top-add">' .
|
'<p class="top-add">' .
|
||||||
'<a class="button add" href="' . $core->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feed']) . '">' .
|
'<a class="button add" href="' . dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feed']) . '">' .
|
||||||
__('New feed') . '</a></p>';
|
__('New feed') . '</a></p>';
|
||||||
|
|
||||||
$feeds_filter->display(
|
$feeds_filter->display(
|
||||||
'admin.plugin.zoneclearFeedServer',
|
'admin.plugin.zoneclearFeedServer',
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', ['part', 'feeds'])
|
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', ['part' => 'feeds'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$feeds_list->feedsDisplay(
|
$feeds_list->feedsDisplay(
|
||||||
$feeds_filter->page,
|
$feeds_filter->page,
|
||||||
$feeds_filter->nb,
|
$feeds_filter->nb,
|
||||||
'<form action="' . $core->adminurl->get('admin.plugin.zoneclearFeedServer', ['part', 'feeds']) . '" method="post" id="form-actions">' .
|
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feeds']) . '" method="post" id="form-actions">' .
|
||||||
'%s' .
|
'%s' .
|
||||||
'<div class="two-cols">' .
|
'<div class="two-cols">' .
|
||||||
'<p class="col checkboxes-helpers"></p>' .
|
'<p class="col checkboxes-helpers"></p>' .
|
||||||
'<p class="col right">' . __('Selected feeds action:') . ' ' .
|
'<p class="col right">' . __('Selected feeds action:') . ' ' .
|
||||||
form::combo(['action'], $feeds_actions_page->getCombo()) .
|
form::combo(['action'], $feeds_actions_page->getCombo()) .
|
||||||
'<input type="submit" value="' . __('ok') . '" />' .
|
'<input type="submit" value="' . __('ok') . '" />' .
|
||||||
$core->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', $feeds_filter->values(true)) .
|
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', $feeds_filter->values(true)) .
|
||||||
$core->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
'</p>' .
|
'</p>' .
|
||||||
'</div>' .
|
'</div>' .
|
||||||
'</form>',
|
'</form>',
|
||||||
|
Loading…
Reference in New Issue
Block a user