actualización

actualización
This commit is contained in:
Xes
2025-04-09 23:45:32 +02:00
parent 6af41dfbbe
commit 9818bce47c
32 changed files with 19298 additions and 0 deletions

1
.bowerrc Normal file
View File

@@ -0,0 +1 @@
{ "directory": "app/Resources/public/assets" }

123
.codeclimate.yml Normal file
View File

@@ -0,0 +1,123 @@
version: "2"
checks:
argument-count:
enabled: false
complex-logic:
enabled: false
file-lines:
enabled: false
method-complexity:
enabled: true
config:
threshold: 20
method-count:
enabled: false
method-lines:
enabled: false
nested-control-flow:
config:
threshold: 20
return-statements:
enabled: false
plugins:
phan:
enabled: false
config:
file_extensions: "php"
fixme:
enabled: true
config:
strings:
- FIXME
- BUG
phpcodesniffer:
enabled: true
config:
standard: "Symfony2"
file_extensions: "php"
checks:
PSR1 Classes ClassDeclaration MissingNamespace:
enabled: false
PSR1 Files SideEffects FoundWithSymbols:
enabled: false
Squiz Strings ConcatenationSpacing PaddingFound:
enabled: false
phpmd:
enabled: true
config:
file_extensions: "php"
rulesets: "codesize.xml"
sonar-php:
enabled: false
checks:
php:S1192:
enabled: false
duplication:
enabled: false
exclude_patterns:
- cli-config.php
- app/cache/
- app/logs/
- app/config/
- app/SymfonyRequirements.php
- app/Migrations/
- app/Resources/
- main/admin/db.php
- main/admin/ldap_synchro.php
- main/auth/cas/lib/
- main/auth/shibboleth
- main/auth/openid
- main/chat/emoji_strategy.php
- main/default_course_document
- main/document/Wami.swf
- main/fonts/
- main/inc/ajax/Wami.swf
- main/inc/lib/browser/
- main/inc/lib/freemindflashbrowser/
- main/inc/lib/internationalization_database/
- main/inc/lib/javascript/
- main/inc/lib/kses-0.2.2/
- main/inc/lib/mimetex/
- main/inc/lib/nanogong/
- main/inc/lib/nusoap/
- main/inc/lib/opengraph/*
- main/inc/lib/ppt2png/
- main/inc/lib/phpseclib
- main/inc/lib/pear/
- main/inc/lib/phpmailer/
- main/inc/lib/phpseclib/
- main/inc/lib/svg-edit/
- main/inc/lib/swfobject/
- main/inc/lib/mediaplayer
- main/inc/lib/mxgraph/
- main/inc/lib/wami-recorder/
- main/inc/lib/xajax/
- main/lp/packaging/
- main/template/
- main/img/
- main/lang/
- plugin/buycourses/resources/js/
- plugin/buycourses/src/Culqi/
- plugin/buycourses/src/Requests/
- plugin/buycourses/src/Requests.php
- plugin/buycourses/src/paypalfunctions.php
- plugin/vchamilo/cli/
- plugin/kannelsms/vendor/
- plugin/clockworksms/vendor/
- plugin/tour/intro.js
- plugin/pens/lib
- plugin/bbb/lib/bbb_api.php
- plugin/ims_lti/OAuthSimple.php
- plugin/sepe/src/wsse/
- plugin/test2pdf/class/
- plugin/jcapture/lib/
- plugin/jcapture/src/
- tests/
- vendor/
- web/

13
.editorconfig Normal file
View File

@@ -0,0 +1,13 @@
; top-most EditorConfig file
root = true
; Unix-style newlines
[*]
end_of_line = lf
charset = utf-8
[*.php]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

31
.gitattributes vendored Normal file
View File

@@ -0,0 +1,31 @@
.github export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.codeclimate.yml export-ignore
.flintci.yml export-ignore
.scrutinizer.yml export-ignore
.styleci.yml export-ignore
.travis.yml export-ignore
.yamllint_config export-ignore
.php_cs.dist export-ignore
.php_cs export-ignore
codesize.xml export-ignore
phpcs.xml export-ignore
/tests export-ignore
.editorconfig export-ignore
/vendor/ezyang/htmlpurifier/docs export-ignore
/vendor/ezyang/htmlpurifier/benchmarks export-ignore
/vendor/ezyang/htmlpurifier/tests export-ignore
/vendor/ezyang/htmlpurifier/smoketests export-ignore
/vendor/ezyang/htmlpurifier/package.php export-ignore
/vendor/ezyang/htmlpurifier/release1-update.php export-ignore
/vendor/ezyang/htmlpurifier/release2-tag.php export-ignore
/vendor/ezyang/htmlpurifier/test-settings.sample.php export-ignore
/vendor/twig/twig/test export-ignore
/vendor/monolog/monolog/tests/ export-ignore
/vendor/neutron/temporary-filesystem/tests export-ignore
/vendor/sabre/vobject/tests export-ignore
/vendor/twig/twig/test export-ignore
/vendor/symfony/console/Symfony/Component/Console/Tests export-ignore

55
.gitignore vendored Normal file
View File

@@ -0,0 +1,55 @@
# Cache directories
app/cache/*
!app/cache/.gitkeep
!app/cache/.htaccess
app/logs/*
!app/logs/.gitkeep
# Chamilo configuration
/app/config/parameters.yml
/app/config/add_course.conf.php
/app/config/auth.conf.php
/app/config/course_info.conf.php
/app/config/events.conf.php
/app/config/mail.conf.php
/app/config/profile.conf.php
/app/config/configuration.php
# Courses
app/courses/*
!app/courses/proxy.php
# Home
app/home/*
# Upload content
app/upload/*
.php_cs.cache
# Logs and databases #
*.log
# IDE settings
.idea
.idea/*
.idea/dictionaries/*
.idea/cssxfire.xml
*.orig
nbproject/*
# Plugins config files
plugin/bbb/config.vm.php
# Cron temp files
main/cron/incoming/*
plugin/vchamilo/templates/*
# Stuff updated through composer - Remove just before release
/vendor
web/
node_modules
yarn.lock

134
.htaccess Normal file
View File

@@ -0,0 +1,134 @@
# Check that your Apache virtualhost have this settings:
#<Directory "/var/www/chamilo-classic">
# AllowOverride All
# Order allow,deny
# Allow from all
#</Directory>
RewriteEngine on
# Disables access to myfile.php/something
AcceptPathInfo Off
# Prevent execution of PHP from directories used for different types of uploads
RedirectMatch 403 ^/app/(?!courses/proxy)(cache|courses|home|logs|upload|Resources/public/css)/.*\.ph(p[3457]?|t|tml|ar)$
RedirectMatch 403 ^/main/default_course_document/images/.*\.ph(p[3457]?|t|tml|ar)$
RedirectMatch 403 ^/main/lang/.*\.ph(p[3457]?|t|tml|ar)$
RedirectMatch 403 ^/web/.*\.ph(p[3457]?|t|tml|ar)$
RedirectMatch 403 ^/app/config/.*\.yml(\.dist)?$
# http://my.chamilo.net/certificates/?id=123 to http://my.chamilo.net/certificates/index.php?id=123
RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^certificates/$ certificates/index.php?id=%1 [L]
# Course redirection
RewriteRule ^courses/([^/]+)/?$ main/course_home/course_home.php?cDir=$1 [QSA,L]
RewriteRule ^courses/([^/]+)/index.php$ main/course_home/course_home.php?cDir=$1 [QSA,L]
# Rewrite everything in the scorm folder of a course to the download script
# except JS, CSS and some image files, which can be served directly
RewriteRule ^courses/([^/]+)/scorm/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$ app/courses/$1/scorm/$2 [QSA,L]
RewriteRule ^courses/([^/]+)/scorm/(.*)$ main/document/download_scorm.php?doc_url=/$2&cDir=$1 [QSA,L]
# Rewrite everything in the document folder of a course to the download script
# Except certificate resources, which might need to be accessible publicly to all
RewriteRule ^courses/([^/]+)/document/certificates/(.*)$ app/courses/$1/document/certificates/$2 [QSA,L]
# Note : since version 2.4.38-3 of Apache a security fix had a side effect that made redirection with space not to work.
# To fix this issue we did not have a common syntaxis but it work with one of those 2 options :
# changing at the end of the following line [QSA,L] for [QSA,L,B=\x20?] or for "[QSA,L,B= ?,BNP]"
RewriteRule ^courses/([^/]+)/document/(.*)$ main/document/download.php?doc_url=/$2&cDir=$1 [QSA,L]
# Optimize load of custom per-course icons in courses (avoid download_uploaded_files.php)
RewriteRule ^courses/([^/]+)/upload/course_home_icons/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$ app/courses/$1/upload/course_home_icons/$2 [QSA,L]
# Course upload files
# Note : since version 2.4.38-3 of Apache a security fix had a side effect that made redirection with space not to work.
# To fix this issue we did not have a common syntaxis but it work with one of those 2 options :
# changing at the end of the following line [QSA,L] for [QSA,L,B=\x20?] or for "[QSA,L,B= ?,BNP]"
RewriteRule ^courses/([^/]+)/upload/([^/]+)/(.*)$ main/document/download_uploaded_files.php?code=$1&type=$2&file=$3 [QSA,L]
# Rewrite everything in the work folder
# Note : since version 2.4.38-3 of Apache a security fix had a side effect that made redirection with space not to work.
# To fix this issue we did not have a common syntaxis but it work with one of those 2 options :
# changing at the end of the following line [QSA,L] for [QSA,L,B=\x20?] or for "[QSA,L,B= ?,BNP]"
RewriteRule ^courses/([^/]+)/work/(.*)$ main/work/download.php?file=work/$2&cDir=$1 [QSA,L]
RewriteRule ^courses/([^/]+)/course-pic85x85.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_source [QSA,L]
RewriteRule ^courses/([^/]+)/course-pic.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_image_large_source [QSA,L]
RewriteRule ^courses/([^/]+)/course-email-pic-cropped.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_email_image_source [QSA,L]
RewriteRule ^courses/([^/]+)/course-email-pic.png$ main/inc/ajax/course.ajax.php?a=get_course_image&code=$1&image=course_email_image_large_source [QSA,L]
# Redirect all courses/ to app/courses/
RewriteRule ^courses/([^/]+)/(.*)$ app/courses/$1/$2 [QSA,L]
# About session
RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [QSA,L]
# About course
RewriteRule ^course/(\d{1,})/about/?$ main/course_info/about.php?course_id=$1 [QSA,L]
# Issued individual badge friendly URL
RewriteRule ^badge/(\d{1,})/?$ main/badge/issued.php?issue=$1 [QSA,L]
# Issued badges friendly URL
RewriteRule ^skill/(\d{1,})/user/(\d{1,})/?$ main/badge/issued_all.php?skill=$1&user=$2 [L]
# Support deprecated URL (avoid 404)
RewriteRule ^badge/(\d{1,})/user/(\d{1,})/?$ main/badge/issued_all.php?skill=$1&user=$2 [L]
# Support old URLs using the exercice (with a c) folder rather than exercise
RewriteRule ^main/exercice/(.*)$ main/exercise/$1 [QSA,L]
# Support old URLs using the newscorm folder rather than lp
RewriteRule ^main/newscorm/(.*)$ main/lp/$1 [QSA,L]
# service Information
RewriteRule ^service/(\d{1,})$ plugin/buycourses/src/service_information.php?service_id=$1 [L]
# LTI outcome service
RewriteRule ^lti/os$ plugin/ims_lti/outcome_service.php [L]
# Deny direct access to user my files
# Note : since version 2.4.38-3 of Apache a security fix had a side effect that made redirection with space not to work.
# To fix this issue we did not have a common syntaxis but it work with one of those 2 options :
# changing at the end of the following line [QSA,L] for [QSA,L,B=\x20?] or for "[QSA,L,B= ?,BNP]"
RewriteRule ^app/upload/users/([^/]+)/([^/]+)/my_files/(.*)$ main/social/download_my_files.php?user_id=$2&file=$3 [QSA,L]
# Deny access
RewriteRule ^(tests|.git) - [F,L,NC]
# Add caching of woff font files to avoid loading 2*15KB each time with Chamilo
# default OpenSans font
AddType application/font-woff .woff .woff2
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/font-woff "access plus 1 month"
</IfModule>
# Force SSL/HTTPS
# We recommend you place this block in your VirtualHost config rather
# than uncommenting it below. However, if you have no other way,
# feel free to uncomment it, but please remember that this file will
# be overwritten during your next Chamilo update.
# Also note this will only work if you have an SSL certificate
# configured elsewhere in your Apache configuration.
#RewriteCond %{HTTPS} !=on
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#<IfModule mod_headers.c>
# Header always set Content-Security-Policy "upgrade-insecure-requests;"
#</IfModule>
# Disallow direct access to /main/inc/lib/javascript/bigupload/files
RedirectMatch 403 ^/main/inc/lib/javascript/bigupload/files
# Disallow MIME sniffing to prevent XSS from unknown/incorrect file extensions
<IfModule mod_headers.c>
Header always set X-Content-Type-Options nosniff
</IfModule>
<Files "web.config">
Require all denied
</Files>
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>

97
.php-cs-fixer.dist.php Normal file
View File

@@ -0,0 +1,97 @@
<?php
$header = '/* For licensing terms, see /license.txt */';
$rules = [
'@Symfony' => true,
//'@Symfony:risky' => true,
'array_syntax' => [
'syntax' => 'short',
],
/*'header_comment' => [
'header' => $header,
],*/
'blank_line_after_opening_tag' => false,
'no_extra_blank_lines' => true,
'multiline_comment_opening_closing' => true,
'yoda_style' => false,
'phpdoc_to_comment' => false,
'phpdoc_no_package' => false,
'phpdoc_annotation_without_dot' => false,
'increment_style' => ['style' => 'post'],
'no_useless_else' => false,
//'no_php4_constructor' => true,
'single_quote' => false,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'no_break_comment' => true,
//'@PHP56Migration' => true,
//'@PHP56Migration:risky' => true,
//'@PHPUnit57Migration:risky' => true,
// To be tested before insertion:
// 'strict_comparison' => true,
// 'strict_param' => true,
// 'php_unit_strict' => true,
];
$finder = PhpCsFixer\Finder::create()
->exclude('app/')
->exclude('node_modules/')
->exclude('assets')
->exclude('bin')
->exclude('documentation')
->exclude('main/auth/cas/lib')
->exclude('main/auth/shibboleth')
->exclude('main/auth/openid')
->exclude('main/default_course_document')
->exclude('main/fonts')
->exclude('main/inc/lib/browser')
->exclude('main/inc/lib/freemindflashbrowser')
->exclude('main/inc/lib/internationalization_database')
->exclude('main/inc/lib/javascript')
->exclude('main/inc/lib/kses-0.2.2')
->exclude('main/inc/lib/mimetex')
->exclude('main/inc/lib/nanogong')
->exclude('main/inc/lib/nusoap')
->exclude('main/inc/lib/opengraph')
->exclude('main/inc/lib/ppt2png')
->exclude('main/inc/lib/phpseclib')
->exclude('main/inc/lib/pear')
->exclude('main/inc/lib/svg-edit')
->exclude('main/inc/lib/swfobject')
->exclude('main/inc/lib/wami-recorder')
->exclude('main/inc/lib/xajax')
->exclude('main/lp/packaging')
->exclude('main/template')
->exclude('main/img')
->exclude('main/lang')
->exclude('plugin/buycourses/src/Culqi')
->exclude('plugin/buycourses/src/Requests')
->exclude('plugin/vchamilo/cli')
->exclude('plugin/kannelsms/vendor')
->exclude('plugin/clockworksms/vendor')
->exclude('plugin/pens/lib')
->exclude('plugin/bbb/lib')
->exclude('plugin/ims_lti')
->exclude('plugin/sepe/src/wsse')
->exclude('plugin/test2pdf/class')
->exclude('plugin/jcapture/src')
->exclude('plugin/jcapture/lib')
->exclude('tests')
->exclude('var')
->exclude('vendor')
->exclude('web')
->notPath('main/admin/db.php')
->notPath('main/admin/ldap_synchro.php')
->notPath('main/chat/emoji_strategy.php')
->in(__DIR__)
;
$config = new PhpCsFixer\Config();
return $config->setRules(
$rules
)
->setFinder($finder);

3
.php-cs-fixer.php Normal file
View File

@@ -0,0 +1,3 @@
<?php
return require_once __DIR__.'/.php-cs-fixer.dist.php';

89
.scrutinizer.yml Normal file
View File

@@ -0,0 +1,89 @@
build:
nodes:
analysis:
project_setup:
override: true
tests:
override:
- php-scrutinizer-run
tests:
override:
command: "php -v"
dependencies:
override:
- "php -v"
resources:
cpus: 1
environment:
php:
version: 7.4
ini:
memory_limit: "-1"
checks:
php: true
filter:
excluded_paths:
- 'cli-config.php'
- 'app/cache/*'
- 'app/logs/*'
- 'app/config/*'
- 'app/SymfonyRequirements.php'
- 'documentation/*'
- 'app/Migrations/*'
- 'app/Resources/*'
- 'main/admin/db.php'
- 'main/admin/ldap_synchro.php'
- 'main/auth/cas/lib/*'
- 'main/auth/shibboleth/*'
- 'main/auth/openid/*'
- 'main/chat/emoji_strategy.php'
- 'main/default_course_document'
- 'main/document/Wami.swf'
- 'main/fonts/*'
- 'main/inc/ajax/Wami.swf'
- 'main/inc/lib/browser/*'
- 'main/inc/lib/freemindflashbrowser/*'
- 'main/inc/lib/internationalization_database/*'
- 'main/inc/lib/javascript/*'
- 'main/inc/lib/kses-0.2.2/*'
- 'main/inc/lib/mimetex/*'
- 'main/inc/lib/nanogong/*'
- 'main/inc/lib/nusoap/*'
- 'main/inc/lib/opengraph/*'
- 'main/inc/lib/ppt2png/*'
- 'main/inc/lib/phpseclib'
- 'main/inc/lib/pear/*'
- 'main/inc/lib/phpmailer/*'
- 'main/inc/lib/phpseclib/*'
- 'main/inc/lib/svg-edit/*'
- 'main/inc/lib/swfobject/*'
- 'main/inc/lib/mediaplayer/*'
- 'main/inc/lib/mxgraph/*'
- 'main/inc/lib/wami-recorder/*'
- 'main/inc/lib/xajax/*'
- 'main/lp/packaging/*'
- 'main/template/*'
- 'main/img/*'
- 'main/lang/*'
- 'plugin/buycourses/resources/js/*'
- 'plugin/buycourses/src/Culqi/*'
- 'plugin/buycourses/src/Requests/*'
- 'plugin/buycourses/src/paypalfunctions.php'
- 'plugin/buycourses/src/Requests.php'
- 'plugin/vchamilo/cli/*'
- 'plugin/kannelsms/vendor/*'
- 'plugin/clockworksms/vendor/*'
- 'plugin/pens/lib/*'
- 'plugin/tour/intro.js'
- 'plugin/bbb/lib/bbb_api.php'
- 'plugin/ims_lti/OAuthSimple.php'
- 'plugin/sepe/src/wsse/*'
- 'plugin/test2pdf/class/*'
- 'plugin/jcapture/lib/*'
- 'plugin/jcapture/src/*'
- 'tests/*'
- 'vendor/*'
- 'web/*'

116
.travis.yml Normal file
View File

@@ -0,0 +1,116 @@
dist: trusty
sudo: required
language: php
addons:
apt:
packages:
- apache2
- postfix
- libapache2-mod-fastcgi
- libappindicator1
- fonts-liberation
services:
- mysql
cache:
directories:
- $HOME/.composer/cache/files
php:
- 7.4
env:
global:
- VHOST_URL=localhost
- CHAMILO_VERSION=1.11.x
before_install:
#- sudo apt-get update
#- sudo apt-get install apache2 libapache2-mod-fastcgi
# Fix travis error https://github.com/travis-ci/travis-ci/issues/8607
- sudo rm -vf /etc/apt/sources.list.d/*riak*
# Get Chrome
#- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
#- sudo apt-get update
#- sudo apt-get install google-chrome-stable
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
# Get Chrome driver
- wget https://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip && unzip chromedriver_linux64.zip
- sudo mv chromedriver /usr/bin
- sudo chmod +x /usr/bin/chromedriver
# Setup display for Selenium
- sh -e /etc/init.d/xvfb start
- export DISPLAY=:99.0
- sleep 3
# Get Selenium
- wget http://selenium-release.storage.googleapis.com/3.1/selenium-server-standalone-3.1.0.jar
# Check java
- java -version
- sudo apt-get install oracle-java8-installer
- java -version
- java -jar selenium-server-standalone-3.1.0.jar -log selenium.log > /dev/null &
- nohup bash -c "webdriver-manager start 2>&1 &"
- sleep 10
# Apache & php-fpm configuration
- bash tests/travis/setup-php-fpm.sh
- bash tests/travis/setup-apache.sh
- mysqld --version
- apache2 -v
- php -v
- php -m
- php -ini | grep memory_limit
- sudo cat /etc/hosts
# Install Chash, a database, and then install Chamilo
- git clone https://github.com/chamilo/chash
- cd chash
- git checkout 0.2.x
- composer install
- php -d phar.readonly=0 createPhar.php
- chmod +x chash.phar
- sudo mv chash.phar /usr/local/bin/chash
# Download chamilo
- php -d date.timezone="Europe/Paris" chash.php chash:chamilo_install $CHAMILO_VERSION $TRAVIS_BUILD_DIR --download-package --no-interaction --only-download-package
- cd $TRAVIS_BUILD_DIR
- pwd
# Install vendors
- travis_wait 30 composer install
# Install chamilo
- php -d date.timezone="Europe/Paris" $TRAVIS_BUILD_DIR/chash/chash.php chash:chamilo_install $CHAMILO_VERSION $TRAVIS_BUILD_DIR --no-interaction --sitename="Chamilo" --site_url="http://$VHOST_URL/" --institution="Chamilo" --institution_url="https://chamilo.org" --encrypt_method="sha1" --firstname="John" --lastname="Doe" --language="english" --driver="pdo_mysql" --host="localhost" --port="3306" --dbname="chamilo" --dbuser="root" --permissions_for_new_directories="0777" --permissions_for_new_files="0666" --linux-user="www-data" --linux-group="www-data" --username="admin" --password="admin" --email="admin@example.com" --phone="555-5555"
- sudo chmod -R 777 app/cache app/logs app/courses app/upload web
# Check chamilo status
- php -d date.timezone="Europe/Paris" $TRAVIS_BUILD_DIR/chash/chash.php chash:chamilo_status
- ls -la
# Permissions
- sudo chown -R www-data:www-data $TRAVIS_BUILD_DIR
- sudo chown -R 775 $TRAVIS_BUILD_DIR
- bash tests/travis/post_installation.sh
- sudo chmod +x /home/travis/build
- sudo service apache2 restart
# Check the result of index.php and check if main.js is build in travis
- curl $VHOST_URL
- ls -la web/build
script:
# - whereis google-chrome-stable
# - google-chrome-stable --version
# - whereis chromedriver
# - chromedriver --version
- cd tests/behat
- pwd
- travis_wait 45 ../../vendor/behat/behat/bin/behat -vv
# - sudo cat /var/log/apache2/$VHOST_URL-access.log
after_failure:
- sudo apache2ctl -M
- sudo cat /var/log/apache2/error.log
# configure notifications (email, IRC, campfire etc)
notifications:
# IRC notifications - disabled for creating a lot of noise on the channel
irc: "irc.freenode.org#chamilodev"
slack:
secure: qVu1BH+UBset9e+v5Qm4UNgAPUdZyEsI+BsVbhBoNZ3h/Qfq/0gb/+EAbffEf5BWTBIMJwVo3f8y6+sszMPgyBSriu8BoGqtQ8OZelLnw0/yTDRnNzbZQhbc+Sszqr1X+Dzz4xjLdW5LsqoIhPQTwoMemh/hT+Vz8O/rp9tVWts=

76
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at info@chamilo.org. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

113
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,113 @@
Contributing
------------
Chamilo LMS is a free software, community-driven project.
Chamilo LMS is an LAMP-based e-learning web platform that focuses on providing an easy-to-use
environment for teachers to improve both the quality and availability of their
educational material, and on providing students with an awesome learning platform.
Before you report an issue, please check the [official Chamilo documentation](https://docs.chamilo.org) (not always up to date)
We are a relatively small development team and greatly welcome any contribution
from the outside world, although we will thoroughly review them before integration,
to make sure they do not introduce security vulnerabilities or degrade the ease
of use of the platform.
The 1.11.x (that you're currently looking at) is a development branch for the
1.11.0 release, that we hope to be releasing around mid-2015. It is a
transitional version that partially uses a series of Symfony 2 modules but relies
heavily on Composer to manage the dependencies towards common libraries. Version
2.0 has already been worked a lot on, and has served as an inspiration for 1.11.0,
but due to the huge success of the 1.9.x and 1.10.x series, we decided to take a transitional
step towards 2.0 to ensure a smooth migration of all our user base to the newer
version (to be released sometime in 2024).
# Contributing patches or new features
If you'd like to contribute to this project, please read the following document:
* [Coding conventions][1]: The main conventions document
* [PSR-1][2]: PSR-1 are standard conventions rules we use as a base (conversion of old code still in progress)
* [PSR-2][3]: PSR-2 are more detailed standard conventions rules we use as base (conversion of old code still in progress)
In short, we expect contributions to be sent through Pull Requests, a very clean feature of Github.
We recommend you follow this guide to understand a little more about the way it works:
https://guides.github.com/activities/contributing-to-open-source/
## Testing new features
As new major features are added, automated tests should be added that ensure that the feature continues to work in the foreseeable future.
In Chamilo, we rely on "Behat":http://docs.behat.org/en/latest/ to do Automated Behaviour Testing. You can find examples and information on how to run Behat tests in the tests/behat/ folder of your Chamilo installation.
Tests are run automatically for every new contribution, courtesy of "Travis-CI":https://travis-ci.org/, so you can follow your feature in time and see whether something breaks it. Check the Chamilo tests URL here: https://travis-ci.org/chamilo/chamilo-lms
# Making changes to the database
If your changes require database changes, here are a few instructions on how to
proceed. You will then need to submit these changes as explained above.
## Database structure changes
If your changes are about structure, you want to follow these steps:
1. Create or modify an entity in src/Chamilo/CoreBundle/Entity/
2. Create a new Migration in src/Chamilo/CoreBundle/Migrations/Schema/V110/
This second step is most easily done by copying one of the current migration
files in that directory. For example, if you're doing it on the 14th of July 2015 at noon:
1. Copy Version20150527120703.php to Version20150714120000.php
2. Edit the file and change any "20150527120703" you find to "20150714120000"
3. Check it works by issuing an update command from the command line:
```
php bin/doctrine.php migrations:execute 20150714120000 --up --configuration=app/config/migrations.yml
```
## Database data changes
If you only want to change the *data* in the database, then you don't need to
modify or create an entity, but you will still need to follow these two steps:
1. Modify the main/install/data.sql file (at the end, add a new section before the chamilo_database_version update
2. Create a new Migration in src/Chamilo/CoreBundle/Migrations/Schema/V110/ (see above section for details)
# Testing through Docker
We are working on an official (production) image of Chamilo LMS for Docker.
In the meantime, you can test development versions following more or less this procedure:
```
host$ composer run -it ubuntu:14.04.2
root@docker$ apt-get update
root@docker$ apt-get install -y git vim libapache2-mod-php5 php5-mysql php5-gd php5-intl php5-curl curl mysql-server mysql-client
```
Pick a password for the MySQL server and enter it twice, when prompted.
```
root@docker$ cd /var/www
root@docker$ rm -rf html
root@docker$ git clone --single-branch -b 1.10.0-beta https://github.com/chamilo/chamilo-lms.git html
root@docker$ cd html
root@docker$ chmod -R 0777 app/ vendor/ main/lang/ main/default_course_document/images/ web/
root@docker$ vim /etc/php5/apache2/php.ini
```
Look for timezone and modify it to the best timezone that suits you:
```
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
date.timezone = Europe/Brussels
```
Save and exit.
```
root@docker$ service apache2 reload
root@docker$ service mysql start
root@docker$ ifconfig | grep inet
```
Now you should be able to load Chamilo in your host machine's browser by loading the IP address showing on the first
line of this command's results (and proceed with the installation on the MySQL server you configured above).
[1]: https://support.chamilo.org/projects/chamilo-18/wiki/Coding_conventions
[2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
[3]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

674
LICENSE Normal file
View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

207
README.md
View File

@@ -0,0 +1,207 @@
# Chamilo 1.11.x
![PHP Composer](https://github.com/chamilo/chamilo-lms/workflows/PHP%20Composer/badge.svg?branch=1.11.x)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/chamilo/chamilo-lms/badges/quality-score.png?b=1.11.x)](https://scrutinizer-ci.com/g/chamilo/chamilo-lms/?branch=1.11.x)
[![Bountysource](https://www.bountysource.com/badge/team?team_id=12439&style=raised)](https://www.bountysource.com/teams/chamilo?utm_source=chamilo&utm_medium=shield&utm_campaign=raised)
[![Code Consistency](https://squizlabs.github.io/PHP_CodeSniffer/analysis/chamilo/chamilo-lms/grade.svg)](http://squizlabs.github.io/PHP_CodeSniffer/analysis/chamilo/chamilo-lms/)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/166/badge)](https://bestpractices.coreinfrastructure.org/projects/166)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/88e934aab2f34bb7a0397a6f62b078b2)](https://www.codacy.com/app/chamilo/chamilo-lms?utm_source=github.com&utm_medium=referral&utm_content=chamilo/chamilo-lms&utm_campaign=badger)
## Installation
This installation guide is for development environments only.
### Install PHP, a web server and MySQL/MariaDB
To run Chamilo, you will need at least a web server (we recommend Apache2 for commodity reasons), a database server (we recommend MariaDB but will explain MySQL for commodity reasons) and a PHP interpreter (and a series of libraries for it). If you are working on a Debian-based system (Debian, Ubuntu, Mint, etc), just
type
```
sudo apt-get install apache2 mysql-server php libapache2-mod-php php-gd php-intl php-curl php-json php-mysql php-zip composer
```
### Install Git
The development version 1.11.x requires you to have Git installed. If you are working on a Debian-based system (Debian, Ubuntu, Mint, etc), just type
```
sudo apt-get install git
```
### Install Composer
To run the development version 1.11.x, you need Composer, a libraries dependency management system that will update all the libraries you need for Chamilo to the latest available version.
Make sure you have Composer installed. If you do, you should be able to launch "composer" on the command line and have the inline help of composer show a few subcommands. If you don't, please follow the installation guide at https://getcomposer.org/download/
### Download Chamilo from GitHub
Clone the repository
```
sudo mkdir chamilo-1.11
sudo chown -R `whoami` chamilo-1.11
git clone -b 1.11.x --single-branch https://github.com/chamilo/chamilo-lms.git chamilo-1.11
```
Checkout branch 1.11.x
```
cd chamilo-1.11
git checkout --track origin/1.11.x
git config --global push.default current
```
### Update dependencies using Composer
From the Chamilo folder (in which you should be now if you followed the previous steps), launch:
```
composer update
```
If you face issues related to missing JS libraries, you might need to ensure
that your web/assets folder is completely re-generated.
Use this set of commands to do that:
```
rm composer.lock
rm -rf web/ vendor/
composer clear-cache
composer update
```
This will take several minutes in the best case scenario, but should definitely
generate the missing files.
### Change permissions
On a Debian-based system, launch:
```
sudo chown -R www-data:www-data app main/default_course_document/images main/lang web
```
### Configure the web server
Enable the Apache web server module "rewrite" :
```
sudo a2enmod rewrite
sudo systemctl restart apache2.service
```
Chamilo's .htaccess must be obeyed.
Create /etc/apache2/conf-available/htaccessForChamilo.conf with these lines :
```
<Directory /var/www/html/chamilo-lms>
AllowOverride All
</Directory>
```
then enable it :
```
sudo a2enconf htaccessForChamilo
sudo systemctl reload apache2.service
```
If you just installed missing PHP extensions using apt, you must restart the web server to get them loaded :
```
sudo systemctl restart apache2.service
```
### Start the installer
In your browser, load the Chamilo URL. You should be automatically redirected
to the installer. If not, add the "main/install/index.php" suffix manually in
your browser address bar. The rest should be a matter of simple
OK > Next > OK > Next...
## Upgrade from 1.10.x
1.11.0 is a major version. It contains a series of new features, that
also mean a series of new database changes in regards with versions 1.10.x. As
such, it is necessary to go through an upgrade procedure when upgrading from
1.10.x to 1.11.x.
The upgrade procedure is relatively straightforward. If you have a 1.10.x
initially installed with Git, here are the steps you should follow
(considering you are already inside the Chamilo folder):
```
git fetch --all
git checkout origin 1.11.x
```
Then load the Chamilo URL in your browser, adding "main/install/index.php" and
follow the upgrade instructions. Select the "Upgrade from 1.10.x" button to
proceed.
If you have previously updated database rows manually, you might face issue with
FOREIGN KEYS during the upgrade process. Please make sure your database is
consistent before upgrading. This usually means making sure that you have to delete
rows from tables referring to rows which have been deleted from the user or access_url tables.
Typically:
<pre>
DELETE FROM access_url_rel_course WHERE access_url_id NOT IN (SELECT id FROM access_url);
</pre>
### Upgrading from non-Git Chamilo 1.10 ###
In the *very unlikely* case of upgrading a "normal" Chamilo 1.10 installation (done with the downloadable zip package) to a Git-based installation, make sure you delete the contents of a few folders first. These folders are re-generated later by the ```composer update``` command. This is likely to increase the downtime of your Chamilo portal of a few additional minutes (plan for 10 minutes on a reasonnable internet connection).
```
rm composer.lock
rm -rf web/*
rm -rf vendor/*
```
# For developers and testers only
This section is for developers only (or for people who have a good reason to use
a development version of Chamilo), in the sense that other people will not
need to update their Chamilo portal as described here.
## Updating code
To update your code with the latest developments in the 1.11.x branch, go to
your Chamilo folder and type:
```
git pull origin 1.11.x
```
If you have made customizations to your code before the update, you will have
two options:
- abandon your changes (use "git stash" to do that)
- commit your changes locally and merge (use "git commit" and then "git pull")
You are supposed to have a reasonable understanding of Git in order to
use Chamilo as a developer, so if you feel lost, please check the Git manual
first: http://git-scm.com/documentation
## Updating your database from new code
Since the 2015-05-27, Chamilo offers the possibility to make partial database
upgrades through Doctrine migrations.
To update your database to the latest version, go to your Chamilo root folder
and type
```
php bin/doctrine.php migrations:migrate --configuration=app/config/migrations.yml
```
If you want to proceed with a single migration "step" (the steps reside in
src/Chamilo/CoreBundle/Migrations/Schema/V110/), then check the datetime of the
version and type the following (assuming you want to execute Version20150527120703)
```
php bin/doctrine.php migrations:execute 20150527120703 --up --configuration=app/config/migrations.yml
```
You can also print the differences between your database and what it should be by issuing the following command from the Chamilo base folder:
```
php bin/doctrine.php orm:schema-tool:update --dump-sql
```
## Contributing
If you want to submit new features or patches to Chamilo, please follow the
Github contribution guide https://guides.github.com/activities/contributing-to-open-source/
and our CONTRIBUTING.md file.
In short, we ask you to send us Pull Requests based on a branch that you create
with this purpose into your repository forked from the original Chamilo repository.
# Documentation
For more information on Chamilo, visit https://1.11.chamilo.org/documentation/index.html

BIN
apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

47
bower.json Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "ChamiloLMS",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"bootstrap": "3.*",
"bootstrap-select": "1.13.*",
"fontawesome": "4.7.*",
"jquery": "2.2.*",
"jquery-ui": "1.12.*",
"bootstrap-daterangepicker": "2.1.*",
"ckeditor": "4.6.2",
"jquery-timeago": "1.4.*",
"mediaelement": "^4.2.16",
"modernizr": "2.8.*",
"jqueryui-timepicker-addon": "1.5.*",
"image-map-resizer": "0.5.*",
"fullcalendar": "3.1.0",
"simpleWebRTC": "2.2.*",
"select2": "4.*",
"MathJax": "2.7.*",
"webcamjs": "1.0.*",
"cropper": "1.0.*",
"jquery.scrollbar": "0.2.*",
"jquery-file-upload": "*",
"readmore-js": "2.1.0",
"qtip2": "*",
"js-cookie": "2.1.*",
"flag-icon-css": "*",
"jquery.easy-pie-chart": "^2.1.6",
"chartjs-plugin-labels": "^1.1",
"jqueryui-touch-punch": "*",
"multiselect-two-sides": "2.5.*",
"bootstrap-year-calendar": "1.1.*",
"datepair": "*",
"jt.timepicker": "*",
"keyboard": "^1.28.7"
},
"resolutions": {
"jquery": "2.1.4"
}
}

44
cli-config.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script needed to execute bin/doctrine.php in the command line
* in order to:.
*
* - Generate migrations
* - Create schema
* - Update schema
* - Validate schema
* - Etc
*/
use Doctrine\ORM\Tools\Console\ConsoleRunner;
require_once __DIR__.'/vendor/autoload.php';
//require_once __DIR__.'/main/inc/lib/api.lib.php';
$configurationFile = __DIR__.'/app/config/configuration.php';
if (!is_file($configurationFile)) {
echo "File does not exists: $configurationFile";
exit();
}
require_once __DIR__.'/main/inc/global.inc.php';
require_once $configurationFile;
$database = new \Database();
$dbParams = [
'driver' => 'pdo_mysql',
'host' => $_configuration['db_host'],
'user' => $_configuration['db_user'],
'password' => $_configuration['db_password'],
'dbname' => $_configuration['main_database'],
];
$database->connect($dbParams, realpath(__DIR__).'/', realpath(__DIR__).'/');
$entityManager = $database::getManager();
$helperSet = ConsoleRunner::createHelperSet($entityManager);
$dialogHelper = new Symfony\Component\Console\Helper\QuestionHelper();
$helperSet->set($dialogHelper);
return $helperSet;

52
codesize.xml Normal file
View File

@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<ruleset name="Chamilo rule set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Chamilo rule set.
</description>
<!-- Import the entire unused code rule set -->
<rule ref="rulesets/cleancode.xml">
<exclude name="BooleanArgumentFlag" />
<exclude name="StaticAccess" />
</rule>
<!--
Import the entire cyclomatic complexity rule and
customize the rule configuration.
-->
<rule ref="rulesets/codesize.xml">
<exclude name="TooManyPublicMethods" />
<exclude name="TooManyFields" />
<exclude name="TooManyMethods" />
<exclude name="CyclomaticComplexity" />
<exclude name="ExcessiveMethodLength" />
<exclude name="ExcessiveClassLength" />
<exclude name="ExcessivePublicCount" />
<exclude name="ExcessiveClassComplexity" />
</rule>
<rule ref="rulesets/controversial.xml" >
<exclude name="Superglobals" />
</rule>
<rule ref="rulesets/design.xml" >
<exclude name="WeightedMethodCount" />
<exclude name="ExitExpression" />
</rule>
<!-- Import entire naming rule set and exclude rules -->
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
<exclude name="LongVariable" />
<exclude name="ShortMethodName" />
</rule>
<rule ref="rulesets/unusedcode.xml" />
</ruleset>

203
composer.json Normal file
View File

@@ -0,0 +1,203 @@
{
"name": "chamilo/chamilo-lms",
"description": "E-learning and collaboration software",
"type": "project",
"homepage": "http://www.chamilo.org",
"license": "GPL-3.0",
"support": {
"docs": "https://docs.chamilo.org/",
"forum": "https://forum.chamilo.org/",
"issues": "https://github.com/chamilo/chamilo-lms/issues",
"source": "https://github.com/chamilo/chamilo-lms"
},
"autoload": {
"psr-4": {
"Application\\": "app/",
"Chamilo\\": "src/Chamilo/"
},
"classmap": [
"main/admin",
"main/auth",
"main/course_description",
"main/cron/lang",
"main/dropbox",
"main/exercise",
"main/gradebook/lib",
"main/inc/lib",
"main/inc/lib/hook",
"main/install",
"main/lp",
"main/survey",
"main/common_cartridge/export",
"main/common_cartridge/import",
"plugin"
]
},
"require": {
"php": "^7.4",
"ext-curl": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"ext-zip": "*",
"ext-zlib": "*",
"angelfqc/vimeo-api": "2.0.6",
"apereo/phpcas": "^1.6",
"brumann/polyfill-unserialize": "^1.0",
"chamilo/pclzip": "~2.8",
"clue/graph": "~0.9.0",
"culqi/culqi-php": "1.3.4",
"ddeboer/data-import": "@stable",
"doctrine/data-fixtures": "~1.0@dev",
"doctrine/dbal": "~2.5",
"doctrine/migrations": "~1.0@dev",
"doctrine/orm": "~2.5",
"emojione/emojione": "1.3.0",
"endroid/qr-code": "2.5.*",
"enshrined/svg-sanitize": "^0.16.0",
"essence/essence": "2.6.1",
"ezyang/htmlpurifier": "~4.9",
"facebook/php-sdk-v4": "~5.0",
"firebase/php-jwt": "~5.0",
"gedmo/doctrine-extensions": "~2.3",
"graphp/algorithms": "~0.8.0",
"graphp/graphviz": "~0.2.0",
"guzzlehttp/guzzle": "~6.0",
"h5p/h5p-core": "*",
"imagine/imagine": "0.6.3",
"ircmaxell/password-compat": "~1.0.4",
"jbroadway/urlify": "1.1.0-stable",
"jeroendesloovere/vcard": "~1.7",
"jimmiw/php-time-ago": "0.4.15",
"kigkonsult/icalcreator": "2.24",
"knplabs/doctrine-behaviors": "~1.1",
"knplabs/gaufrette": "~0.3",
"knplabs/knp-components": "~1.3",
"league/csv": "~8.0",
"media-alchemyst/media-alchemyst": "~0.5",
"michelf/php-markdown": "~1.7",
"monolog/monolog": "~1.0",
"mpdf/mpdf": "^8.0",
"ocramius/proxy-manager": "~1.0|2.0.*",
"onelogin/php-saml": "^3.0",
"paragonie/random-lib": "2.0.0",
"patchwork/utf8": "~1.2",
"php-ffmpeg/php-ffmpeg": "0.5.1",
"php-http/guzzle6-adapter": "^2.0",
"php-xapi/client": "0.7.x-dev",
"php-xapi/repository-api": "dev-master as 0.3.1",
"php-xapi/repository-doctrine": "dev-master",
"php-xapi/symfony-serializer": "2.1.0 as 2.0",
"phpmailer/phpmailer": "~6.1",
"phpoffice/phpexcel": "~1.8",
"phpoffice/phpword": "~0.14",
"phpseclib/phpseclib": "^2.0",
"robrichards/xmlseclibs": "3.0.*",
"sabre/vobject": "~3.1",
"sonata-project/admin-bundle": "~3.1|~4.0",
"sonata-project/core-bundle": "~3.1|~4.0",
"sonata-project/user-bundle": "~3.0|~4.0",
"stripe/stripe-php": "*",
"studio-42/elfinder": "2.1.*",
"sunra/php-simple-html-dom-parser": "~1.5.0",
"sylius/attribute": "0.13.0",
"sylius/translation": "0.13.0",
"symfony/console": "~3.0|~4.0",
"symfony/doctrine-bridge": "~2.8",
"symfony/dom-crawler": "~3.4|~4.0",
"symfony/filesystem": "~3.0|~4.0",
"symfony/http-foundation": "~2.8|~3.0",
"symfony/security": "~3.0|~4.0",
"symfony/serializer": "~3.0|~4.0",
"symfony/validator": "~3.0|~4.0",
"symfony/yaml": "~3.0|~4.0",
"szymach/c-pchart": "~3.0",
"thenetworg/oauth2-azure": "^1.4",
"twig/extensions": "~1.0",
"twig/twig": "1.*",
"webit/eval-math": "1.0.1",
"yuloh/bccomp-polyfill": "dev-master",
"packbackbooks/lti-1p3-tool": "1.1.1.x-dev",
"zendframework/zend-config": "~3.0",
"zendframework/zend-feed": "~2.6|^3.0",
"zendframework/zend-http": "~2.6|^3.0",
"zendframework/zend-soap": "~2.6|^3.0"
},
"require-dev": {
"behat/behat": "~3.5",
"behat/mink": "1.7.1",
"behat/mink-extension": "*",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium2-driver": "*",
"phpunit/phpunit": "*"
},
"scripts": {
"pre-install-cmd": [
"Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x"
],
"pre-update-cmd": [
"Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x"
],
"post-install-cmd": [
"Chamilo\\CoreBundle\\Composer\\ScriptHandler::dumpCssFiles",
"Chamilo\\CoreBundle\\Composer\\ScriptHandler::generateDoctrineProxies"
],
"post-update-cmd": [
"Chamilo\\CoreBundle\\Composer\\ScriptHandler::dumpCssFiles",
"Chamilo\\CoreBundle\\Composer\\ScriptHandler::generateDoctrineProxies"
],
"update-css": "Chamilo\\CoreBundle\\Composer\\ScriptHandler::updateCss"
},
"extra": {
"asset-installer-paths": {
"bower-asset-library": "web/assets/"
},
"branch-alias": {
"dev-master": "1.11.x-dev"
},
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"symfony-app-dir": "app",
"symfony-assets-install": "relative",
"symfony-bin-dir": "bin",
"symfony-tests-dir": "tests",
"symfony-web-dir": "web"
},
"repositories": [
{
"type": "github",
"url": "https://github.com/AngelFQC/vimeo.php.git",
"no-api": true
},
{
"type": "github",
"url": "https://github.com/AngelFQC/xapi-model.git",
"no-api": true
},
{
"type": "github",
"url": "https://github.com/AngelFQC/xapi-repository-doctrine.git",
"no-api": true
},
{
"type": "github",
"url": "https://github.com/AngelFQC/xapi-symfony-serializer.git",
"no-api": true
},
{
"type": "github",
"url": "https://github.com/chamilo/lti-1-3-php-library.git",
"no-api": true
}
],
"config": {
"sort-packages": true,
"component-dir": "web/assets"
}
}

16120
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

228
index.php Normal file
View File

@@ -0,0 +1,228 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* @package chamilo.main
*/
define('CHAMILO_HOMEPAGE', true);
define('CHAMILO_LOAD_WYSIWYG', false);
/* Flag forcing the 'current course' reset, as we're not inside a course anymore. */
// Maybe we should change this into an api function? an example: CourseManager::unset();
$cidReset = true;
require_once 'main/inc/global.inc.php';
// The section (for the tabs).
$this_section = SECTION_CAMPUS; //rewritten below if including HTML file
$includeFile = !empty($_GET['include']);
if ($includeFile) {
$this_section = SECTION_INCLUDE;
} elseif (api_get_configuration_value('plugin_redirection_enabled')) {
RedirectionPlugin::redirectUser(api_get_user_id());
}
$header_title = null;
if (!api_is_anonymous()) {
$header_title = ' ';
}
$controller = new IndexManager($header_title);
//Actions
$loginFailed = isset($_GET['loginFailed']) ? true : isset($loginFailed);
if (!empty($_GET['logout'])) {
$redirect = !empty($_GET['no_redirect']) ? false : true;
// pass $logoutInfo defined in local.inc.php
$controller->logout($redirect, $logoutInfo);
}
/**
* Registers in the track_e_default table (view in important activities in admin
* interface) a possible attempted break in, sending auth data through get.
*
* @todo This piece of code should probably move to local.inc.php where the
* actual login / logout procedure is handled.
* The real use of this code block should be seriously considered as well.
* This form should just use a security token and get done with it.
*/
if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) {
$i = api_get_anonymous_id();
Event::addEvent(
LOG_ATTEMPTED_FORCED_LOGIN,
'tried_hacking_get',
$_SERVER['REMOTE_ADDR'].(empty($_POST['login']) ? '' : '/'.$_POST['login']),
null,
$i
);
echo 'Attempted breakin - sysadmins notified.';
session_destroy();
exit();
}
// Delete session item necessary to check for legal terms
if (api_get_setting('allow_terms_conditions') === 'true') {
Session::erase('term_and_condition');
}
//If we are not logged in and customapages activated
if (!api_user_is_login() && CustomPages::enabled()) {
if (Request::get('loggedout')) {
CustomPages::display(CustomPages::LOGGED_OUT);
} else {
CustomPages::display(CustomPages::INDEX_UNLOGGED);
}
}
/**
* @todo This piece of code should probably move to local.inc.php where the
* actual login procedure is handled.
* @todo Check if this code is used. I think this code is never executed because
* after clicking the submit button the code does the stuff
* in local.inc.php and then redirects to index.php or user_portal.php depending
* on api_get_setting('page_after_login').
*/
if (!empty($_POST['submitAuth'])) {
// The user has been already authenticated, we are now to find the last login of the user.
if (isset($_user['user_id'])) {
$track_login_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = "SELECT UNIX_TIMESTAMP(login_date)
FROM $track_login_table
WHERE login_user_id = '".$_user['user_id']."'
ORDER BY login_date DESC LIMIT 1";
$result_last_login = Database::query($sql);
if (!$result_last_login) {
if (Database::num_rows($result_last_login) > 0) {
$user_last_login_datetime = Database::fetch_array($result_last_login);
$user_last_login_datetime = $user_last_login_datetime[0];
Session::write('user_last_login_datetime', $user_last_login_datetime);
}
}
}
} else {
// Only if login form was not sent because if the form is sent the user was already on the page.
Event::open();
}
if (!api_is_anonymous()) {
$url = api_get_configuration_value('redirect_index_to_url_for_logged_users');
if (!empty($url)) {
header("Location: $url");
exit;
}
}
if (api_get_setting('display_categories_on_homepage') === 'true') {
$controller->tpl->assign('course_category_block', $controller->return_courses_in_categories());
}
$controller->set_login_form();
//@todo move this inside the IndexManager
if (!api_is_anonymous()) {
$controller->tpl->assign('profile_block', $controller->return_profile_block());
$controller->tpl->assign('user_image_block', $controller->return_user_image_block());
$controller->tpl->assign('course_block', $controller->return_course_block());
}
$hotCourses = '';
$announcements_block = '';
// Display the Site Use Cookie Warning Validation
$useCookieValidation = api_get_setting('cookie_warning');
if ($useCookieValidation === 'true') {
if (!api_site_use_cookie_warning_cookie_exist()) {
if (Template::isToolBarDisplayedForUser()) {
$controller->tpl->assign('toolBarDisplayed', true);
} else {
$controller->tpl->assign('toolBarDisplayed', false);
}
$controller->tpl->enableCookieUsageWarning();
}
}
// When loading a chamilo page do not include the hot courses and news
if (!isset($_REQUEST['include'])) {
if (api_get_setting('show_hot_courses') == 'true') {
if (api_get_configuration_value('popular_courses_handpicked')) {
// If the option has been set correctly, use the courses manually
// marked as popular rather than the ones marked by users
$hotCourses = $controller->returnPopularCoursesHandPicked();
} else {
$hotCourses = $controller->return_hot_courses();
}
}
$announcements_block = $controller->return_announcements();
if (api_get_configuration_value('course_catalog_display_in_home')
&& ('true' === api_get_setting('course_catalog_published') || !api_is_anonymous())
) {
$userCanViewPage = CoursesAndSessionsCatalog::userCanView();
if (CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) {
$announcements_block .= $userCanViewPage ? CoursesAndSessionsCatalog::sessionList(true) : '';
} else {
$announcements_block .= $userCanViewPage
? CoursesAndSessionsCatalog::displayCoursesList('display_courses', '', '', true)
: '';
}
}
}
if (api_get_configuration_value('show_hot_sessions') === true) {
$hotSessions = SessionManager::getHotSessions();
$controller->tpl->assign('hot_sessions', $hotSessions);
}
$controller->tpl->assign('hot_courses', $hotCourses);
$controller->tpl->assign('announcements_block', $announcements_block);
$allowJustification = api_get_plugin_setting('justification', 'tool_enable') === 'true';
$justification = '';
if ($allowJustification) {
$plugin = Justification::create();
$courseId = api_get_plugin_setting('justification', 'default_course_id');
if (!empty($courseId)) {
$courseInfo = api_get_course_info_by_id($courseId);
$link = Display::url($plugin->get_lang('SubscribeToASession'), $courseInfo['course_public_url']);
$justification = Display::return_message($link, 'info', false);
}
}
if ($includeFile) {
// If we are including a static page, then home_welcome is empty
$controller->tpl->assign('home_welcome', $justification);
$controller->tpl->assign('home_include', $controller->return_home_page($includeFile));
} else {
// If we are including the real homepage, then home_include is empty
$controller->tpl->assign('home_welcome', $justification.$controller->return_home_page(false));
$controller->tpl->assign('home_include', '');
}
$controller->tpl->assign('navigation_links', $controller->return_navigation_links());
$controller->tpl->assign('notice_block', $controller->return_notice());
$controller->tpl->assign('help_block', $controller->return_help());
$controller->tpl->assign('student_publication_block', $controller->studentPublicationBlock());
if (api_is_platform_admin() || api_is_drh()) {
$controller->tpl->assign('skills_block', $controller->returnSkillLinks());
}
if (api_is_anonymous()) {
$controller->tpl->setLoginBodyClass();
}
// direct login to course
if (isset($_GET['firstpage'])) {
$firstPage = $_GET['firstpage'];
$courseInfo = api_get_course_info($firstPage);
if (!empty($courseInfo)) {
api_set_firstpage_parameter($firstPage);
// if we are already logged, go directly to course
if (api_user_is_login()) {
echo "<script>self.location.href='index.php?firstpage=".Security::remove_XSS($firstPage)."'</script>";
}
}
} else {
api_delete_firstpage_parameter();
}
$controller->setGradeBookDependencyBar(api_get_user_id());
$controller->tpl->display_two_col_template();
// Deleting the session_id.
Session::erase('session_id');
Session::erase('id_session');
Session::erase('studentview');
api_remove_in_gradebook();

35
license.txt Normal file
View File

@@ -0,0 +1,35 @@
Chamilo LMS - elearning and course management software
Copyright (c) 2008-2018 BeezNest Latino SAC, Peru & BeezNest Belgium SPRL, Belgium
Copyright (c) 2016-2018 NoSoloRed S.L, Spain
Copyright (c) 2010-2017 Université de Grenoble, France
Copyright (c) 2011-2012 CBlue SPRL, Belgium
Copyright (c) 2012 Université de Genève, Switzerland
Copyright (c) 2004-2012 Juan Carlos Raña (independent), Spain
Copyright (c) 2004-2009 Dokeos SPRL, Belgium
Copyright (c) 2003-2008 Vrije Universiteit Brussel (VUB)
Copyright (c) 2004-2008 Hoogeschool Gent (HoGent)
Copyright (c) 2003-2007 Ghent University (UGent)
Copyright (c) 2001-2004 Universite catholique de Louvain (UCL)
For a full list of contributors detaining copyrights over parts of
the Chamilo software, see "documentation/credits.html".
The full license can be read in "documentation/license.html".
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Mail: info@chamilo.org
This license is referenced throughout the code using the following header line:
/* For licensing terms, see /license.txt */

31
news_list.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
/* For licensing terms, see /license.txt */
require_once 'main/inc/global.inc.php';
$tool_name = get_lang('SystemAnnouncements');
$visibility = SystemAnnouncementManager::getCurrentUserVisibility();
$id = isset($_GET['id']) ? $_GET['id'] : 0;
if (empty($id)) {
$content = SystemAnnouncementManager::displayAnnouncementsSlider($visibility);
} else {
$content = SystemAnnouncementManager::displayAnnouncement($id, $visibility);
}
$tpl = new Template($tool_name);
if (api_is_platform_admin()) {
$actionEdit = Display::url(
Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), [], ICON_SIZE_MEDIUM),
api_get_path(WEB_PATH).'main/admin/system_announcements.php'
);
$tpl->assign(
'actions',
Display::toolbarAction('toolbar', [$actionEdit])
);
}
$tpl->assign('content', $content);
$tpl->display_one_col_template();

33
robots.txt Normal file
View File

@@ -0,0 +1,33 @@
#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
#
#
# For more information about the robots.txt standard, see:
# http://www.robotstxt.org/wc/robots.html
#
# For syntax checking, see:
# http://www.sxw.org.uk/computing/robots/check.html
User-Agent: *
# Directories
Disallow: /app/
Disallow: /bin/
Disallow: /documentation/
Disallow: /home/
Disallow: /main/
Disallow: /plugin/
Disallow: /tests/
Disallow: /vendor/
# Files
Disallow: /license.txt
Disallow: /README.txt
Disallow: /whoisonline.php
Disallow: /whoisonlinesession.php

50
terms.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/* For licensing terms, see /license.txt */
$cidReset = true;
require_once __DIR__.'/main/inc/global.inc.php';
if (api_get_setting('allow_terms_conditions') !== 'true') {
api_not_allowed(true);
}
if (api_is_anonymous() && api_get_configuration_value('gdpr_terms_public') !== true) {
api_not_allowed(true);
}
$language = api_get_interface_language();
$language = api_get_language_id($language);
$term = LegalManager::get_last_condition($language);
if (!$term) {
// look for the default language
$language = api_get_setting('platformLanguage');
$language = api_get_language_id($language);
$term = LegalManager::get_last_condition($language);
}
$termExtraFields = new ExtraFieldValue('terms_and_condition');
$values = $termExtraFields->getAllValuesByItem($term['id']);
foreach ($values as $value) {
if (!empty($value['value'])) {
$term['content'] .= '<h3>'.get_lang($value['display_text']).'</h3><br />'.$value['value'].'<br />';
}
}
$term['date_text'] = get_lang('PublicationDate').': '.
api_get_local_time(
$term['date'],
null,
null,
false,
true,
true
);
$tpl = new Template(null);
$tpl->assign('term', $term);
$socialLayout = $tpl->get_template('user_portal/terms.tpl');
$tpl->display($socialLayout);

46
user.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Clean URls for the Social Network.
*
* The idea is to access to the user info more easily:
* http://campus.chamilo.org/admin instead of
* http://campus.chamilo.org/main/social/profile.php?1
* To use this you should rename the htaccess to .htaccess and check your
* virtualhost configuration
*
* More improvements will come in next versions of Chamilo maybe in the 1.8.8
*
* @package chamilo.main
*/
$cidReset = true;
require_once 'main/inc/global.inc.php';
/**
* Access permissions check.
*/
//api_block_anonymous_users();
/**
* Treat URL arguments.
*/
$array_keys = array_keys($_GET);
if (empty($array_keys)) {
// we cant find your friend
header('Location: whoisonline.php');
exit;
}
$username = substr($array_keys[0], 0, 20); // max len of an username
$friend_id = UserManager::get_user_id_from_username($username);
if (!$friend_id) {
// we cant find your friend
header('Location: whoisonline.php');
exit;
}
Display::display_header(get_lang('UserInfo'));
echo SocialManager::display_individual_user($friend_id);
Display::display_footer();

347
user_portal.php Normal file
View File

@@ -0,0 +1,347 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This is the index file displayed when a user is logged in on Chamilo.
*
* It displays:
* - personal course list
* - menu bar
* Search for CONFIGURATION parameters to modify settings
*
* @package chamilo.main
*
* @todo Shouldn't the CONFVAL_ constant be moved to the config page? Has anybody any idea what the are used for?
* If these are really configuration settings then we can add those to the dokeos config settings.
* @todo check for duplication of functions with index.php (user_portal.php is orginally a copy of index.php)
* @todo display_digest, shouldn't this be removed and be made into an extension?
*/
/* Flag forcing the 'current course' reset, as we're not inside a course anymore */
$cidReset = true;
// For HTML editor repository.
if (isset($_SESSION['this_section'])) {
unset($_SESSION['this_section']);
}
/* Included libraries */
require_once './main/inc/global.inc.php';
$this_section = SECTION_COURSES;
api_block_anonymous_users(); // Only users who are logged in can proceed.
$logInfo = [
'tool' => SECTION_COURSES,
'tool_id' => 0,
'tool_id_detail' => 0,
];
Event::registerLog($logInfo);
$userId = api_get_user_id();
if (array_key_exists('action', $_REQUEST)) {
switch ($_REQUEST['action']) {
case 'collapse_session':
if (api_get_configuration_value('allow_user_session_collapsable')
&& array_key_exists('session_id', $_REQUEST)
) {
$userRelSession = SessionManager::getUserSession($userId, $_REQUEST['session_id']);
if ($userRelSession) {
$value = isset($_REQUEST['value']) ? (int) $_REQUEST['value'] : '';
$table = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$sql = "UPDATE $table SET collapsed = $value WHERE id = ".$userRelSession['id'];
Database::query($sql);
Display::addFlash(Display::return_message(get_lang('Updated')));
}
header('Location: user_portal.php');
exit;
}
break;
case 'unsubscribe':
if (\Security::check_token('get')) {
$auth = new Auth();
$sessionId = isset($_REQUEST['sid']) ? $_REQUEST['sid'] : 0;
$courseCode = isset($_REQUEST['course_code']) ? $_REQUEST['course_code'] : '';
if (empty($courseCode)) {
api_location(api_get_self());
}
if ($auth->remove_user_from_course($courseCode, $sessionId)) {
Display::addFlash(Display::return_message(get_lang('YouAreNowUnsubscribed')));
}
header('Location: user_portal.php');
exit;
}
break;
}
}
/* Constants and CONFIGURATION parameters */
$load_dirs = api_get_setting('show_documents_preview');
$displayMyCourseViewBySessionLink = api_get_setting('my_courses_view_by_session') === 'true';
$nameTools = get_lang('MyCourses');
$loadHistory = isset($_GET['history']) && intval($_GET['history']) == 1 ? true : false;
// Load course notification by ajax
$loadNotificationsByAjax = api_get_configuration_value('user_portal_load_notification_by_ajax');
if ($loadNotificationsByAjax) {
$htmlHeadXtra[] = '<script>
$(function() {
$(".course_notification").each(function(index) {
var div = $(this);
var id = $(this).attr("id");
var idList = id.split("_");
var courseId = idList[1];
var sessionId = idList[2];
var status = idList[3];
$.ajax({
type: "GET",
url: "'.api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=get_notification&course_id="+courseId+"&session_id="+sessionId+"&status="+status,
success: function(data) {
div.append(data);
}
});
});
});
</script>';
}
/*
Header
Include the HTTP, HTML headers plus the top banner.
*/
if ($load_dirs) {
$url = api_get_path(WEB_AJAX_PATH).'document.ajax.php?a=document_preview';
$folder_icon = api_get_path(WEB_IMG_PATH).'icons/22/folder.png';
$close_icon = api_get_path(WEB_IMG_PATH).'loading1.gif';
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(".document_preview_container").hide();
$(".document_preview").click(function() {
var my_id = this.id;
var course_id = my_id.split("_")[2];
var session_id = my_id.split("_")[3];
//showing div
$(".document_preview_container").hide();
$("#document_result_" +course_id+"_" + session_id).show();
// Loading
var image = $("img", this);
image.attr("src", "'.$close_icon.'");
$.ajax({
url: "'.$url.'",
data: "course_id="+course_id+"&session_id="+session_id,
success: function(return_value) {
image.attr("src", "'.$folder_icon.'");
$("#document_result_" +course_id+"_" + session_id).html(return_value);
}
});
});
});
</script>';
}
if ($displayMyCourseViewBySessionLink) {
$htmlHeadXtra[] = '
<script>
userId = '.$userId.'
$(document).ready(function() {
changeMyCoursesView(Cookies.get("defaultMyCourseView" + userId));
});
/**
* Keep in cookie the last teacher view for the My Courses Tab. default view, or view by session
* @param inView
*/
function changeMyCoursesView(inView) {
Cookies.set("defaultMyCourseView" + userId, inView, 365);
if (inView == '.IndexManager::VIEW_BY_SESSION.') {
$("#viewBySession").addClass("btn-primary");
$("#viewByDefault").removeClass("btn-primary");
} else {
$("#viewByDefault").addClass("btn-primary");
$("#viewBySession").removeClass("btn-primary");
}
}
</script>';
}
$myCourseListAsCategory = api_get_configuration_value('my_courses_list_as_category');
$controller = new IndexManager(get_lang('MyCourses'));
if (!$myCourseListAsCategory) {
// Main courses and session list
if (isset($_COOKIE['defaultMyCourseView'.$userId]) &&
$_COOKIE['defaultMyCourseView'.$userId] == IndexManager::VIEW_BY_SESSION &&
$displayMyCourseViewBySessionLink
) {
$courseAndSessions = $controller->returnCoursesAndSessionsViewBySession($userId);
IndexManager::setDefaultMyCourseView(IndexManager::VIEW_BY_SESSION, $userId);
} else {
$courseAndSessions = $controller->returnCoursesAndSessions($userId, true, null, true, $loadHistory);
IndexManager::setDefaultMyCourseView(IndexManager::VIEW_BY_DEFAULT, $userId);
}
// if teacher, session coach or admin, display the button to change te course view
if ($displayMyCourseViewBySessionLink &&
(
api_is_drh() ||
api_is_session_general_coach() ||
api_is_platform_admin() ||
api_is_session_admin() ||
api_is_teacher()
)
) {
$courseAndSessions['html'] = "
<div class='view-by-session-link'>
<div class='btn-group pull-right'>
<a class='btn btn-default' id='viewByDefault' href='user_portal.php'
onclick='changeMyCoursesView(\"".IndexManager::VIEW_BY_DEFAULT."\")'>
".get_lang('MyCoursesDefaultView')."
</a>
<a class='btn btn-default' id='viewBySession' href='user_portal.php'
onclick='changeMyCoursesView(\"".IndexManager::VIEW_BY_SESSION."\")'>
".get_lang('MyCoursesSessionView')."
</a>
</div>
</div>
<br /><br />
".$courseAndSessions['html'];
}
} else {
$categoryCode = isset($_GET['category']) ? $_GET['category'] : '';
if (!$categoryCode) {
$courseAndSessions = $controller->returnCourseCategoryListFromUser($userId);
} else {
$courseAndSessions = $controller->returnCoursesAndSessions(
$userId,
false,
$categoryCode,
true,
$loadHistory
);
$getCategory = CourseCategory::getCategory($categoryCode);
$controller->tpl->assign('category', $getCategory);
}
}
// Check if a user is enrolled only in one course for going directly to the course after the login.
if (api_get_setting('go_to_course_after_login') == 'true') {
$count_of_sessions = $courseAndSessions['session_count'];
$count_of_courses_no_sessions = $courseAndSessions['course_count'];
// User is subscribe in 1 session and 0 courses.
if ($count_of_sessions == 1 && $count_of_courses_no_sessions == 0) {
$sessions = SessionManager::get_sessions_by_user($userId);
if (isset($sessions[0])) {
$sessionInfo = $sessions[0];
// Session only has 1 course.
if (isset($sessionInfo['courses']) &&
count($sessionInfo['courses']) == 1
) {
foreach ($sessionInfo['courses'] as $courseItem) {
$courseInfo = api_get_course_info_by_id($courseItem['real_id']);
if (!empty($courseInfo)) {
$courseUrl = $courseInfo['course_public_url'].'?id_session='.$sessionInfo['session_id'];
header('Location:'.$courseUrl);
exit;
}
}
}
// Session has many courses.
if (isset($sessionInfo['session_id'])) {
$url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionInfo['session_id'];
header('Location:'.$url);
exit;
}
}
}
// User is subscribed to 1 course.
if (!isset($_SESSION['coursesAlreadyVisited']) &&
$count_of_sessions == 0 &&
$count_of_courses_no_sessions == 1
) {
if (!empty($courseAndSessions['courses']) && isset($courseAndSessions['courses'][0]) && !empty($courseAndSessions['courses'][0]['link'])) {
header("Location: {$courseAndSessions['courses'][0]['link']}");
exit;
}
}
}
// Show the chamilo mascot
if (empty($courseAndSessions['html']) && !isset($_GET['history'])) {
$controller->tpl->assign(
'welcome_to_course_block',
$controller->return_welcome_to_course_block()
);
}
$controller->tpl->assign('content', $courseAndSessions['html']);
// Display the Site Use Cookie Warning Validation
$useCookieValidation = api_get_setting('cookie_warning');
if ($useCookieValidation === 'true') {
if (!api_site_use_cookie_warning_cookie_exist()) {
if (Template::isToolBarDisplayedForUser()) {
$controller->tpl->assign('toolBarDisplayed', true);
} else {
$controller->tpl->assign('toolBarDisplayed', false);
}
$controller->tpl->enableCookieUsageWarning();
}
}
//check for flash and message
$sniff_notification = '';
$some_activex = isset($_SESSION['sniff_check_some_activex']) ? $_SESSION['sniff_check_some_activex'] : null;
$some_plugins = isset($_SESSION['sniff_check_some_plugins']) ? $_SESSION['sniff_check_some_plugins'] : null;
if (!empty($some_activex) || !empty($some_plugins)) {
if (!preg_match("/flash_yes/", $some_activex) && !preg_match("/flash_yes/", $some_plugins)) {
$sniff_notification = Display::return_message(get_lang('NoFlash'), 'warning', true);
//js verification - To annoying of redirecting every time the page
$controller->tpl->assign('sniff_notification', $sniff_notification);
}
}
$controller->tpl->assign('profile_block', $controller->return_profile_block());
$controller->tpl->assign('user_image_block', $controller->return_user_image_block());
$controller->tpl->assign('course_block', $controller->return_course_block());
$controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
$controller->tpl->assign('search_block', $controller->return_search_block());
$controller->tpl->assign('notice_block', $controller->return_notice());
$controller->tpl->assign('classes_block', $controller->returnClassesBlock());
$controller->tpl->assign('skills_block', $controller->returnSkillLinks());
$controller->tpl->assign('student_publication_block', $controller->studentPublicationBlock());
$historyClass = '';
if (!empty($_GET['history'])) {
$historyClass = 'courses-history';
}
$controller->tpl->assign('course_history_page', $historyClass);
if ($myCourseListAsCategory) {
$controller->tpl->assign('header', get_lang('MyCourses'));
}
$controller->setGradeBookDependencyBar($userId);
$controller->tpl->display_two_col_template();
// Deleting the session_id.
Session::erase('session_id');
Session::erase('id_session');
Session::erase('studentview');
api_remove_in_gradebook();

106
web.config Normal file
View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="false" destination="" httpResponseStatus="Permanent" />
<rewrite>
<rules>
<rule name="rule 1v" stopProcessing="true">
<match url="^certificates/$" />
<action type="Rewrite" url="certificates/index.php?id=%1" appendQueryString="false" />
</rule>
<rule name="rule 2v" enabled="true" stopProcessing="true">
<match url="^courses/([^/]+)/?$" />
<action type="Rewrite" url="main/course_home/course_home.php?cDir={R:1}" appendQueryString="true" />
</rule>
<rule name="rule 3v" enabled="true" stopProcessing="true">
<match url="^courses/([^/]+)/index.php$" />
<action type="Rewrite" url="main/course_home/course_home.php?cDir={R:1}" />
</rule>
<rule name="rule 4v" stopProcessing="true">
<match url="^courses/([^/]+)/scorm/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$" />
<action type="Rewrite" url="app/courses/{R:1}/scorm/{R:2}" />
</rule>
<rule name="rule 5v" stopProcessing="true">
<match url="^courses/([^/]+)/scorm/(.*)$" />
<action type="Rewrite" url="main/document/download_scorm.php?doc_url=/{R:2}&amp;cDir={R:1}" />
</rule>
<rule name="rule v6" stopProcessing="true">
<match url="^courses/([^/]+)/document/certificates/(.*)$" />
<action type="Rewrite" url="app/courses/{R:1}/document/certificates/{R:2}" />
</rule>
<rule name="rule v7" stopProcessing="true">
<match url="^courses/([^/]+)/document/(.*)$" />
<action type="Rewrite" url="main/document/download.php?doc_url=/{R:2}&amp;cDir={R:1}" />
</rule>
<rule name="rule v8" stopProcessing="true">
<match url="^courses/([^/]+)/upload/course_home_icons/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$" />
<action type="Rewrite" url="app/courses/{R:1}/upload/course_home_icons/{R:2}" />
</rule>
<rule name="rule v9" stopProcessing="true">
<match url="^courses/([^/]+)/upload/([^/]+)/(.*)$" />
<action type="Rewrite" url="main/document/download_uploaded_files.php?code={R:1}&amp;type={R:2}&amp;file={R:3}" />
</rule>
<rule name="rule v10" stopProcessing="true">
<match url="^courses/([^/]+)/work/(.*)$" />
<action type="Rewrite" url="main/work/download.php?file=work/{R:2}&amp;cDir={R:1}" />
</rule>
<rule name="rule v11" stopProcessing="true">
<match url="^courses/([^/]+)/course-pic85x85.png$" />
<action type="Rewrite" url="main/inc/ajax/course.ajax.php?a=get_course_image&amp;code={R:1}&amp;image=course_image_source" appendQueryString="true" />
</rule>
<rule name="rule v12" stopProcessing="true">
<match url="^courses/([^/]+)/course-pic.png$" />
<action type="Rewrite" url="main/inc/ajax/course.ajax.php?a=get_course_image&amp;code={R:1}&amp;image=course_image_large_source" appendQueryString="true" />
</rule>
<rule name="rule v13" stopProcessing="true">
<match url="^courses/([^/]+)/(.*)$" />
<action type="Rewrite" url="app/courses/{R:1}/{R:2}" appendQueryString="false" />
</rule>
<rule name="rule v14" stopProcessing="true">
<match url="^session/(\d{1,})/about/?$" />
<action type="Rewrite" url="main/session/about.php?session_id={R:1}" appendQueryString="false" />
</rule>
<rule name="rule v15" stopProcessing="true">
<match url="^course/(\d{1,})/about/?$" />
<action type="Rewrite" url="main/course_info/about.php?course_id={R:1}" appendQueryString="false" />
</rule>
<rule name="rule v16" stopProcessing="true">
<match url="^badge/(\d{1,})" />
<action type="Rewrite" url="main/badge/issued.php?issue={R:1}" appendQueryString="false" />
</rule>
<rule name="rule v17" stopProcessing="true">
<match url="^skill/(\d{1,})/user/(\d{1,})" />
<action type="Rewrite" url="main/badge/issued_all.php?skill={R:1}&amp;user={R:2}" appendQueryString="false" />
</rule>
<rule name="rule v18" stopProcessing="true">
<match url="^badge/(\d{1,})/user/(\d{1,})" />
<action type="Rewrite" url="main/badge/issued_all.php?skill={R:1}&amp;user={R:2}" appendQueryString="false" />
</rule>
<rule name="rule v19" stopProcessing="true">
<match url="^main/exercice/(.*)$" />
<action type="Rewrite" url="main/exercise/{R:1}" appendQueryString="true" />
</rule>
<rule name="rule v20" stopProcessing="true">
<match url="^main/newscorm/(.*)$" />
<action type="Rewrite" url="main/lp/{R:1}" appendQueryString="true" />
</rule>
<rule name="rule v21" stopProcessing="true">
<match url="^service/(\d{1,})$" />
<action type="Rewrite" url="plugin/buycourses/src/service_information.php?service_id={R:1}" appendQueryString="false" />
</rule>
<rule name="rule v22" stopProcessing="true">
<match url="^lti/os$" />
<action type="Rewrite" url="plugin/ims_lti/outcome_service.php" appendQueryString="false" />
</rule>
<rule name="rule v23" stopProcessing="true">
<match url="^([^/.]+)/?$" />
<action type="Rewrite" url="user.php?{R:1}" appendQueryString="false" />
</rule>
<rule name="rule v24" stopProcessing="true">
<match url="^(tests|.git)" ignoreCase="false" />
<action type="Rewrite" url="/-" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

74
whoisonline.php Normal file
View File

@@ -0,0 +1,74 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Who is online list.
*/
if (!isset($_GET['cidReq'])) {
$cidReset = true;
}
require_once './main/inc/global.inc.php';
api_block_inactive_user();
if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
api_protect_course_script(true);
}
$this_section = SECTION_SOCIAL;
$social_right_content = '';
$whoisonline_list = '';
$social_search = '';
$userId = api_get_user_id();
$access = accessToWhoIsOnline();
if (!$access) {
api_not_allowed(true);
}
if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
$user_list = who_is_online_in_this_course(
0,
MAX_ONLINE_USERS,
api_get_user_id(),
api_get_setting('time_limit_whosonline'),
$_GET['cidReq']
);
} else {
$user_list = who_is_online(0, MAX_ONLINE_USERS);
}
if ($user_list) {
if (!isset($_GET['id'])) {
if (api_get_setting('allow_social_tool') == 'true') {
if (!api_is_anonymous()) {
$query = isset($_GET['q']) ? $_GET['q'] : null;
$social_search = UserManager::get_search_form($query);
}
}
$social_right_content .= SocialManager::display_user_list($user_list);
}
}
$whoisonline_list .= SocialManager::display_user_list($user_list);
if (isset($_GET['id'])) {
if (api_get_setting('allow_social_tool') == 'true' && api_user_is_login()) {
header("Location: ".api_get_path(WEB_CODE_PATH)."social/profile.php?u=".intval($_GET['id']));
exit;
} else {
$social_right_content .= SocialManager::display_individual_user($_GET['id']);
}
}
$tpl = new Template(get_lang('UsersOnLineList'));
if (api_get_setting('allow_social_tool') === 'true' && !api_is_anonymous()) {
$tpl->assign('whoisonline', $whoisonline_list);
$tpl->assign('social_search', $social_search);
} else {
$tpl->assign('whoisonline', $social_right_content);
}
$social_layout = $tpl->get_template('social/whoisonline.tpl');
$tpl->display($social_layout);

150
whoisonlinesession.php Normal file
View File

@@ -0,0 +1,150 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Shows who is online in a specific session.
*
* @package chamilo.main
*/
require_once './main/inc/global.inc.php';
api_block_anonymous_users();
$userId = api_get_user_id();
if (empty($userId)) {
api_not_allowed(true);
}
$sessionId = api_get_session_id();
if (empty($sessionId)) {
api_not_allowed(true);
}
$allow = api_is_platform_admin(true) ||
api_is_coach($sessionId, null, false) ||
SessionManager::isUserSubscribedAsStudent($sessionId, api_get_user_id());
if (!$allow) {
api_not_allowed(true);
}
$maxNumberItems = 20;
$sessionInfo = api_get_session_info($sessionId);
Display::display_header(get_lang('UsersOnLineList'));
echo Display::page_header($sessionInfo['name']);
function getUsers(
$from,
$numberItems,
$column,
$direction,
$getCount = false
) {
$sessionId = api_get_session_id();
$from = (int) $from;
$numberItems = (int) $numberItems;
$urlCondition = '';
$urlJoin = '';
if (api_is_multiple_url_enabled()) {
$accessUrlUser = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$urlId = api_get_current_access_url_id();
$urlJoin = " INNER JOIN $accessUrlUser a ON (a.user_id = user.id) ";
$urlCondition = " AND a.access_url_id = $urlId ";
}
if (empty($time_limit)) {
$time_limit = api_get_setting('time_limit_whosonline');
} else {
$time_limit = 60;
}
$online_time = time() - $time_limit * 60;
$current_date = api_get_utc_datetime($online_time);
if ($getCount) {
$sql = "SELECT
count(DISTINCT last_access.login_user_id) count
FROM ".Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE)." AS last_access
INNER JOIN ".Database::get_main_table(TABLE_MAIN_USER)." AS user
ON user.id = last_access.login_user_id
$urlJoin
WHERE
session_id ='".$sessionId."' AND
login_date >= '$current_date'
$urlCondition";
$result = Database::query($sql);
$result = Database::fetch_array($result);
return $result['count'];
}
$sql = "SELECT DISTINCT
last_access.login_user_id,
last_access.c_id
FROM ".Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE)." AS last_access
INNER JOIN ".Database::get_main_table(TABLE_MAIN_USER)." AS user
ON user.id = last_access.login_user_id
$urlJoin
WHERE
session_id ='".$sessionId."' AND
login_date >= '$current_date'
$urlCondition
GROUP BY login_user_id
LIMIT $from, $numberItems";
$studentsOnline = [];
$result = Database::query($sql);
while ($user_list = Database::fetch_array($result)) {
$studentsOnline[$user_list['login_user_id']] = $user_list;
}
return $studentsOnline;
}
function getCountUsers()
{
return getUsers(0, 0, 0, 0, true);
}
$table = new SortableTable(
'users',
'getCountUsers',
'getUsers',
'1',
$maxNumberItems
);
$table->set_header(0, get_lang('Name'), false);
$table->set_header(1, get_lang('InCourse'), false);
$table->set_column_filter(0, 'user_filter');
$table->set_column_filter(1, 'course_filter');
$table->display();
function user_filter($userId, $urlParams, $row)
{
$userInfo = api_get_user_info($userId);
return $userInfo['complete_name_with_message_link'];
}
function course_filter($courseId, $urlParams, $row)
{
$sessionId = api_get_session_id();
$courseInfo = api_get_course_info_by_id($courseId);
return Display::url(
$courseInfo['title'],
$courseInfo['course_public_url'].'?id_session='.$sessionId,
['target' => '_blank']
).
'&nbsp;'.
Display::url(
get_lang('Chat'),
'main/chat/chat.php?cidReq='.$courseInfo['code'].'&id_session='.$sessionId,
['target' => '_blank', 'class' => 'btn btn-primary']
);
}
Display::display_footer();