Skip to content

Commit

Permalink
Merge branch 'develop' into master_13513
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Jun 18, 2018
2 parents 0c94b63 + 33649f5 commit a1d0c69
Show file tree
Hide file tree
Showing 341 changed files with 18,761 additions and 9,330 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Expand Up @@ -21,6 +21,7 @@ before_script:
- touch enabletests
#- rm composer.lock
#- rm -r third_party
- composer remove --dev vimeo/psalm
- composer install
- chmod -R 777 tmp
- chmod -R 777 upload
Expand Down Expand Up @@ -50,6 +51,9 @@ before_script:
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
- sudo service apache2 restart

# Check for syntax errors.
- find application/ -type f -name "*.php" -exec php -l {} \; | grep -v 'No syntax errors' || true

# Test server.
- wget localhost
- more localhost
Expand All @@ -67,7 +71,5 @@ before_script:
- java -jar selenium-server-standalone-3.7.1.jar -enablePassThrough false > /dev/null 2> /dev/null &

script:
# Check for syntax errors.
- find application/ -type f -name "*.php" -exec php -l {} \; | grep -v 'No syntax errors' || true
# Run tests.
- DOMAIN=localhost phpunit
- DOMAIN=localhost phpunit --stop-on-failure
2 changes: 1 addition & 1 deletion docs/license.txt → LICENSE
@@ -1,6 +1,6 @@
LimeSurvey - The free & open-source survey software tool

Copyright 2003-2016 LimeSurvey Project Team / Carsten Schmitz
Copyright 2003-2018 LimeSurvey Project Team / Carsten Schmitz

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
Expand Down
9 changes: 5 additions & 4 deletions README.md
Expand Up @@ -19,7 +19,8 @@ Or try taking one of our [test surveys](https://survey.limesurvey.org/index.php?
## How to install

### Release
We try to publish a release every other day.
We release early and often.
The latest stable release version is available for download at https://www.limesurvey.org/about-limesurvey/download
We recommend using those.

### Repository
Expand All @@ -34,7 +35,7 @@ The absolute minimal requirements are:
- Apache >= 2.4 | nginx >= 1.1 | any other php-ready webserver
- php >= 5.4
- with mbstring and pdo-database drivers
- mysql >= 5.5.3 | pgsql >= 9 | mariadb >= 5.5 | mssql >= 2005
- mysql >= 5.5.9 | pgsql >= 9 | mariadb >= 5.5 | mssql >= 2005

### Recommended
We recommend the following setup
Expand All @@ -46,7 +47,7 @@ We recommend the following setup
## Manual
for more information please refer to our [homepage](http://www.limesurvey.org), or have a look at the [manual](http://manual.limesurvey.org)

## Licence
LimeSurvey software is licenced under the [GPL 2.0](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
## License
LimeSurvey software is licensed under the [GPL 2.0](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html), or at your choice any later version of the license.

Pictures and the LimeSurvey Logo are registered trademarks of LimeSurvey GmbH, Hamburg, Germany.
2 changes: 1 addition & 1 deletion application/commands/CompileAssetsCommand.php
Expand Up @@ -89,7 +89,7 @@ private function liveExecuteCommand($cmd, $logfile = false)
} else {
$proc = popen("$cmd 2>&1 ; echo Exit status : $?", 'r');
}

$live_output = "";
$complete_output = "";

Expand Down
21 changes: 15 additions & 6 deletions application/commands/DemomodeCommand.php
Expand Up @@ -31,7 +31,8 @@ public function run($sArgument)

}

private function _resetDatabase() {
private function _resetDatabase()
{
Yii::import('application.helpers.common_helper', true);
Yii::import('application.helpers.database_helper', true);

Expand Down Expand Up @@ -95,7 +96,8 @@ private function _resetDatabase() {
}
}

private function _resetFiles() {
private function _resetFiles()
{

$sBaseUploadDir = dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'upload';

Expand All @@ -105,24 +107,31 @@ private function _resetFiles() {
SureRemoveDir($sBaseUploadDir.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.'question', false);
}

private function _createDemo() {
private function _createDemo()
{
Yii::app()->loadHelper('admin/import');
require_once(dirname(dirname(dirname(__FILE__))).'/application/helpers/replacements_helper.php');
require_once(dirname(dirname(dirname(__FILE__))).'/application/helpers/expressions/em_manager_helper.php');
require_once(dirname(dirname(dirname(__FILE__))).'/application/helpers/expressions/em_core_helper.php');
require_once(dirname(dirname(dirname(__FILE__))).'/application/helpers/admin/activate_helper.php');

Yii::app()->session->add('loginID', 1);
$documentationSurveyPath = dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'docs'.DIRECTORY_SEPARATOR.'demosurveys'.DIRECTORY_SEPARATOR;
$aSamplesurveys = scandir($documentationSurveyPath);
$surveysToActivate = [];
foreach ($aSamplesurveys as $sSamplesurvey) {
$result = NULL;
$result = XMLImportSurvey($documentationSurveyPath.$sSamplesurvey);
$result = null;
//Try catch for console application to be able to import surveys

$result = @ XMLImportSurvey($documentationSurveyPath.$sSamplesurvey);

if (in_array($sSamplesurvey, ['ls205_sample_survey_multilingual.lss', 'ls205_randomization_group_test.lss', 'ls205_cascading_array_filter_exclude.lss'])) {
$surveysToActivate[] = $result['newsid'];
}
}
require_once(__DIR__.'/../helpers/admin/activate_helper.php');
array_map('activateSurvey', $surveysToActivate);
}
}

}

Expand Down
109 changes: 67 additions & 42 deletions application/commands/InstallCommand.php
Expand Up @@ -30,6 +30,8 @@ class InstallCommand extends CConsoleCommand
/**
* @param array $aArguments
* @return int
* @throws CException
* @throws Exception
*/
public function run($aArguments)
{
Expand All @@ -48,21 +50,7 @@ public function run($aArguments)
$this->createDatabase();
};

$this->connection->charset = 'utf8';

switch ($this->connection->driverName) {
case 'mysql':
case 'mysqli':
$this->connection->createCommand("ALTER DATABASE ".$this->connection->quoteTableName($this->getDBConnectionStringProperty('dbname'))." DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")->execute();
break;
case 'pgsql':
case 'dblib':
case 'mssql':
case 'sqlsrv':
break;
default:
throw new Exception(sprintf('Unknown database type "%s".', $this->connection->driverName));
}
$this->prepareCharset();

$sFileName = dirname(APPPATH).'/installer/create-database.php';
require_once($sFileName);
Expand All @@ -74,33 +62,9 @@ public function run($aArguments)
return 1;
}

$this->output('Creating admin user...');
$this->connection->createCommand()->insert(
$this->connection->tablePrefix.'users',
array(
'users_name'=>$aArguments[0],
'password'=>password_hash($aArguments[1], PASSWORD_DEFAULT),
'full_name'=>$aArguments[2],
'parent_id'=>0,
'lang'=>'auto',
'email'=>$aArguments[3]
)
);
$this->connection->createCommand()->insert(
$this->connection->tablePrefix.'permissions',
array(
'entity'=>'global',
'entity_id'=>0,
'uid'=>1,
'permission'=>'superadmin',
'create_p'=>0,
'read_p'=>1,
'update_p'=>0,
'delete_p'=>0,
'import_p'=>0,
'export_p'=>0
)
);
$this->createUser($aArguments);
$this->createPermissions();

$this->output('All done!');
return 0;
} else {
Expand All @@ -110,6 +74,8 @@ public function run($aArguments)
}
}



/**
* @param string $sProperty
* @param string $connectionString
Expand All @@ -130,6 +96,7 @@ public function getDBConnectionStringProperty($sProperty, $connectionString = nu
/**
* Create database with name?
* @return void
* @throws CException
*/
protected function createDatabase()
{
Expand Down Expand Up @@ -197,4 +164,62 @@ protected function setNoisy(array $args)
$this->noisy = true;
}
}


private function prepareCharset()
{
$this->connection->charset = 'utf8';
switch ($this->connection->driverName) {
case 'mysql':
case 'mysqli':
$this->connection->createCommand("ALTER DATABASE ".$this->connection->quoteTableName($this->getDBConnectionStringProperty('dbname'))." DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")->execute();
break;
case 'pgsql':
case 'dblib':
case 'mssql':
case 'sqlsrv':
break;
default:
throw new Exception(sprintf('Unknown database type "%s".', $this->connection->driverName));
}

}

private function createUser($data)
{
$this->output('Creating admin user...');
$this->connection->createCommand()->insert(
$this->connection->tablePrefix.'users',
array(
'users_name'=>$data[0],
'password'=>password_hash($data[1], PASSWORD_DEFAULT),
'full_name'=>$data[2],
'parent_id'=>0,
'lang'=>'auto',
'email'=>$data[3]
)
);
}

private function createPermissions()
{
$this->output('Creating permissions ...');
$this->connection->createCommand()->insert(
$this->connection->tablePrefix.'permissions',
array(
'entity'=>'global',
'entity_id'=>0,
'uid'=>1,
'permission'=>'superadmin',
'create_p'=>0,
'read_p'=>1,
'update_p'=>0,
'delete_p'=>0,
'import_p'=>0,
'export_p'=>0
)
);
}


}
4 changes: 2 additions & 2 deletions application/commands/WipeCommand.php
Expand Up @@ -95,10 +95,10 @@ public function run($sArgument)
$actquery = "update {{settings_global}} set stg_value='Sea_Green' where stg_name='admintheme'";
Yii::app()->db->createCommand($actquery)->execute();

foreach ($templateData = LsDefaultDataSets::getTemplatesData() as $template) {
foreach (LsDefaultDataSets::getTemplatesData() as $template) {
Yii::app()->db->createCommand()->insert("{{templates}}", $template);
}
foreach ($templateConfigurationData = LsDefaultDataSets::getTemplateConfigurationData() as $templateConfiguration) {
foreach (LsDefaultDataSets::getTemplateConfigurationData() as $templateConfiguration) {
Yii::app()->db->createCommand()->insert("{{template_configuration}}", $templateConfiguration);
}

Expand Down
3 changes: 3 additions & 0 deletions application/config/config-defaults.php
Expand Up @@ -88,6 +88,9 @@

$config['allowedresourcesuploads'] = '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,ico,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,xml,zip,css,js'; // File types allowed to be uploaded in the resources sections, and with the HTML Editor

// File types allowed to be uploaded as plugin
$config['allowedpluginuploads'] = 'gif,ico,jpg,png,css,js,map,json,eot,svg,ttf,woff,txt,md,xml,woff2,twig,php,html';

$config['memory_limit'] = '256'; // This sets how much memory LimeSurvey can access in megabytes. 256 MB is the minimum recommended - if you are using PDF functions up to 512 MB may be needed

$config['showpopups'] = 1; // Show popup messages if mandatory or conditional questions have not been answered correctly.
Expand Down

0 comments on commit a1d0c69

Please sign in to comment.