Hello,
I apply again for my module, I have already applied for a CVS account: http://drupal.org/node/885534

Thanks

Jérôme Megel

Comments

joachim’s picture

Status: Needs review » Needs work

What's the link to your sandbox?

jerome.megel’s picture

Hello,

sorry, here is the link: http://drupal.org/sandbox/jerome.megel/1077502

jerome.megel’s picture

Status: Needs work » Needs review
dave reid’s picture

Any reason that we can't improve the existing modules that intercept outgoing e-mails?
http://drupal.org/project/maillog
http://drupal.org/project/mail_logger

dave reid’s picture

Status: Needs review » Needs work
jerome.megel’s picture

Status: Needs work » Needs review

Hello,

yes actually there is a reason, this module display a popup in a modalframe, you know exactly when the emails are sent.
You don't need to watch in your logs to see sent emails.

jthorson’s picture

Component: new project application » module

Jerome,

You've explained how your module differs from the links that Dave provided, but I suspect that wasn't the intent of his question.

Can you explain why we should approve a new module for this, compared to the option of adding a new 'modal popup' feature to an existing module?

In other words, would you instead consider creating a patch which adds the 'modal popup' feature as an enhancement to the pre-existing http://drupal.org/project/maillog module?

jthorson’s picture

Status: Needs review » Needs work
tim.plunkett’s picture

Status: Needs work » Closed (won't fix)

Closing due to inactivity, feel free to re-open if this was a mistake.

jerome.megel’s picture

Status: Closed (won't fix) » Needs review

Hello,

I've tested http://drupal.org/project/mail_logger and it still send emails when activated, my module doesnt. You will be sure that nobody except you will receive testing emails.

For the module http://drupal.org/project/maillog (excepted that it is still in dev) you can't reroute emails and code source isn't built like I need to display emails in modalframe, that's why I would like to have my own module, it's up to you !

The interest is really that you can see emails when they are sent (you can also reroute and block them). Maybe there are some emails that you don't know they are sent and because you don't go watching your logs you don't even see these mails, and when you are debugging it's more pleasant when you don't need to watch your logs.

Thank you.

P.S: Sorry for my English

joachim’s picture

I think it's a fair point that logging and testing are two different things: you want a logger to send emails as normal while logging them; you want a tester to show you the emails without sending them.

So, logically, this module shouldn't do any logging of its own, and leave that to a logging module.

jerome.megel’s picture

Actually, my module doesn't log anything it just display outgoing emails in a modalframe.
I talked about the log modules because in post #4 and #7 they suggest me to use them instead of mine, and I've explained how they are different.

Thanks

joachim’s picture

> Actually, my module doesn't log anything it just display outgoing emails in a modalframe.

That's perfect then!

jerome.megel’s picture

Is email_tester module accepted then ?

joachim’s picture

Well, I think it's justified in being a project alongside the mail logging modules, as I think they cover different, complementary areas. Though you should ensure that they work well together.

Still needs a code review! :)

jerome.megel’s picture

Ok thank you,
what exactly should I review ?
I think the code is good because I have already corrected everything: http://drupal.org/node/885534

sreynen’s picture

Status: Needs review » Needs work

Hi jerome.megal,

I created some issues in your project issue queue. Please set this back to "needs review" when those are fixed.

jerome.megel’s picture

Status: Needs work » Needs review

Hello,
I've fixed all issues, there is one in "needs review" state

Thanks

sreynen’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me.

dave reid’s picture

Has the following code been tested to see if it is vulnerable to XSS at all? The outputting of variables directly in a theme function is kind of a big red flag.

 135 function theme_email_tester_format($emails_to_disp) {
 136   $output  = '<div id="email_popup" title="'. t('Emails sent:') .'">';
 137   $output .= '<ul id="email_accordion" style="width: 760px;">';
 138   foreach ($emails_to_disp as $key => $email) {
 139     $output .= '
 140       <li class="ui-accordion-group">
 141         <h3 class="ui-accordion-header"><a href=\'#\'>'. $key .'</a></h3>
 142         <div class="ui-accordion-data">'.
 143           '<p><strong>'.t('From').'</strong>:&nbsp;'.$email['from'].'</p>'.
 144           '<p><strong>'.t('To').'</strong>:&nbsp;'.$email['to'].'</p>'.
 145           '<p><strong>'.t('Language').'</strong>:&nbsp;'.$email['language'].'</p>'.
 146           '<p><strong>'.t('Subject').'</strong>:&nbsp;'.$email['subject'].'</p>'.
 147           '<p><strong>'.t('Body').'</strong>:&nbsp;'.$email['body'].'</p>'.
 148        '</div>
 149       </li>';
 150   }
 151   $output .= '</ul>';
 152   $output .= '</div>';
 153 
 154   return $output;
jthorson’s picture

Status: Reviewed & tested by the community » Needs work

A few more issues:

  • Module popup is definately susceptible to XSS attacks. I realize that this is supposed to be a admin/development tool, but all screen output must be properly sanitized by passing it through a filter such as check_plain, filter_xss, or filter_xss_admin. (Sending an email to <script>alert('xss!');</script> must not result in a pop-up.)
  • When jquery_ui is not already installed, and a user has simply downloaded the jquery_ui module (and not the library itself), attempting to install Email_tester and have it auto-install jquery_ui (with library missing) resulted in a PHP fatal error:
    PHP Fatal error: Call to undefined function jquery_ui_add() in /var/www/d6/sites/all/modules/email_tester/email_tester.module on line 19
    This resulted in WSOD when visiting admin/build/modules. I had to manually disable the module in the database. To avoid this, you should leverage hook_requirements() to validate the proper installation of jquery_ui before allowing email_tester to be enabled.
  • Email_tester.module is missing an EOL (end-of-line) on the last line of the file.
  • The reroute email textfield on admin/settings/devel should be weighted so that it appears above the 'save settings' buttons.

In addition, Coder reports the following issues:

email_tester.module

Line 2: Commits to the Git repository do not require the CVS $Id$ keyword in each file. (Drupal Docs)

      // $Id$

Line 143: string concatenation should be formatted with a space separating the operators (dot .) and non-quote terms

                '<p><strong>'.t('From').'</strong>:&nbsp;'.$email['from'].'</p>'.

Line 144: string concatenation should be formatted with a space separating the operators (dot .) and non-quote terms

                '<p><strong>'.t('To').'</strong>:&nbsp;'.$email['to'].'</p>'.

Line 145: string concatenation should be formatted with a space separating the operators (dot .) and non-quote terms

                '<p><strong>'.t('Language').'</strong>:&nbsp;'.$email['language'].'</p>'.

Line 146: string concatenation should be formatted with a space separating the operators (dot .) and non-quote terms

                '<p><strong>'.t('Subject').'</strong>:&nbsp;'.$email['subject'].'</p>'.

Line 147: string concatenation should be formatted with a space separating the operators (dot .) and non-quote terms

                '<p><strong>'.t('Body').'</strong>:&nbsp;'.$email['body'].'</p>'.

email_tester.install

Line 2: Commits to the Git repository do not require the CVS $Id$ keyword in each file. (Drupal Docs)

      // $Id$
jerome.megel’s picture

Status: Needs work » Needs review

Hello,
all issues have been fixed

jthorson’s picture

Status: Needs review » Needs work

Thanks for the quick changes!

Generally, I would suggest using check_plain() over filter_xss() for the sanitization checks, unless that variable could legitimately hold HTML tags ... though both will achieve the desired result, check_plain() is probably lighter from a performance perspective.

With regards to the themeroller css files/images ... can you provide a link to some information which discusses the license terms regarding use of the themeroller-generated items? Any included code component that is not your own needs to be re-useable under a GPLv2 license.

And even if the output is useable under a GPLv2 license, I would recommend that the module only include the bare minimum css required to function - To illustrate, consider what would happen if a user installed two different modules on their site, both which have used themeroller to generate their css output. Since the themeroller files contain the same element names for both modules, you're going to run into css namespace conflicts ... or your module could be responsible for over-riding the jquery UI datepicker used in other areas of the site, forcing the site maintainer on a wild goose chase trying to find what broke things.

I would suggest minimalizing the css, and adding namespacing to the .css file definitions ... this is probably not a show-stopper for the application (though the license issue could be), but I'd at least give it a strong consideration.

jerome.megel’s picture

Status: Needs work » Needs review

I've used check_plain() function instead of filter_xss()
And for the CSS problem, I have used default jQuery ui theme and added some requirements , it will be OK this way ??
Thank you

jthorson’s picture

Status: Needs review » Reviewed & tested by the community

Hmmm ... I remember typing this yesterday, but it appears it didn't submit ...

filter_xss() is probably the better choice for the email body, in case you're sending html emails. The check_plain() on the rest looks good.

And a big +1 for going with the default jquery UI theme. :)

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, jerome.megel! Welcome to the community of project contributors on drupal.org.

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

As you continue to work on your module, keep in minde: Commit messages - providing history and credit and Release naming conventions.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Issue summary: View changes
Status: Closed (fixed) » Fixed

I am giving credits to the users who participated in this issue.

avpaderno’s picture

Title: Email tester » [D7] Email tester

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jerome.megel’s picture

Issue summary: View changes