one file plugin

master
Jean-Christian Paul Denis 2023-03-11 17:14:04 +01:00
parent 9ec013e66c
commit 9c2f78d1d6
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
6 changed files with 59 additions and 38 deletions

View File

@ -1,3 +1,8 @@
0.3 - 2023.03.11
- one file plugin
- should be compatible with Dotclear 2.26
- translate plugin description
0.2 - 2022.12.22 0.2 - 2022.12.22
- use abstract plugin id - use abstract plugin id
- fix permissions - fix permissions

View File

@ -15,10 +15,10 @@ if (!defined('DC_RC_PATH')) {
} }
$this->registerModule( $this->registerModule(
'mail2log', 'Mail to log',
'Do not send mails but log them', 'Do not send mails but log them',
'Jean-Christian Denis and contributors', 'Jean-Christian Denis and contributors',
'0.2', '0.3',
[ [
'requires' => [['core', '2.24']], 'requires' => [['core', '2.24']],
'permissions' => dcCore::app()->auth->makePermissions([ 'permissions' => dcCore::app()->auth->makePermissions([
@ -30,3 +30,17 @@ $this->registerModule(
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml', 'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
] ]
); );
if (!function_exists('\_mail')) {
function _mail($to, $subject, $message, $headers)
{
$headers = is_array($headers) ? implode("\n\t", $headers) : (string) $headers;
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME);
$cur->log_table = basename(__DIR__);
$cur->log_msg = sprintf("%s\n-----\n To: %s\n Subject: %s\n-----\n Message:\n%s\n", $headers, $to, $subject, $message);
dcCore::app()->log->addLog($cur);
return true;
}
}

View File

@ -1,29 +0,0 @@
<?php
/**
* @brief mail2log, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
if (!function_exists('_mail')) {
function _mail($to, $subject, $message, $headers)
{
$headers = is_array($headers) ? implode("\n\t", $headers) : (string) $headers;
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME);
$cur->log_table = basename(__DIR__);
$cur->log_msg = sprintf("%s\n-----\n To: %s\n Subject: %s\n-----\n Message:\n%s\n", $headers, $to, $subject, $message);
dcCore::app()->log->addLog($cur);
return true;
}
}

View File

@ -1,11 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="mail2log"> <module id="mail2log">
<name>mail2log</name> <name>Mail to log</name>
<version>0.2</version> <version>0.3</version>
<author>Jean-Christian Denis and contributors</author> <author>Jean-Christian Denis and contributors</author>
<desc>Do not send mails but log them</desc> <desc>Do not send mails but log them</desc>
<file>https://github.com/JcDenis/mail2log/releases/download/v0.2/plugin-mail2log.zip</file> <file>https://github.com/JcDenis/mail2log/releases/download/v0.3/plugin-mail2log.zip</file>
<da:dcmin>2.24</da:dcmin> <da:dcmin>2.24</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/mail2log</da:details> <da:details>https://plugins.dotaddict.org/dc2/details/mail2log</da:details>
<da:support>https://github.com/JcDenis/mail2log</da:support> <da:support>https://github.com/JcDenis/mail2log</da:support>

View File

@ -0,0 +1,13 @@
<?php
/**
* @package Dotclear
*
* @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
*/
#
# DOT NOT MODIFY THIS FILE !
#
l10n::$locales['Mail to log'] = 'Mail en log';
l10n::$locales['Do not send mails but log them'] = 'Ne pas envoyer les mails mais les loguer';

18
locales/fr/main.po 100644
View File

@ -0,0 +1,18 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: mail2log 0.3\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2023-03-11T16:10:37+00:00\n"
"Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "Mail to log"
msgstr "Mail en log"
msgid "Do not send mails but log them"
msgstr "Ne pas envoyer les mails mais les loguer"