Commit 9bad840f authored by Chenu Denis's avatar Chenu Denis

Merge branch '2.06lts' into 2.06_SondagesPro

parents 7d2c6a9c 598b2167
......@@ -150,7 +150,7 @@ class Survey_Common_Action extends CAction
/* Control sid,gid and qid params validity see #12434 */
// Fill param with according existing param, replace existing parameters.
// iGroupId/gid can be found with qid/iQuestionId
if(isset($params['iQuestionId'])) {
if(!empty($params['iQuestionId'])) {
if((string)(int)$params['iQuestionId']!==(string)$params['iQuestionId']) { // pgsql need filtering before find
throw new CHttpException(403,gT("Invalid question id"));
}
......@@ -163,7 +163,7 @@ class Survey_Common_Action extends CAction
}
}
// iSurveyId/iSurveyID/sid can be found with gid/iGroupId
if(isset($params['iGroupId'])) {
if(!empty($params['iGroupId'])) {
if((string)(int)$params['iGroupId']!==(string)$params['iGroupId']) { // pgsql need filtering before find
throw new CHttpException(403,gT("Invalid group id"));
}
......@@ -176,7 +176,7 @@ class Survey_Common_Action extends CAction
}
}
// Finally control validity of sid
if(isset($params['iSurveyId'])) {
if(!empty($params['iSurveyId'])) {
if((string)(int)$params['iSurveyId']!==(string)$params['iSurveyId']) { // pgsql need filtering before find
// 403 mean The request was valid, but the server is refusing action.
throw new CHttpException(403,gT("Invalid survey id"));
......
......@@ -1693,8 +1693,8 @@ function do_list_radio($ia)
$answer .= $startitem;
$answer .= "\t$hiddenfield\n";
$answer .=' <input class="radio" type="radio" value="'.$ansrow['code'].'" name="'.$ia[1].'" id="answer'.$ia[1].$ansrow['code'].'"'.$check_ans.' onclick="if (document.getElementById(\'answer'.$ia[1].'othertext\') != null) document.getElementById(\'answer'.$ia[1].'othertext\').value=\'\';'.$checkconditionFunction.'(this.value, this.name, this.type)" />
<label for="answer'.$ia[1].$ansrow['code'].'" class="answertext">'.$ansrow['answer'].'</label>
$answer .=' <input class="radio" type="radio" value="'.$ansrow['code'].'" name="'.$ia[1].'" id="answer'.$ia[1].'s'.$ansrow['code'].'"'.$check_ans.' onclick="if (document.getElementById(\'answer'.$ia[1].'othertext\') != null) document.getElementById(\'answer'.$ia[1].'othertext\').value=\'\';'.$checkconditionFunction.'(this.value, this.name, this.type)" />
<label for="answer'.$ia[1].'s'.$ansrow['code'].'" class="answertext">'.$ansrow['answer'].'</label>
'.$wrapper['item-end'];
++$rowcounter;
......@@ -3630,7 +3630,7 @@ function do_shortfreetext($ia)
. gT('Click to set the location or drag and drop the pin. You may may also enter coordinates').'</div>';
$question_text['help'] = gT('Click to set the location or drag and drop the pin. You may may also enter coordinates');
}
}
}
else
{
//no question attribute set, use common input text field
......
......@@ -34,14 +34,14 @@ class TokenDynamic extends LSActiveRecord
self::sid($sid);
$refresh = true;
}
$model = parent::model(__CLASS__);
//We need to refresh if we changed sid
if ($refresh === true) $model->refreshMetaData();
return $model;
}
/**
* Sets the survey ID for the next model
*
......@@ -92,8 +92,8 @@ class TokenDynamic extends LSActiveRecord
array('mpid','numerical', 'integerOnly'=>true,'allowEmpty'=>true),
array('blacklisted', 'in','range'=>array('Y','N'), 'allowEmpty'=>true),
array('emailstatus', 'default', 'value' => $this->emailstatus),
// array('validfrom','date', 'format'=>array('yyyy-MM-dd', 'yyyy-MM-dd HH:mm', 'yyyy-MM-dd HH:mm:ss',), 'allowEmpty'=>true),
// array('validuntil','date', 'format'=>array('yyyy-MM-dd', 'yyyy-MM-dd HH:mm', 'yyyy-MM-dd HH:mm:ss',), 'allowEmpty'=>true),
// array('validfrom','date', 'format'=>array('yyyy-MM-dd', 'yyyy-MM-dd HH:mm', 'yyyy-MM-dd HH:mm:ss',), 'allowEmpty'=>true),
// array('validuntil','date', 'format'=>array('yyyy-MM-dd', 'yyyy-MM-dd HH:mm', 'yyyy-MM-dd HH:mm:ss',), 'allowEmpty'=>true),
// Date rules currently don't work properly with MSSQL, deactivating for now
);
}
......@@ -102,7 +102,7 @@ class TokenDynamic extends LSActiveRecord
* Checks to make sure that all required columns exist in this tokens table
* (some older tokens tables dont' get udated properly)
*
* This method should be moved to db update for 2.05 version so it runs only
* This method should be moved to db update for 2.05 version so it runs only
* once per token table / backup token table
*/
public function checkColumns() {
......@@ -128,7 +128,7 @@ class TokenDynamic extends LSActiveRecord
} else {
// On some installs we have created not null for participant_id and blacklisted fix this
$columns = array('blacklisted', 'participant_id');
foreach ($columns as $columnname)
{
$definition = $tableSchema->getColumn($columnname);
......@@ -144,12 +144,12 @@ class TokenDynamic extends LSActiveRecord
public function findUninvited($aTokenIds = false, $iMaxEmails = 0, $bEmail = true, $SQLemailstatuscondition = '', $SQLremindercountcondition = '', $SQLreminderdelaycondition = '')
{
$command = new CDbCriteria;
$command->condition = '';
$command->condition = '';
$command->addCondition("(completed ='N') or (completed='')");
$command->addCondition("token <> ''");
$command->addCondition("email <> ''");
if ($bEmail) {
if ($bEmail) {
$command->addCondition("(sent = 'N') or (sent = '')");
} else {
$command->addCondition("(sent <> 'N') AND (sent <> '')");
......@@ -157,20 +157,20 @@ class TokenDynamic extends LSActiveRecord
if ($SQLemailstatuscondition)
$command->addCondition($SQLemailstatuscondition);
if ($SQLremindercountcondition)
$command->addCondition($SQLremindercountcondition);
if ($SQLreminderdelaycondition)
$command->addCondition($SQLreminderdelaycondition);
if ($aTokenIds)
if ($aTokenIds)
$command->addCondition("tid IN ('".implode("', '", $aTokenIds)."')" );
if ($iMaxEmails)
$command->limit = $iMaxEmails;
$command->order = 'tid';
$command->order = 'tid';
$oResult = TokenDynamic::model()->findAll($command);
return $oResult;
......@@ -179,11 +179,11 @@ class TokenDynamic extends LSActiveRecord
public function findUninvitedIDs($aTokenIds = false, $iMaxEmails = 0, $bEmail = true, $SQLemailstatuscondition = '', $SQLremindercountcondition = '', $SQLreminderdelaycondition = '')
{
$command = new CDbCriteria;
$command->condition = '';
$command->condition = '';
$command->addCondition("(completed ='N') or (completed='')");
$command->addCondition("token <> ''");
$command->addCondition("email <> ''");
if ($bEmail) {
if ($bEmail) {
$command->addCondition("(sent = 'N') or (sent = '')");
} else {
$command->addCondition("(sent <> 'N') AND (sent <> '')");
......@@ -191,20 +191,20 @@ class TokenDynamic extends LSActiveRecord
if ($SQLemailstatuscondition)
$command->addCondition($SQLemailstatuscondition);
if ($SQLremindercountcondition)
$command->addCondition($SQLremindercountcondition);
if ($SQLreminderdelaycondition)
$command->addCondition($SQLreminderdelaycondition);
if ($aTokenIds)
if ($aTokenIds)
$command->addCondition("tid IN ('".implode("', '", $aTokenIds)."')" );
if ($iMaxEmails)
$command->limit = $iMaxEmails;
$command->order = 'tid';
$command->order = 'tid';
$oResult=$this->getCommandBuilder()
->createFindCommand($this->getTableSchema(), $command)
......@@ -212,7 +212,7 @@ class TokenDynamic extends LSActiveRecord
->queryColumn();
return $oResult;
}
function insertParticipant($data)
{
$token = new self;
......@@ -252,7 +252,7 @@ class TokenDynamic extends LSActiveRecord
{
return Yii::app()->db->createCommand("SELECT tid FROM {{tokens_{$iSurveyID}}} WHERE token IS NULL OR token=''")->queryAll();
}
public static function countAllAndCompleted($sid)
{
$select = array(
......@@ -277,11 +277,11 @@ class TokenDynamic extends LSActiveRecord
//get token length from survey settings
$tlrow = Survey::model()->findByAttributes(array("sid"=>self::$sid));
$iTokenLength = $tlrow->tokenlength;
//get all existing tokens
$criteria = $this->getDbCriteria();
$criteria->select = 'token';
$ntresult = $this->findAllAsArray($criteria);
$ntresult = $this->findAllAsArray($criteria);
foreach ($ntresult as $tkrow)
{
$existingtokens[] = $tkrow['token'];
......@@ -299,7 +299,7 @@ class TokenDynamic extends LSActiveRecord
//update specific token row
$itresult = $this->updateToken($iTokenID, $newtoken);
return $newtoken;
}
}
/**
* Creates tokens for all token records that have empty token fields and returns the number
......@@ -380,7 +380,7 @@ class TokenDynamic extends LSActiveRecord
{
if ($this->usesleft>0)
{
$this->completed='N';
$this->completed='N';
}
return parent::beforeSave();
}
......@@ -414,7 +414,7 @@ class TokenDynamic extends LSActiveRecord
/**
* Get CDbCriteria for a json search string
*
*
* @param array $condition
* @return \CDbCriteria
*/
......@@ -422,7 +422,7 @@ class TokenDynamic extends LSActiveRecord
{
$i=0;
$j=1;
$tobedonelater =array();
$tobedonelater =array();
$command = new CDbCriteria;
$command->condition = '';
$iNumberOfConditions = (count($condition)+1)/4;
......@@ -434,27 +434,27 @@ class TokenDynamic extends LSActiveRecord
$sValue=$condition[($i*4)+2];
switch ($sOperator)
{
case 'equal':
case 'equal':
$command->addCondition($sFieldname.' = :condition_'.$i, $sConnectingOperator);
$aParams[':condition_'.$i] = $sValue;
break;
case 'contains':
case 'contains':
$command->addCondition($sFieldname.' LIKE :condition_'.$i, $sConnectingOperator);
$aParams[':condition_'.$i] = '%'.$sValue.'%';
break;
case 'notequal':
case 'notequal':
$command->addCondition($sFieldname.' <> :condition_'.$i, $sConnectingOperator);
$aParams[':condition_'.$i] = $sValue;
break;
case 'notcontains':
case 'notcontains':
$command->addCondition($sFieldname.' NOT LIKE :condition_'.$i, $sConnectingOperator);
$aParams[':condition_'.$i] = '%'.$sValue.'%';
break;
case 'greaterthan':
case 'greaterthan':
$command->addCondition($sFieldname.' > :condition_'.$i, $sConnectingOperator);
$aParams[':condition_'.$i] = $sValue;
break;
case 'lessthan':
case 'lessthan':
$command->addCondition($sFieldname.' < :condition_'.$i, $sConnectingOperator);
$aParams[':condition_'.$i] = $sValue;
break;
......@@ -474,7 +474,7 @@ class TokenDynamic extends LSActiveRecord
{
$command->params = $aParams;
}
return $command;
}
......
......@@ -217,7 +217,7 @@
<?php } else
{?>
<br /><?php eT("Should we proceed with the delete?"); ?> <br />
<?php echo CHtml::form(array("admin/checkintegrity/fixintegrity"), 'post');?>
<?php echo CHtml::form(array("admin/checkintegrity/sa/fixintegrity"), 'post');?>
<input type='hidden' name='ok' value='Y' />
<input type='submit' value='<?php eT("Yes - Delete Them!"); ?>' />
</form>
......@@ -232,7 +232,7 @@
<br /> <?php eT("No database action required!"); ?>
<?php } else
{?>
<?php echo CHtml::form(array("admin/checkintegrity/fixredundancy"), 'post');?>
<?php echo CHtml::form(array("admin/checkintegrity/sa/fixredundancy"), 'post');?>
<ul class='data-redundancy-list'>
<?php
if (isset($redundantsurveytables))
......
......@@ -47,12 +47,13 @@
<?php } ?>
</li>
<?php } else { ?>
<li><a accesskey='d' target='_blank' href="<?php echo $this->createUrl("survey/index/sid/$surveyid/newtest/Y/lang/$baselang"); ?>" >
<li><a accesskey='d' target='_blank' href="<?php echo $this->createUrl("survey/index",array('sid'=>$surveyid,'newtest'=>"Y",'lang'=>$baselang)); ?>" >
<img src='<?php echo $sImageURL;?>do.png' alt='<?php echo $icontext;?>' />
</a>
</li>
<?php } ?>
<?php if($surveylocale || $surveysettings || $surveysecurity || $quotas || $assessments || $surveycontent) { ?>
<li><a href='#'>
<img src='<?php echo $sImageURL;?>edit.png' alt='<?php eT("Survey properties");?>' width="<?php echo $iIconSize;?>" height="<?php echo $iIconSize;?>"/></a><ul>
......@@ -96,11 +97,11 @@
</li>
<?php } ?>
<?php } ?>
</ul>
</ul>
</li>
<?php } ?>
<?php if($surveydelete || $surveytranslate || Permission::model()->hasSurveyPermission($surveyid,'surveycontent','update')) { ?>
<?php if($surveydelete || $surveytranslate || Permission::model()->hasSurveyPermission($surveyid,'surveycontent','update')) { ?>
<li><a href="#">
<img src='<?php echo $sImageURL;?>tools.png' alt='<?php eT("Tools");?>' width="<?php echo $iIconSize;?>" height="<?php echo $iIconSize;?>"/></a><ul>
<?php if ($surveydelete) { ?>
......@@ -145,10 +146,10 @@
</li>
<?php } ?>
<?php } ?>
</ul>
</ul>
</li>
<?php } ?>
<?php } ?>
<?php if($surveyexport || Permission::model()->hasSurveyPermission($surveyid,'surveycontent','read')) { ?>
<li><a href='#'>
<img src='<?php echo $sImageURL;?>display_export.png' alt='<?php eT("Display / Export");?>' width="<?php echo $iIconSize;?>" height="<?php echo $iIconSize;?>"/></a>
......@@ -157,7 +158,7 @@
<li><a href='#'>
<img src='<?php echo $sImageURL;?>export_30.png' alt='' /> <?php eT("Export...");?></a>
<?php } ?>
<ul>
<ul>
<?php if($surveyexport) { ?>
<li><a href='<?php echo $this->createUrl("admin/export/sa/survey/action/exportstructurexml/surveyid/$surveyid");?>' >
<img src='<?php echo $sImageURL;?>export_30.png' alt='' /> <?php eT("Survey structure (.lss)");?></a>
......@@ -203,15 +204,15 @@
?>
<li><a href='<?php echo $this->createUrl("admin/export/quexml/surveyid/$surveyid");?>' >
<img src='<?php echo $sImageURL;?>export_30.png' alt='' /> <?php eT("queXML PDF export");?></a></li>
<?php
<?php
} ?>
</ul>
</ul>
</li>
<?php } ?>
<?php } ?>
<?php if($respstatsread || $responsescreate || $responsesread) { ?>
<li><a href='#'><img src='<?php echo $sImageURL;?>responses.png' alt='<?php eT("Responses");?>' width="<?php echo $iIconSize;?>" height="<?php echo $iIconSize;?>"/></a>
<ul>
<li><a href='#'><img src='<?php echo $sImageURL;?>responses.png' alt='<?php eT("Responses");?>' width="<?php echo $iIconSize;?>" height="<?php echo $iIconSize;?>"/></a>
<ul>
<?php if($respstatsread) {
if($activated) { ?>
<li><a href='<?php echo $this->createUrl("admin/responses/sa/index/surveyid/$surveyid/");?>' >
......@@ -239,9 +240,9 @@
<img src='<?php echo $sImageURL;?>saved_disabled_30.png' alt='' /> <?php eT("Partial (saved) responses");?></a></li>
<?php }
} ?>
</ul>
</ul>
</li>
<?php } ?>
<?php } ?>
<?php if($surveycontent)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment