Description

EMF GraphicMail is a plugin for the Email Marketing Framework, which allows sites that use the e-newsletter mailing platform GraphicMail to maintain synchronised subscriber lists with Drupal.

It requires a working install of the Email Marketing Framework, a GraphicMail account, and GraphicMail API access for your server.

Installation

Install the EMF GraphicMail module into the modules directory (typically sites/all/modules).

Dependencies

The EMF GraphicMail module is dependent on the EMF module.

Configuration

The configuration page is at admin/settings/emf_graphicmail, where you can enter your API details.

Further options are available under admin/build/emf/list. You must run cron before your mailing lists will appear in Drupal.

Project page

https://drupal.org/sandbox/mja/1452484

Git Repository

git clone --branch 6.x-1.x http://git.drupal.org/sandbox/mja/1452484.git emf_graphicmail

Drupal Version

Drupal 6

CommentFileSizeAuthor
#13 drupalcs-result.txt2.83 KBklausi

Comments

patrickd’s picture

Status: Needs review » Needs work

welcome,

You are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.

As installation and usage instructions are quite important for us to review, please take a moment to make your project page follow tips for a great project page. Also create a README.txt that follows the guidelines for in-project documentation.

while waiting for an in-depht review of your module you can start out fixing some coding style issues detected by automated tools:
http://ventral.org/pareview/httpgitdrupalorgsandboxmja1452484git

We do really need more hands in the application queue and highly recommend to get a review bonus so we can come back to your application sooner.

regards

patrickd’s picture

Issue summary: View changes

corrected git/project url

mja’s picture

Status: Needs work » Needs review

Hi patrickd,

Thanks for pointing me in the right direction, and apologies for the initial state of the code.

This should be greatly tidied up and now with a README.txt file and better documentation.

Have also branched into 6.x-1.x and delete code from master branch - sorry about that.

I'll do my best to get reviewing elsewhere.

Thanks,

Mark

bloke_zero’s picture

Hi,

I didn't install the module because I don't meet the requirements so I just looked through the code - looks good!

Couldn't see much wrong:

Probably a good idea to have a README.txt in the major branch saying "See major version branches" as per http://drupal.org/node/1127732

emf_graphicmail.module

  1. Would prefer to see a specific permission, hook_perm() (or inherited from EMF module?).
  2. Line 17: t() in emf_graphicmail_menu() for title & desc
  3. Line 68: I'm assuming that there is a reason for not using drupal_load_include instead of @require_once http://api.drupal.org/api/drupal/includes%21module.inc/function/module_l...
  4. Line 71: $options - would it be wise to have check_plain() or something run on them? Can we be sure they are ok?
  5. Line 125: Prefer standard if/else structure as more readble: http://drupal.org/coding-standards#controlstruct

Good luck.

mja’s picture

Many thanks for those recommendations, @bloke_zero. I've acted on all of them, except for the hook_perm - none of the other plugins for EMF implement hook_perm, so didn't want to break from convention without the blessing of the EMF maintainers. Given that you wouldn't be able to use this plugin without EMF permission, I imagine it won't be too much of a problem.

Thanks again for taking the time to review the code.

avpaderno’s picture

Priority: Normal » Critical
garphy’s picture

Status: Needs review » Needs work

Why recommending installing the module in the plug-ins directory of emf project ? Your module isn't (technically) incorporated in EMF so I would recommend installing it in the usual sites/*/modules directory.

There is no need for the plug-in module to reside inside the EMF source tree and doing so can be a pain to the site further maintenance (updates, ...).

BTW, once promoted, if your module is installed with drush, it will reside in sites/*/modules, not int the plug-ins subdirectory of EMF.

mja’s picture

@garphy,

Thanks for your comment, however I have to say I disagree. EMF is a specifically 'modular' module - i.e. it requires these plugins to operate. The fact that it ships with a Campaign Monitor and MailChimp plugin means that it works out of the box, but it would do nothing without the plugins.

Equally, my module will do nothing - not even install - without EMF.

Given that this is a D6 module, where the vast majority of module installs are still done via FTP, there is no maintainability problem - if you want to install a new version of EMF, just copy the new files over the old ones.

Finally, ALL other EMF plugins follow this pattern. If you disagree with it, can I suggest you take that up with the EMF maintainers? I see that you are already writing an EMF plugin yourself, so perhaps you have already spoken to them. Oh, and while you are doing so, could you ask one of them to take a look at my module please?! It has been in production use for months and they could approve it in seconds...

mja’s picture

Priority: Critical » Normal
Status: Needs work » Needs review
garphy’s picture

Thanks for your comment, however I have to say I disagree. EMF is a specifically 'modular' module - i.e. it requires these plugins to operate. The fact that it ships with a Campaign Monitor and MailChimp plugin means that it works out of the box, but it would do nothing without the plugins.

Equally, my module will do nothing - not even install - without EMF.

I did not said EMF wasn't required. I said that it should not be recommended to end user to deploy it under emf module folder but under its own folder.

Your module doesn't (technically) have to be under emf module folder to operate.

Given that this is a D6 module, where the vast majority of module installs are still done via FTP, there is no maintainability problem - if you want to install a new version of EMF, just copy the new files over the old ones.

Well... maintainability has nothing to do with Drupal core version. Here, we're doing svn+rsync deployments since D5. Your just-copy-the-new-files-over-ftp doesn't take care of deleting deprecated & useless files which can be harmful in some cases. You'll then have to manually fine check your module update to detect files that have vanished remembering the exceptions you manually added. This is insane in large scale production environments. Plus there's no technical advantage of doing so.

Finally, ALL other EMF plugins follow this pattern. If you disagree with it, can I suggest you take that up with the EMF maintainers?

No. Campaign Monitor & MailChimp sub-modules lives in the EMF code base because they are provided with it. They're part of the same 'project'. Interspire E-mail Marketer & Addemar plugins are separate project and do not live in EMF codebase. The do not have to be installed under the emf folder and their documentation does not re command so either.
If you want to see your module live alongside Campaign Monitor & MailChimp plugins, you should not submit a project application for a module on its own but submit a patch to EMF maintainers to be included inside the EMF project itself.

(My 0.02€, but i'll be happy to read other fellows comments & thought on that topic)

Oh, and while you are doing so, could you ask one of them to take a look at my module please?! It has been in production use for months and they could approve it in seconds...

I can't check it against a real GraphicMail setup but I'll do a quick code review ASAP.

mja’s picture

@garphy,

Okay, you win. All I want is for this module to see the light of day. If it needs to sit in the root modules folder to do so, then I will change the documentation to reflect that...

Thanks for your input - I appreciate it.

mja’s picture

Issue summary: View changes

Updating documentation.

mja’s picture

Priority: Normal » Major
klausi’s picture

Assigned: Unassigned » klausi
klausi’s picture

Assigned: klausi » Unassigned
Priority: Major » Normal
Status: Needs review » Needs work
StatusFileSize
new2.83 KB

There is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732
Review of the 6.x-1.x branch:

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. "module_load_include('inc','emf_graphicmail','emf_graphicmail.api')": no need to use module_load_inlcude as you are including files from your own module which you already know where they are. Use something like require_once 'mymodule.inc';
  2. emf_graphicmail_form_emf_admin_list_info_form_alter(): $datasets_data: do not store that sanitized. "When handling data, the golden rule is to store exactly what the user typed. When a user edits a post they created earlier, the form should contain the same things as it did when they first submitted it. This means that conversions are performed when content is output, not when saved to the database". From http://drupal.org/node/28984
  3. "watchdog('emf_graphicmail', 'Error adding custom fields data for subscriber ' . $email);": do not concatenate variables directly into watchdog() calls, use placeholders instead.
mja’s picture

Hi klausi,

Many thanks for your input and for sparing the time to look at the module.

I've implemented all of your recommendations, except for point (2). Whilst I understand the point being made in the Drupal recommendations, in this particular case the data is coming from an API, not a user, and is being readied for display in a form (using hook_form_alter), so would this not be a good case for sanitising data from an 'unknown' source before displaying it to the user?

Thanks again,

Mark

mja’s picture

Status: Needs work » Needs review
patrickd’s picture

The point is not to >store< data sanitized, but to sanitize data before it is >displayed<. There is no problem to save raw data in drupal and sanitizing it in the hook_form_alter() before displaying it to the user.

mja’s picture

@patrickd

Thank you for your comment.

I have removed the check_plain calls before the variable_set and added some further up the function to ensure that the data is sanitized before being displayed to the user.

webdorado’s picture

Status: Needs review » Needs work
  1. emf_graphicmail.module - line 129 - now is if(){ should be if () {
weta1’s picture

Hi guys, have used the Graphic Mail module before for D6 sites (works great thanks). Trying to implement for a D7 site. Can you please point me in the right direction for a download of D7 version or EMF Graphic Mail plugin for EMF. Thanks.

weta1’s picture

Hi guys, this is a followup to earlier mail. Have the Graphic mail module working. However, by default it also appears on the front page. This is despite correct setup in the block section. Thanks again.

mja’s picture

Hi weta1,

It's really good to hear that this module has been useful to someone. I'm afraid, however, that I simply don't have the resources to dedicate to a D7 release for it. As you can see, the D6 release is still sitting in the issue queue, picking up comments about its code indenting. I am pretty demoralised by the whole review process, and cannot at the moment ever imagine wanting to go through it again for a D7 version.

Good luck with your D7 site, and thanks for your comments.

klausi’s picture

This is a one-time approval process to get permission to promote it (and future projects) to a full project. No need to go through it again. As successful completion of the project application process results in the applicant being granted the "Create Full Projects" permission, there is no need to take multiple applications through the process. See http://drupal.org/node/1011698

mja’s picture

Hi Klausi,

Okay, thanks. I didn't realise that. Will see if I can dedicate some more time to it.

mja’s picture

Priority: Normal » Major
Status: Needs work » Needs review

@webdorado

The 'if' statement spacing is now fixed.

zymphonies-dev’s picture

Status: Needs review » Needs work

Hi Mark,

Please fix this small error

FILE: ...ew/sites/all/modules/pareview_temp/test_candidate/graphicmail.class.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
43 | ERROR | Function comment short description must end with a full stop
--------------------------------------------------------------------------------

Thanks
Shanid kv

klausi’s picture

Status: Needs work » Needs review

Minor coding standards are not application blockers. Please take an actual look at the source code.

mja’s picture

Thank-you, Klausi.

zymphonies-dev’s picture

Sure klausi
i will check source code

cwithout’s picture

Status: Needs review » Needs work

mja, I understand your frustration with the review process. It can can seem lengthy and nitpicky, but please don't take the code review personally. What feels nitpicky actually serves a valuable purpose. It ensures people who are granted permission to create modules (as mentioned, it's a one time approval) are at least familiar with Drupal coding standards. Coding standards are important in a collaborative environment. The Drupal coding standards aren't the same as (and in some cases contradict) other things I've coded, so I see where you're coming from that at times it seems a bit annoying and frustrating. But without standards, you could end up with nightmare code that no one could read. People who are reliant on modules need to be able to contribute to them and/or take over coding them if the maintainer disappears.

I'm going to submit my module for approval, and I fully expect to get the same critiques if I have any violations of coding standards. If people ignored them, I might not even be aware I violated a standard for Drupal. The review process is not just a means for others to criticize and block code from being released. It's a learning tool.

Here are the issues I found:

You still have a master branch. It should be deleted. See step 6 at Moving from a master to a major version branch.

Your README.txt file and the project page still recommend installing the module into the EMF module's plugins directory. It should instruct users to install it under sites/all/modules, or as most modules do, you can leave out where to install and assume users know where modules should be installed. Instructing users to place a module into another module's directory goes against best practice. (See EMF Interspire and EMF Addemar Plugin. Neither recommends placing their EMF plugin module's code into the EMF directory.)

emf_graphicmail.settings.inc

'#description' => t('Your Graphicmail API Username. See Graphicmail\'s <a href="http://www.graphicmail.co.uk/api/documentation/">documentation</a> for more info.'),
'description' => $t('Your Graphicmail API password has not been set yet. Please specifiy it on the <a href="@url">Graphicmail settings page</a>.', array('@url' => url('admin/settings/emf_graphicmail'))),

According to the t() documentation, you should avoid escaping quotation marks. But you've also got double quotes in there, so I'm not quite sure what's recommended for that. As such, I'd guess it's not something that should block promotion. But personally, I'd just avoid the whole issue by taking out the apostrophe and and writing "See the Graphicmail documentation" instead.

graphicmail.class.php
Potential XSS vulnerability. In unsubscribeUser() I can't tell where $email is being populated. It seems like it might be external or user input, but it's not sanitized before being sent to watchdog().

watchdog('emf_graphicmail', 'Could not remove dataset data for subscriber ' . $email . ' from dataset ' . $dataset_id . '. The user may not have had a dataset entry');

Should probably be:

watchdog('emf_graphicmail', 'Could not remove dataset data for subscriber @email from dataset @dataset_id. The user may not have had a dataset entry', array('@email' => $email, '@dataset_id' => $dataset_id);

emf_grapichmail.api.inc

drupal_set_message($e->getMessage(), 'error');
watchdog('emf_graphicmail', $e->getMessage(), array(), WATCHDOG_ERROR);

Unsanitized before output. Are you certain that $e->getMessage() for your exception on call_user_func_array will always return data safe to output to the screen? Or might it output the contents of or some part of the variables passed to the function, at least one of which seems like it might be data returned from an API call. If you're not certain, you should sanitize the data before outputting it.

klausi’s picture

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

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

If you reopen this please keep in mind that we are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (found some problems with the project) or "reviewed & tested by the community" (found no major flaws).

klausi’s picture

Issue summary: View changes

Changed module install path recommendation