/
oldUrlCompat.php
43 lines (40 loc) · 1.46 KB
/
oldUrlCompat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Plugin to redirect old url system (index.php?sid=surveyid) to the new url
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2016-2020 LimeSurvey team <https://www.limesurvey.org>
* @license GPL v3
* @version 0.1.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
class oldUrlCompat extends PluginBase
{
static protected $name = 'oldUrlCompat';
static protected $description = 'Old url (pre-2.0) compatible system';
/** @inheritdoc, this plugin didn't have any public method */
public $allowedPublicMethods = array();
public function init()
{
$this->subscribe('afterPluginLoad','oldUrlCompat');
}
/**
* Forward survey controller if we are in default controller and a sid GET parameters is set
* @return void
*/
public function oldUrlCompat()
{
if (App()->getController() && App()->getController()->getId() === "surveys" && App()->request->getQuery('sid')) {
Yii::app()->getController()->forward('survey/index');
}
}
}