An js error when in drupal site name a quote (') is situated

andyceo - May 11, 2008 - 10:19
Project:Click HeatMap
Version:5.x-2.4
Component:Code
Category:bug report
Priority:critical
Assigned:andyceo
Status:closed
Description

Dear maintainer,

I've found a bug and provide a little patch for your click_heatmap.module

When site name contains a quote ('), for example for my site http://andyceo.ruware.com/ , named "Andyceo's Words", the js-code implemented in page, don't work. The js generate next error:

missing ; before statement
catchClickHeat(undefined)clickheat.js (line 18)
[Break on this error] clickHeatSite = 'Andyceo's Words';\n

because the site name must be escaped.

The solution is:

in file click_heatmap.module find row number 97. it will be the next:

"clickHeatSite = '". variable_get('site_name', 'Drupal Click Heatmap') ."';

and change it for the next string:

"clickHeatSite = '". db_escape_string(variable_get('site_name', 'Drupal Click Heatmap')) ."';

After that all processed normally.

Thank you for that great module!

PS: I don't want to create new issue for the next little request: I want have a possibility to install the clickheat library anywhere I want on my server, and in module configuration I want to set a path where my clickheat library was installed. I think that feature add more flexibility for your module and give more freedom for the users of your module and clickheat library. Thank you!

#1

andyceo - May 11, 2008 - 11:25

And I forgot to tell another fix for that bug:

in file click_heatmap.log.inc find the row number 183:

$site_name = strtolower(str_replace(' ', '.', variable_get('site_name', 'Drupal Click Heatmap')));

and replace it for the next string:

$site_name = strtolower(preg_replace('/\W/', '.', variable_get('site_name', 'Drupal Click Heatmap')));

That fix the wrong forming page lists for sites with quote ' in the sitename.

#2

boombatower - May 15, 2008 - 17:24

I will work on this shortly. I have been rather busy lately and apologize for the wait. Thanks for the feedback.

Also if you want to put the ClickHeat library on your server in a variable location you can download the 1.x version of this module. It is the same as 2.x - the admin interface in drupal. It instead forces you to use the ClickHeat library interface.

#3

andyceo - May 15, 2008 - 20:11

Thanks :)

Okay, I'll try a 1.x branch of the module.

#4

boombatower - May 16, 2008 - 06:21
Status:needs review» fixed

I fixed the problem in a different manor to fix other issues I encountered.

Committed to ALL branches.

#5

andyceo - May 16, 2008 - 10:32

Thank you for your support. :)

#6

andyceo - May 18, 2008 - 09:37

Sorry, but you forget to commit changes to the click_heatmap.log.inc file. :(

I wrote about it here - http://drupal.org/node/257133#comment-839614

May be it not necessary? But on my site, for the 2.x branch of your module, not work the clickmap view from drupal admin without that changes. Please pay attention.

#7

andyceo - May 18, 2008 - 09:38
Status:fixed» postponed

change the status of the issue.

#8

boombatower - May 18, 2008 - 22:44
Status:postponed» postponed (maintainer needs more info)

Have you cleared the logs and started over.

It works on my end without that change. Which I believe it should.

#9

andyceo - May 20, 2008 - 18:18
Status:postponed (maintainer needs more info)» closed

Yes, you are right! It's works because now you use the site domain instead of site name. I think it is better decision.

Thanx. )

 
 

Drupal is a registered trademark of Dries Buytaert.