ZiNgA BuRgA
Fag
Posts: 3,357
Joined: Jan 2008
|
NewPoints 1.4 Review
This is a plugin " review" requested by Pirata Nervo.
This is quite a large plugin, so I will not go over everything. In general, the code looks quite good - there doesn't appear to be any outright issues. But as these reviews focus on negative aspects, I'll put up my concerns here.
Concerns
- On newpoints.php, the menu should, ideally, highlight the user's current location so that the user is aware of where they are. Alternatively, a breadcrumb showing the user's location (which isn't present either).
- A number of templates on newpoints.php are uncached.
- As NewPoints appears to support multiple languages, language phrases shouldn't be hardcoded, as in this example in newpoints.php:
- I'm a bit concerned with how user input is handled, mainly with the plugin reporting back to the user if invalid input is supplied. It appears to actually validate and sanitise the input well, however it's not always reported back to the user.
When the user tries to donate points to another user (newpoints.php, under the do_donate action), we have the following piece of code:
The use of the abs() function is a little questionable. Basically, if a user enters a negative amount to donate, the plugin will make it positive, and allow the input through (as long as you have enough points and it's not "-0"). I would ideally let the check which follows handle this invalid input, so that the user is notified that they entered an invalid input.
Then we have the code:
This handles what happens when the user enters a UID or username to donate to. Unfortunately, no validation of either is performed, so if you happen to mistype a username or UID, you'll lose points, but no-one will gain them. Ideally the system should check whether the user in question exists before attempting to donate to them, and telling the user if the user doesn't exist. Also, if you fail to enter either, you'll get a generic error message rather than one explaining your problem.
- A small bug in the code:
The redirect() function calls exit, so the plugin hook will never actually be executed.
- A small "bug": in a number of places, $db->query() is used instead of the more correct $db->write_query(). (yeah, not really an issue for a large majority of cases, and difficult to debug and identify without actually looking through code)
- The main plugin file, inc/plugins/newpoints.php is rather large (nearly 2000 lines) and is loaded on every page. Probably not a big issue, but perhaps it could be modularised a bit more, so less code is loaded on every page load.
- Some of the functions shouldn't be declaring arguments as optional for example:
Not supplying a GID will cause the function to return null - thus making the parameters optional seems a little odd.
- Instances of $_SERVER['PHP_SELF'] should be replaced with $current_page for consistency reasons.
Note that, as mentioned above, I have only gone through some code, primarily newpoints.php and some of inc/plugins/newpoints.php
Commendations
An interesting feature is that there are a lot of plugin hooks spread throughout newpoints.php, which can make developing plugins for NewPoints relatively easy, which is a nice feature.
My Blog
(This post was last modified: 06-29-2010 01:37 PM by ZiNgA BuRgA.)
|
|