View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
19586 | Bug reports | Usability/user experience | public | 2024-06-06 00:27 | 2024-06-06 10:25 |
Reporter | mfavetti | Assigned To | |||
Priority | none | Severity | minor | ||
Status | new | Resolution | open | ||
Product Version | 6.5.x | ||||
Summary | 19586: When using a survey alias, path based routing paramaters are not passed to the controller | ||||
Description | @efornasier noted that limesurvey/<ALIAS>?token=<TOKEN> works but limesurvey/<ALIAS>/<TOKEN> do not work We could make both work Currently all of the above get mapped to survey/index/sid/<SID>, with <SID> being looked up from alias (Also lang is set based on which language has the alias for the survey if not already set on $_GET) A generic solution that passes key/value pairs of path based variables to the controller (either by adding back to controller route directly like /survey/index/sid/<SID>/key/value, or setting on $_GET, like $_GET[key] = value) would handle newtest/Y, token/<TOKEN>, etc. Then there could be a special case of only two path components limesurvey/<ALIAS>/<TOKEN> and set token only (either on controller route or on $_GET like above) this function is responsible: https://github.com/LimeSurvey/LimeSurvey/blob/a681a80e8036fe18d79731b5fbded44a77edaf66/application/core/LSYii_Application.php#L535 | ||||
Steps To Reproduce | Steps to reproduceCreate a survey with an alias Expected resultSurvey loads for token automatically Actual resultSurvey loads and requests token entry | ||||
Tags | No tags attached. | ||||
Bug heat | 12 | ||||
Complete LimeSurvey version number (& build) | 6.5.10 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | Chrome 125.0.6422.141 | ||||
Database type & version | Mariadb 10.11 | ||||
Server OS (if known) | Mint 21.3 | ||||
Webserver software & version (if known) | nginx 1.18 | ||||
PHP Version | 8.0/8.1/8.2 | ||||
rough idea of where/what to implement, unfinished aliastoken.patch (1,616 bytes)
diff --git a/application/core/LSYii_Application.php b/application/core/LSYii_Application.php index f816fe17..9e91fb1f 100755 --- a/application/core/LSYii_Application.php +++ b/application/core/LSYii_Application.php @@ -535,7 +535,8 @@ class LSYii_Application extends CWebApplication private function createControllerFromShortUrl($route) { $route = ltrim($route, "/"); - $alias = explode("/", $route)[0]; + $parts = explode("/", $route); + $alias = $parts[0]; if (empty($alias)) { return null; } @@ -563,7 +564,32 @@ class LSYii_Application extends CWebApplication if (empty($language)) { $_GET['lang'] = $languageSettings->surveyls_language; } - return parent::createController("survey/index/sid/" . $languageSettings->surveyls_survey_id); + + $extra = ''; + + if(count($parts) > 1) { + + if(count($parts) === 2) { + // $extra .= "/token/{$parts[1]}"; + $_GET['token'] = $parts[1]; + } + else { + + for($i = 1; $i < count($parts); $i++) { + if($parts[$i] === 'token') { + // $extra .= "/token/{$parts[$i+1]}"; + $_GET['token'] = $parts[$i+1]; + $i++; + } + } + } + } + + echo "<pre>"; + var_dump($extra); + echo "</pre>"; + + return parent::createController("survey/index/sid/" . $languageSettings->surveyls_survey_id . $extra); } /** |
|
You can create your rough idea on github ? |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2024-06-06 00:27 | mfavetti | New Issue | |
2024-06-06 00:58 | mfavetti | Note Added: 80221 | |
2024-06-06 00:58 | mfavetti | File Added: aliastoken.patch | |
2024-06-06 00:58 | mfavetti | Bug heat | 0 => 2 |
2024-06-06 10:25 | DenisChenu | Issue Monitored: DenisChenu | |
2024-06-06 10:25 | DenisChenu | Bug heat | 2 => 4 |
2024-06-06 10:25 | DenisChenu | Note Added: 80223 | |
2024-06-06 10:25 | DenisChenu | Bug heat | 4 => 6 |
2024-09-02 09:32 | Mazi | Bug heat | 6 => 12 |