Creates an Issuu PHP Stream Wrapper for Resource and implements the various formatter and file listing hooks in the Media module.
Based on media_vimeo and media_youtube modules.
Uses Issuu search API
Which does not need an API-key from Issuu, which is required in development of 7.X version of Issuu module, which aims to allow uploading to issuu. This is read-only integration with thumbnail for the Media Internet Services module.
Sandbox page
Git repository

Reviews of other projects

http://drupal.org/node/1592084#comment-6215954
http://drupal.org/node/1551090#comment-5933682
http://drupal.org/node/1549480#comment-5933742 (and follow up on comment #13)

Comments

patrickd’s picture

welcome,

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

Automated tools don't throw any errors, well done!

Please make sure your always using /**/ comments in global spec (outside of functions).

Please don't call drupal_get_path() so often, rather save it in a variable temporary.
Also you can replace this
include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'media_issuu') . '/includes/media_issuu.variables.inc';with
include_once dirname(__FILE__) . '/includes/media_issuu.variables.inc';

Remove your .gitignore from git (git rm .gitignore) and add it to itself.

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

mallezie’s picture

Status: Needs review » Needs work

Thanks for the review, i'll fix the proposed solution ASAP.
Setting to needs-work, since fixes from me are needed.

mallezie’s picture

Status: Needs work » Needs review

I fixed the errors you've noticed.
I only didn't replace the drupal_get_path() remark. I adjusted it to the form you suggested for the include statements. Otherwise there are only two get_path calls left.

Setting back to needs review. Now of to revieuw some others.

acobot’s picture

Status: Needs review » Needs work

1. Some errors from parview:

FILE: ...dules/pareview_temp/test_candidate/includes/MediaIssuuStreamWrapper.inc
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
13 | ERROR | Line indented incorrectly; expected 2 spaces, found 3
--------------------------------------------------------------------------------

2. You should put the element of array in new line if the line is longer than 80 chars:

'description' => t('Issuu Styles will display embedded Issuu documents and thumbnails to your choosing, such as by resizing, setting colors. You can !manage.', array('!manage' => l(t('manage your Issuu styles here'), 'admin/config/media/media-issuu-styles'))),

3. Please follow the coding standards: http://drupal.org/node/318

mallezie’s picture

Status: Needs work » Needs review

Fixed coding indention.
and note #2

Could you be more precise for note #3 since review tools give no other coding standard error.

Resetting to "needs review". Please don't set to needs work for only coding standard mistakes.

liam morland’s picture

Status: Needs review » Needs work

The Drupal Code Sniffer finds a bunch of issues. I suggest getting a clean report from that before requesting another review.

media_issuu_install() does nothing and be be left out.

In media_issuu_uninstall(), what is the purpose of the call to drupal_load()? It's already loaded if you are uninstalling it.

In media_issuu.module some comment lines begin and end with /* and */. Use a regular comment block for these.

Licensing: No problems noted.

Have you looked at the Issuu integration module? There may be some overlap. Your module could potentially depend on that one to reduce duplication.

mallezie’s picture

Thanks Lian for the review.

I fixed the coding style issues, seems they change sometimes, really thought it was a clean report.
Removed media_issuu_install()
Removed load from uninstall. Didn't have a purpose indeed.
Updated comment blocks.

I started at Issuu integration. See some comments in:
#1321774: [meta] Media integration
#1323164: Read-only integration with media

It seems development for the 7 version of issuu-integration stopped. I was only looking for read-only media-integration. So i decided to do in a sandbox. They also use the module to communicatie with the 'authentication needed' upload API of issuu, while i'm only using the public API, which doesn't need authorization keys. Adding issuu as a dependency whould create that overhead, which isn't needed.

This module only wants to be read only media-integration. Sort of like media_slideshare, media_youtube, media_vimeo, ...

Thanks for the review! Truly hope you could do another one.

mallezie’s picture

Status: Needs work » Needs review

And setting to needs review again

liam morland’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. I haven't tested that it works, just that the code appears sound. I am presuming that you're making sure that the module works as it should.

Minor security issue in MediaIssuuStreamWrapper.inc:

  public function getOriginalThumbnailPath() {
    $issuu_properties = self::getIssuuProperties($this->parameters);
    return 'http://image.issuu.com/' . $issuu_properties['documentId'] . '/jpg/page_1_thumb_medium.jpg';
  }

getIssuuProperties() does not check that the value it returns is a string safe for including in a URL. It will be unless issuu.com is returning stuff that it shouldn't, but the getIssuuProperties() should check the value anyway, just to be sure. A simple regex check should be fine for this. Similar to the principle of not trusting user input, we shouldn't trust the values returned by outside services.

It's not a Drupal coding standard, but I prefer to use === instead of ==. If casting is needed, I would rather do the casting myself so that I know exactly what comparison is being made.

mallezie’s picture

I updated code to use '==='.
I'm searching for a safe regex to use for the filename part. Using encode or drupal_encode_path replaces too much parts, such as - wich changes the returned value.
Thanks for the review!!

liam morland’s picture

You can probably determine a regex for what a issuu documentId is supposed to contain.

mallezie’s picture

And done.

public static function getIssuuProperties($parameters) {
    $request = 'http://search.issuu.com/api/2_0/document?q=username:' . drupal_encode_path($parameters['document'] . ' +docname:' . $parameters['docs']);
    $response = drupal_http_request($request);
    $decodedresponse = drupal_json_decode($response->data);
    // Check documentID for extra security.
    if (preg_match('#^[0-9]{12}\-[0-9a-f]{32}$#', $decodedresponse['response']['docs'][0]['documentId'], $matches)) {
      return $decodedresponse['response']['docs'][0];
    }
  }

Checks for documentID of 12 numbers a '-' and 32 hex digit.
Thanks again for te review and help!

mallezie’s picture

Issue summary: View changes

Added direct repository link

mallezie’s picture

Issue tags: +PAreview: review bonus

Adding review bonus.
Ddi three reviews over last months. Hope it wasn't necessary to do them in a shorter timeframe.

klausi’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Module duplication is a huge problem on drupal.org, and I really think this effort should go into the existing issuu module. Please get in contact with the maintainer to discuss, to get access to the repository and to develop from there. If you cannot reach the maintainer please follow the abandoned modules process: http://drupal.org/node/251466

If that does not work out for whatever reason and you absolutely must develop your own fork of issuu please come back here and set this application back to "needs review".

mallezie’s picture

I'm further trying to contact the maintaner.

mallezie’s picture

Status: Postponed (maintainer needs more info) » Fixed

I'm closing this issue. Thanks for al the reviews. In the meantime i contacted the maintaner of drupal.org/project/issuu and i'm comaintaning that module for the media-integration.

patrickd’s picture

Status: Fixed » Closed (won't fix)

awesome! thank you!

patrickd’s picture

Issue summary: View changes

Added reviews