0.4.6
This commit is contained in:
parent
a3f01bf475
commit
a2fd9a3c87
16
_admin.php
Normal file
16
_admin.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||||
|
# This file is part of Email Optionnel, a plugin for Dotclear.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007-2015 Oleksandr Syenchuk, Pierre Van Glabeke
|
||||||
|
#
|
||||||
|
# Licensed under the GPL version 2.0 license.
|
||||||
|
# A copy 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; }
|
||||||
|
|
||||||
|
$core->addBehavior('adminBlogPreferencesForm',
|
||||||
|
array('emailOptionnelBehaviors', 'adminBlogPreferencesForm'));
|
||||||
|
$core->addBehavior('adminBeforeBlogSettingsUpdate',
|
||||||
|
array('emailOptionnelBehaviors', 'adminBeforeBlogSettingsUpdate'));
|
32
_define.php
Normal file
32
_define.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||||
|
# This file is part of Email Optionnel, a plugin for Dotclear.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007-2015 Oleksandr Syenchuk, Pierre Van Glabeke
|
||||||
|
#
|
||||||
|
# Licensed under the GPL version 2.0 license.
|
||||||
|
# A copy 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; }
|
||||||
|
|
||||||
|
# WARNING :
|
||||||
|
# Email Optionnel is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
$this->registerModule(
|
||||||
|
/* Name */ 'emailOptionnel',
|
||||||
|
/* Description*/ 'Make e-mail address optional in comments',
|
||||||
|
/* Author */ 'Oleksandr Syenchuk, Pierre Van Glabeke',
|
||||||
|
/* Version */ '0.4.6',
|
||||||
|
/* Properties */
|
||||||
|
array(
|
||||||
|
'permissions' => 'admin',
|
||||||
|
'type' => 'plugin',
|
||||||
|
'dc_min' => '2.6',
|
||||||
|
'support' => 'http://forum.dotclear.org/viewtopic.php?pid=332948#p332948',
|
||||||
|
'details' => 'http://plugins.dotaddict.org/dc2/details/emailOptionnel'
|
||||||
|
)
|
||||||
|
);
|
13
_prepend.php
Normal file
13
_prepend.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||||
|
# This file is part of Email Optionnel, a plugin for Dotclear.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007-2015 Oleksandr Syenchuk, Pierre Van Glabeke
|
||||||
|
#
|
||||||
|
# Licensed under the GPL version 2.0 license.
|
||||||
|
# A copy 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; }
|
||||||
|
|
||||||
|
$GLOBALS['__autoload']['emailOptionnelBehaviors'] = dirname(__FILE__).'/behaviors.php';
|
16
_public.php
Normal file
16
_public.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||||
|
# This file is part of Email Optionnel, a plugin for Dotclear.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007-2015 Oleksandr Syenchuk, Pierre Van Glabeke
|
||||||
|
#
|
||||||
|
# Licensed under the GPL version 2.0 license.
|
||||||
|
# A copy 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; }
|
||||||
|
|
||||||
|
$core->addBehavior('publicPrepend',
|
||||||
|
array('emailOptionnelBehaviors','publicPrepend'));
|
||||||
|
$core->addBehavior('publicBeforeCommentCreate',
|
||||||
|
array('emailOptionnelBehaviors','publicBeforeCommentCreate'));
|
88
behaviors.php
Normal file
88
behaviors.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||||
|
# This file is part of Email Optionnel, a plugin for Dotclear.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007-2015 Oleksandr Syenchuk, Pierre Van Glabeke
|
||||||
|
#
|
||||||
|
# Licensed under the GPL version 2.0 license.
|
||||||
|
# A copy 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;}
|
||||||
|
class emailOptionnelBehaviors
|
||||||
|
{
|
||||||
|
public static function adminBlogPreferencesForm($core)
|
||||||
|
{
|
||||||
|
$core->blog->settings->addNamespace('emailoptionnel');
|
||||||
|
$emailOptionnel = $core->blog->settings->emailoptionnel->enabled ? true : false;
|
||||||
|
echo "<div class=\"fieldset\"><h4>".__('Optional e-mail address')."</h4>\n".
|
||||||
|
"<p><label class=\"classic\" for=\"emailOptionnel\">".form::checkbox('emailOptionnel','1',$emailOptionnel)."\n".
|
||||||
|
__('Make e-mail address optional in comments')."</label></p>\n".
|
||||||
|
"</div>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function adminBeforeBlogSettingsUpdate($blog_settings)
|
||||||
|
{
|
||||||
|
$emailOptionnel = empty($_POST['emailOptionnel']) ? false : true;
|
||||||
|
|
||||||
|
$blog_settings->addNamespace('emailoptionnel');
|
||||||
|
$blog_settings->emailoptionnel->put(
|
||||||
|
'enabled',
|
||||||
|
$emailOptionnel,
|
||||||
|
'boolean',
|
||||||
|
'Make e-mail address optional in comments');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function publicPrepend($core)
|
||||||
|
{
|
||||||
|
$core->blog->settings->addNamespace('emailoptionnel');
|
||||||
|
|
||||||
|
if (!isset($_POST['c_content'])
|
||||||
|
|| !empty($_POST['preview'])
|
||||||
|
|| !empty($_POST['c_mail'])
|
||||||
|
|| !$core->blog->settings->emailoptionnel->enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$_POST['c_mail'] = 'invalid@invalid';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function publicBeforeCommentCreate($cur)
|
||||||
|
{
|
||||||
|
global $core;
|
||||||
|
|
||||||
|
$core->blog->settings->addNamespace('emailoptionnel');
|
||||||
|
|
||||||
|
$emailOptionnel = $core->blog->settings->emailoptionnel->enabled ? true : false;
|
||||||
|
|
||||||
|
if ($emailOptionnel && $cur->comment_email == 'invalid@invalid')
|
||||||
|
{
|
||||||
|
$_ctx = &$GLOBALS['_ctx'];
|
||||||
|
|
||||||
|
# désactive l'affichage du mail dans le template
|
||||||
|
$_ctx->comment_preview['mail'] = '';
|
||||||
|
|
||||||
|
# n'enregistre pas de mail dans la BDD
|
||||||
|
$cur->comment_email = '';
|
||||||
|
|
||||||
|
# n'enregistre pas le mail dans le cookie
|
||||||
|
|
||||||
|
if (empty($_POST['c_remember'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_COOKIE['comment_info'])) {
|
||||||
|
$cookie_info = explode("\n",$_COOKIE['comment_info']);
|
||||||
|
if (count($cookie_info) == 3) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$c_cookie = array(
|
||||||
|
'name' => $cur->comment_author,
|
||||||
|
'mail' => $cur->comment_email,
|
||||||
|
'site' => $cur->comment_site);
|
||||||
|
$c_cookie = serialize($c_cookie);
|
||||||
|
setcookie('comment_info',$c_cookie,strtotime('+3 month'),'/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
locales/fr/main.po
Normal file
17
locales/fr/main.po
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"POT-Creation-Date: \n"
|
||||||
|
"PO-Revision-Date: \n"
|
||||||
|
"Last-Translator: brol <contact@brol.info>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=iso-8859-1\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 1.5.7\n"
|
||||||
|
|
||||||
|
msgid "Optional e-mail address"
|
||||||
|
msgstr "Adresse e-mail optionnelle"
|
||||||
|
|
||||||
|
msgid "Make e-mail address optional in comments"
|
||||||
|
msgstr "Rendre la saisie de l'adresse e-mail optionnelle dans les commentaires"
|
Loading…
Reference in New Issue
Block a user