Thor Gallery is a robust gallery wrapper for a Facebook album.

Thor Gallery will make it possible to add any public album on Facebook to your Drupal site. It displays the images in the Facebook album by fetching the images from Facebook API and displaying them into AD Gallery front-end.

Project page: http://drupal.org/sandbox/ain/1875240
Git clone: git clone --branch 6.x-1.x http://git.drupal.org/sandbox/ain/1875240.git thorgallery
Drupal version: 6. Support for Drupal 7 will follow once Drupal 6 version has matured.
Library dependencies: Facebook PHP SDK, AD Gallery. See Configuration for instructions.

Reviewed projects:

  1. http://drupal.org/node/1887278#comment-6948092
  2. http://drupal.org/node/1830954#comment-6953074
  3. http://drupal.org/node/1825062#comment-6953198
  4. http://drupal.org/node/1813730#comment-6958680
  5. http://drupal.org/node/1833682#comment-6958894
  6. http://drupal.org/node/1887210#comment-6960034
  7. http://drupal.org/node/1865018#comment-6975468
  8. http://drupal.org/node/1528036#comment-6960560
  9. http://drupal.org/node/1813730#comment-6975558
  10. http://drupal.org/node/1191490#comment-6988238
  11. http://drupal.org/node/1894210#comment-6988448
  12. http://drupal.org/node/1870404#comment-6988596
  13. http://drupal.org/node/1899914#comment-6989500
  14. http://drupal.org/node/1899230#comment-6989540
  15. http://drupal.org/node/1859944#comment-6989564

NB! Automated review of node-thorgallery.tpl.php ln 10, 17 reports control statement errors regardless of the fact that both lines actually use the alternative syntax.

CommentFileSizeAuthor
Screenshot from a production site629.16 KBain

Comments

monymirza’s picture

Status: Needs review » Needs work

Some drupal standards missing. can be seen here:
http://ventral.org/pareview/httpgitdrupalorgsandboxain1875240git

ain’s picture

Status: Needs work » Needs review
Issue tags: -PAreview: review bonus

Thanks for the review!

The Drupal 6 branch of Coder did not show any of the problems, I guess it's not yet up to date with the Drupal 7 branch.

Nevertheless, all the aforementioned issues have been resolved now.

klausi’s picture

Status: Needs review » Needs work

manual review:

  1. thorgallery_install(): why do you need to change the module weight? Please add a comment.
  2. thorgallery_install(): you are using get_t() incorrectly, it returns the actual translation function and not the text.
  3. thorgallery_create_automated_alias(): why is that function needed, it just sets a variable? Also, no need to set variables upon installation as you can make use of default values with variable_get() anyway.
  4. thorgallery_node_info(): shouldn't the description also run through t()?
  5. thorgallery_insert(): use drupal_write_record() instead of db_query() and you get schema validation for free.
  6. "theme('default', $images, $params, $node->body),": 'default' is too generic, please use you module prefix to avoid name collisions with other modules and their theme functions.
  7. thorgallery_set_message(): not good for the watchdog() calls, since you insert already translated strings to the log. You should always insert them untranslated, because they are sent through t() when the log entry is displayed.
  8. thorgallery.js: indentation errors, always use 2 spaces per indentation level.
  9. notice: Undefined index: type in /home/klausi/workspace/drupal-6/sites/all/modules/thor_gallery/thorgallery.module on line 240. Please enable PHP notices in your development environment.
  10. README.txt: what does the album URL look like? Where can I find it? What is the format? Simply copying the album URL from the facebook account does not work?

Don't forget to add the "PAReview: review bonus" tag as indicated in #1410826: [META] Review bonus for your next review bonus, otherwise you won't show up on my high priority list.

ain’s picture

Issue tags: -PAreview: review bonus

Danke für die Code-Review Klausi.

thorgallery_install(): why do you need to change the module weight? Please add a comment.

It was indeed useless. Removed.

thorgallery_install(): you are using get_t() incorrectly, it returns the actual translation function and not the text.

Fixed.

thorgallery_create_automated_alias(): why is that function needed, it just sets a variable? Also, no need to set variables upon installation as you can make use of default values with variable_get() anyway.

I introduced the separate function to highlight the action of creating the variable that is basically the Pathauto URL alias pattern for a Thor Gallery node. I tend to break things up to increase readability by self-explanatory code. The other option would of course be to document it within the hook_install() doc, but that wouldn't be as obvious.

thorgallery_node_info(): shouldn't the description also run through t()?

Fixed.

thorgallery_insert(): use drupal_write_record() instead of db_query() and you get schema validation for free.

Thanks for the valuable tip! Fixed for both, insert and update.

"theme('default', $images, $params, $node->body),": 'default' is too generic, please use you module prefix to avoid name collisions with other modules and their theme functions.

Thanks for the valuable tip, again! Fixed.

thorgallery_set_message(): not good for the watchdog() calls, since you insert already translated strings to the log. You should always insert them untranslated, because they are sent through t() when the log entry is displayed.

Good point. Refactored.

thorgallery.js: indentation errors, always use 2 spaces per indentation level.

Fixed.

notice: Undefined index: type in /home/klausi/workspace/drupal-6/sites/all/modules/thor_gallery/thorgallery.module on line 240. Please enable PHP notices in your development environment.

Strange. The notices are surely on, I didn't really come across it. Nevertheless, I've made it fail-safe.

README.txt: what does the album URL look like? Where can I find it? What is the format? Simply copying the album URL from the facebook account does not work?

I've added respective documentation in README and on project page. Thanks for pointing it out!

ain’s picture

sprocketman’s picture

Issue tags: +PAreview: review bonus

Further output from the Coder module:
1. form_set_error()/drupal_set_message() lines 385, 388, 527 in thorgallery.module and line 59 thorgallery.install: When using drupal_set_message, use t() to filter the text. In all cases, when using t(), use placeholders for your variables. The Drupal documentation for t() explains how this is done.

Also, although it is obvious once you think about it, you might want to add something in the README.txt troubleshooting area about making sure that the Facebook album you are using is set to be Public.

dydave’s picture

Status: Needs review » Needs work

Thanks atozstudio for your feedback and review.

I just allowed myself to quickly change the status to needs work since I assume a few changes could still be carried to follow up with #6.

Thanks to all for your testing, comments, reviews and feedbacks.

ain’s picture

Status: Needs work » Needs review

Big ups to atozstudio for the review!

form_set_error() translation placeholder issues on lines 385, 388 are fixed. The problem on ln 527 I do not consider an error, the translated string is already passed in to the proxy function and there are no placeholder errors involved.

README.txt covers the necessity of a Public Facebook album in Requirements, but I've also added it to Troubleshooting, incl. on the project page.

ain’s picture

Issue tags: -PAreview: review bonus

Removing review bonus in respect to the last review.

klausi’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus

Please add all your reviews to the issue summary so that we can track them better.

manual review:

  1. node-thorgallery.tpl.php: you are printing $image->getCaption() and others without sanitization. Unfortunateley I was not able to exploit this since I could not get my public photo album to work. Can you point me to the code in the Facebook SDK or to a Facebook documentation page where they say that the contents has already been sanitized against XSS attacks? Otherwise you must use check_url() and check_plain() to protect against that. See also http://drupal.org/node/28984 . And please add that as comment in the template file, I guess a lot of other people might wonder if it is safe to just print those variables.
  2. thorgallery_init(): only add you javascript to pages where it is actually needed, now you are adding it to every single page request. Actually you should add your JS in thorgallery_view() and remove the init hook, no?
  3. "'access arguments' => array('access thorgallery content'),": that permission is not defined?

The first point could be a security issue, so I have to set this back to "needs work". Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

ain’s picture

Status: Needs work » Needs review

Thanks for another review.

  1. Despite of how Facebook API does or does not handle the sanitization, I've implemented it for all fields exposed. It's also commented in the template now.
  2. thorgallery_init() dumped in favour of thorgallery_view(). Thanks for pointing this out!
  3. access thorgallery content permission was redundant as well, removed.
klausi’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

Great, looks RTBC now! Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

ain’s picture

Issue summary: View changes

Adding all reviews to summary, +3 more reviews for the tag

klausi’s picture

Status: Reviewed & tested by the community » Fixed

no objections for more than a week, so ...

Thanks for your contribution, ain!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

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.

Thanks to the dedicated reviewer(s) as well.

ain’s picture

Thanks a lot for the experience and resources provided klausi and many thanks to all who reviewed and dived deep into my code!

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

Anonymous’s picture

Issue summary: View changes

Adding another 3 reviews.