Skip to content

Commit

Permalink
Merge branch 'master' of github.com:LimeSurvey/LimeSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Mar 20, 2016
2 parents e9f7982 + c264920 commit 0c103b1
Show file tree
Hide file tree
Showing 276 changed files with 72,894 additions and 17,177 deletions.
30 changes: 16 additions & 14 deletions application/controllers/OptinController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function actiontokens($surveyid, $token, $langcode = '')
$sLanguageCode = $langcode;
$iSurveyID = $surveyid;
$sToken = $token;
$sToken = sanitize_token($sToken);
$sToken = Token::sanitizeToken($sToken);

if (!$iSurveyID)
{
Expand Down Expand Up @@ -88,26 +88,28 @@ function actiontokens($surveyid, $token, $langcode = '')
}
}

//PRINT COMPLETED PAGE
if (!$aSurveyInfo['templatedir'])
{
$sTemplate=getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
}
else
{
$sTemplate=getTemplatePath($aSurveyInfo['templatedir']);
}
$this->_renderHtml($sMessage,$sTemplate,$aSurveyInfo);
$this->_renderHtml($sMessage, $aSurveyInfo, $iSurveyID);
}

private function _renderHtml($html,$thistpl, $aSurveyInfo)
/**
* Render stuff
*
* @param string $html
* @param array $aSurveyInfo
* @param int $iSurveyID
* @return void
*/
private function _renderHtml($html, $aSurveyInfo, $iSurveyID)
{
sendCacheHeaders();
doHeader();
$aSupportData=array('thissurvey'=>$aSurveyInfo);

$oTemplate = Template::model()->getInstance();
$sTemplatePath = $oTemplate->path;
$oTemplate = Template::model()->getInstance(null, $iSurveyID);
if($oTemplate->cssFramework == 'bootstrap')
{
App()->bootstrap->register();
}
$thistpl = $oTemplate->viewPath;

echo templatereplace(file_get_contents($thistpl.'startpage.pstpl'),array(), $aSupportData);
Expand Down
60 changes: 24 additions & 36 deletions application/controllers/OptoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ class OptoutController extends LSYii_Controller {
public $layout = 'bare';
public $defaultAction = 'tokens';

/* This function is run when opting out of an individual token table. The other function /optout/participants
/**
* This function is run when opting out of an individual token table. The other function /optout/participants
* opts the user out of ALL survey invitations from the system
*
*
* */
*/
function actiontokens()
{
$iSurveyID=Yii::app()->request->getQuery('surveyid');
$sLanguageCode=Yii::app()->request->getQuery('langcode');
$sToken=sanitize_token(Yii::app()->request->getQuery('token'));
$sToken = Token::sanitizeToken(Yii::app()->request->getQuery('token'));
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('sanitize');

Expand Down Expand Up @@ -85,29 +84,18 @@ function actiontokens()
}
}

//PRINT COMPLETED PAGE
if (!$aSurveyInfo['templatedir'])
{
$sTemplate=getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
}
else
{
$sTemplate=getTemplatePath($aSurveyInfo['templatedir']);
}

$this->_renderHtml($sMessage,$sTemplate,$aSurveyInfo);
$this->_renderHtml($sMessage, $aSurveyInfo, $iSurveyID);
}

/* This function is run when opting out of the participants system. The other function /optout/token
/**
* This function is run when opting out of the participants system. The other function /optout/token
* opts the user out of just a single token/survey invite list
*
*
* */
*/
function actionparticipants()
{
$iSurveyID=Yii::app()->request->getQuery('surveyid');
$sLanguageCode=Yii::app()->request->getQuery('langcode');
$sToken=sanitize_token(Yii::app()->request->getQuery('token'));
$sToken = Token::sanitizeToken(Yii::app()->request->getQuery('token'));
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('sanitize');
if (!$iSurveyID) //IF there is no survey id, redirect back to the default public page
Expand Down Expand Up @@ -172,30 +160,30 @@ function actionparticipants()
}
}

//PRINT COMPLETED PAGE
if (!$aSurveyInfo['templatedir'])
{
$sTemplate=getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
}
else
{
$sTemplate=getTemplatePath($aSurveyInfo['templatedir']);
}

$this->_renderHtml($sMessage,$sTemplate, $aSurveyInfo);
$this->_renderHtml($sMessage, $aSurveyInfo, $iSurveyID);
}

private function _renderHtml($html, $thistpl, $aSurveyInfo)
/**
* Render something
*
* @param string $html
* @param array $aSurveyInfo
* @param int $iSurveyID
* @return void
*/
private function _renderHtml($html, $aSurveyInfo, $iSurveyID)
{
sendCacheHeaders();
doHeader();
$aSupportData=array('thissurvey'=>$aSurveyInfo);

$oTemplate = Template::model()->getInstance();
$sTemplatePath = $oTemplate->path;
$oTemplate = Template::model()->getInstance(null, $iSurveyID);
if($oTemplate->cssFramework == 'bootstrap')
{
App()->bootstrap->register();
}
$thistpl = $oTemplate->viewPath;


echo templatereplace(file_get_contents($thistpl.'startpage.pstpl'),array(), $aSupportData);
$aData['html'] = $html;
$aData['thistpl'] = $thistpl;
Expand Down
20 changes: 16 additions & 4 deletions application/controllers/UploaderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ function run($actionID)
App()->clientScript->registerScript('sLangScriptVar',$sLangScriptVar,CClientScript::POS_HEAD);
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts").'ajaxupload.js');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts").'uploader.js');
App()->getClientScript()->registerScriptFile("{$sTemplateUrl}template.js");
App()->getClientScript()->registerScriptFile("{$sTemplateUrl}scripts/template.js");
App()->clientScript->registerCssFile(Yii::app()->getConfig("publicstyleurl")."uploader.css");
App()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . "uploader-files.css");
App()->bootstrap->register();

if (file_exists($sTemplateDir .DIRECTORY_SEPARATOR.'jquery-ui-custom.css'))
{
Expand All @@ -329,7 +330,18 @@ function run($actionID)
{
Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl')."jquery-ui.css");
}
App()->clientScript->registerCssFile("{$sTemplateUrl}template.css");

$oTemplate = Template::model()->getInstance('', $aSurveyInfo['sid']);
foreach ($oTemplate->packages as $package)
{
App()->getClientScript()->registerPackage($package);
}
foreach ($oTemplate->config->files->css->filename as $cssFile)
{
App()->clientScript->registerCssFile("{$sTemplateUrl}" . (string) $cssFile);
}
App()->getClientScript()->registerCssFile(App()->baseUrl . '/installer/css/font-awesome.css');

$header = getHeader($meta);

echo $header;
Expand All @@ -341,7 +353,7 @@ function run($actionID)
$qidattributes=getQuestionAttributeValues($qid);
$qidattributes['max_filesize']=floor(min($qidattributes['max_filesize']*1024,getMaximumFileUploadSize())/1024);
$body = '</head><body class="uploader">
<div id="notice"></div>
<div id="notice" class="text-center"></div>
<input type="hidden" id="ia" value="'.$fn.'" />
<input type="hidden" id="'.$fn.'_minfiles" value="'.$minfiles.'" />
<input type="hidden" id="'.$fn.'_maxfiles" value="'.$maxfiles.'" />
Expand All @@ -355,7 +367,7 @@ function run($actionID)
<!-- The upload button -->
<div class="upload-div">
<button id="button1" class="button upload-button" type="button" >'.gT("Select file").'</button>
<button id="button1" class="btn btn-default" type="button" >'.gT("Select file").'</button>
</div>
<p class="uploadmsg">'.sprintf(gT("You can upload %s under %s KB each."),$qidattributes['allowed_filetypes'],$qidattributes['max_filesize']).'</p>
Expand Down
5 changes: 5 additions & 0 deletions application/controllers/admin/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,11 @@ public function quexml($iSurveyID)
$aData['surveyid'] = $iSurveyID;
$aData['slangs'] = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$aData['baselang'] = Survey::model()->findByPk($iSurveyID)->language;
$aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/'.$iSurveyID; // Close button
$aData['sidemenu']['state'] = false;
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";

array_unshift($aData['slangs'],$aData['baselang']);

Yii::import("application.libraries.admin.quexmlpdf",TRUE);
Expand Down
3 changes: 1 addition & 2 deletions application/controllers/admin/printablesurvey.php
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,6 @@ function index($surveyid, $lang = null)
// END recursive empty tag stripping.

echo self::_populate_template( 'survey' , $survey_output );

}// End print
}

Expand All @@ -1595,7 +1594,7 @@ function index($surveyid, $lang = null)
*/
private function _populate_template( $template , $input , $line = '')
{
$full_path = PRINT_TEMPLATE_DIR.'/views/print_'.$template.'.pstpl';
$full_path = PRINT_TEMPLATE_DIR.'views/print_'.$template.'.pstpl';
$full_constant = 'TEMPLATE'.$template.'.pstpl';
if(!defined($full_constant))
{
Expand Down
4 changes: 1 addition & 3 deletions application/controllers/admin/surveyadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ public function listsurveys()
}

$aData['fullpagebar']['button']['newsurvey'] = true;

$this->_renderWrappedTemplate('survey', 'listSurveys_view', $aData);

}


Expand Down Expand Up @@ -1084,7 +1082,7 @@ public function copy()
if ($action == 'importsurvey')
{

$sFullFilepath = Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . randomChars(20).'.'.$sExtension;
$sFullFilepath = Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . randomChars(30);
if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $sFullFilepath))
{
$aData['sErrorMessage'] = sprintf(gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), Yii::app()->getConfig('tempdir'));
Expand Down
4 changes: 1 addition & 3 deletions application/controllers/admin/surveypermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ function index($surveyid)

if(Permission::model()->hasSurveyPermission($surveyid,'surveysecurity','read'))
{

debugbreak();
$aData['sidemenu']['state'] = false;
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("IbD").":".$iSurveyID.")";
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";
$aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/'.$iSurveyID; // Close button

$aBaseSurveyPermissions=Permission::model()->getSurveyBasePermissions();
Expand Down
3 changes: 1 addition & 2 deletions application/core/Survey_Common_Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $
echo '
<!-- Full page, started in Survey_Common_Action::render_wrapped_template() -->
<div class="container-fluid full-page-wrapper" id="in_survey_common_action">
<div class="row">';
';
}

//// Here the rendering of all the subviews process. Will not be use anymore, because each subview will be directly called from her parent view.
Expand Down Expand Up @@ -991,7 +991,6 @@ function _surveysummary($aData)

$sumcount3 = Question::model()->countByAttributes($condition); //Checked
$condition = array('sid' => $iSurveyID, 'language' => $baselang);

$sumcount2 = QuestionGroup::model()->countByAttributes($condition); //Checked

//SURVEY SUMMARY
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ function alternation($alternate = '' , $type = 'col')
if($type == 'row')
{
$odd = 'array2 well'; // should be row_odd
$even = 'array1'; // should be row_even
$even = 'array1 well'; // should be row_even
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/expressions/em_manager_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6374,7 +6374,7 @@ function _ValidateQuestion($questionSeq,$force=false)
else {
$othertext = $LEM->gT('Other:');
}
$mandatoryTip .= "<br />\n".sprintf($this->gT("If you choose '%s' please also specify your choice in the accompanying text field."),$othertext);
$mandatoryTip .= "\n".sprintf($this->gT("If you choose '%s' please also specify your choice in the accompanying text field."),$othertext);
}
break;
case 'X': // Boilerplate can never be mandatory
Expand Down

0 comments on commit 0c103b1

Please sign in to comment.