Description

Provides integration with the Deezer.com - best place to listen music and share it with friends.

Currently implemented:

  • Login into Drupal-site with a Deezer account.
  • Bind Deezer account to a Drupal-site user.

Future plans:

  1. Favorite artists list
  2. Player with user selected palylists
  3. "Now playing" block

Project's page: https://drupal.org/sandbox/vgrotov/1993038

git clone --branch 7.x-1.x vgrotov@git.drupal.org:sandbox/vgrotov/1993038.git deezer
cd deezer

Thank you.

Manual reviews of other projects

  1. https://drupal.org/node/2025505#comment-7573509
  2. https://drupal.org/node/2027007#comment-7573553
  3. https://drupal.org/node/2023661#comment-7573849

Comments

artaphis’s picture

Status: Needs review » Needs work

1. Please use unix-style line endings (all files);
2. deezer.theme.inc - line 48 - add comma at the end of array;
3. deezer.js - line 31 - add semicolon;
4. deezer.pages.inc - line 225 - i recommend to make redirection customizable or overridable (drupal_goto('') is hardcoded);

Add empty line to the end:
README.txt, deezer.info

chrisscudder’s picture

deezer.install

add hook_install
variable_set - deezer_app_id, deezer_secret_key etc

deezer.module

make DEEZER_ACCESS_TOKEN_URL, DEEZER_API_URL and DEEZER_USERPIC_SIDE variables.

ronfeathers’s picture

Be sure to test through pareview: http://ventral.org/pareview/httpgitdrupalorgsandboxvgrotov1993038git You can get a lot of hints there.
Also, run JS through a tool like JSHint (http://www.jshint.com/) which will help identify some potential issues and save you time here.
~R~

Vasiliy Grotov’s picture

Status: Needs review » Needs work

Hey folks, thanks for the reports!

artaphis

Styling errors fixed.
deezer.pages.inc - line 225 - Yeah, agree. I'm keeping this in mind already. Will make the redirection customisable, when figure out the best way for user to set this settings. For now I would leave it hardcoded to frontpage.

chrisscudder

deezer_app_id, deezer_secret_key - these variables are only set after a user has provided his app info, so there is no need to set them just after the module been enabled.
DEEZER_ACCESS_TOKEN_URL, DEEZER_API_URL and DEEZER_USERPIC_SIDE - as for me, this is more convenient way to store this data in constants, not in Drupal variables. So I would prefer to leave it as it is.

ronfeathers

Thank you for the jshint.com service hint, I never heard of it. I've fixed the errors it showed me.

Vasiliy Grotov’s picture

Status: Needs work » Needs review
Vasiliy Grotov’s picture

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

* Attached to the Bonus Program.

Vasiliy Grotov’s picture

Issue summary: View changes

Added "Reviews of other projects" section.

klausi’s picture

Issue tags: -PAreview: review bonus

Removing review bonus tag, you have not done any manual review, you just posted the output of an automated review tool. Make sure to read through the source code of the other projects, as requested on the review bonus page.

klausi’s picture

Issue summary: View changes

removed automated reviews.

Vasiliy Grotov’s picture

Issue summary: View changes

Added 1 review.

Vasiliy Grotov’s picture

Issue summary: View changes

Add another review.

Vasiliy Grotov’s picture

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

My bad. [=

I've delve more deeply into another 3 projects. So now it should be all right.

klausi’s picture

Status: Needs review » Needs work
Issue tags: +PAreview: security

Review of the 7.x-1.x branch:

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    
    FILE: /home/klausi/pareview_temp/deezer.module
    --------------------------------------------------------------------------------
    FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
     352 | WARNING | Code after RETURN statement cannot be executed
    --------------------------------------------------------------------------------
    

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. deezer.module: why do you have to include deezer.tools.inc globally on every single page request? You should only include files when you actually need them, i.e. in function bodies. And if you provide an important API function it should live directly in the module file.
  2. deezer_init(): writing to the global session on every single page request is bad, because this will break page caching. As soon as a client has a session it will not receive cached pages and will be passed through to Drupal. So your module could have a severe performance impact on larger sites that rely on page caching.
  3. deezer_menu_alter(): why do you need hook_menu_alter() if you are altering your own paths? Please add a comment.
  4. deezer_user_profile_form(): '#markup' => '<br /><b>' . $deezer_user['name'] . '</b>',: this is vulnerable to XSS exploit, since $deezer_user['name'] stems from an untrusted third party source. You need sanitize all untrusted user provided input before printing. Make sure to read https://drupal.org/node/28984 again. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.
  5. Your are not using user_external_login_register() anywhere in your code, which is the proper way to handle external authentication systems.
  6. Why do you add deezer.js on every single page request? Shouldn't that only be added when your block is displayed?

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

Vasiliy Grotov’s picture

Hey klausi!
Thanks for the review.

  1. Ventral's warning is due to the switch statement, so it's not an actual issue.
  2. deezer.tools.inc - it been used just to separate stuff and to make the code be more reader-friendly; I've merged it with core deezer.com file.
  3. deezer_init() - I've refactored logic, so now there is no session writing.
  4. deezer_menu_alter() - Core User module has hardcoded some menu parameters for user categories, so the only detour is to use hook_menu_alter().
  5. deezer_user_profile_form() - have sanitize $deezer_user['name'] with filter_xss().
  6. user_external_login_register() - this approach not supports custom profile fields, so I think I should stick to the current user registration process.
  7. deezer.js - yes, you're totally right; popup JS call moved to deezer_block_view().

So all issues are fixed.

klausi’s picture

Assigned: Unassigned » elc
Status: Needs review » Reviewed & tested by the community

Sorry for the delay. Make sure to review more project applications and get a new review bonus and this will get finished faster.

manual review:

  1. "isset($_SESSION['deezer_goto']) && !empty($_SESSION['deezer_goto'])": the isset() check is not needed here, since empty() will not throw notices if the array key does not exist.
  2. deezer_record_save(): user_external_login_register() should do that for you, no? So you would not have to copy that?
  3. _deezer_request(): do not use file_get_contents() for remote files, that fail on many security protected Drupal sites. Use drupal_http_request() instead.
  4. deezer_login_callback(): why do you set $_SESSION['deezer_goto']? Just call drupal_goto() directly here?

That are not application blockers, otherwise looks RTBC to me.

Assigning to ELC as he might have time to take a final look at this.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

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

Thanks for your contribution, Vasiliy Grotov!

I updated your account so you can 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 stay 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.

Vasiliy Grotov’s picture

Thank you, klausi!

Sorry for the delay.

"isset($_SESSION['deezer_goto']) && !empty($_SESSION['deezer_goto'])": the isset() check is not needed here, since empty() will not throw notices if the array key does not exist.

Totally agree. Cleaned this out.

deezer_record_save(): user_external_login_register() should do that for you, no? So you would not have to copy that?

user_external_login_register() doesn't cares about custom profile fields. So I don't wanna use it. Maybe will made some refactor around using user_set_authmaps() directly and login users from created authmap record in near future. But for now it acts like core User functionality.

_deezer_request(): do not use file_get_contents() for remote files, that fail on many security protected Drupal sites. Use drupal_http_request() instead.

file_get_contents() also been used in deezer_session_get_token() (handles OAuth2 access token farming), so I replaced it in the both cases. Thank you.

deezer_login_callback(): why do you set $_SESSION['deezer_goto']? Just call drupal_goto() directly here?
This piece of code could also be called in popup window, so it not a good way to redirect user right ahead in this function, because redirection will triggers in a popup, not the main window.

Klausi, thanks again for promoting the module, and helping out with cleaning the code!

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

Anonymous’s picture

Issue summary: View changes

Added third review.