Minor - format code

pull/3711/head
Julio Montoya 5 years ago
parent 11e56b8084
commit b5a4ee2dcd
  1. 2
      custompages/first_login-dist.php
  2. 2
      custompages/registration-feedback-dist.php
  3. 2
      main/admin/dashboard_add_courses_to_user.php
  4. 2
      main/admin/dashboard_add_sessions_to_user.php
  5. 2
      main/admin/index.php
  6. 28
      main/admin/init_cas_user_extra_field_from_ldap.php
  7. 2
      main/admin/ldap_import_students.php
  8. 2
      main/admin/ldap_import_students_to_session.php
  9. 2
      main/admin/teacher_time_report.php
  10. 2
      main/admin/user_move_stats.php
  11. 2
      main/auth/conditional_login/complete_phone_number.php
  12. 1
      main/auth/external_login/ldap.inc.php
  13. 2
      main/auth/external_login/ldap_import_all_users.php
  14. 2
      main/calendar/ical_export.php
  15. 4
      main/cron/archive_table_records.php
  16. 2
      main/cron/document/finddoc.php
  17. 2
      main/cron/document/index_all_docs.php
  18. 2
      main/cron/import_csv.php
  19. 3
      main/cron/lang/check_parse_lang.php
  20. 2
      main/cron/lang/langstats.php
  21. 7
      main/cron/lang/list_undefined_langvars.php
  22. 7
      main/cron/lang/list_unused_langvars.php
  23. 2
      main/cron/lang/switch_files_to_gettext.php
  24. 2
      main/cron/notification.php
  25. 2
      main/cron/user_import/client.php
  26. 2
      main/cron/user_import/get_data_from_mail.php
  27. 2
      main/cron/user_import/resend_email_with_new_password.php
  28. 2
      main/document/edit_draw.php
  29. 2
      main/document/edit_paint.php
  30. 4
      main/document/remote.php
  31. 2
      main/document/save_pixlr.php
  32. 4
      main/document/webcam_receiver.php
  33. 6
      main/dropbox/dropbox_class.inc.php
  34. 4
      main/dropbox/dropbox_functions.inc.php
  35. 2
      main/exercise/exercise_show.php
  36. 2
      main/extra/save_school_calendar.php
  37. 2
      main/extra/userInfo.php
  38. 2
      main/gradebook/index.php
  39. 4
      main/gradebook/lib/be/result.class.php
  40. 2
      main/gradebook/lib/be/surveylink.class.php
  41. 2
      main/gradebook/lib/fe/linkaddeditform.class.php
  42. 4
      main/gradebook/lib/user_data_generator.class.php
  43. 10
      main/inc/ajax/admin.ajax.php
  44. 1
      main/inc/ajax/career.ajax.php
  45. 8
      main/inc/ajax/record_audio_wami.ajax.php
  46. 2
      main/inc/ajax/session.ajax.php
  47. 4
      main/inc/global-min.inc.php
  48. 4
      main/inc/global.inc.php
  49. 2
      main/inc/global_error_message.inc.php
  50. 2
      main/inc/lib/course_home.lib.php
  51. 2
      main/inc/lib/display.lib.php
  52. 2
      main/inc/lib/extra_field_option.lib.php
  53. 4
      main/inc/lib/fileUpload.lib.php
  54. 2
      main/inc/lib/groupmanager.lib.php
  55. 2
      main/inc/lib/legal.lib.php
  56. 1
      main/inc/lib/message.lib.php
  57. 3
      main/inc/local.inc.php

@ -12,7 +12,7 @@ require_once __DIR__.'/language.php';
* Security checks. * Security checks.
*/ */
if (!isset($_SESSION['conditional_login']['uid'])) { if (!isset($_SESSION['conditional_login']['uid'])) {
die("Not Authorised"); exit("Not Authorised");
} }
if (isset($_POST['password'])) { if (isset($_POST['password'])) {

@ -33,7 +33,7 @@ $rootWeb = api_get_path('WEB_PATH');
</div> </div>
<div id="registration-form-box" class="form-box"> <div id="registration-form-box" class="form-box">
<div class="block-form-login"> <div class="block-form-login">
<?php echo $content['info']; ?> <?php echo $content['info']; ?>
</div> </div>
</div> </div>
<div id="footer"> <div id="footer">

@ -248,7 +248,7 @@ if (!empty($msg)) {
<p><?php echo get_lang('FirstLetterCourse'); ?> :</p> <p><?php echo get_lang('FirstLetterCourse'); ?> :</p>
<select name="firstLetterCourse" class="selectpicker form-control" onchange = "xajax_search_courses(this.value,'multiple')"> <select name="firstLetterCourse" class="selectpicker form-control" onchange = "xajax_search_courses(this.value,'multiple')">
<option value="%">--</option> <option value="%">--</option>
<?php echo Display :: get_alphabet_options($firstLetter); ?> <?php echo Display :: get_alphabet_options($firstLetter); ?>
</select> </select>
<?php <?php
} ?> } ?>

@ -243,7 +243,7 @@ $result = Database::query($sql);
<p><?php echo get_lang('FirstLetterSession'); ?> :</p> <p><?php echo get_lang('FirstLetterSession'); ?> :</p>
<select class="selectpicker form-control" name="firstLetterSession" onchange = "xajax_search_sessions(this.value, 'multiple')"> <select class="selectpicker form-control" name="firstLetterSession" onchange = "xajax_search_sessions(this.value, 'multiple')">
<option value="%">--</option> <option value="%">--</option>
<?php echo Display :: get_alphabet_options($firstLetterSession); ?> <?php echo Display :: get_alphabet_options($firstLetterSession); ?>
</select> </select>
<?php <?php
} ?> } ?>

@ -927,7 +927,7 @@ if (api_is_platform_admin()) {
} }
if (!is_writable($adminExtraContentDir)) { if (!is_writable($adminExtraContentDir)) {
die; exit;
} }
$fullFilePath = $adminExtraContentDir.$extraData['block']; $fullFilePath = $adminExtraContentDir.$extraData['block'];

@ -45,7 +45,7 @@ If this script is run after all user accounts were CASified, it just stops after
This can be used to check whether no work is left to do. This can be used to check whether no work is left to do.
*/ */
if (php_sapi_name() !== 'cli') { if (php_sapi_name() !== 'cli') {
die("this script is supposed to be run from the command-line\n"); exit("this script is supposed to be run from the command-line\n");
} }
require __DIR__.'/../../cli-config.php'; require __DIR__.'/../../cli-config.php';
require_once __DIR__.'/../../app/config/auth.conf.php'; require_once __DIR__.'/../../app/config/auth.conf.php';
@ -66,7 +66,7 @@ foreach ($extldap_config['host'] as $ldapHost) {
} }
} }
if (false === $ldap) { if (false === $ldap) {
die("ldap_connect() failed\n"); exit("ldap_connect() failed\n");
} }
echo "Connected to LDAP server $ldapHost.\n"; echo "Connected to LDAP server $ldapHost.\n";
@ -83,21 +83,21 @@ ldap_set_option(
); );
ldap_bind($ldap, $extldap_config['admin_dn'], $extldap_config['admin_password']) ldap_bind($ldap, $extldap_config['admin_dn'], $extldap_config['admin_password'])
or die('ldap_bind() failed: '.ldap_error($ldap)."\n"); or exit('ldap_bind() failed: '.ldap_error($ldap)."\n");
echo "Bound to LDAP server as ${extldap_config['admin_dn']}.\n"; echo "Bound to LDAP server as ${extldap_config['admin_dn']}.\n";
// set a few variables for LDAP search // set a few variables for LDAP search
$baseDn = $extldap_config['base_dn'] $baseDn = $extldap_config['base_dn']
or die("cannot read the LDAP directory base DN where to search for user entries\n"); or exit("cannot read the LDAP directory base DN where to search for user entries\n");
echo "Base DN is '$baseDn'.\n"; echo "Base DN is '$baseDn'.\n";
$ldapCASUserAttribute = $extldap_user_correspondance['extra']['cas_user'] $ldapCASUserAttribute = $extldap_user_correspondance['extra']['cas_user']
or die("cannot read the name of the LDAP attribute where to find the CAS user code\n"); or exit("cannot read the name of the LDAP attribute where to find the CAS user code\n");
echo "LDAP CAS user code attribute is '$ldapCASUserAttribute'.\n"; echo "LDAP CAS user code attribute is '$ldapCASUserAttribute'.\n";
$ldapUsernameAttribute = $extldap_user_correspondance['username'] $ldapUsernameAttribute = $extldap_user_correspondance['username']
or die("cannot read the name of the LDAP attribute where to find the username\n"); or exit("cannot read the name of the LDAP attribute where to find the username\n");
echo "LDAP username attribute is '$ldapUsernameAttribute'.\n"; echo "LDAP username attribute is '$ldapUsernameAttribute'.\n";
$filters = [ $filters = [
@ -124,10 +124,10 @@ if (empty($extraFieldData)) {
] ]
); );
if (false === $fieldId) { if (false === $fieldId) {
die("failed to create extra field\n"); exit("failed to create extra field\n");
} }
} else { } else {
die("Required extra field is missing\n"); exit("Required extra field is missing\n");
} }
} else { } else {
$fieldId = $extraFieldData['id']; $fieldId = $extraFieldData['id'];
@ -175,7 +175,7 @@ foreach ($databaseUsers as $user) {
.'))'; .'))';
$searchResult = ldap_search($ldap, $baseDn, $filter, [$ldapCASUserAttribute, $ldapUsernameAttribute]); $searchResult = ldap_search($ldap, $baseDn, $filter, [$ldapCASUserAttribute, $ldapUsernameAttribute]);
if (false === $searchResult) { if (false === $searchResult) {
die('ldap_search() failed: '.ldap_error($ldap)."\n"); exit('ldap_search() failed: '.ldap_error($ldap)."\n");
} }
$userId = $user->getId(); $userId = $user->getId();
echo "$username ($userId): "; echo "$username ($userId): ";
@ -186,15 +186,15 @@ foreach ($databaseUsers as $user) {
case 1: case 1:
$entry = ldap_first_entry($ldap, $searchResult); $entry = ldap_first_entry($ldap, $searchResult);
if (false === $entry) { if (false === $entry) {
die('ldap_first_entry() failed: '.ldap_error($ldap)."\n"); exit('ldap_first_entry() failed: '.ldap_error($ldap)."\n");
} }
$ldapCASUser = ldap_get_values($ldap, $entry, $ldapCASUserAttribute)[0]; $ldapCASUser = ldap_get_values($ldap, $entry, $ldapCASUserAttribute)[0];
if (false === $ldapCASUser) { if (false === $ldapCASUser) {
die('cannot read CAS user code from LDAP entry: '.ldap_error($ldap)."\n"); exit('cannot read CAS user code from LDAP entry: '.ldap_error($ldap)."\n");
} }
$ldapUsername = ldap_get_values($ldap, $entry, $ldapUsernameAttribute)[0]; $ldapUsername = ldap_get_values($ldap, $entry, $ldapUsernameAttribute)[0];
if (false === $ldapUsername) { if (false === $ldapUsername) {
die('cannot read username from LDAP entry: '.ldap_error($ldap)."\n"); exit('cannot read username from LDAP entry: '.ldap_error($ldap)."\n");
} }
echo "\033[2K\r$ldapUsernameAttribute: $ldapUsername, $ldapCASUserAttribute: $ldapCASUser, "; echo "\033[2K\r$ldapUsernameAttribute: $ldapUsername, $ldapCASUserAttribute: $ldapCASUser, ";
$problems = []; $problems = [];
@ -213,7 +213,7 @@ foreach ($databaseUsers as $user) {
$userNamesInUse[$ldapUsername] = $userId; $userNamesInUse[$ldapUsername] = $userId;
} }
} else { } else {
die("LDAP search result does not match username; our filter is wrong: $filter\n"); exit("LDAP search result does not match username; our filter is wrong: $filter\n");
} }
if (array_key_exists($userId, $existingCasUserValues)) { if (array_key_exists($userId, $existingCasUserValues)) {
$currentValue = $existingCasUserValues[$userId]; $currentValue = $existingCasUserValues[$userId];
@ -308,7 +308,7 @@ if ($fixUsernames || $fixWrongAuthSources || $fixWrongCASCodes || $fixMissingCAS
UserManager::getManager()->save($user); UserManager::getManager()->save($user);
} catch (Exception $exception) { } catch (Exception $exception) {
echo $exception->getMessage()."\n"; echo $exception->getMessage()."\n";
die("Script stopped before the end.\n"); exit("Script stopped before the end.\n");
} }
} }
if ($fixMissingCASCodes && array_key_exists($userId, $missingCASCodes)) { if ($fixMissingCASCodes && array_key_exists($userId, $missingCASCodes)) {

@ -88,7 +88,7 @@ if (empty($annee) && empty($course)) {
echo '<br />'; echo '<br />';
echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
//echo "Connection ..."; //echo "Connection ...";
$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); $ds = ldap_connect($ldap_host, $ldap_port) or exit(get_lang('LDAPConnectionError'));
ldap_set_version($ds); ldap_set_version($ds);
if ($ds) { if ($ds) {

@ -94,7 +94,7 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) {
echo '<br />'; echo '<br />';
echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
//echo "Connection ..."; //echo "Connection ...";
$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); $ds = ldap_connect($ldap_host, $ldap_port) or exit(get_lang('LDAPConnectionError'));
ldap_set_version($ds); ldap_set_version($ds);
if ($ds) { if ($ds) {
$r = false; $r = false;

@ -354,7 +354,7 @@ if (isset($_GET['export'])) {
Export::export_table_xls_html($dataToExport, $fileName); Export::export_table_xls_html($dataToExport, $fileName);
break; break;
} }
die; exit;
} }
$form->addSelect( $form->addSelect(

@ -145,7 +145,7 @@ Display::addFlash(
) )
); );
Display::display_header(get_lang('MoveUserStats')); Display::display_header(get_lang('MoveUserStats'));
echo '<div class="actions">'; echo '<div class="actions">';
echo '<a href="../admin/index.php">'. echo '<a href="../admin/index.php">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo '</div>';

@ -5,7 +5,7 @@ require_once __DIR__.'/../../inc/global.inc.php';
$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; $url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php';
if (!isset($_SESSION['conditional_login']['uid'])) { if (!isset($_SESSION['conditional_login']['uid'])) {
die("Not Authorised"); exit("Not Authorised");
} }
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

@ -462,7 +462,6 @@ function extldapGetUserAttributeValue($filter, $attribute)
return $values[0]; return $values[0];
} }
throw new Exception(get_lang('MoreThanOneAttributeValueFound')); throw new Exception(get_lang('MoreThanOneAttributeValueFound'));
// no break;
default: default:
throw new Exception(get_lang('MoreThanOneUserMatched')); throw new Exception(get_lang('MoreThanOneUserMatched'));
} }

@ -10,7 +10,7 @@
* Init. * Init.
*/ */
if (PHP_SAPI != 'cli') { if (PHP_SAPI != 'cli') {
die('For security reasons, this script can only be launched from cron or from the command line'); exit('For security reasons, this script can only be launched from cron or from the command line');
} }
require __DIR__.'/../../inc/global.inc.php'; require __DIR__.'/../../inc/global.inc.php';

@ -161,7 +161,7 @@ if (!empty($event)) {
break; break;
default: default:
header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER'])); header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER']));
die(); exit();
} }
} else { } else {
header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER'])); header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER']));

@ -25,7 +25,7 @@
* @author Yannick Warnier <yannick.warnier@beeznest.com> * @author Yannick Warnier <yannick.warnier@beeznest.com>
*/ */
if (php_sapi_name() !== 'cli') { if (php_sapi_name() !== 'cli') {
die("This script must be run from the command-line. Goodbye.\n"); exit("This script must be run from the command-line. Goodbye.\n");
} }
require __DIR__.'/../../main/inc/global.inc.php'; require __DIR__.'/../../main/inc/global.inc.php';
ini_set('max_execution_time', 0); ini_set('max_execution_time', 0);
@ -42,7 +42,7 @@ $archiveNumber = 5000000;
foreach ($tables as $table) { foreach ($tables as $table) {
$tableArchive = $table.'_'.date('Y'); $tableArchive = $table.'_'.date('Y');
if (!checkAndCreateTable($tableArchive, $table)) { if (!checkAndCreateTable($tableArchive, $table)) {
die("Could not create table $tableArchive. Please check your database user has the CREATE TABLE permission.\n"); exit("Could not create table $tableArchive. Please check your database user has the CREATE TABLE permission.\n");
} }
$sql = "SELECT count(*) FROM $table"; $sql = "SELECT count(*) FROM $table";
$res = Database::query($sql); $res = Database::query($sql);

@ -5,7 +5,7 @@
/** /**
* Code init - comment die() call to enable. * Code init - comment die() call to enable.
*/ */
die(); exit();
require '../../inc/global.inc.php'; require '../../inc/global.inc.php';
if (empty($_GET['doc'])) { if (empty($_GET['doc'])) {
echo "To add a document name to search, add ?doc=abc to the URL"; echo "To add a document name to search, add ?doc=abc to the URL";

@ -5,7 +5,7 @@
/** /**
* Code init - comment die() call to enable. * Code init - comment die() call to enable.
*/ */
die(); exit();
require '../../inc/global.inc.php'; require '../../inc/global.inc.php';
if (empty($_GET['doc'])) { if (empty($_GET['doc'])) {
echo "To add a document name to search, add ?doc=abc to the URL\n"; echo "To add a document name to search, add ?doc=abc to the URL\n";

@ -12,7 +12,7 @@ use Monolog\Handler\StreamHandler;
use Monolog\Logger; use Monolog\Logger;
if (PHP_SAPI != 'cli') { if (PHP_SAPI != 'cli') {
die('Run this script through the command line or comment this line in the code'); exit('Run this script through the command line or comment this line in the code');
} }
if (file_exists('multiple_url_fix.php')) { if (file_exists('multiple_url_fix.php')) {

@ -1,4 +1,5 @@
<?php /* For licensing terms, see /license.txt */ <?php
/* For licensing terms, see /license.txt */
/** /**
* Script to check that no language file has parse errors. * Script to check that no language file has parse errors.
* *

@ -11,7 +11,7 @@
/** /**
* Requires. * Requires.
*/ */
die(); exit();
require_once '../../inc/global.inc.php'; require_once '../../inc/global.inc.php';
require_once 'langstats.class.php'; require_once 'langstats.class.php';
/** /**

@ -1,4 +1,5 @@
<?php /* For licensing terms, see /license.txt */ <?php
/* For licensing terms, see /license.txt */
/** /**
* Cron script to list used, but undefined, language variables. * Cron script to list used, but undefined, language variables.
* *
@ -7,7 +8,7 @@
/** /**
* Includes and declarations. * Includes and declarations.
*/ */
die(); exit();
require_once __DIR__.'/../../inc/global.inc.php'; require_once __DIR__.'/../../inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH).'english'; $path = api_get_path(SYS_LANG_PATH).'english';
ini_set('memory_limit', '128M'); ini_set('memory_limit', '128M');
@ -67,7 +68,7 @@ foreach ($files as $file) {
} }
//$undefined_terms = array_flip($undefined_terms); //$undefined_terms = array_flip($undefined_terms);
if (count($undefined_terms) < 1) { if (count($undefined_terms) < 1) {
die("No missing terms<br />\n"); exit("No missing terms<br />\n");
} else { } else {
echo "The following terms were nowhere to be found: <br />\n<table>"; echo "The following terms were nowhere to be found: <br />\n<table>";
} }

@ -1,4 +1,5 @@
<?php /* For licensing terms, see /license.txt */ <?php
/* For licensing terms, see /license.txt */
/** /**
* Cron script to list unused, but defined, language variables. * Cron script to list unused, but defined, language variables.
* *
@ -7,7 +8,7 @@
/** /**
* Includes and declarations. * Includes and declarations.
*/ */
die(); exit();
require_once __DIR__.'/../../inc/global.inc.php'; require_once __DIR__.'/../../inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH).'english'; $path = api_get_path(SYS_LANG_PATH).'english';
ini_set('memory_limit', '128M'); ini_set('memory_limit', '128M');
@ -110,7 +111,7 @@ foreach ($files as $file) {
// defined terms, and this should prove the concept that there are much // defined terms, and this should prove the concept that there are much
// more variables than what we really use // more variables than what we really use
if (count($usedTerms) < 1) { if (count($usedTerms) < 1) {
die("No used terms<br />\n"); exit("No used terms<br />\n");
} else { } else {
echo "The following terms were defined but never used: <br />\n<table>"; echo "The following terms were defined but never used: <br />\n<table>";
} }

@ -8,7 +8,7 @@
/** /**
* Includes and declarations. * Includes and declarations.
*/ */
die(); exit();
require_once __DIR__.'/../../inc/global.inc.php'; require_once __DIR__.'/../../inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH).'english'; $path = api_get_path(SYS_LANG_PATH).'english';
ini_set('memory_limit', '128M'); ini_set('memory_limit', '128M');

@ -6,7 +6,7 @@
* @author Julio Montoya <gugli100@gmail.com> * @author Julio Montoya <gugli100@gmail.com>
*/ */
if (PHP_SAPI !== 'cli') { if (PHP_SAPI !== 'cli') {
die('Run this script through the command line or comment this line in the code'); exit('Run this script through the command line or comment this line in the code');
} }
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';

@ -19,7 +19,7 @@ require_once __DIR__.'/../../inc/global.inc.php';
// check if this client has been called by php_cli (command line or cron) // check if this client has been called by php_cli (command line or cron)
if (php_sapi_name() != 'cli') { if (php_sapi_name() != 'cli') {
echo 'You can\'t call this service through a browser'; echo 'You can\'t call this service through a browser';
die(); exit();
} }
// create client // create client

@ -14,7 +14,7 @@ sam@example.com
Matthew@example.com Matthew@example.com
HERMAN@example.com HERMAN@example.com
*/ */
die(); exit();
//change filename depending on file containing mails list //change filename depending on file containing mails list
$list = file('input.txt'); $list = file('input.txt');
require_once '../../inc/global.inc.php'; require_once '../../inc/global.inc.php';

@ -18,7 +18,7 @@
Matthew@example.com Matthew@example.com
HERMAN@example.com HERMAN@example.com
*/ */
die(); exit();
//change filename depending on file containing mails list, with one e-mail per line. //change filename depending on file containing mails list, with one e-mail per line.
$list = file('input.txt'); $list = file('input.txt');
require_once '../../inc/global.inc.php'; require_once '../../inc/global.inc.php';

@ -150,7 +150,7 @@ if (api_browser_support('svg')) {
$langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en';
$svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit; ?> $svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit; ?>
<script> <script>
document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $svg_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'); document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $svg_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>');
function resizeIframe() { function resizeIframe() {
var height = window.innerHeight -50; var height = window.innerHeight -50;
//max lower size //max lower size

@ -212,7 +212,7 @@ $pixlr_url = '//pixlr.com/editor/?title='.$title.'&image='.$image.'&loc='.$loc.'
//make frame an send image //make frame an send image
?> ?>
<script> <script>
document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $pixlr_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'); document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $pixlr_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>');
function resizeIframe() { function resizeIframe() {
var height = window.innerHeight; var height = window.innerHeight;
//max lower size //max lower size

@ -33,7 +33,7 @@ $user_id = api_get_user_id();
$coursePath = api_get_path(SYS_COURSE_PATH).$cidReq.'/document'; $coursePath = api_get_path(SYS_COURSE_PATH).$cidReq.'/document';
$_course = api_get_course_info($cidReq); $_course = api_get_course_info($cidReq);
if (empty($_course)) { if (empty($_course)) {
die("problem when fetching course information"); exit("problem when fetching course information");
} }
// stupid variable initialisation for old version of DocumentManager functions. // stupid variable initialisation for old version of DocumentManager functions.
$_course['path'] = $_course['directory']; $_course['path'] = $_course['directory'];
@ -60,7 +60,7 @@ if (strlen($cwd) == 0) {
$cwd = '/'; $cwd = '/';
} }
if (Security::check_abs_path($cwd, api_get_path(SYS_PATH))) { if (Security::check_abs_path($cwd, api_get_path(SYS_PATH))) {
die(); exit();
} }
if ($action == 'list') { if ($action == 'list') {
/*==== List files ====*/ /*==== List files ====*/

@ -88,7 +88,7 @@ if ($contents === false) {
// Extension security // Extension security
if ($extension != 'jpg' && $extension != 'png' && $extension != 'pxd') { if ($extension != 'jpg' && $extension != 'png' && $extension != 'pxd') {
die(); exit();
} }
if ($extension == 'pxd') { if ($extension == 'pxd') {
echo "pxd file type does not supported"; echo "pxd file type does not supported";

@ -19,12 +19,12 @@ if (isset($params['webcamname']) && isset($params['webcamdir']) && isset($params
$webcamuserid = $params['webcamuserid']; $webcamuserid = $params['webcamuserid'];
} else { } else {
api_not_allowed(); api_not_allowed();
die(); exit();
} }
if ($webcamuserid != api_get_user_id() || api_get_user_id() == 0 || $webcamuserid == 0) { if ($webcamuserid != api_get_user_id() || api_get_user_id() == 0 || $webcamuserid == 0) {
api_not_allowed(); api_not_allowed();
die(); exit();
} }
//clean //clean

@ -324,7 +324,7 @@ class Dropbox_SentWork extends Dropbox_Work
} }
if (!is_array($recipient_ids) || 0 == count($recipient_ids)) { if (!is_array($recipient_ids) || 0 == count($recipient_ids)) {
die(get_lang('GeneralError').' (code 209)'); exit(get_lang('GeneralError').' (code 209)');
} }
foreach ($recipient_ids as $rec) { foreach ($recipient_ids as $rec) {
@ -542,7 +542,7 @@ class Dropbox_Person
if (!$found) { if (!$found) {
if (!$this->deleteReceivedWorkFolder($id)) { if (!$this->deleteReceivedWorkFolder($id)) {
die(get_lang('GeneralError').' (code 216)'); exit(get_lang('GeneralError').' (code 216)');
} }
} }
// Delete entries in person table concerning received works // Delete entries in person table concerning received works
@ -573,7 +573,7 @@ class Dropbox_Person
} }
if (!$found) { if (!$found) {
if (!$this->deleteReceivedWorkFolder($id)) { if (!$this->deleteReceivedWorkFolder($id)) {
die(get_lang('GeneralError').' (code 219)'); exit(get_lang('GeneralError').' (code 219)');
} }
} }
//$file_id = $this->sentWork[$index]->id; //$file_id = $this->sentWork[$index]->id;

@ -816,7 +816,7 @@ function getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '')
$result = Database::query($sql); $result = Database::query($sql);
if (!($res = Database::fetch_array($result))) { if (!($res = Database::fetch_array($result))) {
die(get_lang('GeneralError').' (code 901)'); exit(get_lang('GeneralError').' (code 901)');
} }
if ($owner == 0) { if ($owner == 0) {
return $res['uploader_id']; return $res['uploader_id'];
@ -824,7 +824,7 @@ function getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '')
if ($res['uploader_id'] == $owner) { if ($res['uploader_id'] == $owner) {
return true; return true;
} }
die(get_lang('GeneralError').' (code '.$or_die.')'); exit(get_lang('GeneralError').' (code '.$or_die.')');
} }
/** /**

@ -293,7 +293,7 @@ if (!empty($track_exercise_info)) {
if ($is_allowedToEdit && if ($is_allowedToEdit &&
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK == $result_disabled RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK == $result_disabled
){ ) {
$showTotalScoreAndUserChoicesInLastAttempt = true; $showTotalScoreAndUserChoicesInLastAttempt = true;
} }
break; break;

@ -55,7 +55,7 @@ foreach ($_POST as $index => $valeur) {
?> ?>
</td> </td>
</tr> </tr>
<input type=hidden name=aaa value=<?= serialize(Database::fetch_array($resultexam)); ?>/> <input type=hidden name=aaa value=<?php echo serialize(Database::fetch_array($resultexam)); ?>/>
<input type="submit" value="Sauvegarder" name="B1"> <input type="submit" value="Sauvegarder" name="B1">
<?php <?php
echo $id, $tableau; echo $id, $tableau;

@ -303,7 +303,7 @@ if ($displayMode == "viewDefEdit") {
} ?> } ?>
</SELECT> </SELECT>
<?php <?php
echo'<p></p> '; echo '<p></p> ';
if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed)) { if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed)) {
} else { } else {
echo "<td>", get_lang('CourseManager'), "</td>\n"; echo "<td>", get_lang('CourseManager'), "</td>\n";

@ -482,7 +482,7 @@ if (isset($_GET['deletelink'])) {
if (!empty($course_to_crsind) && !isset($_GET['confirm'])) { if (!empty($course_to_crsind) && !isset($_GET['confirm'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
if (!isset($_GET['movecat']) && !isset($_GET['moveeval'])) { if (!isset($_GET['movecat']) && !isset($_GET['moveeval'])) {
die('Error: movecat or moveeval not defined'); exit('Error: movecat or moveeval not defined');
} }
$button = '<form name="confirm" method="post" action="'.api_get_self().'?confirm=' $button = '<form name="confirm" method="post" action="'.api_get_self().'?confirm='
.(isset($_GET['movecat']) ? '&movecat='.$moveCategoryId .(isset($_GET['movecat']) ? '&movecat='.$moveCategoryId

@ -217,7 +217,7 @@ class Result
$sql .= ")"; $sql .= ")";
Database::query($sql); Database::query($sql);
} else { } else {
die('Error in Result add: required field empty'); exit('Error in Result add: required field empty');
} }
} }
@ -248,7 +248,7 @@ class Result
Database::query($sql); Database::query($sql);
} else { } else {
die('Error in Result add: required field empty'); exit('Error in Result add: required field empty');
} }
} }

@ -76,7 +76,7 @@ class SurveyLink extends AbstractLink
public function get_all_links() public function get_all_links()
{ {
if (empty($this->course_code)) { if (empty($this->course_code)) {
die('Error in get_all_links() : course code not set'); exit('Error in get_all_links() : course code not set');
} }
$tbl_survey = $this->get_survey_table(); $tbl_survey = $this->get_survey_table();
$sessionId = $this->get_session_id(); $sessionId = $this->get_session_id();

@ -37,7 +37,7 @@ class LinkAddEditForm extends FormValidator
$link->set_session_id(api_get_session_id()); $link->set_session_id(api_get_session_id());
$link->set_category_id($category_object[0]->get_id()); $link->set_category_id($category_object[0]->get_id());
} else { } else {
die('LinkAddEditForm error: define link_type/category_object or link_object'); exit('LinkAddEditForm error: define link_type/category_object or link_object');
} }
$defaults = []; $defaults = [];

@ -339,9 +339,7 @@ class UserDataGenerator
} }
$scoredisplay = ScoreDisplay::instance(); $scoredisplay = ScoreDisplay::instance();
$displaytype = SCORE_AVERAGE; $displaytype = SCORE_AVERAGE;
/*if ($ignore_score_color)
$displaytype |= SCORE_IGNORE_SPLIT;
*/
return $scoredisplay->display_score($avgscore, $displaytype); return $scoredisplay->display_score($avgscore, $displaytype);
} }

@ -41,14 +41,14 @@ switch ($action) {
$blockName = isset($_POST['block']) ? Security::remove_XSS($_POST['block']) : null; $blockName = isset($_POST['block']) ? Security::remove_XSS($_POST['block']) : null;
if (empty($blockName)) { if (empty($blockName)) {
die; exit;
} }
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$accessUrlId = api_get_current_access_url_id(); $accessUrlId = api_get_current_access_url_id();
if ($accessUrlId == -1) { if ($accessUrlId == -1) {
die; exit;
} }
$urlInfo = api_get_access_url($accessUrlId); $urlInfo = api_get_access_url($accessUrlId);
@ -60,15 +60,15 @@ switch ($action) {
} }
if (!file_exists($newUrlDir)) { if (!file_exists($newUrlDir)) {
die; exit;
} }
if (!Security::check_abs_path("{$newUrlDir}{$blockName}_extra.html", $newUrlDir)) { if (!Security::check_abs_path("{$newUrlDir}{$blockName}_extra.html", $newUrlDir)) {
die; exit;
} }
if (!file_exists("{$newUrlDir}{$blockName}_extra.html")) { if (!file_exists("{$newUrlDir}{$blockName}_extra.html")) {
die; exit;
} }
echo file_get_contents("{$newUrlDir}{$blockName}_extra.html"); echo file_get_contents("{$newUrlDir}{$blockName}_extra.html");

@ -13,7 +13,6 @@ $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
switch ($action) { switch ($action) {
case 'get_promotions': case 'get_promotions':
$careerId = isset($_REQUEST['career_id']) ? (int) $_REQUEST['career_id'] : 0; $careerId = isset($_REQUEST['career_id']) ? (int) $_REQUEST['career_id'] : 0;
$career = new Promotion(); $career = new Promotion();
$promotions = $career->get_all_promotions_by_career_id($careerId); $promotions = $career->get_all_promotions_by_career_id($careerId);

@ -19,12 +19,12 @@ if (isset($params['waminame']) && isset($params['wamidir']) && isset($params['wa
$wamiuserid = $params['wamiuserid']; $wamiuserid = $params['wamiuserid'];
} else { } else {
api_not_allowed(); api_not_allowed();
die(); exit();
} }
if (empty($wamiuserid)) { if (empty($wamiuserid)) {
api_not_allowed(); api_not_allowed();
die(); exit();
} }
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'document'; // can be document or message $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'document'; // can be document or message
@ -49,7 +49,7 @@ $ext = explode('.', $waminame);
$ext = strtolower($ext[sizeof($ext) - 1]); $ext = strtolower($ext[sizeof($ext) - 1]);
if ($ext != 'wav') { if ($ext != 'wav') {
die(); exit();
} }
switch ($type) { switch ($type) {
@ -67,7 +67,7 @@ switch ($type) {
$documentPath = $saveDir.'/'.$waminame_to_save; $documentPath = $saveDir.'/'.$waminame_to_save;
// Add to disk // Add to disk
$fh = fopen($documentPath, 'w') or die("can't open file"); $fh = fopen($documentPath, 'w') or exit("can't open file");
fwrite($fh, $content); fwrite($fh, $content);
fclose($fh); fclose($fh);

@ -307,7 +307,7 @@ switch ($action) {
} }
); );
$documentAndFolders = array_map( $documentAndFolders = array_map(
function (array $documentData) use ($course, $session, $courseInfo, $currentUserId, $http_www, $folderName, $id) { function (array $documentData) use ($course, $session, $folderName) {
$downloadUrl = api_get_path(WEB_CODE_PATH).'document/document.php?' $downloadUrl = api_get_path(WEB_CODE_PATH).'document/document.php?'
.api_get_cidreq_params($course->getCode(), $session->getId()).'&' .api_get_cidreq_params($course->getCode(), $session->getId()).'&'
.http_build_query(['action' => 'download', 'id' => $documentData['id']]); .http_build_query(['action' => 'download', 'id' => $documentData['id']]);

@ -30,7 +30,7 @@ if (file_exists($kernel->getConfigurationFile())) {
$global_error_code = 2; $global_error_code = 2;
// The system has not been installed yet. // The system has not been installed yet.
require_once __DIR__.'/../inc/global_error_message.inc.php'; require_once __DIR__.'/../inc/global_error_message.inc.php';
die(); exit();
} }
} }
@ -79,7 +79,7 @@ try {
$global_error_code = 3; $global_error_code = 3;
// The database server is not available or credentials are invalid. // The database server is not available or credentials are invalid.
require $includePath.'/global_error_message.inc.php'; require $includePath.'/global_error_message.inc.php';
die(); exit();
} }
/* RETRIEVING ALL THE CHAMILO CONFIG SETTINGS FOR MULTIPLE URLs FEATURE*/ /* RETRIEVING ALL THE CHAMILO CONFIG SETTINGS FOR MULTIPLE URLs FEATURE*/

@ -44,7 +44,7 @@ if (file_exists($kernel->getConfigurationFile())) {
$global_error_code = 2; $global_error_code = 2;
// The system has not been installed yet. // The system has not been installed yet.
require_once __DIR__.'/../inc/global_error_message.inc.php'; require_once __DIR__.'/../inc/global_error_message.inc.php';
die(); exit();
} }
} }
@ -161,7 +161,7 @@ try {
$global_error_code = 3; $global_error_code = 3;
// The database server is not available or credentials are invalid. // The database server is not available or credentials are invalid.
require $includePath.'/global_error_message.inc.php'; require $includePath.'/global_error_message.inc.php';
die(); exit();
} }
/* RETRIEVING ALL THE CHAMILO CONFIG SETTINGS FOR MULTIPLE URLs FEATURE*/ /* RETRIEVING ALL THE CHAMILO CONFIG SETTINGS FOR MULTIPLE URLs FEATURE*/

@ -320,5 +320,5 @@ EOM;
$global_error_message_page = str_replace('{'.strtoupper($key).'}', $value, $global_error_message_page); $global_error_message_page = str_replace('{'.strtoupper($key).'}', $value, $global_error_message_page);
} }
header('Content-Type: text/html; charset='.$global_error_message['encoding']); header('Content-Type: text/html; charset='.$global_error_message['encoding']);
die($global_error_message_page); exit($global_error_message_page);
} }

@ -642,7 +642,7 @@ class CourseHome
$allowEditionInSession = api_get_configuration_value('allow_edit_tool_visibility_in_session'); $allowEditionInSession = api_get_configuration_value('allow_edit_tool_visibility_in_session');
// If exists same tool (by name) from session in base course then avoid it. Allow them pass in other cases // If exists same tool (by name) from session in base course then avoid it. Allow them pass in other cases
$tools = array_filter($tools, function (array $toolToFilter) use ($sessionId, $tools) { $tools = array_filter($tools, function (array $toolToFilter) use ($tools) {
if (!empty($toolToFilter['session_id'])) { if (!empty($toolToFilter['session_id'])) {
foreach ($tools as $originalTool) { foreach ($tools as $originalTool) {
if ($toolToFilter['name'] == $originalTool['name'] && empty($originalTool['session_id'])) { if ($toolToFilter['name'] == $originalTool['name'] && empty($originalTool['session_id'])) {

@ -2348,7 +2348,7 @@ class Display
} }
$link = self::url($label.' ', $link_to_show, $linkAttributes); $link = self::url($label.' ', $link_to_show, $linkAttributes);
return '<li class = "'.$class.'">'.$link.'</li>'; return '<li class = "'.$class.'">'.$link.'</li>';
} }
/** /**

@ -735,7 +735,7 @@ class ExtraFieldOption extends Model
*/ */
public function getPriorityOptions() public function getPriorityOptions()
{ {
return [ return [
'' => get_lang('SelectAnOption'), '' => get_lang('SelectAnOption'),
1 => get_lang('Success'), 1 => get_lang('Success'),
2 => get_lang('Info'), 2 => get_lang('Info'),

@ -1620,10 +1620,10 @@ function search_img_from_html($html_file)
$buffer = fread($fp, $size_file); $buffer = fread($fp, $size_file);
if (strlen($buffer) >= 0 && $buffer !== false) { if (strlen($buffer) >= 0 && $buffer !== false) {
} else { } else {
die('<center>Can not read file.</center>'); exit('<center>Can not read file.</center>');
} }
} else { } else {
die('<center>Can not read file.</center>'); exit('<center>Can not read file.</center>');
} }
$matches = []; $matches = [];
if (preg_match_all('~<[[:space:]]*img[^>]*>~i', $buffer, $matches)) { if (preg_match_all('~<[[:space:]]*img[^>]*>~i', $buffer, $matches)) {

@ -2883,7 +2883,7 @@ class GroupManager
case 'settings': case 'settings':
$activeSettings = 'active'; $activeSettings = 'active';
break; break;
case'tutor': case 'tutor':
$activeTutor = 'active'; $activeTutor = 'active';
break; break;
case 'member': case 'member':

@ -437,7 +437,7 @@ class LegalManager
*/ */
public static function getTreatmentTypeList() public static function getTreatmentTypeList()
{ {
return [ return [
'privacy_terms_collection' => 'collection', 'privacy_terms_collection' => 'collection',
'privacy_terms_recording' => 'recording', 'privacy_terms_recording' => 'recording',
'privacy_terms_organization' => 'organization', 'privacy_terms_organization' => 'organization',

@ -1476,7 +1476,6 @@ class MessageManager
get_lang('Me').'</b>'; get_lang('Me').'</b>';
break; break;
case self::MESSAGE_TYPE_OUTBOX: case self::MESSAGE_TYPE_OUTBOX:
$message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'. $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.
$receiverUserInfo['complete_name_with_username'].'</b>'; $receiverUserInfo['complete_name_with_username'].'</b>';
break; break;

@ -827,7 +827,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
include api_get_path(SYS_CODE_PATH).'auth/openid/login.php'; include api_get_path(SYS_CODE_PATH).'auth/openid/login.php';
openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php'); openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php');
//this last function should trigger a redirect, so we can die here safely //this last function should trigger a redirect, so we can die here safely
die('Openid login redirection should be in progress'); exit('Openid login redirection should be in progress');
} elseif (!empty($_GET['openid_identity'])) { //it's usual for PHP to replace '.' (dot) by '_' (underscore) in URL parameters } elseif (!empty($_GET['openid_identity'])) { //it's usual for PHP to replace '.' (dot) by '_' (underscore) in URL parameters
include api_get_path(SYS_CODE_PATH).'auth/openid/login.php'; include api_get_path(SYS_CODE_PATH).'auth/openid/login.php';
$res = openid_complete($_GET); $res = openid_complete($_GET);
@ -1365,7 +1365,6 @@ if ((isset($uidReset) && $uidReset) || $cidReset) {
} }
break; break;
case '0': //Student case '0': //Student
$is_courseMember = true; $is_courseMember = true;
$is_courseTutor = false; $is_courseTutor = false;
$is_courseAdmin = false; $is_courseAdmin = false;

Loading…
Cancel
Save