Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 May 2013 at 14:24 UTC
Updated:
2 Oct 2013 at 22:11 UTC
Uses the Google Places API to display local places. Type of place, current location and radius from current location are all configurable.
http://drupal.org/sandbox/traceyspencer/2002766
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/traceyspencer/2002766.git local_places
P.S. It's my first attempt at a module, so please be nice ;-).
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxtraceyspencer2002766git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
sreynen commentedAdding Drupal version to issue title, to make reviewing easier, hopefully faster.
Comment #3
traceyspencer commentedThanks sreynen, I did try editing the title, but couldn't find a way to do it.
In response to PA robot. I did use automated checkers. I used the coder module, which told me to put extra spaces in, now the tool that you have run is telling me to remove them all.
Comment #4
Caseledde commentedHi,
I found some Issues:
1) Check ventral
link: http://ventral.org/pareview/httpgitdrupalorgsandboxtraceyspencer2002766git
For more details check the coding standard documentation.
2) $_local_places_mapurl
Use drupal_static() for that.
3) Do not use double quotes
Use single quotes instead. To see the difference see php manual.
4) Unnecessary $form declaration
5) Move local_places_form() to .admin.inc
Add a new file local_places.admin.inc and add the form there.
Edit local_places_menu(): Add file attribute. See hook_menu()
6) Use '-' instead of '_' for menu paths
'admin/config/content/local-places' instead of 'admin/config/content/local_places' in local_places_menu().
7) _local_places_page()
Try to use:
8) local_places_contents()
9) Avoid inline CSS
Use classes and separate local-places.css file for this.
10) Use theme functions to provide html
To avoid html in callback functions you should use theme functions.
You can implement them by using hook_theme().
In this way other developers are able to override a theme function to build their own markup.
A theme function is called via theme().
11) Use '===' instead of '=='
It is faster.
12) Use PHP_EOL instead of '\n'
In this way you are independent from platforms. (Windows uses '\n\t')
13) Use '&&' or '||' to chain 'if' statements
14) Implementing hook_uninstall()
You have to create a new file, called local_places.install.
In this file you have to implement hook_uninstall().
During hook_uninstall delete all variables which are stored by local_places like 'local_places_title'.
That's all for now.
Happy coding
Comment #5
traceyspencer commentedThanks Caseledde. I'll start on those changes this afternoon.
Comment #5.0
traceyspencer commentedupdate
Comment #6
traceyspencer commentedDone all that, I think. Ready for another review. Thanks.
Comment #7
dclavain commentedHi traceyspencer:
I have installed me your module and it works correctly.
You have a small problem of vulnerability with the title and description, if you write:
"><script>alert('Title');</script>and<script>alert('Description');</script>check it.In the README.txt file URLs are not correct. I think that it is local-place instead of local_place.
Comment #8
dclavain commentedSorry, reference you forgot me https://drupal.org/node/28984
Comment #9
traceyspencer commentedThanks dclavain
Yes, I changed the path, but forget to update the README. I've changed it now. I've also made the following changes to local_places.module:
local_places_menu()
Replaced:
'title' => variable_get('local_places_title', 'Local Places'),With:
'title' => check_plain(variable_get('local_places_title', 'Local Places')),_local_places_details
Replaced:
drupal_set_title($_GET['name'] . ' | ' . variable_get('local_places_title', 'Local Places'));With:
drupal_set_title(check_plain($_GET['name'] . ' | ' . variable_get('local_places_title', 'Local Places')));local_places_contents()
Replaced:
$vars['description'] = variable_get('local_places_desc', '');With:
$vars['description'] = t(variable_get('local_places_desc', ''));Comment #10
51Degrees.mobi commentedHi there,
After installing, adding my api key and going to /local-places/ I was shown these warnings:
After manually reviewing, I couldn't see any major issues, but I think you could make the code more readable by using double-quote string instread of concatenating single-quote strings.
$map_url = $currenturl . 'details?name=' . $name . '&reference=' . $ref . '&type=' . $type . '&lat=' . $lat . '&lon=' . $lon;
becomes
$map_url = $currenturl . "details?name=$name&reference=$ref&type=$type&lat=$lat&lon=$lon";
Also, you still have some minor issues outstanding with the code sniffer - http://ventral.org/pareview/httpgitdrupalorgsandboxtraceyspencer2002766git.
Finally, it's clear you have put a lot of work into this so it would be a shame if people found it too limiting by having the functionality limited to a single page. Have you considered implementing this as a block?
Comment #11
traceyspencer commentedHi 51Degrees.mobi
Thanks for your feedback. I was using double quotes, but another reviewer told me not to. I'll have a look at the code and see if I can find out what is causing the warnings.
I hope to extend it to allow for more than one page, but I want to get it approved first, so I know I am going along the right lines, as it is my first attempt at a module.
Thanks
Tracey
Comment #12
traceyspencer commentedThe undefined index errors were caused by no results being returned. Added check for results before continuing. Now there are no warnings, just the text that says 'Sorry, no results found.'
All errors in code sniffer now fixed as well http://ventral.org/pareview/httpgitdrupalorgsandboxtraceyspencer2002766git-7x-1x-dev
Thanks
Tracey
Comment #13
Caseledde commentedHi folks,
I was the one, who told to use single quotes. This may be okay for long url queries. But there where nearly all srtrings implemented with double quotes and this was unnessesary.
So, if you follow #11 it will be okay for me.
Comment #14
sreynen commentedHere's what our community coding standards say about quotes: https://drupal.org/coding-standards#quotes Summary: not much. While many of us (myself included) have strong personal preferences between single or double quotes in code, those preferences are not community standards and don't warrant mentioning in a review like this. The double quotes were fine before. The single quotes are fine now. Let's stop worrying about quotes.
Comment #15
bengro commentedAfter installing the module I got the impression that the installation failed, because it said "Sorry, no results found." (which could be misleading as it resembles a 404 page)
For a better user-experience I would change the following:
Future improvement:
Why not use an interactive Google Map? It would be nice if the user could explore the area, while the local places on the right are updated instantly.
All in all, a working module with great potential for the future! :)
Comment #16
dsquaredb commentedModule works as intended. The only problem I encountered was also having the radius set too low so I got the No Results page. It might be good to include something in the Readme or on the No Results page that suggests you increase the radius if you get no results, or else default to the highest level and note that you can reduce the radius if too many results are returned.
A great start on a very useful module. Suggestions for future improvements/added features:
Comment #17
traceyspencer commentedThanks for those suggestions. I will definitely look at some of those future improvements, once the project is approved. In the meantime, I have changed the default radius to the maximum 50000m, and added notes to the Readme about showing the No results found message.
Comment #18
traceyspencer commentedOnce approved, the first improvement that I am going to work on is having more than one plasce type, on different pages. So, for example, you could have one page showing nearby hotels and anothe rpage showing nearby restaurants. Next I will work on more than one location and having the locations based on a geofield in a content type.
Thanks
Tracey
Comment #19
0mni commentedIn local_places.admin.inc you have:
There is no need to have this, its an added function that serves no purpose, just remove the line.
In local_places.module change the function _local_places_page() to this:
No point having two return lines.
Change the function _local_places_details() to this:
No point having two return lines again.
And change local_places_contents() function to this:
Change local_places_content_details() to this:
I would recommend looking at drupal_http_build_query() for this:
Thats what I can find for now on code improvements. Otherwise it appears to function as intended.
Comment #20
0mni commentedThere also appears to be a few errors:
http://pareview.sh/pareview/httpgitdrupalorgsandboxtraceyspencer2002766git
Change your hook_help to:
Comment #21
traceyspencer commentedI've made the changes Omni suggested, thanks.
Comment #22
0mni commentedSorry my bad, needs to be this :)
In local_places.module change the function _local_places_page() to this:
Change the function _local_places_details() to this:
Comment #23
traceyspencer commentedOkay, changed :)
Comment #24
kscheirervariable_get('local_places_location', '51.5073,0.1276');Somewhere near London?Setting to "needs work" for the permission issue above, otherwise this looks ready to go.
I posted on https://drupal.org/node/1211304 to point them to your module, you may find more inspiration there.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #25
traceyspencer commentedHi kscheirer
Thanks for reviewing and posting the link in the forum.
I have changed the permission and renamed the branch.
The default location is Charing Cross, London. It says that in the README file. I haven't added it to the settings form, because it doesn't list any of the other default values.
What did you mean about local_places_contents()?
Thanks
Tracey
Comment #25.0
traceyspencer commentedUpdated repository details to point to branch.
Comment #26
kscheirerHmm, good question! :)
I think I was gonna say you could use drupal_http_build_query() instead of building the string yourself, but in your implementation it may not make things much easier. So you could go either way really.
Thanks for making the rest of those changes.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #27
traceyspencer commentedThanks.
Comment #28
traceyspencer commentedHi
Now this is marked as reviewed and tested by the community, how do I upgrade the project to a full project?
Thanks
Tracey
Comment #29
kscheirerNo further action is required, but the best thing you can do is get a Review Bonus by reviewing other applications. That will get you to the top of the list of projects to get reviewed (and hopefully approved). Only manual reviews count, just using http://pareview.sh is not enough.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #30
traceyspencer commentedThis module has been reviewed and approved. It's the next step I'm not sure about.
Comment #31
kscheirerIt actually hasn't been approved yet, that's the next step. The Review Bonus can speed that up, but it's not required.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #32
kscheirerWell, it's been a month without any further issues, so...
Thanks for your contribution, traceyspencer!
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.
Comment #33.0
(not verified) commentedChanged Git branch.