Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LimeSurvey/LimeSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
limesurvey-translations committed Dec 30, 2017
2 parents b9aa05f + 13b4e08 commit f14c789
Show file tree
Hide file tree
Showing 123 changed files with 606 additions and 542 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Expand Up @@ -23,12 +23,9 @@ before_script:
- composer install
#- composer install
- chmod -R 777 tmp
- chmod -R 777 tmp/runtime
- chmod -R 777 upload
- chmod -R 777 themes # Need 777 so both console and web server can cd into the folder.
- mkdir -p tests/tmp/runtime
- chmod -R 777 tests/tmp
- chmod -R 777 tests/tmp/runtime
- php application/commands/console.php install admin password TravisLS no@email.com verbose
- cp application/config/config-sample-mysql.php application/config/config.php
# Enable debug=2 in config file. OBS: This assumes debug is on line 59.
Expand Down
32 changes: 15 additions & 17 deletions application/commands/CompileAssetsCommand.php
Expand Up @@ -20,7 +20,7 @@ class CompileAssetsCommand extends CConsoleCommand
*/
public function run($aArguments)
{
if(isset($aArguments) && count($aArguments) < 2){
if (isset($aArguments) && count($aArguments) < 2) {
echo "=========================================================================\n";
echo "=== Please provide method and path to compile package assets ===\n";
echo "=== usage example: ===\n";
Expand All @@ -33,7 +33,7 @@ public function run($aArguments)
$package = $aArguments[1];
$silent = isset($aArguments[2]) ? $aArguments[2] : false;

if(!in_array($method, ['gulp', 'bash', 'npm', 'uglify'])){
if (!in_array($method, ['gulp', 'bash', 'npm', 'uglify'])) {
echo "=========================================================================\n";
echo "=== ERROR! Please provide a registered method for compiling ===\n";
echo "=== Possible methods are: ===\n";
Expand All @@ -49,8 +49,7 @@ public function run($aArguments)
$assetsFolder = realpath($sCurrentDir.'/../../assets/');
$packageFolder = $assetsFolder.'/packages/'.$package;

if (!file_exists($packageFolder))
{
if (!file_exists($packageFolder)) {
echo "=========================================================================\n";
echo "=== ERROR! Package does not exist! Exiting. ===\n";
echo "=== Checked path: ===\n";
Expand All @@ -61,31 +60,31 @@ public function run($aArguments)

$logfile = false;

if($silent == true && $silent !=="1" ){
if ($silent == true && $silent !== "1") {
$logfile = $silent;
} else if($silent == true && $silent==="1"){
$logfile =" /dev/null";
} else if ($silent == true && $silent === "1") {
$logfile = " /dev/null";
}

switch($method){
switch ($method) {
case "gulp" :
$this->liveExecuteCommand("(cd {$packageFolder} && {$method})", $logfile );
$this->liveExecuteCommand("(cd {$packageFolder} && {$method})", $logfile);
break;
case "npm" :
$this->liveExecuteCommand("(cd {$packageFolder} && {$method} run compile)", $logfile );
$this->liveExecuteCommand("(cd {$packageFolder} && {$method} run compile)", $logfile);
break;
case "bash" :
$this->liveExecuteCommand("(cd {$packageFolder} && {$method} compile.sh)", $logfile );
$this->liveExecuteCommand("(cd {$packageFolder} && {$method} compile.sh)", $logfile);
break;
}
}

private function liveExecuteCommand($cmd, $logfile=false)
private function liveExecuteCommand($cmd, $logfile = false)
{

while (@ ob_end_flush()); // end all output buffers if any

if($logfile!==false){
if ($logfile !== false) {
$proc = popen("$cmd >{$logfile} 2>&1; echo Exit status : $?", 'r');
} else {
$proc = popen("$cmd 2>&1 ; echo Exit status : $?", 'r');
Expand All @@ -94,10 +93,9 @@ private function liveExecuteCommand($cmd, $logfile=false)
$live_output = "";
$complete_output = "";

while (!feof($proc))
{
while (!feof($proc)) {
$live_output = fread($proc, 4096);
$complete_output = $complete_output . $live_output;
$complete_output = $complete_output.$live_output;

echo "$live_output";
@ flush();
Expand All @@ -112,6 +110,6 @@ private function liveExecuteCommand($cmd, $logfile=false)
return array (
'exit_status' => intval($matches[0]),
'output' => str_replace("Exit status : " . $matches[0], '', $complete_output)
);
);
}
}
4 changes: 2 additions & 2 deletions application/config/version.php
Expand Up @@ -12,9 +12,9 @@
*/


$config['versionnumber'] = '3.0.0'; //The current version of this branch, LS3
$config['versionnumber'] = '3.0.1'; //The current version of this branch, LS3
$config['dbversionnumber'] = 338;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '30000';
$config['assetsversionnumber'] = '30001';
return $config;
8 changes: 4 additions & 4 deletions application/controllers/AdminController.php
Expand Up @@ -116,7 +116,7 @@ protected function _sessioncontrol()
*
* @access public
* @param string $action
* @return bool
* @return boolean|null
*/
public function run($action)
{
Expand Down Expand Up @@ -261,7 +261,7 @@ public function _GetSessionUserRights($loginID)
* @access protected
* @param bool $meta
* @param bool $return
* @return mixed
* @return string|null
*/
public function _getAdminHeader($meta = false, $return = false)
{
Expand Down Expand Up @@ -326,7 +326,7 @@ public function _getAdminHeader($meta = false, $return = false)
* @param string $url
* @param string $explanation
* @param bool $return
* @return mixed
* @return string|null
*/
public function _getAdminFooter($url, $explanation, $return = false)
{
Expand Down Expand Up @@ -360,7 +360,7 @@ public function _getAdminFooter($url, $explanation, $return = false)
* @param string $message
* @param string $class
* @param boolean $return
* @return void
* @return string|null
*/
public function _showMessageBox($title, $message, $class = "message-box-error", $return = false)
{
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/NotificationController.php
Expand Up @@ -127,7 +127,7 @@ public static function getMenuWidget($surveyId = null, $showLoader = false)
$params = array(
'sa' => 'clearAllNotifications',
);
if ($surveyId!==null) {
if ($surveyId !== null) {
$params['surveyId'] = $surveyId;
}
$data['clearAllNotificationsUrl'] = Yii::app()->createUrl('admin/notification', $params);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/PluginHelper.php
Expand Up @@ -11,7 +11,7 @@ class PluginHelper extends Survey_Common_Action
* Helper function to let a plugin put content
* into the side-body easily.
*
* @param int $surveyId
* @param int $surveyid
* @param string $plugin Name of the plugin class
* @param string $method Name of the plugin method
* @return void
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/PluginManagerController.php
Expand Up @@ -228,8 +228,8 @@ public function configure($id)
* @param string $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'pluginmanager', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'pluginmanager', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}
}
2 changes: 1 addition & 1 deletion application/controllers/admin/TutorialEntryController.php
Expand Up @@ -9,7 +9,7 @@ class TutorialEntryController extends Controller
public $layout = '//layouts/column2';

/**
* @return array action filters
* @return string[] action filters
*/
public function filters()
{
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/TutorialsController.php
Expand Up @@ -8,7 +8,7 @@
class TutorialsController extends Survey_Common_Action
{
/**
* @return array action filters
* @return string[] action filters
*/
public function filters()
{
Expand Down Expand Up @@ -141,7 +141,7 @@ public function delete($id)
}
}

public function triggerfinished($tid){
public function triggerfinished($tid) {
$oTutorial = Tutorials::model()->find($tid);
$oTutorial->setFinished(App()->user->id);
echo '{"success": true}';
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/admin/assessments.php
Expand Up @@ -80,10 +80,10 @@ public function index($iSurveyID)
* Renders template(s) wrapped in header and footer
*
* @param string $sAction Current action, the folder to fetch views from
* @param array|string $aViewUrls View url(s)
* @param string $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'assessments', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'assessments', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
$aData['sidemenu']['state'] = false;
$iSurveyID = $aData['surveyid'];
Expand All @@ -94,7 +94,7 @@ protected function _renderWrappedTemplate($sAction = 'assessments', $aViewUrls =
$aData['surveybar']['saveandclosebutton']['form'] = true;
$aData['gid'] = null;
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'assessments.js', LSYii_ClientScript::POS_BEGIN);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}

private function _prepareDataArray(&$aData, $collectEdit = false)
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/admin/authentication.php
Expand Up @@ -267,7 +267,7 @@ public static function runDbUpgrade()
* Send the forgot password email
*
* @param string $sEmailAddr
* @param array $aFields
* @param CActiveRecord $aFields
*/
private function _sendPasswordEmail($sEmailAddr, $aFields)
{
Expand Down Expand Up @@ -360,11 +360,11 @@ private static function doRedirect()
* @param array $aData Data to be passed on. Optional.
* @return void
*/
protected function _renderWrappedTemplate($sAction = 'authentication', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'authentication', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
$aData['display']['menu_bars'] = false;
$aData['language'] = Yii::app()->getLanguage() != Yii::app()->getConfig("defaultlang") ? Yii::app()->getLanguage() : 'default';
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}

}
4 changes: 2 additions & 2 deletions application/controllers/admin/checkintegrity.php
Expand Up @@ -852,8 +852,8 @@ protected function _checkintegrity()
* @param string $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'checkintegrity', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'checkintegrity', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}
}
6 changes: 3 additions & 3 deletions application/controllers/admin/conditionsaction.php
Expand Up @@ -1162,10 +1162,10 @@ protected function applySubaction($p_subaction, array $args)
* @param array $aData Data to be passed on. Optional.
* @return void
*/
protected function _renderWrappedTemplate($sAction = 'conditions', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'conditions', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
////$aData['display']['menu_bars'] = false;
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}

/**
Expand Down Expand Up @@ -2106,7 +2106,7 @@ protected function getHiddenFields(array $rows, $leftOperandType, $rightOperandT

/**
* @param int $qid
* @return array|array<mixed,object> Conditions
* @return CActiveRecord[] Conditions
*/
protected function getAllScenarios($qid)
{
Expand Down
16 changes: 7 additions & 9 deletions application/controllers/admin/database.php
Expand Up @@ -92,7 +92,6 @@ class database extends Survey_Common_Action
/**
* Database::index()
*
* @param mixed $sa
* @return
*/
public function index()
Expand Down Expand Up @@ -142,7 +141,6 @@ public function index()
* @param string $specialtype Special type (i.e. for 'Other')
* @param mixed $language Language (defaults are language specific)
* @param mixed $defaultvalue The default value itself
* @param boolean $ispost If defaultvalue is from a $_POST set this to true to properly quote things
*/
public function _updateDefaultValues($qid, $sqid, $scale_id, $specialtype, $language, $defaultvalue)
{
Expand Down Expand Up @@ -539,13 +537,13 @@ private function actionUpdateQuestion($iSurveyID)
$criteria->compare('qid', $this->iQuestionID);
$validAttributes = \LimeSurvey\Helpers\questionHelper::getQuestionAttributesSettings($sQuestionType);
// If the question has a custom template, we first check if it provides custom attributes
//~ $oAttributeValues = QuestionAttribute::model()->find("qid=:qid and attribute='question_template'",array('qid'=>$cqr->qid));
//~ if (is_object($oAttributeValues && $oAttributeValues->value)){
//~ $aAttributeValues['question_template'] = $oAttributeValues->value;
//~ }else{
//~ $aAttributeValues['question_template'] = 'core';
//~ }
//~ $validAttributes = Question::getQuestionTemplateAttributes($validAttributes, $aAttributeValues, $cqr );
$oAttributeValues = QuestionAttribute::model()->find("qid=:qid and attribute='question_template'", array('qid'=>$cqr->qid));
if (is_object($oAttributeValues) && $oAttributeValues->value) {
$aAttributeValues['question_template'] = $oAttributeValues->value;
} else {
$aAttributeValues['question_template'] = 'core';
}
$validAttributes = Question::getQuestionTemplateAttributes($validAttributes, $aAttributeValues, $cqr);
foreach ($validAttributes as $validAttribute) {
$criteria->compare('attribute', '<>'.$validAttribute['name']);
}
Expand Down
6 changes: 2 additions & 4 deletions application/controllers/admin/dataentry.php
Expand Up @@ -429,7 +429,6 @@ protected function isCompatible(CDbTableSchema $base, CDbTableSchema $old, $chec
* @param mixed $subaction
* @param mixed $id
* @param mixed $surveyid
* @param mixed $language
* @return
*/
public function editdata($subaction, $id, $surveyid)
Expand Down Expand Up @@ -1716,7 +1715,6 @@ public function insert()
* dataentry::view()
* view a dataentry
* @param mixed $surveyid
* @param mixed $lang
*/
public function view($surveyid)
{
Expand Down Expand Up @@ -2167,7 +2165,7 @@ private function _array_filter_help($qidattributes, $surveyprintlang, $surveyid)
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'dataentry', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'dataentry', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
if (!isset($aData['display']['menu_bars']['browse'])) {
$iSurveyId = 0;
Expand All @@ -2184,7 +2182,7 @@ protected function _renderWrappedTemplate($sAction = 'dataentry', $aViewUrls = a
$aData["survey"] = $survey;
$aData['title_bar']['title'] = gT("Data entry");
}
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}

}
4 changes: 2 additions & 2 deletions application/controllers/admin/emailtemplates.php
Expand Up @@ -159,11 +159,11 @@ function update($iSurveyId)
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'emailtemplates', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'emailtemplates', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
App()->getClientScript()->registerPackage('emailtemplates');
$aData['display']['menu_bars']['surveysummary'] = 'editemailtemplates';
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}

}
4 changes: 2 additions & 2 deletions application/controllers/admin/export.php
Expand Up @@ -1339,9 +1339,9 @@ private function _xmlToJson($fileContents)
* @param string $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'export', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'export', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
$aData['display']['menu_bars']['gid_action'] = 'exportstructureGroup';
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}
}
4 changes: 2 additions & 2 deletions application/controllers/admin/expressions.php
Expand Up @@ -264,14 +264,14 @@ private function _printTitle($which)
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'expressions', $aViewUrls = array(), $aData = array(), $sRenderFile=false)
protected function _renderWrappedTemplate($sAction = 'expressions', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
$aData['imageurl'] = Yii::app()->getConfig('adminimageurl');
// $aData['display']['header']=true;
// $aData['display']['menu_bars'] = true;
// $aData['display']['footer']= true;
header("Content-type: text/html; charset=UTF-8"); // needed for correct UTF-8 encoding
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData,$sRenderFile);
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData, $sRenderFile);
}
}
/* End of file expressions.php */
Expand Down

0 comments on commit f14c789

Please sign in to comment.