first clean up of code and update license

This commit is contained in:
Jean-Christian Paul Denis 2021-09-11 11:56:57 +02:00
parent 64e75c9f1c
commit d8a9b15346
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
19 changed files with 3649 additions and 3843 deletions

View File

@ -1,19 +1,19 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
return null;
}
# Namespace for settings
@ -23,7 +23,7 @@ $core->blog->settings->addNamespace('zoneclearFeedServer');
if ($core->getVersion('zoneclearFeedServer') !=
$core->plugins->moduleInfo('zoneclearFeedServer', 'version')) {
return null;
return null;
}
# Widgets
@ -31,48 +31,48 @@ require_once dirname(__FILE__).'/_widgets.php';
# Admin menu
$_menu['Blog']->addItem(
__('Feeds server'),
'plugin.php?p=zoneclearFeedServer',
'index.php?pf=zoneclearFeedServer/icon.png',
preg_match(
'/plugin.php\?p=zoneclearFeedServer(&.*)?$/',
$_SERVER['REQUEST_URI']
),
$core->auth->check('admin', $core->blog->id)
__('Feeds server'),
'plugin.php?p=zoneclearFeedServer',
'index.php?pf=zoneclearFeedServer/icon.png',
preg_match(
'/plugin.php\?p=zoneclearFeedServer(&.*)?$/',
$_SERVER['REQUEST_URI']
),
$core->auth->check('admin', $core->blog->id)
);
# Delete related info about feed post in meta table
$core->addBehavior(
'adminBeforePostDelete',
array('zcfsAdminBehaviors', 'adminBeforePostDelete')
'adminBeforePostDelete',
array('zcfsAdminBehaviors', 'adminBeforePostDelete')
);
if ($core->auth->check('admin', $core->blog->id)) {
# Dashboard icon
$core->addBehavior(
'adminDashboardFavorites',
array('zcfsAdminBehaviors', 'adminDashboardFavorites')
);
# Dashboard icon
$core->addBehavior(
'adminDashboardFavorites',
array('zcfsAdminBehaviors', 'adminDashboardFavorites')
);
# Add info about feed on post page sidebar
$core->addBehavior(
'adminPostHeaders',
array('zcfsAdminBehaviors', 'adminPostHeaders')
);
$core->addBehavior(
'adminPostFormItems',
array('zcfsAdminBehaviors', 'adminPostFormItems')
);
# Add info about feed on post page sidebar
$core->addBehavior(
'adminPostHeaders',
array('zcfsAdminBehaviors', 'adminPostHeaders')
);
$core->addBehavior(
'adminPostFormItems',
array('zcfsAdminBehaviors', 'adminPostFormItems')
);
}
# Take care about tweakurls (thanks Mathieu M.)
if (version_compare($core->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
$core->addbehavior(
'zcfsAfterPostCreate',
array('zoneclearFeedServer', 'tweakurlsAfterPostCreate')
);
$core->addbehavior(
'zcfsAfterPostCreate',
array('zoneclearFeedServer', 'tweakurlsAfterPostCreate')
);
}
/**
@ -82,178 +82,178 @@ if (version_compare($core->plugins->moduleInfo('tweakurls', 'version'), '0.8', '
*/
class zcfsAdminBehaviors
{
/**
* Favorites.
*
* @param dcCore $core dcCore instance
* @param arrayObject $favs Array of favorites
*/
public static function adminDashboardFavorites(dcCore $core, $favs)
{
$favs->register('zcfs', array(
'title' => __('Feeds server'),
'url' => 'plugin.php?p=zoneclearFeedServer',
'small-icon' => 'index.php?pf=zoneclearFeedServer/icon.png',
'large-icon' => 'index.php?pf=zoneclearFeedServer/icon-big.png',
'permissions' => 'usage,contentadmin',
'active_cb' => array(
'zcfsAdminBehaviors',
'adminDashboardFavoritesActive'
),
'dashboard_cb' => array(
'zcfsAdminBehaviors',
'adminDashboardFavoritesCallback'
)
));
}
/**
* Favorites.
*
* @param dcCore $core dcCore instance
* @param arrayObject $favs Array of favorites
*/
public static function adminDashboardFavorites(dcCore $core, $favs)
{
$favs->register('zcfs', array(
'title' => __('Feeds server'),
'url' => 'plugin.php?p=zoneclearFeedServer',
'small-icon' => 'index.php?pf=zoneclearFeedServer/icon.png',
'large-icon' => 'index.php?pf=zoneclearFeedServer/icon-big.png',
'permissions' => 'usage,contentadmin',
'active_cb' => array(
'zcfsAdminBehaviors',
'adminDashboardFavoritesActive'
),
'dashboard_cb' => array(
'zcfsAdminBehaviors',
'adminDashboardFavoritesCallback'
)
));
}
/**
* Favorites selection.
*
* @param string $request Requested page
* @param array $params Requested parameters
*/
public static function adminDashboardFavoritesActive($request, $params)
{
return $request == 'plugin.php'
&& isset($params['p'])
&& $params['p'] == 'zoneclearFeedServer';
}
/**
* Favorites selection.
*
* @param string $request Requested page
* @param array $params Requested parameters
*/
public static function adminDashboardFavoritesActive($request, $params)
{
return $request == 'plugin.php'
&& isset($params['p'])
&& $params['p'] == 'zoneclearFeedServer';
}
/**
* Favorites hack.
*
* @param dcCore $core dcCore instance
* @param arrayObject $fav Fav attributes
*/
public static function adminDashboardFavoritesCallback(dcCore $core, $fav)
{
$zcfs = new zoneclearFeedServer($core);
$count = $zcfs->getFeeds(array(
'feed_status' => '0'
), true)->f(0);
/**
* Favorites hack.
*
* @param dcCore $core dcCore instance
* @param arrayObject $fav Fav attributes
*/
public static function adminDashboardFavoritesCallback(dcCore $core, $fav)
{
$zcfs = new zoneclearFeedServer($core);
$count = $zcfs->getFeeds(array(
'feed_status' => '0'
), true)->f(0);
if (!$count) {
if (!$count) {
return null;
}
return null;
}
$fav['title'] .= '<br />'.sprintf(
__('%s feed disabled', '%s feeds disabled', $count),
$count
);
$fav['url'] = 'plugin.php?p=zoneclearFeedServer&part=feeds'.
'&sortby=feed_status&order=asc';
$fav['large-icon'] = 'index.php?pf=zoneclearFeedServer'.
'/icon-big-update.png';
}
$fav['title'] .= '<br />'.sprintf(
__('%s feed disabled', '%s feeds disabled', $count),
$count
);
$fav['url'] = 'plugin.php?p=zoneclearFeedServer&part=feeds'.
'&sortby=feed_status&order=asc';
$fav['large-icon'] = 'index.php?pf=zoneclearFeedServer'.
'/icon-big-update.png';
}
/**
* Add javascript for toggle to post edition page header.
*
* @return string Page header
*/
public static function adminPostHeaders()
{
return dcPage::jsLoad(
'index.php?pf=zoneclearFeedServer/js/post.js'
);
}
/**
* Add javascript for toggle to post edition page header.
*
* @return string Page header
*/
public static function adminPostHeaders()
{
return dcPage::jsLoad(
'index.php?pf=zoneclearFeedServer/js/post.js'
);
}
/**
* Add form to post sidebar.
*
* @param ArrayObject $main_items Main items
* @param ArrayObject $sidebar_items Sidebar items
* @param record $post Post record or null
*/
public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, $post)
{
if ($post === null || $post->post_type != 'post') {
/**
* Add form to post sidebar.
*
* @param ArrayObject $main_items Main items
* @param ArrayObject $sidebar_items Sidebar items
* @param record $post Post record or null
*/
public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, $post)
{
if ($post === null || $post->post_type != 'post') {
return null;
}
return null;
}
global $core;
global $core;
$url = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_url',
'limit' => 1
));
$url = $url->isEmpty() ? '' : $url->meta_id;
$url = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_url',
'limit' => 1
));
$url = $url->isEmpty() ? '' : $url->meta_id;
if (!$url) {
if (!$url) {
return null;
}
return null;
}
$author = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_author',
'limit' => 1
));
$author = $author->isEmpty() ? '' : $author->meta_id;
$author = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_author',
'limit' => 1
));
$author = $author->isEmpty() ? '' : $author->meta_id;
$site = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_site',
'limit' => 1
));
$site = $site->isEmpty() ? '' : $site->meta_id;
$site = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_site',
'limit' => 1
));
$site = $site->isEmpty() ? '' : $site->meta_id;
$sitename = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_sitename',
'limit' => 1
));
$sitename = $sitename->isEmpty() ? '' : $sitename->meta_id;
$sitename = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_sitename',
'limit' => 1
));
$sitename = $sitename->isEmpty() ? '' : $sitename->meta_id;
$edit = '';
if ($core->auth->check('admin', $core->blog->id)) {
$fid = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_id',
'limit' => 1
));
if (!$fid->isEmpty()) {
$edit =
'<p><a href="plugin.php?p=zoneclearFeedServer'.
'&amp;part=feed&amp;feed_id='.$fid->meta_id.
'">'.__('Edit this feed').'</a></p>';
}
}
$edit = '';
if ($core->auth->check('admin', $core->blog->id)) {
$fid = $core->meta->getMetadata(array(
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_id',
'limit' => 1
));
if (!$fid->isEmpty()) {
$edit =
'<p><a href="plugin.php?p=zoneclearFeedServer'.
'&amp;part=feed&amp;feed_id='.$fid->meta_id.
'">'.__('Edit this feed').'</a></p>';
}
}
$sidebar_items['options-box']['items']['zcfs'] =
'<div id="zcfs">'.
'<h5>'.__('Feed source').'</h5>'.
'<p>'.
'<a href="'.$url.'" title="'.$author.' - '.$url.'">'.__('feed URL').'</a> - '.
'<a href="'.$site.'" title="'.$sitename.' - '.$site.'">'.__('site URL').'</a>'.
'</p>'.
$edit.
'</div>';
}
$sidebar_items['options-box']['items']['zcfs'] =
'<div id="zcfs">'.
'<h5>'.__('Feed source').'</h5>'.
'<p>'.
'<a href="'.$url.'" title="'.$author.' - '.$url.'">'.__('feed URL').'</a> - '.
'<a href="'.$site.'" title="'.$sitename.' - '.$site.'">'.__('site URL').'</a>'.
'</p>'.
$edit.
'</div>';
}
/**
* Delete related info about feed post in meta table.
*
* @param integer $post_id Post id
*/
public static function adminBeforePostDelete($post_id)
{
global $core;
/**
* Delete related info about feed post in meta table.
*
* @param integer $post_id Post id
*/
public static function adminBeforePostDelete($post_id)
{
global $core;
$core->con->execute(
'DELETE FROM '.$core->prefix.'meta '.
'WHERE post_id = '.((integer) $post_id).' '.
'AND meta_type '.$core->con->in(array(
'zoneclearfeed_url',
'zoneclearfeed_author',
'zoneclearfeed_site',
'zoneclearfeed_sitename',
'zoneclearfeed_id'
)).' '
);
}
}
$core->con->execute(
'DELETE FROM '.$core->prefix.'meta '.
'WHERE post_id = '.((integer) $post_id).' '.
'AND meta_type '.$core->con->in(array(
'zoneclearfeed_url',
'zoneclearfeed_author',
'zoneclearfeed_site',
'zoneclearfeed_sitename',
'zoneclearfeed_id'
)).' '
);
}
}

View File

@ -1,23 +1,23 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_MODULE')) {
return null;
return null;
}
$redir = empty($_REQUEST['redir']) ?
$list->getURL().'#plugins' : $_REQUEST['redir'];
$list->getURL().'#plugins' : $_REQUEST['redir'];
# -- Get settings --
$core->blog->settings->addNamespace('zoneclearFeedServer');
@ -35,13 +35,13 @@ $post_title_redir = @unserialize($s->zoneclearFeedServer_post_title_redir);
$feeduser = (string) $s->zoneclearFeedServer_user;
if ($update_limit < 1) {
$update_limit = 10;
$update_limit = 10;
}
if (!is_array($post_full_tpl)) {
$post_full_tpl = array();
$post_full_tpl = array();
}
if (!is_array($post_title_redir)) {
$post_title_redir = array();
$post_title_redir = array();
}
$zc = new zoneclearFeedServer($core);
@ -49,65 +49,65 @@ $zc = new zoneclearFeedServer($core);
# -- Set settings --
if (!empty($_POST['save'])) {
try {
$active = !empty($_POST['active']);
$pub_active = !empty($_POST['pub_active']);
$post_status_new = !empty($_POST['post_status_new']);
$bhv_pub_upd = (integer) $_POST['bhv_pub_upd'];
$limit = abs((integer) $_POST['update_limit']);
$keep_empty_feed = !empty($_POST['keep_empty_feed']);
$tag_case = (integer) $_POST['tag_case'];
$post_full_tpl = $_POST['post_full_tpl'];
$post_title_redir = $_POST['post_title_redir'];
$feeduser = (string) $_POST['feeduser'];
try {
$active = !empty($_POST['active']);
$pub_active = !empty($_POST['pub_active']);
$post_status_new = !empty($_POST['post_status_new']);
$bhv_pub_upd = (integer) $_POST['bhv_pub_upd'];
$limit = abs((integer) $_POST['update_limit']);
$keep_empty_feed = !empty($_POST['keep_empty_feed']);
$tag_case = (integer) $_POST['tag_case'];
$post_full_tpl = $_POST['post_full_tpl'];
$post_title_redir = $_POST['post_title_redir'];
$feeduser = (string) $_POST['feeduser'];
if ($limit < 1) {
$limit = 10;
}
if ($limit < 1) {
$limit = 10;
}
$s->put('zoneclearFeedServer_active', $active);
$s->put('zoneclearFeedServer_pub_active', $pub_active);
$s->put('zoneclearFeedServer_post_status_new', $post_status_new);
$s->put('zoneclearFeedServer_bhv_pub_upd', $bhv_pub_upd);
$s->put('zoneclearFeedServer_update_limit', $limit);
$s->put('zoneclearFeedServer_keep_empty_feed', $keep_empty_feed);
$s->put('zoneclearFeedServer_tag_case', $tag_case);
$s->put('zoneclearFeedServer_post_full_tpl', serialize($post_full_tpl));
$s->put('zoneclearFeedServer_post_title_redir', serialize($post_title_redir));
$s->put('zoneclearFeedServer_user', $feeduser);
$s->put('zoneclearFeedServer_active', $active);
$s->put('zoneclearFeedServer_pub_active', $pub_active);
$s->put('zoneclearFeedServer_post_status_new', $post_status_new);
$s->put('zoneclearFeedServer_bhv_pub_upd', $bhv_pub_upd);
$s->put('zoneclearFeedServer_update_limit', $limit);
$s->put('zoneclearFeedServer_keep_empty_feed', $keep_empty_feed);
$s->put('zoneclearFeedServer_tag_case', $tag_case);
$s->put('zoneclearFeedServer_post_full_tpl', serialize($post_full_tpl));
$s->put('zoneclearFeedServer_post_title_redir', serialize($post_title_redir));
$s->put('zoneclearFeedServer_user', $feeduser);
$core->blog->triggerBlog();
$core->blog->triggerBlog();
dcPage::addSuccessNotice(
__('Configuration successfully updated.')
);
http::redirect(
$list->getURL('module=zoneclearFeedServer&conf=1&redir='.
$list->getRedir())
);
}
catch (Exception $e) {
$core->error->add($e->getMessage());
}
dcPage::addSuccessNotice(
__('Configuration successfully updated.')
);
http::redirect(
$list->getURL('module=zoneclearFeedServer&conf=1&redir='.
$list->getRedir())
);
}
catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
# -- Form combos --
$combo_admins = $zc->getAllBlogAdmins();
$combo_pubupd = array(
__('Disable') => 0,
__('Before display') => 1,
__('After display') => 2,
__('Through Ajax') => 3
__('Disable') => 0,
__('Before display') => 1,
__('After display') => 2,
__('Through Ajax') => 3
);
$combo_status = array(
__('Unpublished') => 0,
__('Published') => 1
__('Unpublished') => 0,
__('Published') => 1
);
$combo_tagcase = array(
__('Keep source case') => 0,
__('First upper case') => 1,
__('All lower case') => 2,
__('All upper case') => 3
__('Keep source case') => 0,
__('First upper case') => 1,
__('All lower case') => 2,
__('All upper case') => 3
);
$pub_page_url = $core->blog->url.$core->url->getBase('zoneclearFeedsPage');
@ -115,12 +115,12 @@ $pub_page_url = $core->blog->url.$core->url->getBase('zoneclearFeedsPage');
# -- Display form --
if (!is_writable(DC_TPL_CACHE)) {
echo
'<p class="error">'.
__('Dotclear cache is not writable or not well configured!').
'</p>';
}
echo
'<p class="error">'.
__('Dotclear cache is not writable or not well configured!').
'</p>';
}
echo '
<div class="fieldset">
@ -135,7 +135,7 @@ echo '
<div class="fieldset">';
if ($core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
echo '<p><a class="onblog_link" href="'.$pub_page_url.'" title="'.$pub_page_url.''.'">'.__('View the public list of feeds').'</a></p>';
echo '<p><a class="onblog_link" href="'.$pub_page_url.'" title="'.$pub_page_url.''.'">'.__('View the public list of feeds').'</a></p>';
}
echo '
@ -178,14 +178,14 @@ __('Enable public page').'</label></p>
<p>'.__('Redirect to original post on:').'</p><ul>';
foreach($zc->getPublicUrlTypes($core) as $k => $v) {
echo
'<li><label for="post_title_redir_'.$v.'">'.
form::checkbox(
array('post_title_redir[]', 'post_title_redir_'.$v),
$v,
in_array($v, $post_title_redir)
).
__($k).'</label></li>';
echo
'<li><label for="post_title_redir_'.$v.'">'.
form::checkbox(
array('post_title_redir[]', 'post_title_redir_'.$v),
$v,
in_array($v, $post_title_redir)
).
__($k).'</label></li>';
}
echo '
</ul>
@ -195,14 +195,14 @@ echo '
<p>'.__('Show full content on:').'</p><ul>';
foreach($zc->getPublicUrlTypes($core) as $k => $v) {
echo
'<li><label for="post_full_tpl_'.$v.'">'.
form::checkbox(
array('post_full_tpl[]', 'post_full_tpl_'.$v),
$v,
in_array($v, $post_full_tpl)
).
__($k).'</label></li>';
echo
'<li><label for="post_full_tpl_'.$v.'">'.
form::checkbox(
array('post_full_tpl[]', 'post_full_tpl_'.$v),
$v,
in_array($v, $post_full_tpl)
).
__($k).'</label></li>';
}
echo '
</ul>

View File

@ -1,36 +1,31 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
return null;
}
$this->registerModule(
/* Name */
"zoneclearFeedServer",
/* Description*/
"Mix your blog with a feeds planet",
/* Author */
"Jean-Christian Denis, BG, Pierre Van Glabeke",
/* Version */
'2015.07.19',
/* Properies */
array(
'permissions' => 'admin',
'type' => 'plugin',
'dc_min' => '2.8',
'support' => 'http://forum.dotclear.org/viewtopic.php?pid=331158',
'details' => 'http://plugins.dotaddict.org/dc2/details/zoneclearFeedServer'
)
'zoneclearFeedServer',
'Mix your blog with a feeds planet',
'Jean-Christian Denis, BG, Pierre Van Glabeke',
'2015.07.19',
[
'requires' => [['core', '2.19']],
'permissions' => 'admin',
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/zoneclearFeedServer',
'details' => 'https://plugins.dotaddict.org/dc2/details/pacKman',
'repository' => 'https://raw.githubusercontent.com/JcDenis/zoneclearFeedServer/master/dcstore.xml'
]
);

View File

@ -1,98 +1,98 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
return null;
}
$dc_min = '2.7';
$mod_id = 'zoneclearFeedServer';
try {
# Check module version
if (version_compare(
$core->getVersion($mod_id),
$core->plugins->moduleInfo($mod_id, 'version'),
'>='
)) {
# Check module version
if (version_compare(
$core->getVersion($mod_id),
$core->plugins->moduleInfo($mod_id, 'version'),
'>='
)) {
return null;
}
return null;
}
# Check Dotclear version
if (!method_exists('dcUtils', 'versionsCompare')
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
throw new Exception(sprintf(
'%s requires Dotclear %s', $mod_id, $dc_min
));
}
# Tables
$t = new dbStruct($core->con, $core->prefix);
$t->zc_feed
->feed_id ('bigint', 0, false)
->feed_creadt ('timestamp', 0, false, 'now()')
->feed_upddt ('timestamp', 0, false, 'now()')
->feed_type ('varchar', 32, false, "'feed'")
->blog_id ('varchar', 32, false)
->cat_id ('bigint', 0, true)
->feed_upd_int ('integer', 0, false, 3600)
->feed_upd_last ('integer', 0, false, 0)
->feed_status ('smallint', 0, false, 0)
->feed_name ('varchar', 255, false)
->feed_desc ('text', 0, true) //!pgsql reserved 'desc'
->feed_url ('varchar', 255, false)
->feed_feed ('varchar', 255, false)
->feed_tags ('varchar', 255, true)
->feed_get_tags ('smallint', 0, false, 1)
->feed_owner ('varchar', 255, false)
->feed_tweeter ('varchar', 64, false) // tweeter ident
->feed_lang ('varchar', 5, true)
->feed_nb_out ('integer', 0, false, 0)
->feed_nb_in ('integer', 0, false, 0)
->primary('pk_zcfs', 'feed_id')
->index('idx_zcfs_type', 'btree', 'feed_type')
->index('idx_zcfs_blog', 'btree', 'blog_id');
$ti = new dbStruct($core->con, $core->prefix);
$changes = $ti->synchronize($t);
# Settings
$core->blog->settings->addNamespace('zoneclearFeedServer');
$s = $core->blog->settings->zoneclearFeedServer;
$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_post_status_new', true, 'boolean', 'Enable auto publish new posts', false, true);
$s->put('zoneclearFeedServer_bhv_pub_upd', 2, 'string', 'Auto update on public side (disable/before/after)', false, true);
$s->put('zoneclearFeedServer_update_limit', 1, 'integer', 'Number of feeds to update at one time', false, true);
$s->put('zoneclearFeedServer_keep_empty_feed', false, 'boolean', 'Keep active empty feeds', false, true);
$s->put('zoneclearFeedServer_tag_case', 0, 'integer', 'How to transform imported tags', false, true);
$s->put('zoneclearFeedServer_user', '', 'string','User id that has right on post', false, true);
$s->put('zoneclearFeedServer_post_full_tpl', serialize(array('post', 'category', 'tag', 'archive')), 'string', 'List of templates types for full feed', false, true);
$s->put('zoneclearFeedServer_post_title_redir', serialize(array('feed')), 'string', 'List of templates types for redirection to original post', false, true);
# Check Dotclear version
if (!method_exists('dcUtils', 'versionsCompare')
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
throw new Exception(sprintf(
'%s requires Dotclear %s', $mod_id, $dc_min
));
}
# Set module version
$core->setVersion(
$mod_id,
$core->plugins->moduleInfo($mod_id, 'version')
);
# Tables
$t = new dbStruct($core->con, $core->prefix);
$t->zc_feed
->feed_id ('bigint', 0, false)
->feed_creadt ('timestamp', 0, false, 'now()')
->feed_upddt ('timestamp', 0, false, 'now()')
->feed_type ('varchar', 32, false, "'feed'")
->blog_id ('varchar', 32, false)
->cat_id ('bigint', 0, true)
->feed_upd_int ('integer', 0, false, 3600)
->feed_upd_last ('integer', 0, false, 0)
->feed_status ('smallint', 0, false, 0)
->feed_name ('varchar', 255, false)
->feed_desc ('text', 0, true) //!pgsql reserved 'desc'
->feed_url ('varchar', 255, false)
->feed_feed ('varchar', 255, false)
->feed_tags ('varchar', 255, true)
->feed_get_tags ('smallint', 0, false, 1)
->feed_owner ('varchar', 255, false)
->feed_tweeter ('varchar', 64, false) // tweeter ident
->feed_lang ('varchar', 5, true)
->feed_nb_out ('integer', 0, false, 0)
->feed_nb_in ('integer', 0, false, 0)
return true;
->primary('pk_zcfs', 'feed_id')
->index('idx_zcfs_type', 'btree', 'feed_type')
->index('idx_zcfs_blog', 'btree', 'blog_id');
$ti = new dbStruct($core->con, $core->prefix);
$changes = $ti->synchronize($t);
# Settings
$core->blog->settings->addNamespace('zoneclearFeedServer');
$s = $core->blog->settings->zoneclearFeedServer;
$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_post_status_new', true, 'boolean', 'Enable auto publish new posts', false, true);
$s->put('zoneclearFeedServer_bhv_pub_upd', 2, 'string', 'Auto update on public side (disable/before/after)', false, true);
$s->put('zoneclearFeedServer_update_limit', 1, 'integer', 'Number of feeds to update at one time', false, true);
$s->put('zoneclearFeedServer_keep_empty_feed', false, 'boolean', 'Keep active empty feeds', false, true);
$s->put('zoneclearFeedServer_tag_case', 0, 'integer', 'How to transform imported tags', false, true);
$s->put('zoneclearFeedServer_user', '', 'string','User id that has right on post', false, true);
$s->put('zoneclearFeedServer_post_full_tpl', serialize(array('post', 'category', 'tag', 'archive')), 'string', 'List of templates types for full feed', false, true);
$s->put('zoneclearFeedServer_post_title_redir', serialize(array('feed')), 'string', 'List of templates types for redirection to original post', false, true);
# Set module version
$core->setVersion(
$mod_id,
$core->plugins->moduleInfo($mod_id, 'version')
);
return true;
}
catch (Exception $e) {
$core->error->add($e->getMessage());
$core->error->add($e->getMessage());
return false;
return false;
}

View File

@ -1,25 +1,25 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
return null;
}
if ($core->getVersion('zoneclearFeedServer') !=
$core->plugins->moduleInfo('zoneclearFeedServer', 'version')) {
return null;
return null;
}
$d = dirname(__FILE__).'/inc/';
@ -32,24 +32,24 @@ $__autoload['zcfsDefaultFeedsActions'] = $d.'class.zcfs.feedsactions.php';
# public url for page of description of the flux
$core->url->register(
'zoneclearFeedsPage',
'zcfeeds',
'^zcfeeds(.*?)$',
array('zcfsUrlHandler', 'zcFeedsPage')
'zoneclearFeedsPage',
'zcfeeds',
'^zcfeeds(.*?)$',
array('zcfsUrlHandler', 'zcFeedsPage')
);
/*
# Add to plugn soCialMe (writer part)
$__autoload['zcfsSoCialMeWriter'] = $d.'lib.zcfs.socialmewriter.php';
$core->addBehavior(
'soCialMeWriterMarker',
array('zcfsSoCialMeWriter', 'soCialMeWriterMarker')
'soCialMeWriterMarker',
array('zcfsSoCialMeWriter', 'soCialMeWriterMarker')
);
$core->addBehavior(
'zoneclearFeedServerAfterFeedUpdate',
array('zcfsSoCialMeWriter', 'zoneclearFeedServerAfterFeedUpdate')
'zoneclearFeedServerAfterFeedUpdate',
array('zcfsSoCialMeWriter', 'zoneclearFeedServerAfterFeedUpdate')
);
//*/
# Add to report on plugin activityReport
if (defined('ACTIVITY_REPORT')) {
require_once $d.'lib.zcfs.activityreport.php';
require_once $d.'lib.zcfs.activityreport.php';
}

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +1,82 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
return null;
}
$mod_id = 'zoneclearFeedServer';
$this->addUserAction(
/* type */ 'settings',
/* action */ 'delete_all',
/* ns */ $mod_id,
/* desc */ __('delete all settings')
/* type */ 'settings',
/* action */ 'delete_all',
/* ns */ $mod_id,
/* desc */ __('delete all settings')
);
$this->addUserAction(
/* type */ 'tables',
/* action */ 'delete',
/* ns */ 'zc_feed',
/* desc */ __('delete table')
/* type */ 'tables',
/* action */ 'delete',
/* ns */ 'zc_feed',
/* desc */ __('delete table')
);
$this->addUserAction(
/* type */ 'plugins',
/* action */ 'delete',
/* ns */ $mod_id,
/* desc */ __('delete plugin files')
/* type */ 'plugins',
/* action */ 'delete',
/* ns */ $mod_id,
/* desc */ __('delete plugin files')
);
$this->addUserAction(
/* type */ 'versions',
/* action */ 'delete',
/* ns */ $mod_id,
/* desc */ __('delete the version number')
/* type */ 'versions',
/* action */ 'delete',
/* ns */ $mod_id,
/* desc */ __('delete the version number')
);
$this->addDirectAction(
/* type */ 'settings',
/* action */ 'delete_all',
/* ns */ $mod_id,
/* desc */ sprintf(__('delete all %s settings'), $mod_id)
/* type */ 'settings',
/* action */ 'delete_all',
/* ns */ $mod_id,
/* desc */ sprintf(__('delete all %s settings'), $mod_id)
);
$this->addDirectAction(
/* type */ 'tables',
/* action */ 'delete',
/* ns */ 'zc_feed',
/* desc */ sprintf(__('delete %s table'), $mod_id)
/* type */ 'tables',
/* action */ 'delete',
/* ns */ 'zc_feed',
/* desc */ sprintf(__('delete %s table'), $mod_id)
);
$this->addDirectAction(
/* type */ 'plugins',
/* action */ 'delete',
/* ns */ $mod_id,
/* desc */ sprintf(__('delete %s plugin files'), $mod_id)
/* type */ 'plugins',
/* action */ 'delete',
/* ns */ $mod_id,
/* desc */ sprintf(__('delete %s plugin files'), $mod_id)
);
$this->addDirectAction(
/* type */ 'versions',
/* action */ 'delete',
/* ns */ $mod_id,
/* desc */ sprintf(__('delete %s version number'), $mod_id)
/* type */ 'versions',
/* action */ 'delete',
/* ns */ $mod_id,
/* desc */ sprintf(__('delete %s version number'), $mod_id)
);
$this->addDirectCallback(
/* function */ 'zoneclearfeedServerUninstall',
/* desc */ 'delete feeds relations'
/* function */ 'zoneclearfeedServerUninstall',
/* desc */ 'delete feeds relations'
);
function zoneclearfeedServerUninstall($core, $id)
{
if ($id != 'zoneclearFeedServer') {
if ($id != 'zoneclearFeedServer') {
return null;
}
//...
return null;
}
//...
}

View File

@ -1,28 +1,28 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
return null;
}
$core->addBehavior(
'initWidgets',
array('zoneclearFeedServerWidget', 'adminSource')
'initWidgets',
array('zoneclearFeedServerWidget', 'adminSource')
);
$core->addBehavior(
'initWidgets',
array('zoneclearFeedServerWidget', 'adminNumber')
'initWidgets',
array('zoneclearFeedServerWidget', 'adminNumber')
);
/**
@ -32,282 +32,282 @@ $core->addBehavior(
*/
class zoneclearFeedServerWidget
{
/**
* Widget configuration for sources list.
*
* @param dcWidget $w dcWidget instance
*/
public static function adminSource($w)
{
$w->create(
'zcfssource',
__('Feeds server: sources'),
array('zoneclearFeedServerWidget', 'publicSource'),
null,
__('List sources of feeds')
);
$w->zcfssource->setting(
'title',
__('Title:'),
__('Feeds sources'),
'text'
);
$w->zcfssource->setting(
'sortby',
__('Order by:'),
'feed_upd_last',
'combo',
array(
__('Last update') => 'feed_upd_last',
__('Name') => 'lowername',
__('Create date') => 'feed_creadt'
)
);
$w->zcfssource->setting(
'sort',
__('Sort:'),
'desc',
'combo',
array(
__('Ascending') => 'asc',
__('Descending') => 'desc'
)
);
$w->zcfssource->setting(
'limit',
__('Limit:'),
10,
'text'
);
$w->zcfssource->setting('pagelink',__('Link to the list of sources:'),__('All sources'));
$w->zcfssource->setting(
'homeonly',
__('Display on:'),
0,
'combo',
array(
__('All pages') => 0,
__('Home page only') => 1,
__('Except on home page') => 2
)
);
$w->zcfssource->setting('content_only',__('Content only'),0,'check');
$w->zcfssource->setting('class',__('CSS class:'),'');
$w->zcfssource->setting('offline',__('Offline'),0,'check');
}
/**
* Widget configuration for sources list.
*
* @param dcWidget $w dcWidget instance
*/
public static function adminSource($w)
{
$w->create(
'zcfssource',
__('Feeds server: sources'),
array('zoneclearFeedServerWidget', 'publicSource'),
null,
__('List sources of feeds')
);
$w->zcfssource->setting(
'title',
__('Title:'),
__('Feeds sources'),
'text'
);
$w->zcfssource->setting(
'sortby',
__('Order by:'),
'feed_upd_last',
'combo',
array(
__('Last update') => 'feed_upd_last',
__('Name') => 'lowername',
__('Create date') => 'feed_creadt'
)
);
$w->zcfssource->setting(
'sort',
__('Sort:'),
'desc',
'combo',
array(
__('Ascending') => 'asc',
__('Descending') => 'desc'
)
);
$w->zcfssource->setting(
'limit',
__('Limit:'),
10,
'text'
);
$w->zcfssource->setting('pagelink',__('Link to the list of sources:'),__('All sources'));
$w->zcfssource->setting(
'homeonly',
__('Display on:'),
0,
'combo',
array(
__('All pages') => 0,
__('Home page only') => 1,
__('Except on home page') => 2
)
);
$w->zcfssource->setting('content_only',__('Content only'),0,'check');
$w->zcfssource->setting('class',__('CSS class:'),'');
$w->zcfssource->setting('offline',__('Offline'),0,'check');
}
/**
* Widget configuration for feeds info.
*
* @param dcWidget $w dcWidget instance
*/
public static function adminNumber($w)
{
$w->create(
'zcfsnumber',
__('Feeds server: numbers'),
array('zoneclearFeedServerWidget', 'publicNumber'),
null,
__('Show some numbers about feeds')
);
$w->zcfsnumber->setting(
'title',
__('Title:')
,__('Feeds numbers'),
'text'
);
/**
* Widget configuration for feeds info.
*
* @param dcWidget $w dcWidget instance
*/
public static function adminNumber($w)
{
$w->create(
'zcfsnumber',
__('Feeds server: numbers'),
array('zoneclearFeedServerWidget', 'publicNumber'),
null,
__('Show some numbers about feeds')
);
$w->zcfsnumber->setting(
'title',
__('Title:')
,__('Feeds numbers'),
'text'
);
# Feed
$w->zcfsnumber->setting(
'feed_show',
__('Show feeds count'),
1,
'check'
);
$w->zcfsnumber->setting(
'feed_title',
__('Title for feeds count:'),
__('Feeds:'),
'text'
);
# Feed
$w->zcfsnumber->setting(
'feed_show',
__('Show feeds count'),
1,
'check'
);
$w->zcfsnumber->setting(
'feed_title',
__('Title for feeds count:'),
__('Feeds:'),
'text'
);
# Entry
$w->zcfsnumber->setting(
'entry_show',
__('Show entries count'),
1,
'check'
);
$w->zcfsnumber->setting(
'entry_title',
__('Title for entries count:'),
__('Entries:'),
'text'
);
$w->zcfsnumber->setting(
'homeonly',
__('Display on:'),
0,
'combo',
array(
__('All pages') => 0,
__('Home page only') => 1,
__('Except on home page') => 2
)
);
$w->zcfsnumber->setting(
'content_only',
__('Content only'),
0,
'check'
);
$w->zcfsnumber->setting(
'class',
__('CSS class:'),
''
);
$w->zcfsnumber->setting('offline',__('Offline'),0,'check');
}
# Entry
$w->zcfsnumber->setting(
'entry_show',
__('Show entries count'),
1,
'check'
);
$w->zcfsnumber->setting(
'entry_title',
__('Title for entries count:'),
__('Entries:'),
'text'
);
/**
* Widget for sources list.
*
* @param dcWidget $w dcWidget instance
*/
public static function publicSource($w)
{
global $core;
$w->zcfsnumber->setting(
'homeonly',
__('Display on:'),
0,
'combo',
array(
__('All pages') => 0,
__('Home page only') => 1,
__('Except on home page') => 2
)
);
$w->zcfsnumber->setting(
'content_only',
__('Content only'),
0,
'check'
);
$w->zcfsnumber->setting(
'class',
__('CSS class:'),
''
);
$w->zcfsnumber->setting('offline',__('Offline'),0,'check');
}
if ($w->offline)
return;
if (!$core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|| $w->homeonly == 1 && $core->url->type != 'default'
|| $w->homeonly == 2 && $core->url->type == 'default'
) {
return null;
}
/**
* Widget for sources list.
*
* @param dcWidget $w dcWidget instance
*/
public static function publicSource($w)
{
global $core;
$p = array();
$p['order'] = ($w->sortby && in_array($w->sortby, array('feed_upd_last', 'lowername', 'feed_creadt'))) ?
$w->sortby.' ' : 'feed_upd_last ';
$p['order'] .= $w->sort == 'desc' ? 'DESC' : 'ASC';
$p['limit'] = abs((integer) $w->limit);
$p['feed_status'] = 1;
if ($w->offline)
return;
$zc = new zoneclearFeedServer($core);
$rs = $zc->getFeeds($p);
if (!$core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|| $w->homeonly == 1 && $core->url->type != 'default'
|| $w->homeonly == 2 && $core->url->type == 'default'
) {
return null;
}
if ($rs->isEmpty()) {
$p = array();
$p['order'] = ($w->sortby && in_array($w->sortby, array('feed_upd_last', 'lowername', 'feed_creadt'))) ?
$w->sortby.' ' : 'feed_upd_last ';
$p['order'] .= $w->sort == 'desc' ? 'DESC' : 'ASC';
$p['limit'] = abs((integer) $w->limit);
$p['feed_status'] = 1;
return null;
}
$zc = new zoneclearFeedServer($core);
$rs = $zc->getFeeds($p);
$res = '';
$i = 1;
while($rs->fetch()) {
$res .=
'<li>'.
'<a href="'.$rs->feed_url.'" title="'.$rs->feed_owner.'">'.$rs->feed_name.'</a>'.
'</li>';
$i++;
}
if ($rs->isEmpty()) {
$res =
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
return null;
}
$res = '';
$i = 1;
while($rs->fetch()) {
$res .=
'<li>'.
'<a href="'.$rs->feed_url.'" title="'.$rs->feed_owner.'">'.$rs->feed_name.'</a>'.
'</li>';
$i++;
}
$res =
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
'<ul>'.$res.'</ul>';
if ($w->pagelink) {
$res .= '<p><strong><a href="'.$core->blog->url.$core->url->getBase('zoneclearFeedsPage').'">'.
if ($w->pagelink) {
$res .= '<p><strong><a href="'.$core->blog->url.$core->url->getBase('zoneclearFeedsPage').'">'.
html::escapeHTML($w->pagelink).'</a></strong></p>';
}
}
return $w->renderDiv($w->content_only,'zoneclear-sources '.$w->class,'',$res);
}
return $w->renderDiv($w->content_only,'zoneclear-sources '.$w->class,'',$res);
}
/**
* Widget for feeds info.
*
* @param dcWidget $w dcWidget instance
*/
public static function publicNumber($w)
{
global $core;
/**
* Widget for feeds info.
*
* @param dcWidget $w dcWidget instance
*/
public static function publicNumber($w)
{
global $core;
if ($w->offline)
return;
if ($w->offline)
return;
if (!$core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|| $w->homeonly == 1 && $core->url->type != 'default'
|| $w->homeonly == 2 && $core->url->type == 'default'
) {
return null;
}
if (!$core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|| $w->homeonly == 1 && $core->url->type != 'default'
|| $w->homeonly == 2 && $core->url->type == 'default'
) {
return null;
}
$zc = new zoneclearFeedServer($core);
$content = '';
$zc = new zoneclearFeedServer($core);
$content = '';
# Feed
if ($w->feed_show) {
$title = ($w->feed_title ?
'<strong>'.html::escapeHTML($w->feed_title).'</strong> ' : '');
# Feed
if ($w->feed_show) {
$title = ($w->feed_title ?
'<strong>'.html::escapeHTML($w->feed_title).'</strong> ' : '');
$count = $zc->getFeeds(array(),true)->f(0);
$count = $zc->getFeeds(array(),true)->f(0);
if ($count == 0) {
$text = sprintf(__('no sources'),$count);
}
elseif ($count == 1) {
$text = sprintf(__('one source'),$count);
}
else {
$text = sprintf(__('%d sources'),$count);
}
if ($core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
$text = '<a href="'.$core->blog->url.$core->url->getBase('zoneclearFeedsPage').'">'.$text.'</a>';
}
if ($count == 0) {
$text = sprintf(__('no sources'),$count);
}
elseif ($count == 1) {
$text = sprintf(__('one source'),$count);
}
else {
$text = sprintf(__('%d sources'),$count);
}
if ($core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
$text = '<a href="'.$core->blog->url.$core->url->getBase('zoneclearFeedsPage').'">'.$text.'</a>';
}
$content .= sprintf('<li>%s%s</li>',$title,$text);
}
$content .= sprintf('<li>%s%s</li>',$title,$text);
}
# Entry
if ($w->entry_show) {
$count = 0;
$feeds = $zc->getFeeds();
# Entry
if ($w->entry_show) {
$count = 0;
$feeds = $zc->getFeeds();
if (!$feeds->isEmpty()) {
while ($feeds->fetch()) {
$count += (integer) $zc->getPostsByFeed(array('feed_id' => $feeds->feed_id), true)->f(0);
}
}
$title = ($w->entry_title ?
'<strong>'.html::escapeHTML($w->entry_title).'</strong> ' : '');
if (!$feeds->isEmpty()) {
while ($feeds->fetch()) {
$count += (integer) $zc->getPostsByFeed(array('feed_id' => $feeds->feed_id), true)->f(0);
}
}
$title = ($w->entry_title ?
'<strong>'.html::escapeHTML($w->entry_title).'</strong> ' : '');
if ($count == 0) {
$text = sprintf(__('no entries'),$count);
}
elseif ($count == 1) {
$text = sprintf(__('one entry'),$count);
}
else {
$text = sprintf(__('%d entries'),$count);
}
if ($count == 0) {
$text = sprintf(__('no entries'),$count);
}
elseif ($count == 1) {
$text = sprintf(__('one entry'),$count);
}
else {
$text = sprintf(__('%d entries'),$count);
}
$content .= sprintf('<li>%s%s</li>',$title,$text);
}
$content .= sprintf('<li>%s%s</li>',$title,$text);
}
# Nothing to display
if (!$content) {
# Nothing to display
if (!$content) {
return null;
}
return null;
}
# Display
$res =
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
# Display
$res =
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
'<ul>'.$content.'</ul>';
return $w->renderDiv($w->content_only,'zoneclear-number '.$w->class,'',$res);
}
return $w->renderDiv($w->content_only,'zoneclear-number '.$w->class,'',$res);
}
}

View File

@ -1,17 +1,5 @@
#!/usr/bin/env php
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
# This file is highly based cron-script.php
# From Dotclear extension called planet
# By Olivier Meunier and contributors
@ -21,18 +9,18 @@ $opts = getopt('d:c:b:u:h');
function help($status=0)
{
echo
"Options: \n".
" -h shows this help\n".
" -d DotClear root path\n".
" -c DotClear conf path\n".
" -b Blog ID\n".
" -u User ID\n\n";
exit($status);
echo
"Options: \n".
" -h shows this help\n".
" -d DotClear root path\n".
" -c DotClear conf path\n".
" -b Blog ID\n".
" -u User ID\n\n";
exit($status);
}
if (isset($opts['h'])) {
help();
help();
}
$dc_root = null;
@ -40,36 +28,36 @@ $dc_conf = null;
$blog_id = null;
if (isset($opts['d'])) {
$dc_root = $opts['d'];
$dc_root = $opts['d'];
} elseif (isset($_SERVER['DC_ROOT'])) {
$dc_root = $_SERVER['DC_ROOT'];
$dc_root = $_SERVER['DC_ROOT'];
}
if (isset($opts['c'])) {
$dc_conf = realpath($opts['c']);
$dc_conf = realpath($opts['c']);
} elseif (isset($_SERVER['DC_RC_PATH'])) {
$dc_conf = realpath($_SERVER['DC_RC_PATH']);
$dc_conf = realpath($_SERVER['DC_RC_PATH']);
}
if (isset($opts['b'])) {
$blog_id = $opts['b'];
$blog_id = $opts['b'];
} elseif (isset($_SERVER['DC_BLOG_ID'])) {
$blog_id = $opts['DC_BLOG_ID'];
$blog_id = $opts['DC_BLOG_ID'];
}
if (!$dc_root || !is_dir($dc_root)) {
fwrite(STDERR,"DotClear root path is not defined\n\n");
help(1);
fwrite(STDERR,"DotClear root path is not defined\n\n");
help(1);
}
if (!$dc_conf || !is_readable($dc_conf)) {
fwrite(STDERR,"DotClear configuration not found\n\n");
help(1);
fwrite(STDERR,"DotClear configuration not found\n\n");
help(1);
}
if (!$blog_id) {
fwrite(STDERR,"Blog ID is not defined\n\n");
help(1);
fwrite(STDERR,"Blog ID is not defined\n\n");
help(1);
}
$_SERVER['DC_RC_PATH'] = $dc_conf;
@ -83,13 +71,13 @@ unset($dc_root);
$core->setBlog(DC_BLOG_ID);
if ($core->blog->id == null) {
fwrite(STDERR,"Blog is not defined\n");
exit(1);
fwrite(STDERR,"Blog is not defined\n");
exit(1);
}
if (!isset($opts['u']) || !$core->auth->checkUser($opts['u'])) {
fwrite(STDERR,"Unable to set user\n");
exit(1);
fwrite(STDERR,"Unable to set user\n");
exit(1);
}
$core->plugins->loadModules(DC_PLUGINS_ROOT);
@ -97,9 +85,9 @@ $core->plugins->loadModules(DC_PLUGINS_ROOT);
$core->blog->settings->addNamespace('zoneclearFeedServer');
try {
$zc = new zoneclearFeedServer($core);
$zc->checkFeedsUpdate();
$zc = new zoneclearFeedServer($core);
$zc->checkFeedsUpdate();
} catch (Exception $e) {
fwrite(STDERR,$e->getMessage()."\n");
exit(1);
fwrite(STDERR,$e->getMessage()."\n");
exit(1);
}

View File

@ -1,93 +1,87 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @ingroup DC_PLUGIN_ZONECLEARFEEDSERVER
* @brief Feeds server - actions methods
* @since 2.6
* @see dcPostsActionsPage for more info
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class zcfsFeedsActionsPage extends dcActionsPage
{
public $zcfs;
public $zcfs;
public function __construct(dcCore $core, $uri, $redirect_args=array())
{
$this->zcfs = new zoneclearFeedServer($core);
public function __construct(dcCore $core, $uri, $redirect_args=array())
{
$this->zcfs = new zoneclearFeedServer($core);
parent::__construct($core, $uri, $redirect_args);
$this->redirect_fields = array(
'sortby', 'order', 'page', 'nb'
);
$this->field_entries = 'feeds';
$this->caller_title = __('Feeds');
$this->loadDefaults();
}
parent::__construct($core, $uri, $redirect_args);
$this->redirect_fields = array(
'sortby', 'order', 'page', 'nb'
);
$this->field_entries = 'feeds';
$this->caller_title = __('Feeds');
$this->loadDefaults();
}
protected function loadDefaults()
{
zcfsDefaultFeedsActions::zcfsFeedsActionsPage($this->core, $this);
$this->core->callBehavior('zcfsFeedsActionsPage', $this->core, $this);
}
protected function loadDefaults()
{
zcfsDefaultFeedsActions::zcfsFeedsActionsPage($this->core, $this);
$this->core->callBehavior('zcfsFeedsActionsPage', $this->core, $this);
}
public function beginPage($breadcrumb='', $head='')
{
echo
'<html><head><title>'.__('Feeds server').'</title>'.
dcPage::jsLoad('js/_posts_actions.js').
$head.
'</script></head><body>'.
$breadcrumb.
'<p><a class="back" href="'.$this->getRedirection(true).'">'.
__('Back to feeds list').'</a></p>';
}
public function beginPage($breadcrumb='', $head='')
{
echo
'<html><head><title>'.__('Feeds server').'</title>'.
dcPage::jsLoad('js/_posts_actions.js').
$head.
'</script></head><body>'.
$breadcrumb.
'<p><a class="back" href="'.$this->getRedirection(true).'">'.
__('Back to feeds list').'</a></p>';
}
public function endPage()
{
echo
'</body></html>';
}
public function endPage()
{
echo
'</body></html>';
}
public function error(Exception $e)
{
$this->core->error->add($e->getMessage());
$this->beginPage(dcPage::breadcrumb(array(
html::escapeHTML($this->core->blog->name) => '',
$this->getCallerTitle() => $this->getRedirection(true),
__('Feeds actions') => ''
)));
$this->endPage();
}
public function error(Exception $e)
{
$this->core->error->add($e->getMessage());
$this->beginPage(dcPage::breadcrumb(array(
html::escapeHTML($this->core->blog->name) => '',
$this->getCallerTitle() => $this->getRedirection(true),
__('Feeds actions') => ''
)));
$this->endPage();
}
protected function fetchEntries($from)
{
if (!empty($from['feeds'])) {
protected function fetchEntries($from)
{
if (!empty($from['feeds'])) {
$params['feed_id'] = $from['feeds'];
$params['feed_id'] = $from['feeds'];
$feeds = $this->zcfs->getFeeds($params);
while ($feeds->fetch()) {
$this->entries[$feeds->feed_id] = $feeds->feed_name;
}
$this->rs = $feeds;
}
else {
$this->rs = $this->core->con->select(
"SELECT blog_id FROM ".
$this->core->prefix."blog WHERE false"
);
}
}
$feeds = $this->zcfs->getFeeds($params);
while ($feeds->fetch()) {
$this->entries[$feeds->feed_id] = $feeds->feed_name;
}
$this->rs = $feeds;
}
else {
$this->rs = $this->core->con->select(
"SELECT blog_id FROM ".
$this->core->prefix."blog WHERE false"
);
}
}
}
/**
@ -98,292 +92,292 @@ class zcfsFeedsActionsPage extends dcActionsPage
*/
class zcfsDefaultFeedsActions
{
public static function zcfsFeedsActionsPage(dcCore $core, zcfsFeedsActionsPage $ap)
{
$ap->addAction(
array(__('Change category') => 'changecat'),
array('zcfsDefaultFeedsActions', 'doChangeCategory')
);
$ap->addAction(
array(__('Change update interval') => 'changeint'),
array('zcfsDefaultFeedsActions', 'doChangeInterval')
);
$ap->addAction(
array(__('Disable feed update') => 'disablefeed'),
array('zcfsDefaultFeedsActions', 'doEnableFeed')
);
$ap->addAction(
array(__('Enable feed update') => 'enablefeed'),
array('zcfsDefaultFeedsActions', 'doEnableFeed')
);
$ap->addAction(
array(__('Reset last update') => 'resetupdlast'),
array('zcfsDefaultFeedsActions', 'doResetUpdate')
);
$ap->addAction(
array(__('Update (check) feed') => 'updatefeed'),
array('zcfsDefaultFeedsActions', 'doUpdateFeed')
);
$ap->addAction(
array(__('Delete related posts') => 'deletepost'),
array('zcfsDefaultFeedsActions', 'doDeletePost')
);
$ap->addAction(
array(__('Delete feed (without related posts)') => 'deletefeed'),
array('zcfsDefaultFeedsActions', 'doDeleteFeed')
);
}
public static function zcfsFeedsActionsPage(dcCore $core, zcfsFeedsActionsPage $ap)
{
$ap->addAction(
array(__('Change category') => 'changecat'),
array('zcfsDefaultFeedsActions', 'doChangeCategory')
);
$ap->addAction(
array(__('Change update interval') => 'changeint'),
array('zcfsDefaultFeedsActions', 'doChangeInterval')
);
$ap->addAction(
array(__('Disable feed update') => 'disablefeed'),
array('zcfsDefaultFeedsActions', 'doEnableFeed')
);
$ap->addAction(
array(__('Enable feed update') => 'enablefeed'),
array('zcfsDefaultFeedsActions', 'doEnableFeed')
);
$ap->addAction(
array(__('Reset last update') => 'resetupdlast'),
array('zcfsDefaultFeedsActions', 'doResetUpdate')
);
$ap->addAction(
array(__('Update (check) feed') => 'updatefeed'),
array('zcfsDefaultFeedsActions', 'doUpdateFeed')
);
$ap->addAction(
array(__('Delete related posts') => 'deletepost'),
array('zcfsDefaultFeedsActions', 'doDeletePost')
);
$ap->addAction(
array(__('Delete feed (without related posts)') => 'deletefeed'),
array('zcfsDefaultFeedsActions', 'doDeleteFeed')
);
}
public static function doEnableFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$enable = $ap->getAction() == 'enablefeed';
$ids = $ap->getIDs();
public static function doEnableFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$enable = $ap->getAction() == 'enablefeed';
$ids = $ap->getIDs();
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
foreach($ids as $id) {
$ap->zcfs->enableFeed($id, $enable);
}
foreach($ids as $id) {
$ap->zcfs->enableFeed($id, $enable);
}
dcPage::addSuccessNotice(sprintf(
$enable ?
__(
'%d feed has been successfully enabled.',
'%d feeds have been successfully enabled.',
count($ids)
)
:
__(
'%d feed has been successfully disabled.',
'%d feeds have been successfully disabled.',
count($ids)
)
,
count($ids)
));
$ap->redirect(true);
}
dcPage::addSuccessNotice(sprintf(
$enable ?
__(
'%d feed has been successfully enabled.',
'%d feeds have been successfully enabled.',
count($ids)
)
:
__(
'%d feed has been successfully disabled.',
'%d feeds have been successfully disabled.',
count($ids)
)
,
count($ids)
));
$ap->redirect(true);
}
public static function doDeletePost(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$types = array(
'zoneclearfeed_url',
'zoneclearfeed_author',
'zoneclearfeed_site',
'zoneclearfeed_sitename',
'zoneclearfeed_id'
);
public static function doDeletePost(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$types = array(
'zoneclearfeed_url',
'zoneclearfeed_author',
'zoneclearfeed_site',
'zoneclearfeed_sitename',
'zoneclearfeed_id'
);
$ids = $ap->getIDs();
$ids = $ap->getIDs();
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
foreach($ids as $id) {
foreach($ids as $id) {
$posts = $ap->zcfs->getPostsByFeed(array(
'feed_id' => $id
));
$posts = $ap->zcfs->getPostsByFeed(array(
'feed_id' => $id
));
while($posts->fetch()) {
while($posts->fetch()) {
$core->blog->delPost($posts->post_id);
$core->con->execute(
'DELETE FROM '.$core->prefix.'meta '.
'WHERE post_id = '.$posts->post_id.' '.
'AND meta_type '.$core->con->in($types).' '
);
}
}
$core->blog->delPost($posts->post_id);
$core->con->execute(
'DELETE FROM '.$core->prefix.'meta '.
'WHERE post_id = '.$posts->post_id.' '.
'AND meta_type '.$core->con->in($types).' '
);
}
}
dcPage::addSuccessNotice(
__('Entries have been successfully deleted.')
);
$ap->redirect(true);
}
dcPage::addSuccessNotice(
__('Entries have been successfully deleted.')
);
$ap->redirect(true);
}
public static function doDeleteFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$ids = $ap->getIDs();
public static function doDeleteFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$ids = $ap->getIDs();
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
foreach($ids as $id) {
$ap->zcfs->delFeed($id);
}
foreach($ids as $id) {
$ap->zcfs->delFeed($id);
}
dcPage::addSuccessNotice(sprintf(
__(
'%d feed has been successfully deleted.',
'%d feeds have been successfully deleted.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
dcPage::addSuccessNotice(sprintf(
__(
'%d feed has been successfully deleted.',
'%d feeds have been successfully deleted.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
public static function doUpdateFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$ids = $ap->getIDs();
public static function doUpdateFeed(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$ids = $ap->getIDs();
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
foreach($ids as $id) {
$ap->zcfs->checkFeedsUpdate($id, true);
}
foreach($ids as $id) {
$ap->zcfs->checkFeedsUpdate($id, true);
}
dcPage::addSuccessNotice(sprintf(
__(
'%d feed has been successfully updated.',
'%d feeds have been successfully updated.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
dcPage::addSuccessNotice(sprintf(
__(
'%d feed has been successfully updated.',
'%d feeds have been successfully updated.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
public static function doResetUpdate(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$ids = $ap->getIDs();
public static function doResetUpdate(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
$ids = $ap->getIDs();
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
foreach($ids as $id) {
$cur = $ap->zcfs->openCursor();
$cur->feed_upd_last = 0;
$ap->zcfs->updFeed($id, $cur);
$ap->zcfs->checkFeedsUpdate($id, true);
}
foreach($ids as $id) {
$cur = $ap->zcfs->openCursor();
$cur->feed_upd_last = 0;
$ap->zcfs->updFeed($id, $cur);
$ap->zcfs->checkFeedsUpdate($id, true);
}
dcPage::addSuccessNotice(sprintf(
__(
'Last update of %s feed successfully reseted.',
'Last update of %s feeds successfully reseted.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
dcPage::addSuccessNotice(sprintf(
__(
'Last update of %s feed successfully reseted.',
'Last update of %s feeds successfully reseted.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
public static function doChangeCategory(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
if (isset($post['upd_cat_id'])) {
$ids = $ap->getIDs();
public static function doChangeCategory(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
if (isset($post['upd_cat_id'])) {
$ids = $ap->getIDs();
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
$cat_id = abs((integer) $post['upd_cat_id']);
$cat_id = abs((integer) $post['upd_cat_id']);
foreach($ids as $id) {
$cur = $ap->zcfs->openCursor();
$cur->cat_id = $cat_id == 0 ? null : $cat_id;
$ap->zcfs->updFeed($id, $cur);
}
foreach($ids as $id) {
$cur = $ap->zcfs->openCursor();
$cur->cat_id = $cat_id == 0 ? null : $cat_id;
$ap->zcfs->updFeed($id, $cur);
}
dcPage::addSuccessNotice(sprintf(
__(
'Category of %s feed successfully changed.',
'Category of %s feeds successfully changed.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
else {
dcPage::addSuccessNotice(sprintf(
__(
'Category of %s feed successfully changed.',
'Category of %s feeds successfully changed.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
else {
$categories_combo = dcAdminCombos::getCategoriesCombo(
$core->blog->getCategories()
);
$categories_combo = dcAdminCombos::getCategoriesCombo(
$core->blog->getCategories()
);
$ap->beginPage(
dcPage::breadcrumb(
array(
html::escapeHTML($core->blog->name) => '',
__('Feeds server') => '',
$ap->getCallerTitle() => $ap->getRedirection(true),
__('Change category for this selection') => ''
)));
$ap->beginPage(
dcPage::breadcrumb(
array(
html::escapeHTML($core->blog->name) => '',
__('Feeds server') => '',
$ap->getCallerTitle() => $ap->getRedirection(true),
__('Change category for this selection') => ''
)));
echo
'<form action="'.$ap->getURI().'" method="post">'.
$ap->getCheckboxes().
'<p><label for="upd_cat_id" class="classic">'.__('Category:').'</label> '.
form::combo(array('upd_cat_id'), $categories_combo, '').
$core->formNonce().
$ap->getHiddenFields().
form::hidden(array('action'), 'changecat').
'<input type="submit" value="'.__('Save').'" /></p>'.
'</form>';
echo
'<form action="'.$ap->getURI().'" method="post">'.
$ap->getCheckboxes().
'<p><label for="upd_cat_id" class="classic">'.__('Category:').'</label> '.
form::combo(array('upd_cat_id'), $categories_combo, '').
$core->formNonce().
$ap->getHiddenFields().
form::hidden(array('action'), 'changecat').
'<input type="submit" value="'.__('Save').'" /></p>'.
'</form>';
$ap->endPage();
}
}
$ap->endPage();
}
}
public static function doChangeInterval(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
if (isset($post['upd_upd_int'])) {
$ids = $ap->getIDs();
public static function doChangeInterval(dcCore $core, zcfsFeedsActionsPage $ap, $post)
{
if (isset($post['upd_upd_int'])) {
$ids = $ap->getIDs();
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
if (empty($ids)) {
throw new Exception(__('No feeds selected'));
}
$upd_int = abs((integer) $post['upd_upd_int']);
$upd_int = abs((integer) $post['upd_upd_int']);
foreach($ids as $id) {
$cur = $ap->zcfs->openCursor();
$cur->feed_upd_int = $upd_int;
$ap->zcfs->updFeed($id, $cur);
}
foreach($ids as $id) {
$cur = $ap->zcfs->openCursor();
$cur->feed_upd_int = $upd_int;
$ap->zcfs->updFeed($id, $cur);
}
dcPage::addSuccessNotice(sprintf(
__(
'Update frequency of %s feed successfully changed.',
'Update frequency of %s feeds successfully changed.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
else {
dcPage::addSuccessNotice(sprintf(
__(
'Update frequency of %s feed successfully changed.',
'Update frequency of %s feeds successfully changed.',
count($ids)
),
count($ids)
));
$ap->redirect(true);
}
else {
$ap->beginPage(
dcPage::breadcrumb(
array(
html::escapeHTML($core->blog->name) => '',
__('Feeds server') => '',
$ap->getCallerTitle() => $ap->getRedirection(true),
__('Change update frequency for this selection') => ''
)));
$ap->beginPage(
dcPage::breadcrumb(
array(
html::escapeHTML($core->blog->name) => '',
__('Feeds server') => '',
$ap->getCallerTitle() => $ap->getRedirection(true),
__('Change update frequency for this selection') => ''
)));
echo
'<form action="'.$ap->getURI().'" method="post">'.
$ap->getCheckboxes().
'<p><label for="upd_upd_int" class="classic">'.__('Frequency:').'</label> '.
form::combo(array('upd_upd_int'), $ap->zcfs->getAllUpdateInterval(), '').
$core->formNonce().
$ap->getHiddenFields().
form::hidden(array('action'), 'changeint').
'<input type="submit" value="'.__('Save').'" /></p>'.
'</form>';
echo
'<form action="'.$ap->getURI().'" method="post">'.
$ap->getCheckboxes().
'<p><label for="upd_upd_int" class="classic">'.__('Frequency:').'</label> '.
form::combo(array('upd_upd_int'), $ap->zcfs->getAllUpdateInterval(), '').
$core->formNonce().
$ap->getHiddenFields().
form::hidden(array('action'), 'changeint').
'<input type="submit" value="'.__('Save').'" /></p>'.
'</form>';
$ap->endPage();
}
}
$ap->endPage();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
return null;
}
/**
@ -24,95 +24,95 @@ if (!defined('DC_CONTEXT_ADMIN')) {
*/
class zcfsFeedsList extends adminGenericList
{
public function feedsDisplay($page, $nb_per_page, $url, $enclose='')
{
if ($this->rs->isEmpty()) {
public function feedsDisplay($page, $nb_per_page, $url, $enclose='')
{
if ($this->rs->isEmpty()) {
return '<p><strong>'.__('There is no feed').'</strong></p>';
}
return '<p><strong>'.__('There is no feed').'</strong></p>';
}
$pager = new dcPager($page, $this->rs_count ,$nb_per_page, 10);
$pager = new dcPager($page, $this->rs_count ,$nb_per_page, 10);
$pager->base_url = $url;
$pager->base_url = $url;
$html_block =
'<div class="table-outer">'.
'<table class="clear">'.
'<thead>'.
'<tr>'.
'<th class="nowrap first" colspan="2">'.__('Name').'</th>'.
'<th class="nowrap">'.__('Feed').'</th>'.
'<th class="nowrap">'.__('Frequency').'</th>'.
'<th class="nowrap">'.__('Last update').'</th>'.
'<th class="nowrap">'.__('Entries').'</th>'.
'<th class="nowrap">'.__('Status').'</th>'.
'</tr>'.
'</thead>'.
'<tbody>%s</tbody>'.
'</table>'.
'</div>';
$html_block =
'<div class="table-outer">'.
'<table class="clear">'.
'<thead>'.
'<tr>'.
'<th class="nowrap first" colspan="2">'.__('Name').'</th>'.
'<th class="nowrap">'.__('Feed').'</th>'.
'<th class="nowrap">'.__('Frequency').'</th>'.
'<th class="nowrap">'.__('Last update').'</th>'.
'<th class="nowrap">'.__('Entries').'</th>'.
'<th class="nowrap">'.__('Status').'</th>'.
'</tr>'.
'</thead>'.
'<tbody>%s</tbody>'.
'</table>'.
'</div>';
$res = '';
while ($this->rs->fetch()) {
$res .= $this->feedsLine();
}
$res = '';
while ($this->rs->fetch()) {
$res .= $this->feedsLine();
}
return
$pager->getLinks().
sprintf($enclose, sprintf($html_block, $res)).
$pager->getLinks();
}
private function feedsLine()
{
$combo_status = zoneclearFeedServer::getAllStatus();
$combo_upd_int = zoneclearFeedServer::getAllUpdateInterval();
$status = $this->rs->feed_status ?
'<img src="images/check-on.png" alt="enable" />' :
'<img src="images/check-off.png" alt="disable" />';
$category = $this->rs->cat_id ?
$this->rs->cat_title : __('no categories');
return
$pager->getLinks().
sprintf($enclose, sprintf($html_block, $res)).
$pager->getLinks();
}
$entries_count = $this->rs->zc->getPostsByFeed(array('feed_id' => $this->rs->feed_id), true)->f(0);
$shunk_feed = $this->rs->feed_feed;
if (strlen($shunk_feed) > 83) {
$shunk_feed = substr($shunk_feed,0,50).'...'.substr($shunk_feed,-20);
}
private function feedsLine()
{
$combo_status = zoneclearFeedServer::getAllStatus();
$combo_upd_int = zoneclearFeedServer::getAllUpdateInterval();
$status = $this->rs->feed_status ?
'<img src="images/check-on.png" alt="enable" />' :
'<img src="images/check-off.png" alt="disable" />';
$category = $this->rs->cat_id ?
$this->rs->cat_title : __('no categories');
$url = 'plugin.php?p=zoneclearFeedServer&amp;part=feed&amp;feed_id='.$this->rs->feed_id;
$entries_count = $this->rs->zc->getPostsByFeed(array('feed_id' => $this->rs->feed_id), true)->f(0);
$shunk_feed = $this->rs->feed_feed;
if (strlen($shunk_feed) > 83) {
$shunk_feed = substr($shunk_feed,0,50).'...'.substr($shunk_feed,-20);
}
return
'<tr class="line">'."\n".
'<td class="nowrap">'.
form::checkbox(array('feeds[]'), $this->rs->feed_id, 0).
'</td>'.
'<td class="nowrap">'.
'<a href="'.$url.'#feed" title="'.__('Edit').'">'.
html::escapeHTML($this->rs->feed_name).'</a>'.
"</td>\n".
'<td class="maximal nowrap">'.
'<a href="'.$this->rs->feed_feed.'" title="'.html::escapeHTML($this->rs->feed_desc).'">'.html::escapeHTML($shunk_feed).'</a>'.
"</td>\n".
'<td class="nowrap">'.
array_search($this->rs->feed_upd_int,$combo_upd_int).
"</td>\n".
'<td class="nowrap">'.
($this->rs->feed_upd_last < 1 ?
__('never') :
dt::str(__('%Y-%m-%d %H:%M'), $this->rs->feed_upd_last,$this->rs->zc->core->auth->getInfo('user_tz'))
).
"</td>\n".
'<td class="nowrap">'.
($entries_count ?
'<a href="'.$url.'#entries" title="'.__('View entries').'">'.$entries_count.'</a>' :
$entries_count
).
"</td>\n".
'<td>'.
$status.
"</td>\n".
'</tr>'."\n";
}
$url = 'plugin.php?p=zoneclearFeedServer&amp;part=feed&amp;feed_id='.$this->rs->feed_id;
return
'<tr class="line">'."\n".
'<td class="nowrap">'.
form::checkbox(array('feeds[]'), $this->rs->feed_id, 0).
'</td>'.
'<td class="nowrap">'.
'<a href="'.$url.'#feed" title="'.__('Edit').'">'.
html::escapeHTML($this->rs->feed_name).'</a>'.
"</td>\n".
'<td class="maximal nowrap">'.
'<a href="'.$this->rs->feed_feed.'" title="'.html::escapeHTML($this->rs->feed_desc).'">'.html::escapeHTML($shunk_feed).'</a>'.
"</td>\n".
'<td class="nowrap">'.
array_search($this->rs->feed_upd_int,$combo_upd_int).
"</td>\n".
'<td class="nowrap">'.
($this->rs->feed_upd_last < 1 ?
__('never') :
dt::str(__('%Y-%m-%d %H:%M'), $this->rs->feed_upd_last,$this->rs->zc->core->auth->getInfo('user_tz'))
).
"</td>\n".
'<td class="nowrap">'.
($entries_count ?
'<a href="'.$url.'#entries" title="'.__('View entries').'">'.$entries_count.'</a>' :
$entries_count
).
"</td>\n".
'<td>'.
$status.
"</td>\n".
'</tr>'."\n";
}
}
/**
@ -123,82 +123,82 @@ class zcfsFeedsList extends adminGenericList
*/
class zcfsEntriesList extends adminGenericList
{
public function display($page, $nb_per_page, $url, $enclose='')
{
if ($this->rs->isEmpty()) {
public function display($page, $nb_per_page, $url, $enclose='')
{
if ($this->rs->isEmpty()) {
return '<p><strong>'.__('No entry').'</strong></p>';
}
return '<p><strong>'.__('No entry').'</strong></p>';
}
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
$pager->base_url = $url;
$pager->html_prev = $this->html_prev;
$pager->html_next = $this->html_next;
$pager->var_page = 'page';
$pager = new dcPager($page, $this->rs_count, $nb_per_page, 10);
$pager->base_url = $url;
$pager->html_prev = $this->html_prev;
$pager->html_next = $this->html_next;
$pager->var_page = 'page';
$html_block =
'<div class="table-outer">'.
'<table class="clear"><tr>'.
'<th colspan="2">'.__('Title').'</th>'.
'<th>'.__('Date').'</th>'.
'<th>'.__('Category').'</th>'.
'<th>'.__('Author').'</th>'.
'<th>'.__('Comments').'</th>'.
'<th>'.__('Trackbacks').'</th>'.
'<th>'.__('Status').'</th>'.
'</tr>%s</table></div>';
$html_block =
'<div class="table-outer">'.
'<table class="clear"><tr>'.
'<th colspan="2">'.__('Title').'</th>'.
'<th>'.__('Date').'</th>'.
'<th>'.__('Category').'</th>'.
'<th>'.__('Author').'</th>'.
'<th>'.__('Comments').'</th>'.
'<th>'.__('Trackbacks').'</th>'.
'<th>'.__('Status').'</th>'.
'</tr>%s</table></div>';
$res = '';
while ($this->rs->fetch()) {
$res .= $this->postLine();
}
$res = '';
while ($this->rs->fetch()) {
$res .= $this->postLine();
}
return
$pager->getLinks().
sprintf($enclose, sprintf($html_block, $res)).
$pager->getLinks();
}
return
$pager->getLinks().
sprintf($enclose, sprintf($html_block, $res)).
$pager->getLinks();
}
private function postLine()
{
$cat_link = $this->core->auth->check('categories', $this->core->blog->id) ?
'<a href="category.php?id=%s" title="'.__('Edit category').'">%s</a>'
: '%2$s';
private function postLine()
{
$cat_link = $this->core->auth->check('categories', $this->core->blog->id) ?
'<a href="category.php?id=%s" title="'.__('Edit category').'">%s</a>'
: '%2$s';
$cat_title = $this->rs->cat_title ?
sprintf($cat_link,$this->rs->cat_id, html::escapeHTML($this->rs->cat_title))
: __('None');
$cat_title = $this->rs->cat_title ?
sprintf($cat_link,$this->rs->cat_id, html::escapeHTML($this->rs->cat_title))
: __('None');
$img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
switch ($this->rs->post_status) {
case 1:
$img_status = sprintf($img, __('published'), 'check-on.png');
break;
case 0:
$img_status = sprintf($img, __('unpublished'), 'check-off.png');
break;
case -1:
$img_status = sprintf($img, __('scheduled'), 'scheduled.png');
break;
case -2:
$img_status = sprintf($img, __('pending'), 'check-wrn.png');
break;
}
$img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
switch ($this->rs->post_status) {
case 1:
$img_status = sprintf($img, __('published'), 'check-on.png');
break;
case 0:
$img_status = sprintf($img, __('unpublished'), 'check-off.png');
break;
case -1:
$img_status = sprintf($img, __('scheduled'), 'scheduled.png');
break;
case -2:
$img_status = sprintf($img, __('pending'), 'check-wrn.png');
break;
}
return
'<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'.
' id="p'.$this->rs->post_id.'">'.
'<td class="nowrap">'.
form::checkbox(array('entries[]'), $this->rs->post_id, '', '', '', !$this->rs->isEditable()).'</td>'.
'<td class="maximal"><a href="'.$this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id).
'" title="'.__('Edit entry').'">'.
html::escapeHTML($this->rs->post_title).'</a></td>'.
'<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt).'</td>'.
'<td class="nowrap">'.$cat_title.'</td>'.
'<td class="nowrap">'.$this->rs->user_id.'</td>'.
'<td class="nowrap">'.$this->rs->nb_comment.'</td>'.
'<td class="nowrap">'.$this->rs->nb_trackback.'</td>'.
'<td class="nowrap status">'.$img_status.'</td>'.
'</tr>';
}
return
'<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'.
' id="p'.$this->rs->post_id.'">'.
'<td class="nowrap">'.
form::checkbox(array('entries[]'), $this->rs->post_id, '', '', '', !$this->rs->isEditable()).'</td>'.
'<td class="maximal"><a href="'.$this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id).
'" title="'.__('Edit entry').'">'.
html::escapeHTML($this->rs->post_title).'</a></td>'.
'<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt).'</td>'.
'<td class="nowrap">'.$cat_title.'</td>'.
'<td class="nowrap">'.$this->rs->user_id.'</td>'.
'<td class="nowrap">'.$this->rs->nb_comment.'</td>'.
'<td class="nowrap">'.$this->rs->nb_trackback.'</td>'.
'<td class="nowrap status">'.$img_status.'</td>'.
'</tr>';
}
}

View File

@ -1,19 +1,19 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
return null;
}
/**
@ -25,124 +25,124 @@ if (!defined('DC_RC_PATH')) {
*/
class zcfsSoCialMeWriter
{
public static function soCialMeWriterMarker($rs)
{
$rs['zcfscreate'] = array(
'name' => __('New Zoneclear post'),
'description' => __('When a feed has new entry'),
'action' => array('Message','Link'),
'format' => array('Message'),
'wildcards' => array('Message' => array(
'%posttitle%',
'%postlink%',
'%postauthor%',
'%posttweeter%',
'%sitetitle%',
'%sitelink%',
'%tags'
))
);
}
public static function soCialMeWriterMarker($rs)
{
$rs['zcfscreate'] = array(
'name' => __('New Zoneclear post'),
'description' => __('When a feed has new entry'),
'action' => array('Message','Link'),
'format' => array('Message'),
'wildcards' => array('Message' => array(
'%posttitle%',
'%postlink%',
'%postauthor%',
'%posttweeter%',
'%sitetitle%',
'%sitelink%',
'%tags'
))
);
}
public static function zoneclearFeedServerAfterFeedUpdate($core, $is_new_published_entry, $post, $meta)
{
// for now only new post
if(!$is_new_published_entry) {
public static function zoneclearFeedServerAfterFeedUpdate($core, $is_new_published_entry, $post, $meta)
{
// for now only new post
if(!$is_new_published_entry) {
return null;
}
return null;
}
$key = 'zcfscreate';
$key = 'zcfscreate';
# Is install
if (!$core->plugins->moduleExists('soCialMe')) {
# Is install
if (!$core->plugins->moduleExists('soCialMe')) {
return null;
}
return null;
}
# Is active
if (!$core->blog->settings->soCialMeWriter->active) {
# Is active
if (!$core->blog->settings->soCialMeWriter->active) {
return null;
}
return null;
}
# Load services
$soCialMeWriter = new soCialMeWriter($core);
# Load services
$soCialMeWriter = new soCialMeWriter($core);
# List of service per action
$actions = $soCialMeWriter->getMarker('action');
# List of service per action
$actions = $soCialMeWriter->getMarker('action');
# List of format per type
$formats = $soCialMeWriter->getMarker('format');
# List of format per type
$formats = $soCialMeWriter->getMarker('format');
# prepare data
$shortposturl = soCialMeUtils::reduceURL($meta->url);
$shortposturl = $shortposturl ? $shortposturl : $meta->url;
# prepare data
$shortposturl = soCialMeUtils::reduceURL($meta->url);
$shortposturl = $shortposturl ? $shortposturl : $meta->url;
$shortsiteurl = soCialMeUtils::reduceURL($meta->site);
$shortsiteurl = $shortsiteurl ? $shortsiteurl : $meta->site;
$shortsiteurl = soCialMeUtils::reduceURL($meta->site);
$shortsiteurl = $shortsiteurl ? $shortsiteurl : $meta->site;
// need this?
foreach($meta->tags as $k => $tag) {
$tags[$k] = '#'.$tag;
}
// need this?
foreach($meta->tags as $k => $tag) {
$tags[$k] = '#'.$tag;
}
# sendMessage
if (!empty($formats[$key]['Message'])
&& !empty($actions[$key]['Message'])
) {
// parse message
$message_txt = str_replace(
array(
'%posttitle%',
'%postlink%',
'%postauthor%',
'%posttweeter%',
'%sitetitle%',
'%sitelink%',
'%tags'
),
array(
$post->post_title,
$shortposturl,
$meta->author,
$meta->tweeter,
$meta->sitename,
$shortsiteurl,
implode(',', $meta->tags)
),
$formats[$key]['Message']
);
# sendMessage
if (!empty($formats[$key]['Message'])
&& !empty($actions[$key]['Message'])
) {
// parse message
$message_txt = str_replace(
array(
'%posttitle%',
'%postlink%',
'%postauthor%',
'%posttweeter%',
'%sitetitle%',
'%sitelink%',
'%tags'
),
array(
$post->post_title,
$shortposturl,
$meta->author,
$meta->tweeter,
$meta->sitename,
$shortsiteurl,
implode(',', $meta->tags)
),
$formats[$key]['Message']
);
// send message
if (!empty($message_txt)) {
foreach($actions[$key]['Message'] as $service_id) {
$soCialMeWriter->play(
$service_id,
'Message',
'Content',
$message_txt
);
}
}
}
// send message
if (!empty($message_txt)) {
foreach($actions[$key]['Message'] as $service_id) {
$soCialMeWriter->play(
$service_id,
'Message',
'Content',
$message_txt
);
}
}
}
# sendLink
if (!empty($actions[$key]['Link'])) {
foreach($actions[$key]['Link'] as $service_id) {
$soCialMeWriter->play(
$service_id,
'Link',
'Content',
$cur->post_title,$shortposturl
);
}
}
# sendLink
if (!empty($actions[$key]['Link'])) {
foreach($actions[$key]['Link'] as $service_id) {
$soCialMeWriter->play(
$service_id,
'Link',
'Content',
$cur->post_title,$shortposturl
);
}
}
# sendData
// not yet implemented
# sendData
// not yet implemented
#sendArticle
// not yet implemented
}
#sendArticle
// not yet implemented
}
}

View File

@ -1,169 +0,0 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of zoneclearFeedServer, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
return null;
}
# This file is used with plugin activityReport
$core->activityReport->addGroup(
'zoneclearFeedServer',
__('Plugin zoneclearFeedServer')
);
# from BEHAVIOR zoneclearFeedServerAfterAddFeed in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
$core->activityReport->addAction(
'zoneclearFeedServer',
'create',
__('feed creation'),
__('A new feed named "%s" point to "%s" was added by "%s"'),
'zoneclearFeedServerAfterAddFeed',
array('zoneclearFeedServerActivityReportBehaviors', 'addFeed')
);
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
$core->activityReport->addAction(
'zoneclearFeedServer',
'updatefeedinfo',
__('updating feed info'),
__('Feed named "%s" point to "%s" has been updated by "%s"'),
'zoneclearFeedServerAfterUpdFeed',
array('zoneclearFeedServerActivityReportBehaviors', 'updFeedInfo')
);
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
$core->activityReport->addAction(
'zoneclearFeedServer',
'updatefeedrecords',
__('updating feed records'),
__('Records of the feed named "%s" have been updated automatically'),
'zoneclearFeedServerAfterUpdFeed',
array('zoneclearFeedServerActivityReportBehaviors', 'updFeedRecord')
);
# from BEHAVIOR zoneclearFeedServerAfterDelFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
$core->activityReport->addAction(
'zoneclearFeedServer',
'delete',
__('feed deletion'),
__('Feed named "%s" point to "%s" has been deleted by "%s"'),
'zoneclearFeedServerAfterDelFeed',
array('zoneclearFeedServerActivityReportBehaviors', 'delFeed')
);
# from BEHAVIOR zoneclearFeedServerAfterEnableFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
$core->activityReport->addAction(
'zoneclearFeedServer',
'status',
__('feed status'),
__('Feed named "%s" point to "%s" has been set to "%s"'),
'zoneclearFeedServerAfterEnableFeed',
array('zoneclearFeedServerActivityReportBehaviors', 'enableFeed')
);
class zoneclearFeedServerActivityReportBehaviors
{
public static function addFeed($cur)
{
global $core;
$logs = array(
$cur->feed_name,
$cur->feed_feed,
$core->auth->getInfo('user_cn')
);
$core->activityReport->addLog(
'zoneclearFeedServer',
'create',
$logs
);
}
public static function updFeedInfo($cur, $id)
{
if (defined('DC_CONTEXT_ADMIN')) {
global $core;
$zc = new zoneclearFeedServer($core);
$rs = $zc->getFeeds(array('feed_id' => $id));
$logs = array(
$rs->feed_name,
$rs->feed_feed,
$core->auth->getInfo('user_cn')
);
$core->activityReport->addLog(
'zoneclearFeedServer',
'updatefeedinfo',
$logs
);
}
}
public static function updFeedRecord($cur,$id)
{
if (!defined('DC_CONTEXT_ADMIN')) {
global $core;
$zc = new zoneclearFeedServer($core);
$rs = $zc->getFeeds(array('feed_id' => $id));
$logs = array(
$rs->feed_name
);
$core->activityReport->addLog(
'zoneclearFeedServer',
'updatefeedrecords',
$logs
);
}
}
public static function delFeed($id)
{
global $core;
$zc = new zoneclearFeedServer($core);
$rs = $zc->getFeeds(array('feed_id' => $id));
$logs = array(
$rs->feed_name,
$rs->feed_feed,
$core->auth->getInfo('user_cn')
);
$core->activityReport->addLog(
'zoneclearFeedServer',
'delete',
$logs
);
}
public static function enableFeed($id, $enable, $time)
{
global $core;
$zc = new zoneclearFeedServer($core);
$rs = $zc->getFeeds(array('feed_id' => $id));
$logs = array(
$rs->feed_name,
$rs->feed_feed,
$enable ? 'enable' : 'disable'
);
$core->activityReport->addLog(
'zoneclearFeedServer',
'status',
$logs
);
}
}

1588
index.php

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ $(function(){
$filtersform = $('#filters-form');
$filtersform.before('<p><a id="filter-control" class="form-control" href="plugin.php?p=zoneclearFeedServer&amp;part=feeds" style="display:inline">'+dotclear.msg.filter_posts_list+'</a></p>')
if( dotclear.msg.show_filters == 'false' ) {
$filtersform.hide();
} else {
@ -11,7 +11,7 @@ $(function(){
.addClass('open')
.text(dotclear.msg.cancel_the_filter);
}
$('#filter-control').click(function() {
if( $(this).hasClass('open') ) {
if( dotclear.msg.show_filters == 'true' ) {

View File

@ -3,7 +3,7 @@ $(function(){
$filtersform = $('#filters-form');
$filtersform.before('<p><a id="filter-control" class="form-control" href="plugin.php?p=zoneclearFeedServer&amp;part=feed#entries" style="display:inline">'+dotclear.msg.filter_posts_list+'</a></p>')
if( dotclear.msg.show_filters == 'false' ) {
$filtersform.hide();
} else {
@ -11,7 +11,7 @@ $(function(){
.addClass('open')
.text(dotclear.msg.cancel_the_filter);
}
$('#filter-control').click(function() {
if( $(this).hasClass('open') ) {
if( dotclear.msg.show_filters == 'true' ) {

View File

@ -13,5 +13,5 @@
if (!isset($__resources['help']['zoneclearFeedServer']))
{
$__resources['help']['zoneclearFeedServer'] = dirname(__FILE__).'/help/zoneclearFeedServer.html';
$__resources['help']['zoneclearFeedServer'] = dirname(__FILE__).'/help/zoneclearFeedServer.html';
}

View File

@ -13,5 +13,5 @@
if (!isset($__resources['help']['zoneclearFeedServer']))
{
$__resources['help']['zoneclearFeedServer'] = dirname(__FILE__).'/help/zoneclearFeedServer.html';
$__resources['help']['zoneclearFeedServer'] = dirname(__FILE__).'/help/zoneclearFeedServer.html';
}