Hi,

This is a simple links sharing module with the help of this module site administrators can share their site links with the other site administrators. It provides a form where user can submit their links and reciprocal links. It provides a system settings form where admin can configure this module. It will help in the link building and link sharing site administrators can share their traffic with the help of this module. It will also help in the search engine optimization. Right now it is available only for Drupal 7

You will find my project here Exchange Links

Git Link : git clone http://git.drupal.org/sandbox/anwar_max/1428472.git exchange_links

Reviews of other projects:
http://drupal.org/node/1503992#comment-5855486
http://drupal.org/node/1511646#comment-5865106
http://drupal.org/node/1445414#comment-5865148

Manual Review of other projects:
http://drupal.org/node/1522456#comment-6071708
http://drupal.org/node/1289146#comment-6071750
http://drupal.org/node/1536854#comment-6071784

Manual Review of other projects:
http://drupal.org/node/1421554#comment-6099492
http://drupal.org/node/1624464#comment-6103966
http://drupal.org/node/1480562#comment-6104104

Manual Review of other projects:
http://drupal.org/node/1613094#comment-6112918
http://drupal.org/node/1632316#comment-6113042
http://drupal.org/node/1632294#comment-6113154

Manual Review of other projects:
http://drupal.org/node/1392210#comment-6113838
http://drupal.org/node/1576090#comment-6113904
http://drupal.org/node/1630118#comment-6114074
http://drupal.org/node/1626848#comment-6113972

CommentFileSizeAuthor
#11 drupalcs-result.txt1.04 KBklausi
#9 systen.jpg129.13 KBanwar_max
#8 userform.jpg133.92 KBanwar_max

Comments

patrickd’s picture

welcome,

I wonder if there's also a similar module doing this? (Could not find something after searching ~5min, maybe you could?)

Please take a moment to create a README.txt that follows the guidelines for in-project documentation.

Please take a moment to make your project page follow tips for a great project page.

It make's no sense to create a tag yet, you should only create tags if you're going to create a release (what is not possible yet).

while waiting for an in-depht review of your module you can start out fixing some coding style issues detected by automated tools:
http://ventral.org/pareview/httpgitdrupalorgsandboxanwarmax1428472git

You can also get a review bonus and we will come back to your application sooner.

regards

jygastaud’s picture

Status: Needs review » Needs work

Hi,

Please see result of automated review from ventral pareview and try to fix errors and warnings.
On the link, you should "repeat review" before change back status of the task to "need review".

Manual review:
- Every text display to users should be in t() function as in exchange_linkspage.inc.
- Be aware that html code should not be in t() -> Eg: Line 19 in exchange_links.module.
- Every comments should end by a "." , "?" or "!".
- Remove unnecessary comments as at line 90 in exchange_links.install.

chertzog’s picture

I installed your module, and went looking for the configuration page, and couldnt find it. then i looked at your code, and noticed that your main configuration settings page is a MENU_LOCAL_TASK.

  $items['admin/config/search/exchange-links/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('exchange_links_settings_form'),
    'access arguments' => array('administer exchange links'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
    'file' => 'exchange_links.admin.inc',
  );

All you have to do is add separate menu item to be displayed on the configuration page, and then set the settings page as "MENU_DEFAULT_LOCAL_TASK" to make it be the first page that is shown.

  $items['admin/config/search/exchange-links'] = array(
    'title' => 'Exchange Links settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('exchange_links_settings_form'),
    'access arguments' => array('administer exchange links'),
    'type' => MENU_NORMAL_ITEM,
    'weight' => 10,
    'file' => 'exchange_links.admin.inc',
  );
  $items['admin/config/search/exchange-links/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('exchange_links_settings_form'),
    'access arguments' => array('administer exchange links'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 10,
    'file' => 'exchange_links.admin.inc',
  );

Also, in the settings page you have the default text of the html code set as "

<a href="http://www.yoursite.com" title="Site Title">Site Title</a>

which comes from your .install file

 variable_set('exchange_links_html_code', '<a href="http://www.yoursite.com" title="Site Title">Site Title</a>');

This is also shown on the admin.inc file.

  $form['your_linking_details']['exchange_links_html_code'] = array(
    '#type' => 'textfield',
    '#title' => 'HTML Code',
    '#required' => TRUE,
    '#description' => 'Enter HTML code here. Example: <a href="http://www.yoursite.com" title="Site Title">Site Title&amplt;/a>',
    '#default_value' => variable_get('exchange_links_html_code', '<a href="http://www.yoursite.com" title="Site Title">Site Title</a>'),
  );

In your .pages.inc you have:

 $form['FPV_related_links'] = array(
    '#type' => 'item',
    '#markup' => '<div>&nbsp;</div>' . get_exchange_links() . '<div>&nbsp;</div>',
  );

...
/**
 * Implementation of get_exchange_links()
 */
function get_exchange_links() {

Your functions names should start with the name of your module to avoid namespace issues. So it should probably be something like :

function exchange_links_list() {
anwar_max’s picture

Status: Needs work » Fixed

Hi,

All the above mentioned issues are fixed. Please have a look at Ventral Pareview.

Regards,
Anwar

anwar_max’s picture

Status: Fixed » Needs review
chhavik’s picture

Status: Needs review » Needs work

Manual Review :-

  • exchange_links.module:- Line 186. It's not a hook, so you should use the @return syntax to describe the returned data of that function. Refer Doxygen and comment formatting conventions.
  • exchange_links.install:- hook_uninstall, You should use variable_del, instead of db_query and then no need to clear cache as well.
  • exchange_links.pages.inc:- function exchange_links_form(). Wrap #title, #description within t() function
  • exchange_links.pages.inc:- function exchange_links_form(). Line 68 If there is a link use l() within t().
anwar_max’s picture

Status: Needs work » Needs review

Hi Chhavik,

  • exchange_links.install:- hook_uninstall, You should use variable_del, instead of db_query and then no need to clear cache as well. : I think this is not an issue as you can see pathauto module is also using the same code.
  • exchange_links.pages.inc:- function exchange_links_form(). Line 68 If there is a link use l() within t(). : Not an issue.

Thanks,
Anwar

anwar_max’s picture

StatusFileSize
new133.92 KB
anwar_max’s picture

StatusFileSize
new129.13 KB
anwar_max’s picture

Issue summary: View changes

Added reviews of other project.

anwar_max’s picture

Issue summary: View changes

Reviewed one project.

anwar_max’s picture

Issue tags: +PAreview: review bonus

Added PAReview: review bonus

klausi’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus
StatusFileSize
new1.04 KB

Thanks for your reviews, just make sure that you pick applications that did not get a review in a long time. When finishing your review comment also set the issue status either to "needs work" (you found some problems with the project) or "reviewed & tested by the community" (you found no flaws).

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

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. Get a review bonus and we will come back to your application sooner.

manual review:

  1. exchange_links_install(): no need to set variables on installation, as you can use default values with variable_get() anyway.
  2. exchange_links_uninstall(): why do you need the delete query on the vocabulary table?
  3. "'access callback' => TRUE,"; a path in hook_menu() is unprotected? Are you doing that on purpose?
  4. exchange_links_form(): all user facing text must run through t() for translation. Also make sure to use placeholders for dynamically inserted variables.
  5. exchange_links_form(): don't create table markup yourself, use theme('table', ...) instead.
  6. "'#value' => 'Add my link',": again, t() missing. Check all your strings in your module.
  7. exchange_links_get_exchange_links(): doc block does not make sense. This is not a hook, why the "Implements"? See http://drupal.org/node/1354#functions . Also elsewhere.
  8. exchange_links_get_exchange_links(): don't create list markup yourself, user theme('item_list', ...).
  9. exchange_links_admin_links_form_submit(): use drupal_write_record() (schema validation) here instead of db_insert().
  10. Same in exchange_links_view_links_form_submit() instead of db_update().
  11. "module_invoke_all('exchange_links_operations'": if your module invokes its own hooks your should document them in an *.api.php file. See http://drupal.org/node/161085#api_php
  12. exchange_links_overview(): $roles is never used.
  13. Please fix all doc blocks of your functions, they are useless right now.

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

anwar_max’s picture

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

1) exchange_links_install(): no need to set variables on installation, as you can use default values with variable_get() anyway.
++ Can you please suggest me best way for this?
2) exchange_links_uninstall(): why do you need the delete query on the vocabulary table?
++ I am deleting vocabulary and their terms.
3) "'access callback' => TRUE,"; a path in hook_menu() is unprotected? Are you doing that on purpose?
++ Fixed.
4) exchange_links_form(): all user facing text must run through t() for translation. Also make sure to use placeholders for dynamically inserted variables.
++ Fixed.
5) exchange_links_form(): don't create table markup yourself, use theme('table', ...) instead.
++ Fixed.
6) "'#value' => 'Add my link',": again, t() missing. Check all your strings in your module.
++ Fixed.
7) exchange_links_get_exchange_links(): doc block does not make sense. This is not a hook, why the "Implements"? See http://drupal.org/node/1354#functions . Also elsewhere.
++ Fixed.
8) exchange_links_get_exchange_links(): don't create list markup yourself, user theme('item_list', ...).
++ Fixed.
9) exchange_links_admin_links_form_submit(): use drupal_write_record() (schema validation) here instead of db_insert().
++ Fixed.
10) Same in exchange_links_view_links_form_submit() instead of db_update().
++ Fixed.
11) "module_invoke_all('exchange_links_operations'": if your module invokes its own hooks your should document them in an *.api.php file. See http://drupal.org/node/161085#api_php
++ Created a new exchange_links.api.php file to document hook.
12) exchange_links_overview(): $roles is never used.
++ Removed.
13) Please fix all doc blocks of your functions, they are useless right now.
++ Fixed.

Reviews of other projects:

http://drupal.org/node/1522456#comment-6071708
http://drupal.org/node/1289146#comment-6071750
http://drupal.org/node/1536854#comment-6071784

klausi’s picture

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

Please add all your reviews to the issue summary, also the new ones.

manual review:

  1. exchange_links_install(): just remove the variable_set() calls here.
  2. exchange_links_uninstall(): The extra delete query on the taxonomy_vocabulary table is not necessary.
  3. exchange_links_form(): doc block is wrong, this is not a hook, this is a form builder function. See http://drupal.org/node/1354#forms Same on exchange_links_form_validate() and others. Please check all your function documentation.
  4. 'Play fair link back!': all user facing text must run through t() for translation. Please check all your strings. Same in exchange_links_form_validate().
  5. exchange_links_overview(): The output of this function is vulnerable to XSS exploits. If I enter <script>alert('XSS');</script> as site title or category I get a nasty javascript popup. This allows an attacker to pass malicious script code to the site administrator. You need to sanitize user provided input before printing it. See http://drupal.org/node/28984

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

klausi’s picture

Issue summary: View changes

Reviewed one more project.

anwar_max’s picture

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

Added reviews to the issue summary, also the new ones.

1. exchange_links_install(): just remove the variable_set() calls here.
+ Now I am using only variable_get() function in other files so no need to remove variable_set() function from exchange_links_install().
2. exchange_links_uninstall(): The extra delete query on the taxonomy_vocabulary table is not necessary.
+ Removed.
3. exchange_links_form(): doc block is wrong, this is not a hook, this is a form builder function. See http://drupal.org/node/1354#forms Same on exchange_links_form_validate() and others. Please check all your function documentation.
+ Fixed.
4. 'Play fair link back!': all user facing text must run through t() for translation. Please check all your strings. Same in exchange_links_form_validate().
+ Fixed.
5. exchange_links_overview(): The output of this function is vulnerable to XSS exploits. If I enter

alert('XSS');

as site title or category I get a nasty javascript popup. This allows an attacker to pass malicious script code to the site administrator. You need to sanitize user provided input before printing it. See http://drupal.org/node/28984
+ Fixed.

klausi’s picture

Issue tags: +PAreview: security

Please don't remove the security tag, we keep that for statistics and to show examples of security problems.

klausi’s picture

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

manual review:

  1. exchange_links_overview(): this is still vulnerable to XSS. Taxonomy term names are also user provided data and need to be sanitized.
  2. Same for exchange_links_form(): all the user provided text settings retrieved with variable_get() should run through the appropriate sanitization function.

Security issues are blockers, but otherwise this looks nearly ready. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

klausi’s picture

Issue summary: View changes

Added Manual Reviews of other projects

anwar_max’s picture

Issue tags: +PAreview: review bonus

Hi Klausi,

Thanks for your manual review :)

1) exchange_links_overview(): this is still vulnerable to XSS. Taxonomy term names are also user provided data and need to be sanitized.
+ Fixed.
Same for exchange_links_form(): all the user provided text settings retrieved with variable_get() should run through the appropriate sanitization function.
+ Fixed.

anwar_max’s picture

Status: Needs work » Needs review

Forgot to change status.
Now changing status.

klausi’s picture

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

manual review:

  1. exchange_links_form(): $link_category is only used on #options for a select form element, which sanitizes automatically. so you don't need the check_plain() on the items, double escaping is bad. See http://drupal.org/node/28984
  2. exchange_links_form(): this is still vulnerable to XSS. The related links listing also includes the category which is not sanitized in exchange_links_get_exchange_links().

So unfortunately I need to bump this back one more time. Almost there! Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

klausi’s picture

Issue summary: View changes

Added review links

anwar_max’s picture

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

Hi Klausi,

Thanks for quick response :)

1. exchange_links_form(): $link_category is only used on #options for a select form element, which sanitizes automatically. so you don't need the check_plain() on the items, double escaping is bad. See http://drupal.org/node/28984
+ Fixed.
2. exchange_links_form(): this is still vulnerable to XSS. The related links listing also includes the category which is not sanitized in exchange_links_get_exchange_links().
+ Fixed.

carlhinton’s picture

Assigned: Unassigned » carlhinton

This now seems to pass all tests at ventral

carlhinton’s picture

Assigned: carlhinton » Unassigned
Rahul Singh’s picture

Status: Needs review » Reviewed & tested by the community

Took a look, and this seems like RTBC for me.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, anwar_max! Welcome to the community of project contributors on drupal.org.

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

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.

As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.

Thanks to the dedicated reviewer(s) as well.

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

Anonymous’s picture

Issue summary: View changes

Added manual review links