0.8.1
This commit is contained in:
parent
ebbfbaf3b8
commit
b2be082c62
41
CHANGELOG
Normal file
41
CHANGELOG
Normal file
@ -0,0 +1,41 @@
|
||||
v0.8.1 - 22-04-2015 - Pierre Van Glabeke
|
||||
* modif url support
|
||||
* modif tpl (validation html5)
|
||||
|
||||
v0.8 - 20-02-2015 - Pierre Van Glabeke
|
||||
* ajout barre d'édition dcLegacyEditor
|
||||
* correction tpl mustek disclaimer.html
|
||||
|
||||
v0.7 - 16-01-2015 - Pierre Van Glabeke
|
||||
* compatibilité dc2.7
|
||||
* modification tpl pour html5 (currywurst et mustek)
|
||||
* modification localisation
|
||||
* modification fichier css
|
||||
|
||||
v0.6.2 - 2013-11-14
|
||||
* Switch to Dotclear 2.6
|
||||
|
||||
v0.6.1 - 2010-11-12
|
||||
* Fixed install on nightly build
|
||||
* Fixed some post fields
|
||||
|
||||
v0.6 - 2010-06-05
|
||||
* Switched to DC 2.2
|
||||
|
||||
v0.5 - 2009-12-13
|
||||
* Added LICENSE
|
||||
* Added versioning
|
||||
* Prepared DC 2.2 break
|
||||
|
||||
v0.4.1 - 2009-11-12
|
||||
* Fixed ''header'' errors on public side
|
||||
|
||||
v0.4 - 2009-09-23
|
||||
* Fixed DC 2.1.6 URL handlers ending
|
||||
|
||||
v0.3 - 2009-09-15
|
||||
* Fixed search engine indexing
|
||||
* Added support of plugin dcAdvancedCleaner
|
||||
|
||||
v0.2 - 2009-08-16
|
||||
* Fixed php 5.3 compatibility
|
9
LICENSE
9
LICENSE
@ -1,7 +1,7 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -329,7 +329,7 @@ necessary. Here is a sample; alter the names:
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
{signature of Ty Coon}, 1 April 1989
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
||||
|
108
README.md
108
README.md
@ -1,2 +1,106 @@
|
||||
# disclaimer
|
||||
Ajoute un avertissement à l'entrée sur le blog
|
||||
# README
|
||||
|
||||
## QU'EST CE QUE DISCLAIMER ?
|
||||
|
||||
"disclaimer" est un plugin pour l'outil open source de
|
||||
publication web nommé Dotclear.
|
||||
|
||||
Ce plugin permet d'ajouter un texte d'avertissement
|
||||
pour le visiteur avant son entrée sur le blog.
|
||||
|
||||
Le code de ce plugin est largement inspiré du plugin
|
||||
"Private mode" d'Osku.
|
||||
|
||||
## LICENCE
|
||||
|
||||
This file is part of disclaimer, a plugin for Dotclear 2.
|
||||
Copyright (c) 2009 JC Denis and contributors
|
||||
jcdenis@gdwd.com
|
||||
Licensed under the GPL version 2.0 license.
|
||||
A copy of this license is available at
|
||||
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
|
||||
Some icons from Silk icon set 1.3 by Mark James at:
|
||||
http://www.famfamfam.com/lab/icons/silk/
|
||||
under a Creative Commons Attribution 2.5 License at
|
||||
http://creativecommons.org/licenses/by/2.5/
|
||||
|
||||
## SUPPORT
|
||||
|
||||
http://forum.dotclear.net
|
||||
|
||||
### Note
|
||||
|
||||
Certains thèmes ne sont pas compatibles avec ce plugin.
|
||||
|
||||
## USAGE
|
||||
|
||||
### Paramètres
|
||||
|
||||
La configuration du plugin est situé dans
|
||||
la rubrique "Disclaimer" de la page des paramètres du blog.
|
||||
|
||||
#### Activer le plugin
|
||||
|
||||
Permet d'activer ou non la page d'avertissement.
|
||||
|
||||
#### Se souvenir de l'utilisateur
|
||||
|
||||
Permet d'envoyer un cookie au visiteur pour qu'il n'ait pas
|
||||
à revalider l'avertissement lors d'une visite ultérieure.
|
||||
|
||||
#### Titre
|
||||
|
||||
C'est le titre principale de la page d'avertissement.
|
||||
|
||||
#### Lien de sortie
|
||||
|
||||
Lien vers lequel sera renvoyé le visiteur s'il refuse les termes.
|
||||
|
||||
#### Avertissement
|
||||
|
||||
Texte principal de la page d'avertissement, cette page accepte le code html.
|
||||
(sauf si l'attribut encode_html est actif dans les templates)
|
||||
|
||||
#### Liste des robots autorisés à indexer les pages du site
|
||||
|
||||
Liste des robots d'indexation séparés par un point-virgule.
|
||||
Cela permet au robot utilisant ce user-agent de ne pas être bloqué par
|
||||
le disclaimer.
|
||||
|
||||
#### Désactiver l'autorisation d'indexation par les moteurs de recherches
|
||||
|
||||
Permet de désactiver la fonction de recherche de user-agent et de rediriger
|
||||
tous les user-agent vers le disclaimer.
|
||||
|
||||
### Templates
|
||||
|
||||
Le fichier de template par default pour la page d'avertissement
|
||||
se situe dans le repertoire "/default-template/mustek/disclaimer.html" ou
|
||||
"/default-template/currywurst/disclaimer.html" du plugin.
|
||||
|
||||
Il faut le copier dans le repertoire /tpl du thème pour le modifier.
|
||||
|
||||
|
||||
### Balises
|
||||
|
||||
Le plugin ajoute les balises de template suivantes :
|
||||
|
||||
#### DisclaimerTitle
|
||||
|
||||
Titre de l'avertissement.
|
||||
|
||||
#### DisclaimerText
|
||||
|
||||
Texte de l'avertissement.
|
||||
|
||||
#### DisclaimerFormURL
|
||||
|
||||
A mettre dans l'attribut "action" de la balise "form".
|
||||
|
||||
Ces balises supportent les attributs communs.
|
||||
|
||||
|
||||
---
|
||||
Cordialement et en français dans le texte,
|
||||
Jean-Christian Denis
|
207
_admin.php
Normal file
207
_admin.php
Normal file
@ -0,0 +1,207 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of disclaimer, 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_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$core->addBehavior(
|
||||
'adminBeforeBlogSettingsUpdate',
|
||||
array('adminDisclaimer', 'adminBeforeBlogSettingsUpdate')
|
||||
);
|
||||
$core->addBehavior(
|
||||
'adminBlogPreferencesHeaders',
|
||||
array('adminDisclaimer', 'adminDisclaimerHeaders')
|
||||
);
|
||||
$core->addBehavior(
|
||||
'adminBlogPreferencesForm',
|
||||
array('adminDisclaimer', 'adminBlogPreferencesForm')
|
||||
);
|
||||
|
||||
/**
|
||||
* @ingroup DC_PLUGIN_DISCLAIMER
|
||||
* @brief Public disclaimer - Admin methods.
|
||||
* @since 2.6
|
||||
*/
|
||||
class adminDisclaimer
|
||||
{
|
||||
|
||||
/**
|
||||
* Save settings
|
||||
*
|
||||
* @param dcSettings $blog_settings dcSettings instance
|
||||
*/
|
||||
public static function adminBeforeBlogSettingsUpdate(dcSettings $blog_settings)
|
||||
{
|
||||
$blog_settings->addNamespace('disclaimer');
|
||||
$s = $blog_settings->disclaimer;
|
||||
try {
|
||||
$disclaimer_active =
|
||||
isset($_POST['disclaimer_active']);
|
||||
$disclaimer_remember =
|
||||
isset($_POST['disclaimer_remember']);
|
||||
$disclaimer_redir =
|
||||
isset($_POST['disclaimer_redir']) ?
|
||||
$_POST['disclaimer_redir'] : '';
|
||||
$disclaimer_title =
|
||||
isset($_POST['disclaimer_title']) ?
|
||||
$_POST['disclaimer_title'] : '';
|
||||
$disclaimer_text =
|
||||
isset($_POST['disclaimer_text']) ?
|
||||
$_POST['disclaimer_text'] : '';
|
||||
$disclaimer_bots_unactive =
|
||||
isset($_POST['disclaimer_bots_unactive']);
|
||||
$disclaimer_bots_agents =
|
||||
isset($_POST['disclaimer_bots_agents']) ?
|
||||
$_POST['disclaimer_bots_agents'] : '';
|
||||
|
||||
$s->put('disclaimer_active', $disclaimer_active);
|
||||
$s->put('disclaimer_remember', $disclaimer_remember);
|
||||
$s->put('disclaimer_redir', $disclaimer_redir);
|
||||
$s->put('disclaimer_title', $disclaimer_title);
|
||||
$s->put('disclaimer_text', $disclaimer_text);
|
||||
$s->put('disclaimer_bots_unactive', $disclaimer_bots_unactive);
|
||||
$s->put('disclaimer_bots_agents', $disclaimer_bots_agents);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$s->drop('disclaimer_active');
|
||||
$s->put('disclaimer_active', 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static function adminDisclaimerHeaders()
|
||||
{
|
||||
global $core;
|
||||
|
||||
$post_format = $core->auth->getOption('post_format');
|
||||
$post_editor = $core->auth->getOption('editor');
|
||||
|
||||
$admin_post_behavior = '';
|
||||
if ($post_editor && !empty($post_editor[$post_format])) {
|
||||
$admin_post_behavior = $core->callBehavior('adminPostEditor', $post_editor[$post_format],
|
||||
'disclaimer_text', array('#disclaimer_text')
|
||||
);
|
||||
}
|
||||
|
||||
return
|
||||
dcPage::jsToolBar().
|
||||
$admin_post_behavior.
|
||||
dcPage::jsConfirmClose('opts-forms').
|
||||
dcPage::jsLoad('index.php?pf=disclaimer/js/config.js');
|
||||
}
|
||||
/**
|
||||
* Form
|
||||
*
|
||||
* @param dcCore $core dcCore instance
|
||||
* @param dcSettings $blog_settings dcSettings instance
|
||||
*/
|
||||
public static function adminBlogPreferencesForm(dcCore $core, dcSettings $blog_settings)
|
||||
{
|
||||
$blog_settings->addNamespace('disclaimer');
|
||||
$s = $blog_settings->disclaimer;
|
||||
$disclaimer_active = (boolean) $s->disclaimer_active;
|
||||
$disclaimer_remember = (boolean) $s->disclaimer_remember;
|
||||
$disclaimer_redir = (string) $s->disclaimer_redir;
|
||||
$disclaimer_title = (string) $s->disclaimer_title;
|
||||
$disclaimer_text = (string) $s->disclaimer_text;
|
||||
$disclaimer_bots_unactive = (boolean) $s->disclaimer_bots_unactive;
|
||||
$disclaimer_bots_agents = $s->disclaimer_bots_agents;
|
||||
if (!$disclaimer_bots_agents) {
|
||||
$disclaimer_bots_agents =
|
||||
'bot;Scooter;Slurp;Voila;WiseNut;Fast;Index;Teoma;'.
|
||||
'Mirago;search;find;loader;archive;Spider;Crawler';
|
||||
}
|
||||
|
||||
echo
|
||||
'<div class="fieldset">'.
|
||||
'<h4>'.__('Disclaimer').'</h4>'.
|
||||
|
||||
'<div class="two-boxes">'.
|
||||
|
||||
'<p><label class="classic" for="disclaimer_active">'.
|
||||
form::checkbox(
|
||||
'disclaimer_active',
|
||||
'1',
|
||||
$disclaimer_active
|
||||
).
|
||||
__('Enable disclaimer').'</label></p>'.
|
||||
|
||||
'<p><label for="disclaimer_title">'.
|
||||
__('Title:').
|
||||
'</label>'.
|
||||
form::field(
|
||||
'disclaimer_title',
|
||||
30,
|
||||
255,
|
||||
html::escapeHTML($disclaimer_title)
|
||||
).
|
||||
'</p>'.
|
||||
|
||||
'</div><div class="two-boxes">'.
|
||||
|
||||
'<p><label class="classic">'.
|
||||
form::checkbox(
|
||||
'disclaimer_remember',
|
||||
'1',
|
||||
$disclaimer_remember
|
||||
).
|
||||
__('Remember the visitor').'</label></p>'.
|
||||
|
||||
'<p><label for="disclaimer_redir">'.
|
||||
__('Link output:').
|
||||
'</label>'.
|
||||
form::field(
|
||||
'disclaimer_redir',
|
||||
30,
|
||||
255,
|
||||
html::escapeHTML($disclaimer_redir)
|
||||
).'</p>'.
|
||||
'<p class="form-note info">'.__('Leave blank to redirect to the site Dotclear').'</p>'.
|
||||
|
||||
'</div><div class="clear">'.
|
||||
|
||||
'<p class="area"><label for="disclaimer_text">'.
|
||||
__('Disclaimer:').
|
||||
'</label>'.
|
||||
form::textarea(
|
||||
'disclaimer_text',
|
||||
60,
|
||||
5,
|
||||
html::escapeHTML($disclaimer_text)
|
||||
).'</p>'.
|
||||
|
||||
'<p><label for="disclaimer_bots_agents">'.
|
||||
__('List of robots allowed to index the site pages (separated by semicolons):').
|
||||
'</label>'.
|
||||
form::field(
|
||||
'disclaimer_bots_agents',
|
||||
120,
|
||||
255,
|
||||
html::escapeHTML($disclaimer_bots_agents)
|
||||
).'</p>'.
|
||||
|
||||
'<p><label for="disclaimer_bots_unactive">'.
|
||||
form::checkbox(
|
||||
'disclaimer_bots_unactive',
|
||||
'1',
|
||||
$disclaimer_bots_unactive
|
||||
).
|
||||
__('Disable the authorization of indexing by search engines').
|
||||
'</label></p>'.
|
||||
|
||||
'</div>'.
|
||||
|
||||
'</div>';
|
||||
}
|
||||
}
|
36
_define.php
Normal file
36
_define.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of disclaimer, 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->registerModule(
|
||||
/* Name */
|
||||
"disclaimer",
|
||||
/* Description*/
|
||||
"Add a disclaimer to your blog entrance",
|
||||
/* Author */
|
||||
"Jean-Christian Denis, Pierre Van Glabeke",
|
||||
/* Version */
|
||||
'0.8.1',
|
||||
/* Properties */
|
||||
array(
|
||||
'permissions' => 'admin',
|
||||
'type' => 'plugin',
|
||||
'dc_min' => '2.7',
|
||||
'support' => 'http://forum.dotclear.org/viewtopic.php?id=40000',
|
||||
'details' => 'http://plugins.dotaddict.org/dc2/details/disclaimer'
|
||||
)
|
||||
);
|
127
_install.php
Normal file
127
_install.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of disclaimer, 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_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
# -- Module specs --
|
||||
|
||||
$dc_min = '2.7';
|
||||
$mod_id = 'disclaimer';
|
||||
$mod_conf = array(
|
||||
array(
|
||||
'disclaimer_active',
|
||||
'Enable disclaimer plugin',
|
||||
false,
|
||||
'boolean'
|
||||
),
|
||||
array(
|
||||
'disclaimer_remember',
|
||||
'Remember the visitor who has already accepted the terms',
|
||||
false,
|
||||
'boolean'
|
||||
),
|
||||
array(
|
||||
'disclaimer_redir',
|
||||
'Redirection if disclaimer is refused',
|
||||
'https://www.google.fr',
|
||||
'string'
|
||||
),
|
||||
array(
|
||||
'disclaimer_title',
|
||||
'Title for disclaimer',
|
||||
'Disclaimer',
|
||||
'string'
|
||||
),
|
||||
array(
|
||||
'disclaimer_text',
|
||||
'Description for disclaimer',
|
||||
__('<p>You must accept this term before entering</p>'),
|
||||
//'You must accept this term before entering',
|
||||
'string'
|
||||
),
|
||||
array(
|
||||
'disclaimer_bots_unactive',
|
||||
'Bypass disclaimer for bots',
|
||||
false,
|
||||
'boolean'
|
||||
),
|
||||
array(
|
||||
'disclaimer_bots_agents',
|
||||
'List of know bots',
|
||||
implode(';', array(
|
||||
'bot',
|
||||
'Scooter',
|
||||
'Slurp',
|
||||
'Voila',
|
||||
'WiseNut',
|
||||
'Fast',
|
||||
'Index',
|
||||
'Teoma',
|
||||
'Mirago',
|
||||
'search',
|
||||
'find',
|
||||
'loader',
|
||||
'archive',
|
||||
'Spider',
|
||||
'Crawler'
|
||||
)),
|
||||
'string'
|
||||
)
|
||||
);
|
||||
|
||||
# -- Nothing to change below --
|
||||
|
||||
try {
|
||||
|
||||
# Check module version
|
||||
if (version_compare(
|
||||
$core->getVersion($mod_id),
|
||||
$core->plugins->moduleInfo($mod_id, 'version'),
|
||||
'>='
|
||||
)) {
|
||||
|
||||
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
|
||||
));
|
||||
}
|
||||
|
||||
# Set module settings
|
||||
$core->blog->settings->addNamespace($mod_id);
|
||||
foreach($mod_conf as $v) {
|
||||
$core->blog->settings->{$mod_id}->put(
|
||||
$v[0], $v[2], $v[3], $v[1], 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());
|
||||
|
||||
return false;
|
||||
}
|
264
_public.php
Normal file
264
_public.php
Normal file
@ -0,0 +1,264 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of disclaimer, 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;
|
||||
}
|
||||
|
||||
$core->blog->settings->addNamespace('disclaimer');
|
||||
|
||||
# Is active
|
||||
if (!$core->blog->settings->disclaimer->disclaimer_active) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
# Localized l10n
|
||||
__('Disclaimer');
|
||||
__('Accept terms of uses');
|
||||
__('I agree');
|
||||
__('I disagree');
|
||||
|
||||
# Behaviors
|
||||
$core->addBehavior(
|
||||
'publicBeforeDocument',
|
||||
array('urlDisclaimer', 'publicBeforeDocument')
|
||||
);
|
||||
$core->addBehavior(
|
||||
'publicHeadContent',
|
||||
array('urlDisclaimer', 'publicHeadContent')
|
||||
);
|
||||
|
||||
# Templates
|
||||
$core->tpl->addValue(
|
||||
'DisclaimerTitle',
|
||||
array('tplDisclaimer', 'DisclaimerTitle')
|
||||
);
|
||||
$core->tpl->addValue(
|
||||
'DisclaimerText',
|
||||
array('tplDisclaimer', 'DisclaimerText')
|
||||
);
|
||||
$core->tpl->addValue(
|
||||
'DisclaimerFormURL',
|
||||
array('tplDisclaimer', 'DisclaimerFormURL')
|
||||
);
|
||||
|
||||
/**
|
||||
* @ingroup DC_PLUGIN_DISCLAIMER
|
||||
* @brief Public disclaimer - URL handler.
|
||||
* @since 2.6
|
||||
*/
|
||||
class urlDisclaimer extends dcUrlHandlers
|
||||
{
|
||||
public static $default_bots_agents = array(
|
||||
'bot','Scooter','Slurp','Voila','WiseNut','Fast','Index','Teoma',
|
||||
'Mirago','search','find','loader','archive','Spider','Crawler'
|
||||
);
|
||||
|
||||
/**
|
||||
* Remove public callbacks (and serve disclaimer css)
|
||||
*
|
||||
* @param array $args Arguments
|
||||
*/
|
||||
public static function overwriteCallbacks($args)
|
||||
{
|
||||
if ($args == 'disclaimer.css') {
|
||||
self::serveDocument('disclaimer.css', 'text/css', false);
|
||||
exit;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add CSS for disclaimer
|
||||
*
|
||||
* @param dcCore $core dcCore instance
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public static function publicHeadContent(dcCore $core)
|
||||
{
|
||||
$url = $core->blog->getQmarkURL().'pf='.basename(dirname(__FILE__));
|
||||
echo
|
||||
"<style type=\"text/css\">\n@import url(".
|
||||
$url.
|
||||
"/css/disclaimer.css);\n</style>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check disclaimer
|
||||
*
|
||||
* @param array $args Arguments
|
||||
*/
|
||||
public static function publicBeforeDocument($args)
|
||||
{
|
||||
global $core, $_ctx;
|
||||
|
||||
# Test user-agent to see if it is a bot
|
||||
if (!$core->blog->settings->disclaimer->disclaimer_bots_unactive) {
|
||||
$bots_agents = $core->blog->settings->disclaimer->diclaimer_bots_agents;
|
||||
$bots_agents = !$bots_agents ?
|
||||
self::$default_bots_agents : explode(';', $bots_agents);
|
||||
|
||||
$is_bot = false;
|
||||
foreach($bots_agents as $bot) {
|
||||
|
||||
if(stristr($_SERVER['HTTP_USER_AGENT'], $bot)) {
|
||||
$is_bot = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_bot) {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
# Set default-templates path for disclaimer files
|
||||
$tplset = $core->themes->moduleInfo($core->blog->settings->system->theme,'tplset');
|
||||
if (!empty($tplset) && is_dir(dirname(__FILE__).'/default-templates/'.$tplset)) {
|
||||
$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates/'.$tplset);
|
||||
} else {
|
||||
$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates/'.DC_DEFAULT_TPLSET);
|
||||
}
|
||||
|
||||
# New URL handler
|
||||
$urlHandler = new urlHandler();
|
||||
$urlHandler->mode = $core->url->mode;
|
||||
$urlHandler->registerDefault(array(
|
||||
'urlDisclaimer',
|
||||
'overwriteCallbacks'
|
||||
));
|
||||
|
||||
# Create session if not exists
|
||||
if (!isset($session)) {
|
||||
$session = new sessionDB(
|
||||
$core->con,
|
||||
$core->prefix.'session',
|
||||
'dc_disclaimer_sess_'.$core->blog->id,
|
||||
'/'
|
||||
);
|
||||
$session->start();
|
||||
}
|
||||
|
||||
# Remove all URLs representations
|
||||
foreach ($core->url->getTypes() as $k => $v) {
|
||||
$urlHandler->register(
|
||||
$k,
|
||||
$v['url'],
|
||||
$v['representation'],
|
||||
array('urlDisclaimer', 'overwriteCallbacks')
|
||||
);
|
||||
}
|
||||
|
||||
# Get type
|
||||
$urlHandler->getDocument();
|
||||
$type = $urlHandler->type;
|
||||
unset($urlHandler);
|
||||
|
||||
# Test cookie
|
||||
$cookie_name="dc_disclaimer_cookie_".$core->blog->id;
|
||||
$cookie_value =
|
||||
empty($_COOKIE[$cookie_name])
|
||||
|| !$core->blog->settings->disclaimer->disclaimer_remember ?
|
||||
false : ($_COOKIE[$cookie_name]) == 1;
|
||||
|
||||
# User say "disagree" so go away
|
||||
if (isset($_POST['disclaimerdisagree'])) {
|
||||
$session->destroy();
|
||||
if ($core->blog->settings->disclaimer->disclaimer_remember) {
|
||||
setcookie($cookie_name, 0, time()-86400, '/');
|
||||
}
|
||||
$redir = $core->blog->settings->disclaimer->disclaimer_redir;
|
||||
if (!$redir) {
|
||||
$redir = 'http://www.dotclear.org';
|
||||
}
|
||||
http::redirect($redir);
|
||||
exit;
|
||||
}
|
||||
|
||||
# Check if user say yes before
|
||||
elseif (!isset($_SESSION['sess_blog_disclaimer'])
|
||||
|| $_SESSION['sess_blog_disclaimer'] != 1
|
||||
) {
|
||||
if ($core->blog->settings->disclaimer->disclaimer_remember
|
||||
&& $cookie_value != false
|
||||
) {
|
||||
$_SESSION['sess_blog_disclaimer'] = 1;
|
||||
|
||||
return null;
|
||||
}
|
||||
if (!empty($_POST['disclaimeragree'])) {
|
||||
$_SESSION['sess_blog_disclaimer'] = 1;
|
||||
|
||||
if ($core->blog->settings->disclaimer->disclaimer_remember) {
|
||||
setcookie($cookie_name, 1, time() + 31536000, '/');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$session->destroy();
|
||||
self::serveDocument('disclaimer.html', 'text/html', false);
|
||||
exit;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup DC_PLUGIN_DISCLAIMER
|
||||
* @brief Public disclaimer - Template.
|
||||
* @since 2.6
|
||||
*/
|
||||
class tplDisclaimer
|
||||
{
|
||||
/**
|
||||
* Public title of disclaimer page and form
|
||||
*
|
||||
* @param array $attr Template value attribute
|
||||
*/
|
||||
public static function DisclaimerTitle($attr)
|
||||
{
|
||||
$f = $GLOBALS['core']->tpl->getFilters($attr);
|
||||
|
||||
return
|
||||
'<?php echo '.sprintf(
|
||||
$f,
|
||||
'$core->blog->settings->disclaimer->disclaimer_title'
|
||||
).'; ?>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Public disclaimer text
|
||||
*
|
||||
* @param array $attr Template value attribute
|
||||
*/
|
||||
public static function DisclaimerText($attr)
|
||||
{
|
||||
return
|
||||
'<?php echo $core->blog->settings->disclaimer->disclaimer_text; ?>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Public URL of disclaimer form action
|
||||
*
|
||||
* @param array $attr Template value attribute
|
||||
*/
|
||||
public static function DisclaimerFormURL($attr)
|
||||
{
|
||||
return '<?php $core->blog->url; ?>';
|
||||
}
|
||||
}
|
62
_uninstall.php
Normal file
62
_uninstall.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of disclaimer, 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_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$mod_id = 'disclaimer';
|
||||
|
||||
$this->addUserAction(
|
||||
/* type */ 'settings',
|
||||
/* action */ 'delete_all',
|
||||
/* ns */ $mod_id,
|
||||
/* desc */ __('delete all settings')
|
||||
);
|
||||
|
||||
$this->addUserAction(
|
||||
/* 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')
|
||||
);
|
||||
|
||||
|
||||
$this->addDirectAction(
|
||||
/* type */ 'settings',
|
||||
/* action */ 'delete_all',
|
||||
/* ns */ $mod_id,
|
||||
/* desc */ sprintf(__('delete all %s settings'), $mod_id)
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
/* 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)
|
||||
);
|
3
css/disclaimer.css
Normal file
3
css/disclaimer.css
Normal file
@ -0,0 +1,3 @@
|
||||
/* common */
|
||||
.dc-disclaimer .disclaimer-text {padding:1em 0;}
|
||||
.dc-disclaimer .disclaimer-accept {font-weight:bold;}
|
86
default-templates/currywurst/disclaimer.html
Normal file
86
default-templates/currywurst/disclaimer.html
Normal file
@ -0,0 +1,86 @@
|
||||
{{tpl:extends parent="__layout.html"}}
|
||||
|
||||
<tpl:Block name="head-title">
|
||||
<title>{{tpl:lang Disclaimer}} - {{tpl:BlogName encode_html="1"}}</title>
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="meta-robots">
|
||||
<meta name="ROBOTS" content="{{tpl:BlogMetaRobots robots="NOINDEX"}}" />
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="meta-entry">
|
||||
<meta name="description" lang="{{tpl:BlogLanguage}}" content="{{tpl:BlogDescription encode_html="1" cut_string="180" remove_html="1"}}" />
|
||||
<meta name="author" content="{{tpl:BlogEditor encode_html="1"}}" />
|
||||
<meta name="date" content="{{tpl:BlogUpdateDate iso8601="1"}}" />
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="dc-entry">
|
||||
<meta property="dc.title" content="{{tpl:lang Disclaimer}} - {{tpl:BlogName encode_html="1"}}" />
|
||||
<meta property="dc.description" lang="{{tpl:BlogLanguage}}" content="{{tpl:BlogDescription encode_html="1" cut_string="180" remove_html="1"}}" />
|
||||
<meta property="dc.language" content="{{tpl:BlogLanguage}}" />
|
||||
<meta property="dc.date" content="{{tpl:BlogUpdateDate iso8601="1"}}" />
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="head-linkrel">
|
||||
<link rel="contents" href="{{tpl:BlogArchiveURL}}" title="{{tpl:lang Archives}}" />
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="html-head">
|
||||
{{tpl:parent}}
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="body-tag"><body class="dc-disclaimer"></tpl:Block>
|
||||
|
||||
<tpl:Block name="page-top">
|
||||
<div class="header">
|
||||
<nav role="navigation">
|
||||
<ul class="skip-links" id="prelude">
|
||||
<li><a href="#main">{{tpl:lang To content}}</a></li>
|
||||
<li><a href="#blognav">{{tpl:lang To menu}}</a></li>
|
||||
<li><a href="#search">{{tpl:lang To search}}</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="banner" role="banner">
|
||||
<h1 class="site-title"><a class="site-title__link"
|
||||
href="{{tpl:BlogURL}}"><span class="site-title__text">{{tpl:BlogName encode_html="1"}}</span></a></h1>
|
||||
<p class="site-baseline">{{tpl:BlogDescription}}</p>
|
||||
</div>
|
||||
|
||||
<!-- # --BEHAVIOR-- publicTopAfterContent -->
|
||||
{{tpl:SysBehavior behavior="publicTopAfterContent"}}
|
||||
</div>
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="main-content">
|
||||
<div id="content-info">
|
||||
<h2>{{tpl:DisclaimerTitle}}</h2>
|
||||
</div>
|
||||
|
||||
<div class="content-inner">
|
||||
<div class="disclaimer-text">
|
||||
{{tpl:DisclaimerText}}
|
||||
</div>
|
||||
|
||||
<div id="disclaimer-form">
|
||||
<form action="{{tpl:DisclaimerFormURL}}" method="post" id="comment-form">
|
||||
|
||||
<p class="disclaimer-accept">{{tpl:lang Accept terms of uses}}</p>
|
||||
<p class="buttons">
|
||||
<input type="submit" class="submit" name="disclaimeragree" value="{{tpl:lang I agree}}" />
|
||||
<input type="submit" class="submit" name="disclaimerdisagree" value="{{tpl:lang I disagree}}" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="wrapper-sidebar">
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="page-footer">
|
||||
<div class="footer" id="footer" role="contentinfo">
|
||||
<p>{{tpl:SysPoweredBy}}</p>
|
||||
</div>
|
||||
</tpl:Block>
|
68
default-templates/mustek/disclaimer.html
Normal file
68
default-templates/mustek/disclaimer.html
Normal file
@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{tpl:BlogLanguage}}">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="ROBOTS" content="{{tpl:BlogMetaRobots robots="NOINDEX"}}" />
|
||||
|
||||
<title>{{tpl:lang Disclaimer}} - {{tpl:BlogName encode_html="1"}}</title>
|
||||
<meta name="copyright" content="{{tpl:BlogCopyrightNotice encode_html="1"}}" />
|
||||
<meta name="author" content="{{tpl:BlogEditor encode_html="1"}}" />
|
||||
<meta name="date" content="{{tpl:BlogUpdateDate iso8601="1"}}" />
|
||||
|
||||
<meta property="dc.title" lang="{{tpl:BlogLanguage}}" content="{{tpl:lang Disclaimer}} - {{tpl:BlogName encode_html="1"}}" />
|
||||
<meta property="dc.language" content="{{tpl:BlogLanguage}}" />
|
||||
<meta property="dc.publisher" content="{{tpl:BlogEditor encode_html="1"}}" />
|
||||
<meta property="dc.rights" content="{{tpl:BlogCopyrightNotice encode_html="1"}}" />
|
||||
<meta property="dc.date" content="{{tpl:BlogUpdateDate iso8601="1"}}" />
|
||||
<meta property="dc.type" content="text" />
|
||||
<meta property="dc.format" content="text/html" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{tpl:BlogThemeURL}}/style.css" media="screen" />
|
||||
<link rel="stylesheet" type="text/css" href="{{tpl:BlogQmarkURL}}pf=print.css" media="print" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{tpl:BlogQmarkURL}}pf=disclaimer/css/disclaimer.css" media="screen" />
|
||||
|
||||
<script type="text/javascript" src="{{tpl:BlogQmarkURL}}pf={{tpl:BlogJsJQuery}}/jquery.js"></script>
|
||||
<script type="text/javascript" src="{{tpl:BlogQmarkURL}}pf={{tpl:BlogJsJQuery}}/jquery.cookie.js"></script>
|
||||
|
||||
{{tpl:include src="_head.html"}}
|
||||
</head>
|
||||
|
||||
<body class="dc-disclaimer">
|
||||
<div id="page">
|
||||
{{tpl:include src="_top.html"}}
|
||||
|
||||
<div id="wrapper">
|
||||
|
||||
<div id="main" role="main">
|
||||
<div id="content">
|
||||
|
||||
<div id="content-info">
|
||||
<h2>{{tpl:DisclaimerTitle}}</h2>
|
||||
</div>
|
||||
|
||||
<div class="content-inner">
|
||||
<div class="disclaimer-text">
|
||||
{{tpl:DisclaimerText}}
|
||||
</div>
|
||||
|
||||
<div id="disclaimer-form">
|
||||
<form action="{{tpl:DisclaimerFormURL}}" method="post" id="comment-form">
|
||||
|
||||
<p class="disclaimer-accept">{{tpl:lang Accept terms of uses}}</p>
|
||||
<p class="buttons">
|
||||
<input type="submit" class="submit" name="disclaimeragree" value="{{tpl:lang I agree}}" />
|
||||
<input type="submit" class="submit" name="disclaimerdisagree" value="{{tpl:lang I disagree}}" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- End #wrapper -->
|
||||
|
||||
{{tpl:include src="_footer.html"}}
|
||||
</div> <!-- End #page -->
|
||||
</body>
|
||||
</html>
|
6
js/config.js
Normal file
6
js/config.js
Normal file
@ -0,0 +1,6 @@
|
||||
$(function() {
|
||||
if ($.isFunction(jsToolBar)) {
|
||||
var tbUser = new jsToolBar(document.getElementById('disclaimer_text'));
|
||||
tbUser.draw('xhtml');
|
||||
}
|
||||
});
|
69
locales/fr/main.po
Normal file
69
locales/fr/main.po
Normal file
@ -0,0 +1,69 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: disclaimer 0.6.2\n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2013-11-14T16:46:36+00:00\n"
|
||||
"Last-Translator: Jean-Christian Denis\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
msgid "disclaimer"
|
||||
msgstr "disclaimer"
|
||||
|
||||
#: _admin.php:102
|
||||
#: _public.php:27
|
||||
#: disclaimer.html:9
|
||||
#: disclaimer.html:15
|
||||
msgid "Disclaimer"
|
||||
msgstr "Disclaimer"
|
||||
|
||||
#: _admin.php:112
|
||||
msgid "Enable disclaimer"
|
||||
msgstr "Activer l'avertissement"
|
||||
|
||||
#: _admin.php:133
|
||||
msgid "Remember the visitor"
|
||||
msgstr "Se souvenir du visiteur"
|
||||
|
||||
#: _admin.php:136
|
||||
msgid "Link output:"
|
||||
msgstr "Lien de sortie :"
|
||||
|
||||
msgid "Leave blank to redirect to the site Dotclear"
|
||||
msgstr "Laisser vide pour rediriger vers le site de Dotclear"
|
||||
|
||||
#: _admin.php:148
|
||||
msgid "Disclaimer:"
|
||||
msgstr "Avertissement :"
|
||||
|
||||
#: _admin.php:158
|
||||
msgid "List of robots allowed to index the site pages (separated by semicolons):"
|
||||
msgstr "Liste des robots autorisés à indexer les pages du site (séparés par un point virgule) :"
|
||||
|
||||
#: _admin.php:173
|
||||
msgid "Disable the authorization of indexing by search engines"
|
||||
msgstr "Désactiver l'autorisation d'indexation par les moteurs de recherches"
|
||||
|
||||
#: _public.php:28
|
||||
#: disclaimer.html:43
|
||||
msgid "Accept terms of uses"
|
||||
msgstr "Accepter les conditions d'utilisation"
|
||||
|
||||
#: _public.php:29
|
||||
#: disclaimer.html:46
|
||||
msgid "I agree"
|
||||
msgstr "J'accepte"
|
||||
|
||||
#: _public.php:30
|
||||
#: disclaimer.html:47
|
||||
msgid "I disagree"
|
||||
msgstr "Je refuse"
|
||||
|
||||
msgid "Add a disclaimer to your blog entrance"
|
||||
msgstr "Ajoute un avertissement à l'entrée sur le blog"
|
||||
|
||||
msgid "<p>You must accept this term before entering</p>"
|
||||
msgstr "<p>Vous devez accepter ces conditions avant d'entrer</p>"
|
||||
|
Loading…
Reference in New Issue
Block a user