Skip to content

Commit

Permalink
feature 2995: New email template
Browse files Browse the repository at this point in the history
rewrite pwg_mail_group() and pwg_mail_notification_admins()
new function pwg_mail_admins()
add complete template management in pwg_mail()
TODO : font-size problem in Thunderbird

git-svn-id: http://piwigo.org/svn/trunk@25357 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Nov 6, 2013
1 parent b768047 commit 7a5e31e
Show file tree
Hide file tree
Showing 9 changed files with 267 additions and 251 deletions.
33 changes: 17 additions & 16 deletions admin/album_notification.php
Expand Up @@ -80,28 +80,29 @@
$img_url = '';
}

// TODO Mettre un array pour traduction subjet
pwg_mail_group(
$_POST['group'],
get_str_email_format(true), /* TODO add a checkbox in order to choose format*/
get_l10n_args('[%s] Visit album %s',
array($conf['gallery_title'], $category['name'])),
'cat_group_info',
array
(
'IMG_URL' => $img_url,
'CAT_NAME' => $category['name'],
'LINK' => make_index_url(
array(
array(
'subject' => l10n('[%s] Visit album %s', $conf['gallery_title'], $category['name']),
// TODO : change this language variable to 'Visit album %s'
// TODO : 'language_selected' => ....
),
array(
'filename' => 'cat_group_info',
'assign' => array(
'IMG_URL' => $img_url,
'CAT_NAME' => $category['name'],
'LINK' => make_index_url(array(
'category' => array(
'id' => $category['id'],
'name' => $category['name'],
'permalink' => $category['permalink']
))),
'CPL_CONTENT' => empty($_POST['mail_content'])
? '' : stripslashes($_POST['mail_content'])
),
'' /* TODO Add listbox in order to choose Language selected */);
)
)),
'CPL_CONTENT' => empty($_POST['mail_content']) ? '' : stripslashes($_POST['mail_content']),
)
)
);

unset_make_full_url();

Expand Down
2 changes: 1 addition & 1 deletion include/config_default.inc.php
Expand Up @@ -285,7 +285,7 @@
$conf['mail_sender_email'] = '';

// set true to allow text/html emails
$conf['allow_html_email'] = true;
$conf['mail_allow_html'] = true;

// 'clear' or 'dark'
$conf['mail_theme'] = 'clear';
Expand Down
66 changes: 30 additions & 36 deletions include/functions_comment.inc.php
Expand Up @@ -232,25 +232,22 @@ function insert_user_comment( &$comm, $key, &$infos )

$comment_url = get_absolute_root_url().'comments.php?comment_id='.$comm['id'];

$keyargs_content = array
(
get_l10n_args('Author: %s', stripslashes($comm['author']) ),
get_l10n_args('Email: %s', stripslashes($comm['email']) ),
get_l10n_args('Comment: %s', stripslashes($comm['content']) ),
get_l10n_args('', ''),
get_l10n_args('Manage this user comment: %s', $comment_url)
$content = array(
l10n('Author: %s', stripslashes($comm['author']) ),
l10n('Email: %s', stripslashes($comm['email']) ),
l10n('Comment: %s', stripslashes($comm['content']) ),
'',
l10n('Manage this user comment: %s', $comment_url),
);

if ('moderate' == $comment_action)
{
$keyargs_content[] = get_l10n_args('', '');
$keyargs_content[] = get_l10n_args('(!) This comment requires validation', '');
$content[] = l10n('(!) This comment requires validation');
}

pwg_mail_notification_admins
(
get_l10n_args('Comment by %s', stripslashes($comm['author']) ),
$keyargs_content
pwg_mail_notification_admins(
l10n('Comment by %s', stripslashes($comm['author']) ),
implode("\n", $content)
);
}
}
Expand Down Expand Up @@ -376,20 +373,17 @@ function update_user_comment($comment, $post_key)

$comment_url = get_absolute_root_url().'comments.php?comment_id='.$comment['comment_id'];

$keyargs_content = array
(
get_l10n_args('Author: %s', stripslashes($GLOBALS['user']['username']) ),
get_l10n_args('Comment: %s', stripslashes($comment['content']) ),
get_l10n_args('', ''),
get_l10n_args('Manage this user comment: %s', $comment_url),
get_l10n_args('', ''),
get_l10n_args('(!) This comment requires validation', ''),
$content = array(
l10n('Author: %s', stripslashes($GLOBALS['user']['username']) ),
l10n('Comment: %s', stripslashes($comment['content']) ),
'',
l10n('Manage this user comment: %s', $comment_url),
l10n('(!) This comment requires validation'),
);

pwg_mail_notification_admins
(
get_l10n_args('Comment by %s', stripslashes($GLOBALS['user']['username']) ),
$keyargs_content
pwg_mail_notification_admins(
l10n('Comment by %s', stripslashes($GLOBALS['user']['username']) ),
implode("\n", $content)
);
}
// just mail admin
Expand All @@ -416,24 +410,24 @@ function email_admin($action, $comment)

include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');

$keyargs_content = array();
$keyargs_content[] = get_l10n_args('Author: %s', $comment['author']);
$content = array(
l10n('Author: %s', $comment['author']),
);

if ($action=='delete')
{
$keyargs_content[] = get_l10n_args('This author removed the comment with id %d',
$comment['comment_id']
);
$content[] = l10n('This author removed the comment with id %d', $comment['comment_id']);
}
else
{
$keyargs_content[] = get_l10n_args('This author modified following comment:', '');
$keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']);
$content[] = l10n('This author modified following comment:');
$content[] = l10n('Comment: %s', $comment['content']);
}

pwg_mail_notification_admins(get_l10n_args('Comment by %s',
$comment['author']),
$keyargs_content
);
pwg_mail_notification_admins(
l10n('Comment by %s', $comment['author']),
implode("\n", $content)
);
}

function get_comment_author_id($comment_id, $die_on_error=true)
Expand Down

0 comments on commit 7a5e31e

Please sign in to comment.