CVS edit link for vonfaff

I have just finished coding a module for Drupal called 'eveauth'. This module is in its current stage in working order and can be used as soon as it goes public. I will tag it as alpha quality when it goes live since it is the first release and it might have some rough edges that need to be addressed and improved.

Purpose of the module: The module is designed for the MMORPG game community that plays 'Eve online'. It is essential an authentication middle layer that prompts new users that registers to the Drupal website of a userid and api key. These values will be used to determine if the registrant is in the same corporation or alliance as the administrator (which in turn must provide his api key in the administration screen). These key values will be communicated to the CCP game servers. As it stands the module counts 617 lines of code.

Before its release I will include two features to the module, first a function that pulls the users avatar from CCP's game servers and attach them to the appropriate user, second a feature that lets users of the drupal sites (with appropriate roles) to view all the character sheets of the members, which makes it easier to spot spies plan skill progression for newer players and keep a better tab of the members within the organization.

The only similar piece of software to this I know of is a module for the forum software 'phpBB'. With Drupal's extensive ability to be customized I expect a very big influx of drupal users from the 300.000 playerbase. I also plan a host of other Drupal projects that will ease the management, planning and communication within the game.

CommentFileSizeAuthor
#12 eveauth6x0.2.3.zip19.28 KBvonfaff
#2 eveauth.zip16.25 KBvonfaff
#1 eveauth.zip16.25 KBvonfaff

Comments

vonfaff’s picture

StatusFileSize
new16.25 KB

Hope this gets accepted. There are a lot of people eager to test this out :-)

vonfaff’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new16.25 KB

Forgot to change status of task

avpaderno’s picture

Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

avpaderno’s picture

Assigned: Unassigned » avpaderno

I am assigning this report to me, as I will review it tomorrow morning (which means in about 16 hours from now).

avpaderno’s picture

Status: Needs review » Needs work
  1. Database schema descriptions should not be passed to t(); see what done from Drupal core modules.
  2. In the installation file, the message reported to the user through drupal_set_message() is not translated.
  3. The code is using simplexml_load_string() without first check if the function is available; if that extension is available only on PHP 5, then the module should explicit such dependency in the .info file (Drupal 6 requires PHP 4 or higher).
  4. The module is not removing the Drupal variables when it is uninstalled.
  5. Strings used in the user interface should be in sentence case. There are some strings that are in title case.
  6. See http://drupal.org/coding-standards to understand how a module should be written. In particular see how the code should be formatted, and how constants, Drupal variables, and functions should be named.
  7.     require_once(drupal_get_path('module', 'user') . "/user.admin.inc");
    

    There is a Drupal function to use in such cases.

  8. The call to form_set_error() done in eveauth_character_validate() should be replaced with a call to form_error() (the first argument of form_error() is the same first argument of a element validation function. I am not sure the first argument of form_set_error() is correct, when the form element is declared as $form['api']['character'].
  9.                 '#title' => t($alliance["name"].' API validation'),
    

    The first argument of t() must be a literal string; differently, the script that extracts the string to translate to create the translation template will not be able to extract the string, which would not be translatable (if not in the case another module uses the same exact string, but it's rather difficult it happens, when the string is dynamically changed).

  10.     $user_api   = db_result(db_query('SELECT api FROM eveauth WHERE drupalid="'.$user->uid.'"', 2));
        $user_id    = db_result(db_query('SELECT userid FROM eveauth WHERE drupalid="'.$user->uid.'"', 2));
    

    The code should use query placeholders.

  11.         $html[$key] = "<img src=\"http://img.eve.is/serv.asp?s=256&c=".$character."\" style=\"float: left; margin-right: 8px;\">
                    <h2>".t('Character Sheet for '.$doc->result->name)."</h2><br />
                    <strong>".t('Race:')."</strong>
                      ".
                              $doc->result->race."<br />
                    <strong>".t('Bloodline:')."</strong>
                      ".
                              $doc->result->bloodLine."<br />
                    <strong>".t('Gender:')."</strong>
                      ".
                              $doc->result->gender."<br />
                    <strong>".t('Place of employment:')."</strong>
                      ".
                              $doc->result->corporationName."<br /><br /><hr /><br />
                    <strong>".t('Currently training:')."</strong>
                      ".
                              $skill." to <strong>level ".$training->result->trainingToLevel."</strong> (Training will end on ".$training->result->trainingEndTime.")<br />
                    <strong>".t('Skill points:')."</strong>
                      ".
                              $doc->result->cloneSkillPoints."<br />
                    <strong>".t('Clone status:')."</strong>
                      ".
    
                              $doc->result->cloneName."<br />
                    <strong>".t('Monetary assets:')."</strong>
                      ".
                              convertcash($doc->result->balance)."<br /><br />
                    <h3>Character Skill sheet</h3>";
    

    The code is generating a lot of HTML output; it should use theme functions.

avpaderno’s picture

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

There have not been replies in the past week. I am marking this application as won't fix.

Paul Simard’s picture

I've downloaded the "won't fix" version and am working to correct the issues cited above, as well as updating the module to be compatible with v7.x. I can't take the pledge as 7.0's in final release candidate stage, but I will keep you advised of my progress.

Also, I'm going to need links to learn about submitting the work when it's completed. If you might point me in the right direction... :)

Thanks,
Paul

vonfaff’s picture

The module is in active development. I am using google code as repo. Please do not do any improvements to the code in the won't fix version as there has been a lot of changes to it since the initial release. The latest release can be downloaded and reviewed from here: http://code.google.com/p/eveauth/downloads/list

Strange thing is, as I remember it, I originaly choosed to not use the Drupal repo as kiamlaluno didn't give any insight into what needed to be improved in the code for it to pass other than "See http://drupal.org/coding-standards to understand how a module should be written. In particular see how the code should be formatted, and how constants, Drupal variables, and functions should be named". I see he have given an extensive explenation to what needs to be fixed and I will look into it.

jcisio’s picture

Code in Drupal repository should be conformed to Drupal coding standards. If you can't verify it yourself, there is a big chance that your application won't be validated. I haven't seen any application that kiamlaluno does a one phrase review ;-)

avpaderno’s picture

See http://drupal.org/coding-standards to understand how a module should be written. In particular see how the code should be formatted, and how constants, Drupal variables, and functions should be named.

The sentence explain exactly what it is wrong with the code, and the coding standards explain how a module function should be named.
For a module called example.module, can a function be called test_check_title()?

I reported what needed to be changed on June 23, and I didn't get any reply, not even at May 8; in such case, I normally close the application because I get the applicant lost interest.

vonfaff’s picture

No worries. Please do not misinterpret my post as a complaint or me trying to blame anyone. I perfectly understand why you have the guidelines and as this is my first drupal module I am not shocked that there need to be a lot of improvement in the code. I will go through my code again and rectify the errors. Thank you kiamlaluno for your time and insight :-)

vonfaff’s picture

Status: Closed (won't fix) » Needs review
StatusFileSize
new19.28 KB

I have now gone through the code and made modifications in order for it to comply with Drupal coding standards. As stated, I appreciate all the constructive feedback you are providing kiamlaluno. Complete source package are provided as attachement

  1. All database schema descriptions have been altered with normal comments instead of using the t(); function
  2. Corrected all strings that did not return with t(); including the message reported to the user through drupal_set_message() in the installation process
  3. Dependency for PHP 5 have been included in eveauth.info to avoid PHP errors with the simplexml_load_string() function
    ; $Id$
    name = Eve Authentication
    description = Lets your Drupal site authenticate users via the Eve online API key
    core = 6.x
    php = 5.2
    
  4. Altered eveauth_uninstall to remove the Drupal variables upon uninstall
    <?php
    
    db_query("DELETE FROM {variable} WHERE name LIKE 'eveauth%'");
    cache_clear_all('variables', 'cache');
    
    ?>
    
  5. Altered strings used in the user interface to match sentence case instead of title case.
  6. Have done extensive modifications so eveauth.module conforms with drupal coding standards:
    • Cleaned up indenting and whitespace.
    • Cleaned up control structures
    • Renamed some functions that needed eveauth_ added in the beginning of the function names to avoid conflict with other modules
    • Modified and made sure persistent variables used the grouping/module name as a prefix, to avoid name collisions between modules.
  7. Modified and replaced the code with the correct drupal function:
    <?php
    
    module_load_include('inc','user','user.admin');
    
    ?>
    
  8. Replaced all instances containing form_set_error(); with form_error();
  9. Altered all strings using the t(); function where variables was passed inside this function to instead be printed out as part of the string, ex:
    <?php
    
    drupal_set_message(t('Security check failed! Your wallet balance does not match the needed value. Make sure your wallet balance ends in').' '.$security_amount.' '.t('(example: 874941360.').$security_amount.'), '.t('then try to re-select your character (or select a different one). For your information, your wallet now ends in').' '.$walletr, 'error', FALSE);
    
    ?>
    
  10. Modified SQL calls to use query placeholders
    <?php
    
    $query_user_api = "SELECT api FROM {eveauth} WHERE drupalid = %d";
    $query_user_id = "SELECT userid FROM {eveauth} WHERE drupalid = %d";
    $res_user_api = db_query($query_user_api,$user->uid);
    $res_user_id = db_query($query_user_id,$user->uid);
    $user_api = db_result($res_user_api);
    $user_id = db_result($res_user_id);
    
    ?>
    
  11. Work in progress

Edit: Current code (r10) can be compared with the old (r8) using google code aswell: http://code.google.com/p/eveauth/source/diff?spec=svn10&r=10&format=side...

Paul Simard’s picture

I suggested installing and enabling the Devel and Coder modules. I found Coder's Code Review invaluable especially in formatting issues. After one marathon editing session using Coder, I managed to fix the won't fix version to 7.x compatibility under the Minor error detection level, with an end result of only 1 critical error.

All in all, a fair amount of work, but well worth the results.

Paul

Paul Simard’s picture

Component: new project application » Miscellaneous
Assigned: Unassigned » avpaderno
Status: Needs work » Needs review

There is an Eve Online module under development at: Eve Online HTTP Tools that you might want to look at. The developer is an active member of the security review team, so the code there appears to be much more in line with best practices as it applies to Drupal development.

Paul

added:
The module at the above link is an API Integration module that may be useful as you expand the scope of the eveauth project as described above. Duplication may not be bad, with a couple of different approaches, the better way generally emerges. This seems especially true when as of now there is *no* module that reliably performs these tasks.

Paul

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: avpaderno » Unassigned
Status: Needs review » Needs work

I am changing the status as per previous comment. It seems the proposed module is duplicating the work done in an existing project.

vonfaff’s picture

Component: Miscellaneous » new project application
Assigned: avpaderno » Unassigned

The proposed module (this one) does not conflict with the module P Simard is talking about (Eve Online HTTP Tools). As I understand it Eve Online HTTP Tools is a tool primarily to keep a tab at characters progression and skill training. Eveauth is an authentication mechanism to make sure the right players register at your site (with a lot of extra tools).

I tried to install Eve Online HTTP Tools on my own test server but it returned with a critical error. (Error message
FieldException: Attempt to create an instance of field user_id without an entity type. in field_create_instance() (line 459 of /home/sites/helges.net/public_html/d7test/modules/field/field.crud.inc)

Can someone please take a look and review my latest submission. I have put a lot of work into this and I am keen to go forward with improving it further. I have also gotten a lot of positive feedback from the playerbase.

Thanks.

PS: I don't know what Simard is talking about. I have done extensive testing with my module and it does work very well.

Paul Simard’s picture

Ok, just to clarify a couple of things.

I suggested the look at EVE Online HTTP Tools to make you aware of what already existed, in the event you didn't know about it.

That the critical error occurred I can't speak to, but I suspect that something had not been created that was needed.

I haven't offered any comments about testing, so I don't know what's being referred to either.

Sorry for any misunderstandings.

Paul

zzolo’s picture

Status: Needs review » Postponed

Hi. Please read all the following and the links provided as this is very important information about your CVS Application:

Drupal.org has moved from CVS to Git! This is a very significant change for the Drupal community and for your application. Please read the following documentation on how this affects and benefits you and the application process:
Migrating from CVS Applications to (Git) Full Project Applications

  • The status of this application will be put to "postponed" and by following the instructions in the above link, you will be able to reopen it.
  • Or if your application has been "needs work" for more than 5 weeks, your application will be marked as "closed (won't fix)". You can still reopen it, by reading the instructions above.
avpaderno’s picture

Issue summary: View changes
Status: Postponed » Closed (won't fix)

As per previous comment, I am setting this issue as Won't fix.
Since new users can now create full projects, applications have a different purpose and they are handled on a different issue queue. See Apply for permission to opt into security advisory coverage for more information.