OpenSearchServer module allows to use OpenSearchServer to enable full text search on Drupal-based websites. This plugin replaces Drupal's built-in search functionality. The goal is to provide an improved and powerful search user experience to Drupal's users. This is the first stable version.
Key Features:
- Filter search results by Facet Field,
- Search through every type of document,
- Easy to set up with just filling a form.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | coding_standards-1189056-16.patch | 13.15 KB | ParisLiakos |
Comments
Comment #1
Emmanuel Keller commentedComment #2
Emmanuel Keller commentedFollowing the appropriate rules, I change the priority to critical (more then 6 weeks). Me and Naveen are available to help any reviewer to test our product.
Comment #3
berkas1 commentedI think there is no README.txt file in your repository
Comment #4
naveenann commentedPlease find the latest commit with README in
http://drupalcode.org/sandbox/ekeller/1128202.git/commit/d2d54d0edbc1bd9...
Comment #5
ParisLiakos commentedPlease remove the LICENSE.txt it is added automatically by the drupal packaging script.
after you remove it set your project back to needs review.
Comment #6
ParisLiakos commentedand please,
read this here http://drupal.org/node/1015226
and name your git branches accordingly.
the way you have it now it is very confusing.also you should point which branch a reviewer should check
Comment #7
naveenann commentedUpdated the branches according to the naming conventions of Drupal and please review the branch 6.x-1.x
Comment #8
Emmanuel Keller commentedThank you for your feedback. We have fixed the points you mentioned.
Now we have a 6.x-1.x branch, and also a 6.x-1.1-rc1 tag.
We are using the module on our own website since several weeks. The Drupal module is an important new feature long-awaited by OpenSearchServer community.
http://www.open-search-server.com/one_feature/drupal_module
Thanks in advance for your review.
Comment #9
ParisLiakos commentedOk thanks for the branch renaming!
I checked the module a bit more, but soon find out a lot issues.
i suggest running your module on Coder on minor level, also reading this
http://drupal.org/coding-standards and since you mostly use OOP be sure to read this too as well http://drupal.org/node/608152
I am sorry that i force you to rewrite a large part of your module, but it is required if you want to get full project status
When your module fully complies with Drupal coding standars set this back to needs reviews!
(it makes reviewing easier when code is consistent)
Thank you !
Comment #10
naveenann commentedThankYou for your suggestions.We have updated the code regarding the drupal coding standards.
Please review the tag 6.x-1.1-rc1.
Comment #11
ParisLiakos commented- Put a space between the (type) and the $variable in a cast: (int) $mynumber.
- All binary operators (operators that come between two values), such as +, -, =, !=, ==, >, etc. should have a space before and after the operator
eg this
should be
- You are strongly encouraged to always use curly braces even in situations where they are technically optional
to
or
to
- Comments should be always wrapped to 80 spaces.
- Do not put licensing information in your module anywhere. Anything that is put in the Drupal repository is automatically licensed at GPLv2.
- Remove
; $Id$.They are not needed now that drupal moved to git from CVS- Indentation: everything is indented to 2 spaces:
should be
- Functions should be separated with a new line, and documented if possible.Also separate dots with spaces:
eg
- Use check_plain() when printing unsafe values to avoid XSS
to
- Use indentation on sql queries too.This is ver ugly eg
check this: http://drupal.org/node/2497
- Creating classes directly is discouraged. Instead, use a factory function that creates the appropriate object and returns it
- Classes and Interfaces should use UpperCamel naming.
- Functions and variables should be named using lowercase, and words should be separated with an underscore. Functions should in addition have the grouping/module name as a prefix, to avoid name collisions between modules.
could be
also on the
- opensearch.module lines 564 and below.You should use a template for that amount of HTML.this way that is hardcoded, a themer can't
chenge it without actually hacking the module
- Is there a reason that
annotate_schema()isn'topensearchserver_schema()?and a lot more..actually there is no point continuing.just realized.Please set this back to needs review, after everything is as close as possible to Drupal Coding Standars and run against the Coder module set to minor. (the links i posted above)
Thanks for your patience
Comment #12
ParisLiakos commentedComment #13
Emmanuel Keller commentedNaveen forgot to say that we used the coding module set to minor. The module returns "Coder found 1 projects, 11 files, 0 warnings were flagged to be ignored - No problems found".
I understand that the module don't check every points.
The PHP code we gave is a part of our product. This code has already being released on our product. It is used by many users.
So, some files are made only for the Drupal module:
- opensearchserver.module
- opensearchserver.info
- opensearchserver.install
The others (starting with "OSS_...") come from our PHP client library.
I know that the Drupal coding standard is well made. So, we will take this opportunity to improve our code.
I also noticed that it is important to move the HTML code to a template file.
Thank you for your help.
Comment #14
ParisLiakos commentedThen you shouldnt include that in your module and request users to download separately:
http://drupal.org/node/422996
That would save you from having to rewrite a large portion of them to agree with drupal coding standards.
Comment #15
naveenann commentedWe have updated the code to Drupal Coding Standards and tested under the
coder module with settings minor and found no warnings.
- And we have implemented your suggestion regarding the template file.
and added a opensearchserver.tpl.php file to display the search result.
- Add our php library has also been ported to drupal coding standards.
Please review our module with tag 6.x-1.1-rc1
Thankyou for you help and support.
Comment #16
ParisLiakos commentedSorry i dont have time these days.
here is a quick patch.check it and commit it please
It definitely needs work.
i will come back with more info,once i find time.
Unless someone else volunteers to complete this meanwhile
Comment #17
Emmanuel Keller commentedThank you for your patch. It has been applied.
In the meantime, we have continued to improve our code.
The Coder module did not find any issue (minor warning checked).
Can you again review the 6.x-1.x branch ?
Comment #18
ParisLiakos commentedI still dont have time.I am sorry:(
Comment #19
13rac1 commentedIt seems this module should be a plugin for http://drupal.org/project/search_api Any reason why not?
Comment #20
Emmanuel Keller commentedYou're right, it is a very good suggestion. We start working on this.
Comment #21
Emmanuel Keller commentedI confirm we start working on the plugin for the Search_api module.
Is it possible to have a review for the current Drupal 6 plugin (Search_api is for Drupal 7) ?
Comment #22
jthorson commentedJust a note ... I noticed a .gitignore file in your repository. Was this intentional?
A few other comments ...
from opensearchserver_form_alter (line 106):
You assign a value, then remove it on the very next line ... unset() alone is sufficient. From my quick look, I don't understand why you're clearing $form['token'] in the first place; but admittedly, I didn't look very hard.
opensearchserver_admin_index_form_submit (line 515)
This is going to cause a 'pass by reference' error on recent php versions.
opensearchserver_cron (line 542)
Numerous SQL statements do not make proper use of db_placeholders, which could result in a vulnerability to SQL injection. Even if you feel the variables are safe, do not use direct string concatenation to include them in your queries.
I would also be worried about XSS attacks ... while I couldn't pinpoint a direct example, I had an uneasy feeling throughout the entire review that some of the values entered in one location could find their way to output without being run through a sanitation check such as check_plain() or filter_xss(). With the number of sql concatenation issues as identified above, I'm not going to continue the review at this point in time ... but I'd recommend taking something like $block_tool_tip->block_text, entering
<script>alert('xss vulnerability');</script>as the value, and then browse around the site and make sure you never get the javascript popup.Comment #23
Emmanuel Keller commentedThank you Jeremy, we start working on that.
Comment #24
naveenann commentedAs per the review given we have improved the code with drupal coding standards ,
-Every printing statements has been checked with check_plain and check_url to avoid XSS.
-The SQL statements has been improved with indentation.
-Db place holders has been used and removed the concatenation in SQL statements.
-And we have checked the module under coder module with option set to "minor (most)" which returned "No Problems Found"
Please review the 6.x-1.x branch and give us feedback.
Thank you.
Comment #25
klausilib: appears to be 3rd party code. 3rd party code is not generally allowed on Drupal.org and should be deleted. This policy is described in the getting involved handbook. It also appears in the terms and conditions you agreed to when you signed up for Git access, which you may want to re-read, to be sure you're not violating other terms. The Libraries API module is a recommended method for adding 3rd party dependencies without directly including the code on Drupal.org.
Comment #26
naveenann commentedThank you for feedback and review Klaus Purer.For your information the lib folder contains our own php library and its not an 3rd party library and the php library is developed and maintained by OpenSearchServer.And the code has been released under GPL.
From the (http://drupal.org/node/422996) "This policy does not apply to original code written by a project maintainer. For example, if you write an integration library to connect a Drupal module to another API, you may include it in a repository (licensed under the GPL), since this will be the original version of the library".
we haven't violated any terms of drupal.
Thankyou.
Comment #27
klausiBut the library is not developed exclusively on drupal.org, right? It is developed here http://sourceforge.net/projects/opensearchserve/ . So it is not the original version of the library. What version of the library is included in your module? Did you modify it?
Next problem: if another module on your site also needs that library and includes it the correct way via the Libraries API, you will get PHP errors because Drupal will include files with the same class names.
So yes, you did not violate any license, but you violate best practices.
Comment #28
Emmanuel Keller commentedHi Klaus,
That's true, the PHP client library was created on my Sourceforge project. We wanted to simplify the module by embedding the files directly in the Drupal module. By the way, I was happy to submit our PHP code to the Drupal code review! Thanks to the code review module, the code has been improved.
However, I agree that it is better to maintain the code in one place only. It is also important to be respectful with the best practice in use here. So we will have a look at the libraries API module
Thank for your help,
Emmanuel Keller.
Comment #29
misc commented@Emmanuel Keller has been contacted to ask if the application is abandoned.
http://drupal.org/node/894256
Comment #30
misc commentedThe application has been closed. If you would like to reopen it, you are free to do so.
See http://drupal.org/node/894256#abandonedtwoweekscontact
Comment #31
Emmanuel Keller commentedSorry for my late reply. After a little break, the development continue. We were waiting for the new 1.2.4 edition of OpenSearchServer. We will publish today a new patch which reflect the comment from Klausi.
Comment #32
naveenann commentedThank you for your patience and review . As per the suggestion made by Mr.Klausi, we have removed our own PHP library.
The OpenSearchServer PHP library can be included using Libraries API. The code has been reviewed using the coder module
with minor level.
Thank you once again for your time.
Comment #33
ParisLiakos commentedi see you got a 7.x branch as well:)
which branch should i review?
EDIT:
i see you are working on master branch:
http://drupal.org/node/1128202/commits
you should empty it and add an README like this:
http://drupalcode.org/project/newsletter.git/tree/refs/heads/master
and then continue development to 6.x and/or 7.x
Comment #34
naveenann commentedThank you for your feedback. As you suggested we have updated the master branch with the README.txt file.
And updated the 6.x-1.x branch please review the 6.x-1.x branch.
Comment #35
patrickd commentedPlease don't assign the issue to your self, only the current reviewer should do this.
Comment #36
ParisLiakos commentedOk,this still needs quite a bit more work.
opensearchserever.js
The functions should be namespaced.I strongly suggest converting everything to jQuery:) Mostly the AJAX calls
i suggest reading this http://drupal.org/node/171213
opensearchservewr.install
a lot of indentation issues.
eg:
should be
take extra care to 'name' and 'type'
opensearchserver.moduleagain indentation issues..eg hook_menu() implementation indentation varies..i can see indentation with 2 spaces,4 spaces and 6 spaces within the same function
opensearchserver.tpl.php
There should be no logic inside templates.Please move php logic outside the template and use php just to print values.
Also use t() for strings so that can be translated.
opensearchserver.admin.inc
Again indentation issues.
function insert_database_values: Dont use check_plain when inserting data in the database.Only when you print them.Use spaces before and after operators.
eg this:
$user_url=$base_url . '/?q=user/';should be
$user_url = $base_url . '/?q=user/';Also use ternaries for better readability.
eg this function:
should be
Much better:)
But you could actually dont need this function at all..Use url function.
so instead of get_user_url you just do
url('user');rest files: again indentation issues. use everywhere 2 spaces
Comment #37
ParisLiakos commentedremoving tag
Comment #38
naveenann commentedThanks for the review Mr.Rootarwc
As per the suggestion made by you the following things where changed.
All the files has been updated with 2 space indentation.
The logic has been removed from opensearchserver.tpl.php .
It just iterates over the search result and prints it.
opensearchserver.js has been changed to namespaced and the
AJAX calls has been made through jQuery.
The check_plain has been removed from the SQL insert statement.
The module has been checked with coder module with option set to "minor (most)" which returned "No Problems Found". And please review the 6.x-1.x branch.
Comment #39
naveenann commentedComment #40
ParisLiakos commentedDid again a quick check and still see indentation issue in .install file at least.
Also in the tpl.php i still see more php than html.
variable assignement should happen outside the tpl:)
Comment #41
naveenann commentedThanks for the review Mr.Rootarwc
We have checked the .install file and did not find any issues in that.
Can u please explain what is the indentation issue in the .install file?
In the .tpl.php file the logic and the variable assignment. has been removed
Please check the 6.x-1.x branch and give us feedback.
Thankyou once again for your support.
Comment #42
ParisLiakos commentedlines 132-134 and 138-140 two extra spaces
Comment #43
naveenann commentedWe have removed the two extra space in .install file.
Please review the 6.x-1.x and give us feedback.
Thankyou once again for your support.
Comment #44
ParisLiakos commentedSorry, busy again.
We really need more hands in the application queue and highly recommend to get a review bonus to get this done sooner ;)
Comment #45
patrickd commentedYour project page is not very detailed, please have a look at the tips for a great project page, you may also use HTML-tags for better structure.
Also, at the moment the 3rd party files are still contained in 7.x-1.x. Please make sure that also the d7 version of this module uses libraries correctly. It would definitely make sense to implement hook requirements and check whether the necessary library files are available / tell a short introduction where to download and where to put it to in the status report page. (usage and installation instructions should also be contained on the project page which is currently pretty short)
An automated review (drupalcs not coder in this case) of your project has found some issues with your code; As coding standards make sure projects are coded in a consistent style we please you to have a look at the report and try to fix them. Anyway, note that issues found are possibly false positives and fixing all issues is not a requirement for getting through the application process.
You can test it yourself on http://ventral.org/pareview
D7 has class lazyloading, you can add these 3rd party files to drupal's registry and they'll be included automatically when needed and not on every bootstrap. Same with your d6 version; I'd recommend depending on the autoload module which provides the same functionality so you don't have to include these files by hook_init() every time.
Always (except within hook_menu(), hook_schema() and watchdog()) encapsulate human readable string with t().
Also it makes no sense here to use check_plain on $msg as it is a static string and can't contain any user input. I'd suggest you to have a look at the writing secure code chapter.
Your also doing
$type = 'error'what makes not very much sense and probably happened by c&p from the api site.the .info of your d7 version says
core = 6.xthere's no hook_perm in d7, it's hook_permission now and has changed a little
seriously do not use t() within hook_menu()
what's this for?
Your documenting all your functions with
The "Implements ..." is only for hooks! See documentation: https://drupal.org/node/1354#hookimpl
well; don't get me wrong, but this looks a little messed up, IMHO I'd really suggest you to take a weekend and rework both versions of this module completely before we continue here :/
Comment #46
klausiClosing due to lack of activity. Feel free to reopen if you are still working on this application.