LimeSurvey issue tracker
Registration

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
05621User patchesTokenspublic2011-12-05 17:512013-09-13 04:18
ReporterJEfromCanada 
Assigned To 
PrioritynormalSeverityminor 
StatusconfirmedResolutionopen 
Product Version1.90+ 
Target VersionFixed in Version 
Summary05621: Adding short url equivalents for tokens {SURVEYURL} and {OPTOUTURL}
DescriptionAs per idea #353, survey invitation and opt out urls can be split into two lines by the email program if the length of the generated URL exceeds the maximum length which can be presented on one line of the email message.

Some email programs are unable to properly generate URLs that span multiple lines.

By using a short url (such as the ones generated through tinyurl.com), these links can be made to fit within the line length of any email program.
Steps To ReproduceInstall the LimeSurvey in a folder, in such a way that the length of the generated survey/optout url exceeds the length of a typical email line:

(e.g. http://mydomain.com/mysurveyrootpath/index.php?lang=en&sid=12345&token=bigrandomstring [^])

In such cases, the email program will generate a URL that will be split at a point somewhere inside the "token" parameter. Clicking on the URL will fail, because the portion of the token on the second line of the email will not be included.
Additional InformationI use LimeSurvey and discovered that a large number of my clients were not responding to survey requests. When I called to find out why they weren't responding, I was told they had tried, but failed. In one case, the client forwarded the emailed invitation to me, and that's when I realized that the links had been split.

Using the most recent stable release of LimeSurvey, I was able to correct the problem by finding all instances of SURVEYURL and OPTOUTURL in the source code, adding new code to support the use of the published tinyurl.com web API to generate short urls and placing them in new tokens {SHORTSURVEYURL} and {SHORTOPTOUTURL}, which are presented to the user for inclusion in email templates.

The affected modules are as follows:

common_functions.php (created new function "getshorturl", which calls the published tinyurl.com API with a "long" URL and returns a "short" url)

fck_LimeReplacementFields.php (added support for new tokens SHORTSURVEYURL and SHORTOPTOUTURL using the same coding techniques as currently used for the long url equivalents)

register.php, tokens.php and lsrc.helper.php (extended string substitutions for the newly created tokens, in a manner consistent with existing code).


NOTE: In the process of changing register.php, I also fixed a small error in original line 159, where there was a missing "?" character between the word "optout.php" and the first parameter.


I have already coded (and locally tested) the fix, but will not upload the patch until I can properly create a .diff patch.
TagsNo tags attached.
LimeSurvey build number OR git commit ID11379
Attached Filesdiff file icon Idea#353.diff [^] (15,035 bytes) 2011-12-06 00:56 [Show Content]

- Relationships

-  Notes
User avatar (16742)
JEfromCanada (reporter)
2011-12-06 00:58

Although I first created the software update based on my download of the 11379 build of LimeSurvey, I believe my patch was actually created on top of a newer build (based on the most recent "stable" repository that got uploaded when I installed Tortoise SVN).
User avatar (16743)
c_schmitz (administrator)
2011-12-06 12:27

Thanks.

I am sorry but we will not accept this patch into the core because there if you want short URLs use mod_rewrite and the fancy URL option (config-defaults.php)

Also by sending the URL to an external service for shortening there are certain privacy implications which are not legal in all countries (sending identifying information to a third-party provider without consent of the participant).
User avatar (16744)
JEfromCanada (reporter)
2011-12-08 03:18

Mr. Schmitz,

I hadn't thought of the privacy implications of sending a URL out to an external provider so that it could be shortened. There very well may be jurisdictions where this would not be allowed. However, with respect, I believe you're missing the point of my suggestion and it is not addressed by using a mod_rewrite. The length of the generated email address using the mod_rewrite feature will not be significantly different from the current length (indeed, the mod_rewrite is intended to make the URL appear more user-friendly, not shorter).

Since the proposed URL shortening would be a user-selectable option (i.e. it would not appear in any email unless specifically selected by the author of the survey), would it have been acceptable if the routine "getshorturl" only called the external service if a flag within config-defaults.php were to be set to allow such an action?

If so, I could revise my code so that this flag would be checked before populating the drop down list in fck_LimeReplacementFields.php and would further be checked inside the routine "getshorturl" so that, even if a user manually inserted the "undocumented" token {SHORTSURVEYURL} or {SHORTOPTOUTURL} into an email, the translation routine would NOT process it.

The whole intent of this request was to create URL's that were short enough to pass through to a client without fear of having the URL split between two lines. I cannot think of any process that allows this without having to add a customized front end script to their server to deal with a "customized" survey link.
User avatar (16745)
DenisChenu (developer)
2011-12-09 09:14
edited on: 2011-12-09 09:15

Hello,

I see another problem here, you use tinyurl.com in core code. There are a lot of other little url source, and you can have your own little url installation*. I think we can have a configuration for litle url source.

[*]http://sourceforge.net/projects/lilurl/ [^] for example

Or put the lilurl in LS source code ?

User avatar (16748)
JEfromCanada (reporter)
2011-12-09 16:58

Shnouelle,

You are right. There are numerous URL shortening applications. If you read my "orignal" post about the idea (in the forum), I had suggested the LS investigate the availability of API's to shortening services. Tinyurl was used only because I discovered its API through a search of the web, and, unlike bit.ly, it did not require that the survey writer register with bit.ly for a special API code. I personally was not aware of "lilurl".

The problem still exists - how to create a SHORT url that can benefit survey authors, while maintaining privacy. The code I proposed has only a single component that references a specific URL shortening service. If you believe it would be beneficial to allow survey authors to choose among various services, this is easily accommodated through a configuration value.

For example, you could have a value in config-defaults.php called "url_shortening_service", with a value of 0 through n. The default "0" would mean "Do not use shortening service", while other values would correspond to other services. These values could be documented in the comments.

I really don't care about which service is used. As far as I'm concerned, I'd be happiest with a shortening service (such as lilurl) that is directly in the LS source code, so that the privacy concerns associated with using an external service are eliminated. I just don't want to see this fully implemented idea abandoned due to issues that are easily resolved.

Because of my own needs, I'm more than willing to provide implementation code to the project for the benefit of everyone who uses LS.

- Issue History
Date Modified Username Field Change
2011-12-05 17:51 JEfromCanada New Issue
2011-12-06 00:56 JEfromCanada File Added: Idea#353.diff
2011-12-06 00:58 JEfromCanada Note Added: 16742
2011-12-06 12:27 c_schmitz Note Added: 16743
2011-12-06 12:28 c_schmitz Assigned To => c_schmitz
2011-12-06 12:28 c_schmitz Status new => acknowledged
2011-12-08 03:18 JEfromCanada Note Added: 16744
2011-12-09 09:14 DenisChenu Note Added: 16745
2011-12-09 09:15 DenisChenu Note Edited: 16745 View Revisions
2011-12-09 16:58 JEfromCanada Note Added: 16748
2012-06-21 13:30 c_schmitz Status acknowledged => confirmed
2012-06-21 14:17 c_schmitz Assigned To c_schmitz =>


Copyright © 2000 - 2014 MantisBT Team
Powered by Mantis Bugtracker