Skip to content

Commit

Permalink
Merge pull request #2 from ILIAS-eLearning/release_6
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
ILIASLM authored Feb 24, 2021
2 parents a4f21c5 + d230291 commit df2c09f
Show file tree
Hide file tree
Showing 327 changed files with 57,840 additions and 55,129 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: checks
on: [pull_request]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, gd, json, readline, xsl
tools: composer:v1
coverage: none

- name: Install dependencies
run: composer install --no-interaction --no-progress

- name: PHP Unit Test
run: CI/PHPUnit/run_tests.sh

- name: Install PHP CS Fixer
run: composer require friendsofphp/php-cs-fixer --no-interaction --no-progress

- name: PHP CS Fixer
run: CI/PHP-CS-Fixer/run_check.sh

- name: Special Char Checker
run: CI/Special-Char-Checker/special-char-checker.sh
3 changes: 2 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
RewriteCond %{HTTP_USER_AGENT} ^(DavClnt)$
RewriteCond %{REQUEST_METHOD} ^(OPTIONS)$
RewriteRule .* "-" [R=401,L]

</IfModule>
<IfModule mod_alias.c>
RedirectMatch 404 /\.git
</IfModule>
<IfModule mod_xsendfile.c>
Expand Down
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion CI/Import/Variables.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash
TMP_DIR="/tmp"

CI_RESULTS_REPO="https://github.com/ILIAS-eLearning/CI-Results"

PHP_CS_FIXER_RESULTS_PATH="$TMP_DIR/phpfix_results"
PHP_CS_FIXER="libs/composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer"

PHP_VERSION=$(phpenv version-name)
PHP_VERSION=$(php -v | tac | tail -n 1 | cut -d " " -f 2 | cut -c 1-3)
PHPUNIT_PATH="$TMP_DIR/phpunit_latest_$PHP_VERSION.csv"
PHPUNIT_PATH_TMP="$TMP_DIR/phpunit_changed_$PHP_VERSION.csv"
PHPUNIT_RESULTS_PATH="$TMP_DIR/phpunit_results_$PHP_VERSION"
Expand Down
22 changes: 12 additions & 10 deletions CI/PHP-CS-Fixer/run_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ if [[ -x "$PHP_CS_FIXER" ]]

printLn "Command exited with code: $PIPE_EXIT_CODE"

printLn "Cloning results repository, copy results file."
if [ -d "$TRAVIS_RESULTS_DIRECTORY" ]; then
printLn "Starting to remove old temp directory"
rm -rf "$TRAVIS_RESULTS_DIRECTORY"
fi
# We disabled reporting because we can't implement it right now
# Priority has the base function so that the tests work
#printLn "Cloning results repository, copy results file."
#if [ -d "$TRAVIS_RESULTS_DIRECTORY" ]; then
# printLn "Starting to remove old temp directory"
# rm -rf "$TRAVIS_RESULTS_DIRECTORY"
#fi

cd /tmp && git clone https://github.com/ILIAS-eLearning/CI-Results
#cd tmp && git clone $CI_RESULTS_REPO

printLn "Switching directory and run results handling."
cp "$PHP_CS_FIXER_RESULTS_PATH" "$TRAVIS_RESULTS_DIRECTORY/data/"
cd "$TRAVIS_RESULTS_DIRECTORY" && ./run.sh
#printLn "Switching directory and run results handling."
#cp "$PHP_CS_FIXER_RESULTS_PATH" "$TRAVIS_RESULTS_DIRECTORY/data/"
#cd "$TRAVIS_RESULTS_DIRECTORY" && ./run.sh

else
printLn "No php-cs-fixer found, please install it with the following command:"
printLn "\tcomposer require friendsofphp/php-cs-fixer"
fi
fi
2 changes: 1 addition & 1 deletion CI/PHPUnit/run_tests_with_reporting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ if [[ -e "$PHPUNIT_RESULTS_PATH" ]]
else
printLn "No result file found, stopping!"
exit 99
fi
fi
160 changes: 71 additions & 89 deletions CI/Special-Char-Checker/special-char-checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,106 +10,88 @@
# which are usually used by old printers. Sometimes these hidden characters
# like hidden spaces, tabs or newlines are added to the code accidentally.

# help
if [ "$1" == "help" ]; then
echo "General usage:"
echo "type ./charchecker.sh path_to_src_folder extension"
echo "default extension is 'php' if no extension is given"
exit 1;
fi

# config
if [ "$1" ]; then
PATH_TO_SRC=$1
else
echo "No path to folder specified. Exiting."
exit 1;
fi

if [ "$2" ]; then
EXTENSION=$2
else
EXTENSION="php"
fi
# get the files from this PR to the last head
GITFILES=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD ${TRAVIS_BRANCH}))

# Print out bla first
echo "Scanning $PATH_TO_SRC for $EXTENSION Files ..."
echo "Scanning changed files for special chars ..."

# find all the php files and check them for not wanted control characters
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
FILES=()
cd $PATH_TO_SRC

AMOUNT_OF_FILES=$(find . -path ./libs -prune -o -type f -name '*.\'"$EXTENSION" | wc -l)
echo "Found $AMOUNT_OF_FILES files."

COUNTER=0
for PHPFILE in $(find . -path ./libs -prune -o -type f -name '*.'"$EXTENSION");
for PHPFILE in $GITFILES;
do
if [[ $PHPFILE == "./libs" ]]; then
continue
fi

COUNTER=$((COUNTER + 1))
echo -ne "Scanning $COUNTER of $AMOUNT_OF_FILES"'\r';

TWOB=$(grep -n -C 0 "$(printf %b '\u200b')" $PHPFILE) | cut -d: -f1;
if [ "$TWOB" ]; then
FILES+=("u200b found in $PHPFILE see line(s) $TWOB")
fi

TWOC=$(grep -n -C 0 "$(printf %b '\u200c')" $PHPFILE) | cut -d: -f1;
if [ "$TWOC" ]; then
FILES+=("u200c found in $PHPFILE see line(s) $TWOC")
fi

TWOD=$(grep -n -C 0 "$(printf %b '\u200d')" $PHPFILE) | cut -d: -f1;
if [ "$TWOD" ]; then
FILES+=("u200d found in $PHPFILE see line(s) $TWOD")
fi

TWOE=$(grep -n -C 0 "$(printf %b '\u200e')" $PHPFILE) | cut -d: -f1;
if [ "$TWOE" ]; then
FILES+=("u200e found in $PHPFILE see line(s) $TWOE")
fi

TWOF=$(grep -n -C 0 "$(printf %b '\u200f')" $PHPFILE | cut -d: -f1);
if [ "$TWOF" ]; then
FILES+=("u200f found in $PHPFILE see line(s) $TWOF")
fi

FEFF=$(grep -n -C 0 "$(printf %b '\ufeff')" $PHPFILE | cut -d: -f1);
if [ "$FEFF" ]; then
FILES+=("ufeff found in $PHPFILE see line(s) $FEFF")
fi

OOOT=$(grep -n -C 0 "$(printf %b '\u0003')" $PHPFILE | cut -d: -f1);
if [ "$OOOT" ]; then
FILES+=("u0003 found in $PHPFILE see line(s) $OOOT")
fi

OTWOE=$(grep -n -C 0 "$(printf %b '\u2028')" $PHPFILE | cut -d: -f1);
if [ "$OTWOE" ]; then
FILES+=("u2028 found in $PHPFILE see line(s) $OTWOE")
fi

OOAO=$(grep -n -C 0 "$(printf %b '\u00A0' | tr -d '\n')" $PHPFILE | cut -d: -f1);
if [ "$OOAO" ]; then
FILES+=("u00A0 found in $PHPFILE see line(s) $OOAO")
fi
done; echo
FELONE="$(pwd)/$PHPFILE"

if [ ! -f "$FELONE" ]; then
continue
fi

if [[ $FELONE == "./libs" ]]; then
continue
fi

# check for php extension
if [ ! ${FELONE: -4} == ".php" ]; then
continue
fi

TWOB=$(grep -n -C 0 "$(printf %b '\u200b')" $FELONE) | cut -d: -f1;
if [ "$TWOB" ]; then
FILES+=("u200b found in $PHPFILE see line(s) $TWOB")
fi

TWOC=$(grep -n -C 0 "$(printf %b '\u200c')" $FELONE) | cut -d: -f1;
if [ "$TWOC" ]; then
FILES+=("u200c found in $PHPFILE see line(s) $TWOC")
fi

TWOD=$(grep -n -C 0 "$(printf %b '\u200d')" $FELONE) | cut -d: -f1;
if [ "$TWOD" ]; then
FILES+=("u200d found in $PHPFILE see line(s) $TWOD")
fi

TWOE=$(grep -n -C 0 "$(printf %b '\u200e')" $FELONE) | cut -d: -f1;
if [ "$TWOE" ]; then
FILES+=("u200e found in $PHPFILE see line(s) $TWOE")
fi

TWOF=$(grep -n -C 0 "$(printf %b '\u200f')" $FELONE | cut -d: -f1);
if [ "$TWOF" ]; then
FILES+=("u200f found in $PHPFILE see line(s) $TWOF")
fi

FEFF=$(grep -n -C 0 "$(printf %b '\ufeff')" $FELONE | cut -d: -f1);
if [ "$FEFF" ]; then
FILES+=("ufeff found in $PHPFILE see line(s) $FEFF")
fi

OOOT=$(grep -n -C 0 "$(printf %b '\u0003')" $FELONE | cut -d: -f1);
if [ "$OOOT" ]; then
FILES+=("u0003 found in $PHPFILE see line(s) $OOOT")
fi

OTWOE=$(grep -n -C 0 "$(printf %b '\u2028')" $FELONE | cut -d: -f1);
if [ "$OTWOE" ]; then
FILES+=("u2028 found in $PHPFILE see line(s) $OTWOE")
fi

OOAO=$(grep -n -C 0 "$(printf %b '\u00A0' | tr -d '\n')" $FELONE | cut -d: -f1);
if [ "$OOAO" ]; then
FILES+=("u00A0 found in $PHPFILE see line(s) $OOAO")
fi
done;

cd $DIR
AMOUNTFILES=${#FILES[@]}
SEARCH="--"
REPLACE=", "
echo "Scan complete. Found $AMOUNTFILES incidents."
if [ "$AMOUNTFILES" -gt "0" ]; then
for (( i=0; i<${AMOUNTFILES}; i++ ));
do
LINE=${FILES[$i]}
echo ${LINE//$SEARCH/$REPLACE}
done
exit 1
for (( i=0; i<${AMOUNTFILES}; i++ ));
do
LINE=${FILES[$i]}
echo ${LINE//$SEARCH/$REPLACE}
done
exit 1
fi
exit 0
exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ protected function buildDatesBySchedule($week_start, array $hours, ilBookingSche
//
// Step 1a)
//
// Assign multiple participants (starting from participants screen)
// Assign multiple participants (starting from participants screen) (no, from object screen!)
//

//Table to assing participants to an object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public static function getList($a_booking_pool, array $a_filter = null, $a_objec
$ctrl->setParameterByClass('ilbookingparticipantgui', 'bkusr', $val['user_id']);
$actions[] = array(
'text' => $lng->txt("book_assign_object"),
'url' => $ctrl->getLinkTargetByClass("ilbookingparticipantgui", 'assignObjects')
'url' => $ctrl->getLinkTargetByClass(["ilobjbookingpoolgui", "ilbookingparticipantgui"], 'assignObjects')
);
$ctrl->setParameterByClass('ilbookingparticipantgui', 'bkusr', '');
}
Expand Down
22 changes: 22 additions & 0 deletions Modules/BookingManager/classes/class.ilObjBookingPoolAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@ public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_use
return true;
}

/**
* Check wether booking pool is online (legacy version)
*
* @deprecated
*/
public static function _lookupOnlineStatus($a_ids)
{
global $DIC;

$ilDB = $DIC->database();

$q = "SELECT booking_pool_id, pool_offline FROM booking_settings WHERE " .
$ilDB->in("booking_pool_id", $a_ids, false, "integer");
$lm_set = $ilDB->query($q);
$status = [];
while ($r = $ilDB->fetchAssoc($lm_set)) {
$status[$r["booking_pool_id"]] = !$r["pool_offline"];
}
return $status;
}


/**
* @param ilWACPath $ilWACPath
*
Expand Down
6 changes: 2 additions & 4 deletions Modules/Category/classes/class.ilCategoryXmlWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,15 @@ protected function buildTranslations()
$this->xmlStartTag('Translations');

$translations = $this->getCategory()->getObjectTranslation()->getLanguages();


foreach ((array) $translations as $translation) {
$this->xmlStartTag(
'Translation',
array(
'default' => (int) $translation['lang_default'],
'language' => $translation['lang'])
'language' => $translation['lang_code'])
);
$this->xmlElement('Title', array(), $translation['title']);
$this->xmlElement('Description', array(), $translation['desc']);
$this->xmlElement('Description', array(), $translation['description']);
$this->xmlEndTag('Translation');
}
$this->xmlEndTag('Translations');
Expand Down
11 changes: 6 additions & 5 deletions Modules/Chatroom/chat/Bootstrap/SetupEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var CONST = require('../Constants');
var Container = require('../AppContainer');
var Winston = require('winston');
var Util = require('util');
var DateHelper = require('../Helper/Date');


/**
Expand Down Expand Up @@ -37,9 +38,9 @@ module.exports = function SetupEnvironment(result, callback) {
filename: logFile,
level: logLevel,
json: false,
timestamp: function(){
var date = new Date();
return date.toDateString() + ' ' + date.toTimeString();
timestamp: function() {
const t = new Date();
return DateHelper.iso8601DatetimeFormat(t) + DateHelper.iso8601TimezoneFormat(t);
},
formatter: function(options) {
return Util.format(
Expand All @@ -61,8 +62,8 @@ module.exports = function SetupEnvironment(result, callback) {
humanReadableUnhandledException: true,
json: false,
timestamp: function(){
var date = new Date();
return date.toDateString() + ' ' + date.toTimeString();
const t = new Date();
return DateHelper.iso8601DatetimeFormat(t) + DateHelper.iso8601TimezoneFormat(t);
},
formatter: function(options) {
return Util.format(
Expand Down
Loading

0 comments on commit df2c09f

Please sign in to comment.