Skip to content

Commit

Permalink
Merge branch 'Yii' of https://github.com/LimeSurvey/LimeSurvey into Yii
Browse files Browse the repository at this point in the history
  • Loading branch information
jcleeland committed Apr 19, 2012
2 parents 8f9793d + f91a3a8 commit b826354
Show file tree
Hide file tree
Showing 59 changed files with 2,584 additions and 1,611 deletions.
11 changes: 9 additions & 2 deletions application/config/config-sample.php
Expand Up @@ -54,8 +54,15 @@
'rules' => require('routes.php'),
'showScriptName' => true,
),

),
// Use the following config variable to set modified optional settings copied from config-defaults.php
'config'=>array(
// debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this
// then please check your error-logs - either in your hosting provider admin panel or in some /logs directory
// on your webspace.
// LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
'debug'=>0
)
)
);
/* End of file config.php */
/* Location: ./application/config/config.php */
8 changes: 8 additions & 0 deletions application/controllers/InstallerController.php
Expand Up @@ -999,6 +999,14 @@ function _writeConfigFile()
."\t" . "" . "\n"

."\t" . ")," . "\n"
."\t" . "// Use the following config variable to set modified optional settings copied from config-defaults.php". "\n"
."\t" . "'config'=>array(" . "\n"
."\t" . "// debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this". "\n"
."\t" . "// then please check your error-logs - either in your hosting provider admin panel or in some /logs directory". "\n"
."\t" . "// on your webspace.". "\n"
."\t" . "// LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates". "\n"
."\t\t" . "'debug'=>0" . "\n"
."\t" . ")" . "\n"
. ");" . "\n"
. "/* End of file config.php */" . "\n"
. "/* Location: ./application/config/config.php */";
Expand Down
20 changes: 10 additions & 10 deletions application/controllers/UploaderController.php
Expand Up @@ -67,7 +67,7 @@ function run()
$iFileIndex++;
}
if ($found==true) unset($aFiles[$iFileIndex]);
$_SESSION[$sFieldname] = str_replace('{','{ ',json_encode($aFiles));
$_SESSION[$sFieldname] = ls_json_encode($aFiles);
}
}
//var_dump($sFileDir.$sFilename);
Expand Down Expand Up @@ -129,7 +129,7 @@ function run()
"success" => false,
"msg" => sprintf($clang->gT("Sorry, this file extension (%s) is not allowed!"),$ext)
);
echo lsJSONEncode($return);
echo ls_json_encode($return);
exit ();
}

Expand All @@ -142,7 +142,7 @@ function run()
"success" => false,
"msg" => sprintf($clang->gT("Sorry, this file is too large. Only files upto %s KB are allowed."), $maxfilesize)
);
echo lsJSONEncode($return);
echo ls_json_encode($return);
exit ();
}

Expand All @@ -158,7 +158,7 @@ function run()
"filename" => $randfilename,
"msg" => $clang->gT("The file has been successfuly uploaded.")
);
echo lsJSONEncode($return);
echo ls_json_encode($return);
// TODO : unlink this file since this is just a preview
// unlink($randfileloc);
exit ();
Expand All @@ -174,7 +174,7 @@ function run()
"success" => false,
"msg" => sprintf($clang->gT("Sorry, this file is too large. Only files up to %s KB are allowed.",'unescaped'), $maxfilesize)
);
echo lsJSONEncode($return);
echo ls_json_encode($return);
exit ();
}
elseif ($iFileUploadTotalSpaceMB>0 && ((calculateTotalFileUploadUsage()+($size/1024/1024))>$iFileUploadTotalSpaceMB))
Expand All @@ -183,7 +183,7 @@ function run()
"success" => false,
"msg" => $clang->gT("We are sorry but there was a system error and your file was not saved. An email has been dispatched to notify the survey administrator.",'unescaped')
);
echo lsJSONEncode($return);
echo ls_json_encode($return);
exit ();
}
elseif (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $randfileloc))
Expand All @@ -199,7 +199,7 @@ function run()
"msg" => $clang->gT("The file has been successfuly uploaded.")
);

echo lsJSONEncode($return);
echo ls_json_encode($return);
exit ();
}
// if there was some error, report error message
Expand All @@ -213,7 +213,7 @@ function run()
"msg" => $clang->gT("Sorry, there was an error uploading your file")
);

echo lsJSONEncode($return);
echo ls_json_encode($return);
exit ();
}
// check to ensure that the file does not cross the maximum file size
Expand All @@ -224,7 +224,7 @@ function run()
"msg" => sprintf($clang->gT("Sorry, this file is too large. Only files upto %s KB are allowed."), $maxfilesize)
);

echo lsJSONEncode($return);
echo ls_json_encode($return);
exit ();
}
else
Expand All @@ -233,7 +233,7 @@ function run()
"success" => false,
"msg" => $clang->gT("Unknown error")
);
echo lsJSONEncode($return);
echo ls_json_encode($return);
exit ();
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/conditionsaction.php
Expand Up @@ -1092,7 +1092,7 @@ function index($subaction, $surveyid=null, $gid=null, $qid=null)
{
foreach($canswers as $can)
{
$an = lsJSONEncode(flattenText($can[2]));
$an = ls_json_encode(flattenText($can[2]));
$aViewUrls['output'] .= "Fieldnames[$jn]='$can[0]';\n"
. "Codes[$jn]='$can[1]';\n"
. "Answers[$jn]={$an};\n";
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/dataentry.php
Expand Up @@ -1760,7 +1760,7 @@ public function insert()
}
}

$insert_data[$fieldname] = json_encode($phparray);
$insert_data[$fieldname] = ls_json_encode($phparray);

}
else
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/labels.php
Expand Up @@ -381,7 +381,7 @@ public function getAllSets()
$output[$row->lid] = $row->getAttribute('label_name');
}

echo json_encode($output);
echo ls_json_encode($output);
}

public function ajaxSets()
Expand Down Expand Up @@ -422,7 +422,7 @@ public function ajaxSets()
$res = 'fail';
}
}
echo json_encode($res);
echo ls_json_encode($res);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -198,7 +198,7 @@ function getShareInfo_json()
$i++;
}

echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}
// otherwise only the shared participants by that user
else
Expand All @@ -216,7 +216,7 @@ function getShareInfo_json()
$i++;
}

echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}
}

Expand Down Expand Up @@ -282,7 +282,7 @@ function getAttributeInfo_json()
$i++;
}

echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}

/**
Expand Down Expand Up @@ -473,7 +473,7 @@ function getSurveyInfo_json()
$i++;
}

echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}

/**
Expand Down Expand Up @@ -907,7 +907,7 @@ function subval_sort($a, $subkey, $order)
$i++;
}
}
echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}
// Only the owned and shared participants will be visible
else
Expand Down Expand Up @@ -991,7 +991,7 @@ function subval_sort($a, $subkey, $order)
$i++;
}
}
echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}
}

Expand Down Expand Up @@ -1078,7 +1078,7 @@ function subval_sort($a, $subkey, $order)
$i++;
}
}
echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}
// Only the owned and shared participants will be visible
else
Expand Down Expand Up @@ -1128,7 +1128,7 @@ function subval_sort($a, $subkey, $order)
$i++;
}
}
echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}
}

Expand Down Expand Up @@ -1220,7 +1220,7 @@ function getAttribute_json()
$i++;
}
}
echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/admin/question.php
Expand Up @@ -732,7 +732,7 @@ public function index($sa, $surveyid, $gid, $qid=null)
foreach ($qtypelist as $qtype => $qdesc)
{
$qDescToCode .= " '{$qdesc['description']}' : '{$qtype}', \n";
$qCodeToInfo .= " '{$qtype}' : '" . lsJSONEncode($qdesc) . "', \n";
$qCodeToInfo .= " '{$qtype}' : '" . ls_json_encode($qdesc) . "', \n";
}
$aData['qTypeOutput'] = "$qDescToCode 'null':'null' }; \n $qCodeToInfo 'null':'null' };";

Expand Down Expand Up @@ -978,7 +978,7 @@ public function ajaxlabelsetdetails()
$resultdata[]=array($language=>array($labels,getLanguageNameFromCode($language,false)));
}

echo json_encode($resultdata);
echo ls_json_encode($resultdata);
}

/**
Expand All @@ -1000,7 +1000,7 @@ public function ajaxlabelsetpicker()
$language=null;
}
$resultdata=getlabelsets($language);
echo json_encode($resultdata);
echo ls_json_encode($resultdata);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -427,7 +427,7 @@ public function ajaxgetusers()
foreach ($result as $rows)
$aUsers[] = array($rows['uid'], $rows['users_name']);
}
$ajaxoutput = json_encode($aUsers) . "\n";
$ajaxoutput = ls_json_encode($aUsers) . "\n";
echo $ajaxoutput;
}

Expand Down Expand Up @@ -468,7 +468,7 @@ public function ajaxowneredit($newowner, $surveyid)
foreach ($result as $row)
$aUsers['newowner'] = $row->owner->users_name;

$ajaxoutput = json_encode($aUsers) . "\n";
$ajaxoutput = ls_json_encode($aUsers) . "\n";

echo $ajaxoutput;
}
Expand Down Expand Up @@ -601,7 +601,7 @@ public function getSurveys_json()
$aSurveyEntries->rows[] = array('id' => $rows['sid'], 'cell' => $aSurveyEntry);
}

echo lsJSONEncode($aSurveyEntries);
echo ls_json_encode($aSurveyEntries);
}

/**
Expand Down Expand Up @@ -1380,7 +1380,7 @@ function getUrlParamsJSON($iSurveyId)
$aData->records = $oResult->getRowCount();
$aData->total = 1;

echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}

/**
Expand Down
20 changes: 16 additions & 4 deletions application/controllers/admin/tokens.php
Expand Up @@ -392,7 +392,7 @@ function getTokens_json($iSurveyId)
}
}

echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}

function editToken($iSurveyId)
Expand Down Expand Up @@ -482,7 +482,7 @@ function editToken($iSurveyId)
$this->getController()->error(sprintf($clang->gT('%s cannot be empty'), $desc['description']));
$aData[$attr_name] = Yii::app()->request->getPost($attr_name);
}
echo lsJSONEncode(var_export($aData));
echo ls_json_encode(var_export($aData));
$token = new Tokens_dynamic;
foreach ($aData as $k => $v)
$token->$k = $v;
Expand Down Expand Up @@ -934,6 +934,8 @@ function updatetokenattributes($iSurveyId)
'title' => sprintf($clang->gT("%s field(s) were successfully added."), $number2add),
'message' => "<br /><input type='button' value='" . $clang->gT("Back to attribute field management.") . "' onclick=\"window.open('" . $this->getController()->createUrl("/admin/tokens/managetokenattributes/surveyid/$iSurveyId") . "', '_top')\" />"
)), $aData);

LimeExpressionManager::SetDirtyFlag(); // so that knows that token tables have changed
}

/**
Expand Down Expand Up @@ -1151,7 +1153,7 @@ function email($iSurveyId, $aTokenIds = null)
$fieldsarray["{{$key}URL}"] = "<a href='{$url}'>" . htmlspecialchars($url) . '</a>';
if ($key == 'SURVEY')
{
$fieldsarray["@@SURVEYURL@@"] = $url;
$barebone_link = $url;
}
}

Expand All @@ -1162,6 +1164,12 @@ function email($iSurveyId, $aTokenIds = null)
$modsubject = Replacefields(Yii::app()->request->getPost('subject_' . $emrow['language']), $fieldsarray);
$modmessage = Replacefields(Yii::app()->request->getPost('message_' . $emrow['language']), $fieldsarray);

if (isset($barebone_link))
{
$modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject);
$modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage);
}

if (trim($emrow['validfrom']) != '' && convertDateTimeFormat($emrow['validfrom'], 'Y-m-d H:i:s', 'U') * 1 > date('U') * 1)
{
$tokenoutput .= $emrow['tid'] . " " . ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.") . "<br />", $fieldsarray);
Expand Down Expand Up @@ -1931,6 +1939,8 @@ function kill($iSurveyId)
. "<input type='submit' value='"
. $clang->gT("Main Admin Screen") . "' onclick=\"window.open('" . Yii::app()->getController()->createUrl("admin/") . "', '_top')\" />"
)), $aData);

LimeExpressionManager::SetDirtyFlag(); // so that knows that token tables have changed
}
}

Expand Down Expand Up @@ -2079,6 +2089,8 @@ function _newtokentable($iSurveyId)
. "<input type='submit' value='"
. $clang->gT("Continue") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/index/surveyid/$iSurveyId") . "', '_top')\" />\n"
)));

LimeExpressionManager::SetDirtyFlag(); // so that knows that token tables have changed
}
else
{
Expand Down Expand Up @@ -2178,7 +2190,7 @@ function subval_sort($a, $subkey, $order)
$i++;
}
}
echo lsJSONEncode($aData);
echo ls_json_encode($aData);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/translate.php
Expand Up @@ -1074,7 +1074,7 @@ private function translate_google_api()
'converted' => $sOutput
);

return lsJSONEncode($aOutput) . "\n";
return ls_json_encode($aOutput) . "\n";
}

/**
Expand Down

0 comments on commit b826354

Please sign in to comment.