Minor - format code

pull/3124/head
Julio Montoya 6 years ago
parent 0721528534
commit 97e9899f7d
  1. 22
      .github/workflows/php.yml
  2. 1
      public/main/admin/access_url_add_courses_to_url.php
  3. 1
      public/main/admin/access_url_add_usergroup_to_url.php
  4. 1
      public/main/admin/access_url_add_users_to_url.php
  5. 4
      public/main/admin/access_url_edit_users_to_url.php
  6. 1
      public/main/admin/access_urls.php
  7. 2
      public/main/admin/add_users_to_usergroup.php
  8. 1
      public/main/admin/course_request_accepted.php
  9. 1
      public/main/admin/course_request_edit.php
  10. 1
      public/main/admin/course_request_rejected.php
  11. 1
      public/main/admin/course_request_review.php
  12. 2
      public/main/admin/dashboard_add_users_to_user.php
  13. 2
      public/main/admin/email_tester.php
  14. 3
      public/main/admin/export_certificates.php
  15. 9
      public/main/admin/extra_field_options.php
  16. 9
      public/main/admin/extra_field_workflow.php
  17. 5
      public/main/admin/extra_fields.php
  18. 2
      public/main/admin/filler.php
  19. 8
      public/main/admin/grade_models.php
  20. 2
      public/main/admin/gradebook_dependency.php
  21. 2
      public/main/admin/gradebook_list.php
  22. 14
      public/main/admin/index.php
  23. 22
      public/main/admin/languages.php
  24. 5
      public/main/admin/ldap_form_add_users_group.php
  25. 5
      public/main/admin/ldap_import_students.php
  26. 7
      public/main/admin/ldap_import_students_to_session.php
  27. 6
      public/main/admin/ldap_users_list.php
  28. 6
      public/main/admin/ldap_users_synchro.php
  29. 12
      public/main/admin/legal_add.php
  30. 2
      public/main/admin/legal_list.php
  31. 15
      public/main/admin/promotions.php
  32. 5
      public/main/admin/questions.php
  33. 92
      public/main/admin/settings.lib.php
  34. 26
      public/main/admin/settings.php
  35. 2
      public/main/admin/skill.php
  36. 4
      public/main/admin/skill_badge.php
  37. 6
      public/main/admin/skill_badge_create.php
  38. 2
      public/main/admin/skill_badge_list.php
  39. 2
      public/main/admin/skill_create.php
  40. 2
      public/main/admin/skill_edit.php
  41. 2
      public/main/admin/skill_level.php
  42. 2
      public/main/admin/skill_list.php
  43. 2
      public/main/admin/skill_profile.php
  44. 2
      public/main/admin/skill_rel_course.php
  45. 6
      public/main/admin/skill_translate.php
  46. 3
      public/main/admin/skills.php
  47. 5
      public/main/admin/skills_gradebook.php
  48. 9
      public/main/admin/skills_import.php
  49. 3
      public/main/admin/skills_profile.php
  50. 3
      public/main/admin/skills_wheel.php
  51. 26
      public/main/admin/special_exports.php
  52. 4
      public/main/admin/specific_fields.php
  53. 6
      public/main/admin/specific_fields_add.php
  54. 3
      public/main/admin/statistics.php
  55. 50
      public/main/admin/statistics/index.php
  56. 16
      public/main/admin/sub_language.php
  57. 46
      public/main/admin/sub_language_add.php
  58. 4
      public/main/admin/sub_language_ajax.inc.php
  59. 28
      public/main/admin/subscribe_user2course.php
  60. 22
      public/main/admin/system_announcements.php
  61. 2
      public/main/admin/teachers_time_by_session_report.php
  62. 2
      public/main/admin/update_schema.php
  63. 23
      public/main/admin/user_add.php
  64. 29
      public/main/admin/user_edit.php
  65. 13
      public/main/admin/user_export.php
  66. 26
      public/main/admin/user_import.php
  67. 22
      public/main/admin/user_information.php
  68. 2
      public/main/admin/user_linking_requests.php
  69. 26
      public/main/admin/user_list.php
  70. 18
      public/main/admin/user_list_consent.php
  71. 16
      public/main/admin/user_move_stats.php
  72. 20
      public/main/admin/user_update_import.php
  73. 3
      public/main/admin/usergroup_export.php
  74. 6
      public/main/admin/usergroup_import.php
  75. 12
      public/main/admin/usergroup_user_import.php
  76. 4
      public/main/admin/usergroup_users.php
  77. 5
      public/main/admin/usergroups.php
  78. 1
      public/main/announcements/announcements.php
  79. 10
      public/main/attendance/attendance_controller.php
  80. 4
      public/main/attendance/attendance_sheet.php
  81. 4
      public/main/auth/catalog_layout.php
  82. 8
      public/main/auth/courses.php
  83. 26
      public/main/auth/courses_categories.php
  84. 30
      public/main/auth/courses_controller.php
  85. 140
      public/main/auth/inscription.php
  86. 8
      public/main/auth/justification.php
  87. 2
      public/main/auth/layout.php
  88. 12
      public/main/auth/lostPassword.php
  89. 10
      public/main/auth/my_progress.php
  90. 50
      public/main/auth/profile.php
  91. 22
      public/main/auth/sort_my_courses.php
  92. 2
      public/main/auth/unsubscribe_account.php
  93. 6
      public/main/badge/assertion.php
  94. 6
      public/main/badge/assign.php
  95. 2
      public/main/badge/class.php
  96. 2
      public/main/badge/criteria.php
  97. 8
      public/main/badge/issued.php
  98. 8
      public/main/badge/issued_all.php
  99. 2
      public/main/badge/issuer.php
  100. 30
      public/main/blog/blog.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -25,20 +25,20 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v1
- name: Setup PHP Action
uses: shivammathur/setup-php@1.6.1
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, gd, soap, intl, zip, bcmath
- name: Setup PHP Action
uses: shivammathur/setup-php@1.6.1
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, gd, soap, intl, zip, bcmath
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Composer analyse
run: composer analyse
- name: Composer analyse
run: composer analyse
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

@ -5,7 +5,6 @@
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on.
*
*
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;

@ -5,7 +5,6 @@
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on.
*
*
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;

@ -5,7 +5,6 @@
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on.
*
*
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;

@ -98,7 +98,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$user_info = api_get_user_info($user);
if (!empty($user_info)) {
$user_added_list[] = $i.'. '.api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, null, $user_info['username']);
++$i;
$i++;
}
}
if (!empty($user_added_list)) {
@ -114,7 +114,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$user_info = api_get_user_info($user);
if (!empty($user_info)) {
$user_deleted_list[] = $i.'. '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
++$i;
$i++;
}
}
if (!empty($user_deleted_list)) {

@ -5,7 +5,6 @@
/**
* Frontend script for multiple access urls.
*
*
* @author Julio Montoya <gugli100@gmail.com>
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*/

@ -169,7 +169,7 @@ if (is_array($extra_field_list)) {
if ($use_extra_fields) {
$final_result = [];
if (count($extra_field_result) > 1) {
for ($i = 0; $i < count($extra_field_result) - 1; ++$i) {
for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
if (is_array($extra_field_result[$i + 1])) {
$final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]);
}

@ -5,7 +5,6 @@
/**
* A list containig the accepted course requests.
*
*
* @author José Manuel Abuin Mosquera <chema@cesga.es>, 2010
* @author Bruno Rubio Gayo <brubio@cesga.es>, 2010
* Centro de Supercomputacion de Galicia (CESGA)

@ -5,7 +5,6 @@
/**
* A page for detailed preview or edition of a given course request.
*
*
* @author Ivan Tcholakov <ivantcholakov@gmail.com>, 2010
*/
$cidReset = true;

@ -5,7 +5,6 @@
/**
* A list containing the rejected course requests.
*
*
* @author José Manuel Abuin Mosquera <chema@cesga.es>, 2010
* @author Bruno Rubio Gayo <brubio@cesga.es>, 2010
* Centro de Supercomputacion de Galicia (CESGA)

@ -5,7 +5,6 @@
/**
* A list containing the pending course requests.
*
*
* @author José Manuel Abuin Mosquera <chema@cesga.es>, 2010
* Centro de Supercomputacion de Galicia (CESGA)
* @author Ivan Tcholakov <ivantcholakov@gmail.com> (technical adaptation for Chamilo 1.8.8), 2010

@ -153,7 +153,7 @@ function search_users($needle, $type = 'multiple')
$rs = Database::query($sql);
$i = 0;
while ($user = Database :: fetch_array($rs)) {
++$i;
$i++;
if ($i <= 10) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_user(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Index page of the admin tools.
*
* @package chamilo.admin
*/
// Resetting the course id.
$cidReset = true;

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
Display::display_header(null);

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -36,7 +33,7 @@ $extra_field_info = $extra_field->get($field_id);
$check = Security::check_token('request');
$token = Security::get_token();
if ($action == 'add') {
if ('add' == $action) {
$interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
$interbreadcrumb[] = [
'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
@ -47,7 +44,7 @@ if ($action == 'add') {
'name' => get_lang('Edit extra field options'),
];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
} elseif ($action == 'edit') {
} elseif ('edit' == $action) {
$interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
$interbreadcrumb[] = [
'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
@ -148,7 +145,7 @@ $obj->fieldId = $field_id;
// Action handling: Add
switch ($action) {
case 'add':
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
if (0 != api_get_session_id() && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
$url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&'.$params;

@ -3,9 +3,6 @@
use Chamilo\CoreBundle\Entity\ExtraFieldOptionRelFieldOption;
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -35,7 +32,7 @@ $extraFieldInfo = $extraField->get($field_id);
$check = Security::check_token('request');
$token = Security::get_token();
if ($action == 'add') {
if ('add' == $action) {
$interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extraField->type, 'name' => $extraField->pageName];
$interbreadcrumb[] = [
'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
@ -46,7 +43,7 @@ if ($action == 'add') {
'name' => get_lang('Edit extra field options'),
];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
} elseif ($action == 'edit') {
} elseif ('edit' == $action) {
$interbreadcrumb[] = [
'url' => 'extra_fields.php?type='.$extraField->type,
'name' => $extraField->pageName,
@ -234,7 +231,7 @@ if ($form->validate()) {
]
);
if ($value == 1) {
if (1 == $value) {
if (empty($extraFieldOptionRelFieldOption)) {
$extraFieldOptionRelFieldOption = new ExtraFieldOptionRelFieldOption();
$extraFieldOptionRelFieldOption

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -112,7 +109,7 @@ Display::display_header($tool_name);
// Action handling: Add
switch ($action) {
case 'add':
if (api_get_session_id() != 0 &&
if (0 != api_get_session_id() &&
!api_is_allowed_to_session_edit(false, true)
) {
api_not_allowed();

@ -3,8 +3,6 @@
/**
* Index of the admin tools.
*
* @package chamilo.admin
*/
// resetting the course id

@ -8,7 +8,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
if (api_get_setting('gradebook_enable_grade_model') != 'true') {
if ('true' != api_get_setting('gradebook_enable_grade_model')) {
api_not_allowed(true);
}
@ -23,10 +23,10 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
$check = Security::check_token('request');
$token = Security::get_token();
if ($action === 'add') {
if ('add' === $action) {
$interbreadcrumb[] = ['url' => 'grade_models.php', 'name' => get_lang('Grading model')];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
} elseif ($action == 'edit') {
} elseif ('edit' == $action) {
$interbreadcrumb[] = ['url' => 'grade_models.php', 'name' => get_lang('Grading model')];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
} else {
@ -136,7 +136,7 @@ $obj = new GradeModel();
// Action handling: Add
switch ($action) {
case 'add':
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
if (0 != api_get_session_id() && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}

@ -8,7 +8,7 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_admin_script();
$allow = api_get_configuration_value('gradebook_dependency');
if ($allow == false) {
if (false == $allow) {
api_not_allowed(true);
}

@ -10,7 +10,7 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_admin_script();
$allow = api_get_configuration_value('gradebook_dependency');
if ($allow == false) {
if (false == $allow) {
api_not_allowed(true);
}

@ -7,8 +7,6 @@ use League\Flysystem\Filesystem;
/**
* Index page of the admin tools.
*
* @package chamilo.admin
*/
// Resetting the course id.
$cidReset = true;
@ -162,7 +160,7 @@ if (api_is_platform_admin()) {
$items[] = ['url' => 'course_list.php', 'label' => get_lang('Course list')];
$items[] = ['url' => 'course_add.php', 'label' => get_lang('Add course')];
if (api_get_setting('course_validation') == 'true') {
if ('true' == api_get_setting('course_validation')) {
$items[] = ['url' => 'course_request_review.php', 'label' => get_lang('Review incoming course requests')];
$items[] = ['url' => 'course_request_accepted.php', 'label' => get_lang('Accepted course requests')];
$items[] = ['url' => 'course_request_rejected.php', 'label' => get_lang('Rejected course requests')];
@ -174,7 +172,7 @@ if (api_is_platform_admin()) {
$items[] = ['url' => 'subscribe_user2course.php', 'label' => get_lang('Add a user to a course')];
$items[] = ['url' => 'course_user_import.php', 'label' => get_lang('Import users list')];
if (api_get_setting('gradebook_enable_grade_model') == 'true') {
if ('true' == api_get_setting('gradebook_enable_grade_model')) {
$items[] = ['url' => 'grade_models.php', 'label' => get_lang('Grading model')];
}
@ -381,14 +379,14 @@ if (api_is_platform_admin()) {
}
}
if (api_get_plugin_setting('dictionary', 'enable_plugin_dictionary') == 'true') {
if ('true' == api_get_plugin_setting('dictionary', 'enable_plugin_dictionary')) {
$items[] = [
'url' => api_get_path(WEB_PLUGIN_PATH).'dictionary/terms.php',
'label' => get_lang('Dictionary'),
];
}
if (api_get_setting('allow_terms_conditions') == 'true') {
if ('true' == api_get_setting('allow_terms_conditions')) {
$items[] = ['url' => 'legal_add.php', 'label' => get_lang('Terms and Conditions')];
}
@ -452,7 +450,7 @@ if (api_is_platform_admin()) {
'label' => get_lang('Tickets'),
];
if (api_get_configuration_value('db_manager_enabled') == true &&
if (true == api_get_configuration_value('db_manager_enabled') &&
api_is_global_platform_admin()
) {
$host = $_configuration['db_host'];
@ -601,7 +599,7 @@ $tpl = new Template();
// Display the Site Use Cookie Warning Validation
$useCookieValidation = api_get_setting('cookie_warning');
if ($useCookieValidation === 'true') {
if ('true' === $useCookieValidation) {
if (isset($_POST['acceptCookies'])) {
api_set_site_use_cookie_warning_cookie();
} elseif (!api_site_use_cookie_warning_cookie_exist()) {

@ -27,9 +27,9 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
//Ajax request
if (isset($_POST['sent_http_request'])) {
if (isset($_POST['visibility']) &&
$_POST['visibility'] == strval(intval($_POST['visibility'])) && $_POST['visibility'] == 0) {
$_POST['visibility'] == strval(intval($_POST['visibility'])) && 0 == $_POST['visibility']) {
if (isset($_POST['id']) && $_POST['id'] == strval(intval($_POST['id']))) {
if (SubLanguageManager::check_if_language_is_used($_POST['id']) == false) {
if (false == SubLanguageManager::check_if_language_is_used($_POST['id'])) {
SubLanguageManager::make_unavailable_language($_POST['id']);
echo 'set_hidden';
} else {
@ -38,7 +38,7 @@ if (isset($_POST['sent_http_request'])) {
}
}
if (isset($_POST['visibility']) &&
$_POST['visibility'] == strval(intval($_POST['visibility'])) && $_POST['visibility'] == 1
$_POST['visibility'] == strval(intval($_POST['visibility'])) && 1 == $_POST['visibility']
) {
if (isset($_POST['id']) && $_POST['id'] == strval(intval($_POST['id']))) {
SubLanguageManager::make_available_language($_POST['id']);
@ -186,7 +186,7 @@ switch ($action) {
$failedDisabledLanguages = '';
$checkFailed = false;
foreach ($allLanguages as $language) {
if (SubLanguageManager::check_if_language_is_used($language['id']) == false) {
if (false == SubLanguageManager::check_if_language_is_used($language['id'])) {
SubLanguageManager::make_unavailable_language($language['id']);
} else {
if (intval(SubLanguageManager::get_platform_language_id()) !== intval($language['id'])) {
@ -205,7 +205,7 @@ switch ($action) {
break;
case 'make_unavailable_confirmed':
$language_info = SubLanguageManager::get_all_information_of_language($id);
if ($language_info['available'] == 1) {
if (1 == $language_info['available']) {
SubLanguageManager::make_unavailable_language($id);
$platform_language = api_get_setting('platformLanguage');
UserManager::update_all_user_languages($language_info['english_name'], $platform_language);
@ -224,7 +224,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
WHERE id='$postId'";
$result = Database::query($sql);
// changing the Platform language
if ($_POST['platformlanguage'] && $_POST['platformlanguage'] != '') {
if ($_POST['platformlanguage'] && '' != $_POST['platformlanguage']) {
api_set_setting('platformLanguage', $_POST['platformlanguage'], null, null, api_get_current_access_url_id());
header("Location: $url");
exit;
@ -285,7 +285,7 @@ while ($row = Database::fetch_array($result_select)) {
$row_td[] = $row['id'];
$checked = '';
// the first column is the original name of the language OR a form containing the original name
if ($action == 'edit' && $row['id'] == $id) {
if ('edit' == $action && $row['id'] == $id) {
if ($row['english_name'] == api_get_setting('platformLanguage')) {
$checked = ' checked="checked" ';
}
@ -321,13 +321,13 @@ while ($row = Database::fetch_array($result_select)) {
$allow_add_term_sub_language = null;
$allow_use_sub_language = '';
$allow_add_term_sub_language = '';
if (api_get_setting('allow_use_sub_language') === 'true') {
if ('true' === api_get_setting('allow_use_sub_language')) {
$verified_if_is_sub_language = SubLanguageManager::check_if_language_is_sub_language($row['id']);
if ($verified_if_is_sub_language === false) {
if (false === $verified_if_is_sub_language) {
$verified_if_is_father = SubLanguageManager::check_if_language_is_father($row['id']);
$allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=".$row['id']."'>".
Display::return_icon('new_language.png', get_lang('Create sub-language'), [], ICON_SIZE_SMALL)."</a>";
if ($verified_if_is_father === true) {
if (true === $verified_if_is_father) {
$allow_add_term_sub_language = '';
} else {
$allow_add_term_sub_language = '';
@ -346,7 +346,7 @@ while ($row = Database::fetch_array($result_select)) {
Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>
&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
} else {
if ($row['available'] == 1) {
if (1 == $row['available']) {
$row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeunavailable&id=".$row['id']."'>".
Display::return_icon('visible.png', get_lang('Make unavailable'), ['id' => 'imglinktool_'.$row['id']], ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
} else {

@ -2,9 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Form to add users through LDAP (deprecated?).
*
* @package chamilo.admin
* Copyright (c) 2007 Mustapha Alouani (supervised by Michel Moreau-Belliard)
*/
/**
@ -12,7 +9,7 @@
*/
$nbre = 0;
echo '<form name="form" method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'">';
if ($statut == 1) {
if (1 == $statut) {
echo get_lang(
'e-mailNotifySubscription'
).': <input type="checkbox" name="mailling" value="1" checked="checked"><i>'.get_lang(

@ -3,9 +3,6 @@
/**
* Script to import students from LDAP.
*
* @package chamilo.admin
* Copyright (c) 2007 Mustapha Alouani (supervised by Michel Moreau-Belliard)
*/
// resetting the course id
$cidReset = true;
@ -127,7 +124,7 @@ if (empty($annee) && empty($course)) {
echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('Back to start new search').'</a>';
echo '<br /><br />';
echo '</div>';
} elseif (!empty($annee) && !empty($course) && ($_POST['confirmed'] == 'yes')) {
} elseif (!empty($annee) && !empty($course) && ('yes' == $_POST['confirmed'])) {
$id = $_POST['username_form'];
$UserList = [];
$userid_match_login = [];

@ -2,9 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Edition script for sessions categories.
*
* @package chamilo.admin
* Copyright (c) 2007 Mustapha Alouani (supervised by Michel Moreau-Belliard)
*/
// resetting the course id
@ -131,7 +128,7 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) {
echo '<a href="ldap_import_students.php?annee=">'.get_lang('Back to start new search').'</a>';
echo '<br /><br />';
echo '</div>';
} elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes')) {
} elseif (!empty($annee) && !empty($id_session) && ('yes' == $_POST['confirmed'])) {
$id = $_POST['username_form'];
$UserList = [];
$userid_match_login = [];
@ -155,7 +152,7 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) {
'registered_at' => api_get_utc_datetime(),
]
);
if ($res_user !== false) {
if (false !== $res_user) {
$num++;
}
}

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* @author Mustapha Alouani
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -16,7 +14,7 @@ $action = @$_GET["action"] ?: null;
$login_as_user_id = @$_GET["user_id"] ?: null;
// Login as ...
if ($action == "login_as" && !empty($login_as_user_id)) {
if ("login_as" == $action && !empty($login_as_user_id)) {
login_user($login_as_user_id);
}
@ -123,7 +121,7 @@ if (isset($_POST['action'])) {
$UserList[] = ldap_add_user($user_id);
}
}
if (isset($_GET['id_session']) && (trim($_GET['id_session']) != "")) {
if (isset($_GET['id_session']) && ("" != trim($_GET['id_session']))) {
addUserToSession($UserList, $_GET['id_session']);
}
if (count($UserList) > 0) {

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
/**
* Code.
*/
@ -57,7 +55,7 @@ Display::display_header($tool_name);
</form>
<?php
if (isset($action) && ($action == "synchro")) {
if (isset($action) && ("synchro" == $action)) {
$included = true;
require 'ldap_synchro.php';
echo Display::return_message($message, 'normal', false);

@ -3,8 +3,6 @@
/**
* Management of legal conditions.
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -12,7 +10,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
if (api_get_setting('allow_terms_conditions') !== 'true') {
if ('true' !== api_get_setting('allow_terms_conditions')) {
api_not_allowed(true);
}
@ -70,10 +68,10 @@ if ($form->validate()) {
$default['content'] = $content;
if (isset($values['language'])) {
if ($submit == 'back') {
if ('back' == $submit) {
header('Location: legal_add.php');
exit;
} elseif ($submit === 'save') {
} elseif ('save' === $submit) {
$id = LegalManager::add($lang, $content, $type, $changes, $values);
if (!empty($id)) {
Display::addFlash(Display::return_message(get_lang('Term and condition saved'), 'success'));
@ -84,7 +82,7 @@ if ($form->validate()) {
$tok = Security::get_token();
header('Location: legal_list.php?sec_token='.$tok);
exit();
} elseif ($submit === 'preview') {
} elseif ('preview' === $submit) {
$defaults['type'] = $type;
$defaults['content'] = $content;
$defaults['changes'] = $changes;
@ -138,7 +136,7 @@ if (isset($_POST['language'])) {
$preview = LegalManager::show_last_condition($term_preview);
if ($term_preview['type'] != -1) {
if (-1 != $term_preview['type']) {
$preview = LegalManager::replaceTags($preview);
$form->addElement('label', get_lang('Preview'), $preview);
}

@ -5,8 +5,6 @@ use Chamilo\CoreBundle\Repository\LegalRepository;
/**
* Sessions list script.
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -23,13 +20,13 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
$check = Security::check_token('request');
$token = Security::get_token();
if ($action == 'add') {
if ('add' == $action) {
$interbreadcrumb[] = [
'url' => 'promotions.php',
'name' => get_lang('Promotions'),
];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
} elseif ($action == 'edit') {
} elseif ('edit' == $action) {
$interbreadcrumb[] = [
'url' => 'promotions.php',
'name' => get_lang('Promotions'),
@ -43,14 +40,14 @@ if ($action == 'add') {
Display::display_header('');
// Tool name
if (isset($_GET['action']) && $_GET['action'] == 'add') {
if (isset($_GET['action']) && 'add' == $_GET['action']) {
$tool = 'Add';
$interbreadcrumb[] = [
'url' => api_get_self(),
'name' => get_lang('Promotion'),
];
}
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
if (isset($_GET['action']) && 'edit' == $_GET['action']) {
$tool = 'Modify';
$interbreadcrumb[] = [
'url' => api_get_self(),
@ -120,7 +117,7 @@ $promotion = new Promotion();
switch ($action) {
case 'add':
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
if (0 != api_get_session_id() && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
@ -200,7 +197,7 @@ switch ($action) {
$promotion->display();
break;
case 'copy':
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
if (0 != api_get_session_id() && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
if ($check) {

@ -7,9 +7,6 @@ use ChamiloSession as Session;
use Doctrine\Common\Collections\Criteria;
use Knp\Component\Pager\Paginator;
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -177,7 +174,7 @@ if ($formSent) {
/** @var CQuiz $exercise */
foreach ($exerciseList as $exercise) {
$question->questionData .= $exercise->getTitle();
if ($exercise->getActive() == -1) {
if (-1 == $exercise->getActive()) {
$question->questionData .= '- ('.get_lang('The test has been deleted').' #'.$exercise->getIid().') ';
}
$question->questionData .= '<br />';

@ -13,8 +13,6 @@ use Symfony\Component\Filesystem\Filesystem;
* @author Guillaume Viguier <guillaume@viguierjust.com>
*
* @since Chamilo 1.8.7
*
* @package chamilo.admin
*/
define('CSS_UPLOAD_PATH', api_get_path(SYS_PATH).'Resources/public/css/themes/');
@ -314,7 +312,7 @@ function handleStylesheets()
);
} else {
// Uploading a new stylesheet.
if ($urlId == 1) {
if (1 == $urlId) {
$show_upload_form = true;
} else {
if ($is_style_changeable) {
@ -385,7 +383,7 @@ function handleStylesheets()
)
);
if ($webPlatformLogoPath !== null) {
if (null !== $webPlatformLogoPath) {
$logoForm->addLabel(
get_lang('Current logo'),
'<img id="header-logo-custom" src="'.$webPlatformLogoPath.'?'.time().'">'
@ -540,7 +538,7 @@ function uploadStylesheet($values, $picture)
$info = pathinfo($picture['name']);
if ($info['extension'] == 'zip') {
if ('zip' == $info['extension']) {
// Try to open the file and extract it in the theme.
$zip = new ZipArchive();
if ($zip->open($picture['tmp_name'])) {
@ -554,7 +552,7 @@ function uploadStylesheet($values, $picture)
for ($i = 0; $i < $num_files; $i++) {
$file = $zip->statIndex($i);
if (substr($file['name'], -1) != '/') {
if ('/' != substr($file['name'], -1)) {
$path_parts = pathinfo($file['name']);
if (!in_array($path_parts['extension'], $allowedFiles)) {
$valid = false;
@ -562,7 +560,7 @@ function uploadStylesheet($values, $picture)
}
}
if (strpos($file['name'], '/') === false) {
if (false === strpos($file['name'], '/')) {
$single_directory = false;
}
}
@ -588,14 +586,14 @@ function uploadStylesheet($values, $picture)
$mode = api_get_permissions_for_new_directories();
for ($i = 0; $i < $num_files; $i++) {
$entry = $zip->getNameIndex($i);
if (substr($entry, -1) == '/') {
if ('/' == substr($entry, -1)) {
continue;
}
$pos_slash = strpos($entry, '/');
$entry_without_first_dir = substr($entry, $pos_slash + 1);
// If there is still a slash, we need to make sure the directories are created.
if (strpos($entry_without_first_dir, '/') !== false) {
if (false !== strpos($entry_without_first_dir, '/')) {
if (!is_dir($extraction_path.dirname($entry_without_first_dir))) {
// Create it.
@mkdir($extraction_path.dirname($entry_without_first_dir), $mode, true);
@ -664,7 +662,7 @@ function storeRegions()
if (!empty($areas_to_installed)) {
$plugin_obj->removeAllRegions($plugin);
foreach ($areas_to_installed as $region) {
if (!empty($region) && $region != '-1') {
if (!empty($region) && '-1' != $region) {
$plugin_obj->add_to_region($plugin, $region);
}
}
@ -781,7 +779,7 @@ function handleSearch()
}
$specific_fields = get_specific_field_list();
if ($search_enabled == 'true') {
if ('true' == $search_enabled) {
$values = api_get_settings_options('search_show_unlinked_results');
$group = formGenerateElementsGroup(
$form,
@ -834,7 +832,7 @@ function handleSearch()
$form->display();
echo '</div>';
if ($search_enabled == 'true') {
if ('true' == $search_enabled) {
$xapianPath = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb';
/*
@ -913,14 +911,14 @@ function handleTemplates()
* isset() combos all over the place. */
$action = isset($_GET['action']) ? $_GET['action'] : "invalid";
if ($action != 'add') {
if ('add' != $action) {
echo '<div class="actions" style="margin-left: 1px;">';
echo '<a href="settings.php?category=Templates&action=add">'.
Display::return_icon('new_template.png', get_lang('Add a template'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
}
if ($action == 'add' || ($action == 'edit' && is_numeric($_GET['id']))) {
if ('add' == $action || ('edit' == $action && is_numeric($_GET['id']))) {
addEditTemplate();
// Add event to the system log.
@ -934,7 +932,7 @@ function handleTemplates()
$user_id
);
} else {
if ($action == 'delete' && is_numeric($_GET['id'])) {
if ('delete' == $action && is_numeric($_GET['id'])) {
deleteTemplate($_GET['id']);
// Add event to the system log
@ -1108,7 +1106,7 @@ function addEditTemplate()
);
// Setting the form elements: the header.
if ($_GET['action'] == 'add') {
if ('add' == $_GET['action']) {
$title = get_lang('Add a template');
} else {
$title = get_lang('Template edition');
@ -1137,7 +1135,7 @@ function addEditTemplate()
$form->addElement('static', 'file_comment', '', get_lang('This image will represent the template in the templates list. It should be no larger than 100x70 pixels'));
// Getting all the information of the template when editing a template.
if ($_GET['action'] == 'edit') {
if ('edit' == $_GET['action']) {
$defaults['template_id'] = $id;
$defaults['template_text'] = $template->getContent();
// Forcing get_lang().
@ -1231,7 +1229,7 @@ function addEditTemplate()
$bootstrap = api_get_bootstrap_and_font_awesome();
$viewport = '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
if ($_GET['action'] == 'add') {
if ('add' == $_GET['action']) {
$templateContent = '<head>'.$viewport.'<title>'.$values['title'].'</title>'.$bootstrap.'</head>'
.$values['template_text'];
$template
@ -1414,9 +1412,9 @@ function generateSettingsForm($settings, $settings_by_access_list)
if (!empty($_configuration['multiple_access_urls'])) {
if (api_is_global_platform_admin()) {
if ($row['access_url_locked'] == 0) {
if ($url_id == 1) {
if ($row['access_url_changeable'] == '1') {
if (0 == $row['access_url_locked']) {
if (1 == $url_id) {
if ('1' == $row['access_url_changeable']) {
$form->addElement(
'html',
'<div class="float-right"><a class="share_this_setting" data_status = "0" data_to_send = "'.$row['variable'].'" href="javascript:void(0);">'.
@ -1430,7 +1428,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
);
}
} else {
if ($row['access_url_changeable'] == '1') {
if ('1' == $row['access_url_changeable']) {
$form->addElement(
'html',
'<div class="float-right">'.
@ -1451,12 +1449,12 @@ function generateSettingsForm($settings, $settings_by_access_list)
$hideme = [];
$hide_element = false;
if ($_configuration['access_url'] != 1) {
if ($row['access_url_changeable'] == 0) {
if (1 != $_configuration['access_url']) {
if (0 == $row['access_url_changeable']) {
// We hide the element in other cases (checkbox, radiobutton) we 'freeze' the element.
$hide_element = true;
$hideme = ['disabled'];
} elseif ($url_info['active'] == 1) {
} elseif (1 == $url_info['active']) {
// We show the elements.
if (empty($row['variable'])) {
$row['variable'] = 0;
@ -1472,7 +1470,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
is_array($settings_by_access_list[$row['variable']][$row['subkey']][$row['category']])
) {
// We are sure that the other site have a selected value.
if ($settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value'] != '') {
if ('' != $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value']) {
$row['selected_value'] = $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value'];
}
}
@ -1495,7 +1493,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
);
$form->applyFilter($row['variable'], 'html_filter');
$default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
} elseif ($row['variable'] == 'account_valid_duration') {
} elseif ('account_valid_duration' == $row['variable']) {
$form->addElement(
'text',
$row['variable'],
@ -1510,7 +1508,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
// For platform character set selection:
// Conversion of the textfield to a select box with valid values.
$default_values[$row['variable']] = $row['selected_value'];
} elseif ($row['variable'] == 'platform_charset') {
} elseif ('platform_charset' == $row['variable']) {
break;
} else {
$hideme['class'] = 'col-md-4';
@ -1529,7 +1527,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
}
break;
case 'textarea':
if ($row['variable'] == 'header_extra_content') {
if ('header_extra_content' == $row['variable']) {
$file = api_get_home_path().'header_extra_content.txt';
$value = '';
if (file_exists($file)) {
@ -1543,7 +1541,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
$hideme
);
$default_values[$row['variable']] = $value;
} elseif ($row['variable'] == 'footer_extra_content') {
} elseif ('footer_extra_content' == $row['variable']) {
$file = api_get_home_path().'footer_extra_content.txt';
$value = '';
if (file_exists($file)) {
@ -1605,14 +1603,14 @@ function generateSettingsForm($settings, $settings_by_access_list)
$group = [];
while ($rowkeys = Database::fetch_array($result)) {
// Profile tab option should be hidden when the social tool is enabled.
if (api_get_setting('allow_social_tool') == 'true') {
if ($rowkeys['variable'] === 'show_tabs' && $rowkeys['subkey'] === 'my_profile') {
if ('true' == api_get_setting('allow_social_tool')) {
if ('show_tabs' === $rowkeys['variable'] && 'my_profile' === $rowkeys['subkey']) {
continue;
}
}
// Hiding the gradebook option.
if ($rowkeys['variable'] === 'show_tabs' && $rowkeys['subkey'] === 'my_gradebook') {
if ('show_tabs' === $rowkeys['variable'] && 'my_gradebook' === $rowkeys['subkey']) {
continue;
}
@ -1623,7 +1621,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
get_lang($rowkeys['subkeytext'])
);
if ($row['access_url_changeable'] == 1) {
if (1 == $row['access_url_changeable']) {
// 2. We look into the DB if there is a setting for a specific access_url.
$access_url = $_configuration['access_url'];
if (empty($access_url)) {
@ -1637,11 +1635,11 @@ function generateSettingsForm($settings, $settings_by_access_list)
access_url = $access_url";
$result_access = Database::query($sql);
$row_access = Database::fetch_array($result_access);
if ($row_access['selected_value'] === 'true' && !$form->isSubmitted()) {
if ('true' === $row_access['selected_value'] && !$form->isSubmitted()) {
$element->setChecked(true);
}
} else {
if ($rowkeys['selected_value'] === 'true' && !$form->isSubmitted()) {
if ('true' === $rowkeys['selected_value'] && !$form->isSubmitted()) {
$element->setChecked(true);
}
}
@ -1706,7 +1704,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
case 'pdf_export_watermark_enable':
$url = PDF::get_watermark(null);
if ($url != false) {
if (false != $url) {
$delete_url = '<a href="?delete_watermark">'.get_lang('Remove picture').' '.Display::return_icon('delete.png', get_lang('Remove picture')).'</a>';
$form->addElement('html', '<div style="max-height:100px; max-width:100px; margin-left:162px; margin-bottom:10px; clear:both;"><img src="'.$url.'" style="margin-bottom:10px;" />'.$delete_url.'</div>');
}
@ -1767,12 +1765,12 @@ function searchSetting($search)
$title = api_strtolower(get_lang($setting['title']));
// try the title
if (strpos($title, $search) === false) {
if (false === strpos($title, $search)) {
$comment = api_strtolower(get_lang($setting['comment']));
//Try the comment
if (strpos($comment, $search) === false) {
if (false === strpos($comment, $search)) {
//Try the variable name
if (strpos($setting['variable'], $search) === false) {
if (false === strpos($setting['variable'], $search)) {
continue;
} else {
$found = true;
@ -1870,7 +1868,7 @@ function showSearchSettingsTable($data)
function showSearchToolsStatusTable()
{
//@todo windows support
if (api_is_windows_os() == false) {
if (false == api_is_windows_os()) {
$list_of_programs = ['pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv'];
foreach ($list_of_programs as $program) {
$output = [];
@ -1940,7 +1938,7 @@ function isStyleChangeable()
if ($urlId) {
$style_info = api_get_settings('stylesheets', '', 1, 0);
$url_info = api_get_access_url($urlId);
if ($style_info[0]['access_url_changeable'] == 1 && $url_info['active'] == 1) {
if (1 == $style_info[0]['access_url_changeable'] && 1 == $url_info['active']) {
$changeable = true;
}
} else {
@ -1962,13 +1960,13 @@ function getCategorySettings($category = '')
$url_id = api_get_current_access_url_id();
$settings_by_access_list = [];
if ($url_id == 1) {
if (1 == $url_id) {
$settings = api_get_settings($category, 'group', $url_id);
} else {
$url_info = api_get_access_url($url_id);
if ($url_info['active'] == 1) {
if (1 == $url_info['active']) {
$categoryToSearch = $category;
if ($category == 'search_setting') {
if ('search_setting' == $category) {
$categoryToSearch = '';
}
// The default settings of Chamilo
@ -1988,7 +1986,7 @@ function getCategorySettings($category = '')
}
// One more validation if is changeable.
if ($row['access_url_changeable'] == 1) {
if (1 == $row['access_url_changeable']) {
$settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = $row;
} else {
$settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = [];
@ -1997,7 +1995,7 @@ function getCategorySettings($category = '')
}
}
if (isset($category) && $category == 'search_setting') {
if (isset($category) && 'search_setting' == $category) {
if (!empty($_REQUEST['search_field'])) {
$settings = searchSetting($_REQUEST['search_field']);
}

@ -9,8 +9,6 @@ use ChamiloSession as Session;
*
* @author Patrick Cool
* @author Julio Montoya - Multiple URL site
*
* @package chamilo.admin
*/
// Resetting the course id.
@ -27,7 +25,7 @@ $_SESSION['this_section'] = $this_section;
api_protect_admin_script();
// Submit stylesheets.
if (isset($_POST['save']) && isset($_GET['category']) && $_GET['category'] === 'Stylesheets') {
if (isset($_POST['save']) && isset($_GET['category']) && 'Stylesheets' === $_GET['category']) {
storeStylesheets();
Display::addFlash(Display::return_message(get_lang('Saved.')));
}
@ -68,7 +66,7 @@ if (isset($_GET['delete_watermark'])) {
Display::addFlash(Display::return_message(get_lang('File deleted')));
}
if (isset($_GET['action']) && $_GET['action'] == 'delete_grading') {
if (isset($_GET['action']) && 'delete_grading' == $_GET['action']) {
$id = intval($_GET['id']);
api_delete_setting_option($id);
}
@ -166,19 +164,19 @@ if (!empty($_GET['category']) &&
}
}
if (isset($values['allow_social_tool']) && $values['allow_social_tool'] == 'true') {
if (isset($values['allow_social_tool']) && 'true' == $values['allow_social_tool']) {
$values['allow_message_tool'] = 'true';
}
foreach ($settings as $item) {
$key = $item['variable'];
if ($key === 'prevent_multiple_simultaneous_login') {
if ('prevent_multiple_simultaneous_login' === $key) {
Session::write('first_user_login', 1);
}
if (in_array($key, $settings_to_avoid)) {
continue;
}
if ($key == 'search_field' || $key == 'submit_fixed_in_bottom') {
if ('search_field' == $key || 'submit_fixed_in_bottom' == $key) {
continue;
}
$key = Database::escape_string($key);
@ -195,14 +193,14 @@ if (!empty($_GET['category']) &&
$keys = [];
foreach ($values as $key => $value) {
if (strcmp($key, 'MAX_FILE_SIZE') === 0) {
if (0 === strcmp($key, 'MAX_FILE_SIZE')) {
continue;
}
if (in_array($key, $settings_to_avoid)) {
continue;
}
// Avoid form elements which have nothing to do with settings
if ($key == 'search_field' || $key == 'submit_fixed_in_bottom') {
if ('search_field' == $key || 'submit_fixed_in_bottom' == $key) {
continue;
}
@ -223,9 +221,9 @@ if (!empty($_GET['category']) &&
case 'course_validation_terms_and_conditions_url':
// URL validation for some settings.
$value = trim(Security::remove_XSS($value));
if ($value != '') {
if ('' != $value) {
// Here we accept absolute URLs only.
if (strpos($value, '://') === false) {
if (false === strpos($value, '://')) {
$value = 'http://'.$value;
}
if (!api_valid_url($value, true)) {
@ -238,7 +236,7 @@ if (!empty($_GET['category']) &&
case 'emailAdministrator':
// Validation against e-mail address for some settings.
$value = trim(Security::remove_XSS($value));
if ($value != '' && !api_valid_email($value)) {
if ('' != $value && !api_valid_email($value)) {
// If the new (non-empty) e-mail address is invalid, then the old e-mail address stays.
// If the new e-mail address is empty, then it will be stored (i.e. the setting will be deleted).
$value = $old_value;
@ -256,8 +254,8 @@ if (!empty($_GET['category']) &&
while ($row_subkeys = Database::fetch_array($res)) {
// If subkey is changed:
if ((isset($value[$row_subkeys['subkey']]) && api_get_setting($key, $row_subkeys['subkey']) == 'false') ||
(!isset($value[$row_subkeys['subkey']]) && api_get_setting($key, $row_subkeys['subkey']) == 'true')
if ((isset($value[$row_subkeys['subkey']]) && 'false' == api_get_setting($key, $row_subkeys['subkey'])) ||
(!isset($value[$row_subkeys['subkey']]) && 'true' == api_get_setting($key, $row_subkeys['subkey']))
) {
$keys[] = $key;
break;

@ -5,8 +5,6 @@ use Chamilo\CoreBundle\Entity\Skill;
/**
* This script manages the skills, levels and profiles assignments.
*
* @package chamilo.skill
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -4,8 +4,6 @@
* Show information about Mozilla OpenBadges.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.admin.openbadges
*/
$cidReset = true;
@ -19,7 +17,7 @@ Skill::isAllowed();
$backpack = 'https://backpack.openbadges.org/';
$configBackpack = api_get_setting('openbadges_backpack');
if (strcmp($backpack, $configBackpack) !== 0) {
if (0 !== strcmp($backpack, $configBackpack)) {
$backpack = $configBackpack;
}

@ -5,8 +5,6 @@
* Show information about Mozilla OpenBadges.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.admin.openbadges
*/
$cidReset = true;
@ -32,12 +30,12 @@ $badgeStudio = [
'script_js' => '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/js/studio.js?"></script>',
];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ('POST' === $_SERVER['REQUEST_METHOD']) {
$params = [
'id' => $skillId,
];
if ((isset($_FILES['image']) && $_FILES['image']['error'] == 0) ||
if ((isset($_FILES['image']) && 0 == $_FILES['image']['error']) ||
!empty($_POST['badge_studio_image'])
) {
$dirPermissions = api_get_permissions_for_new_directories();

@ -6,8 +6,6 @@
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.admin.openbadges
*
* @deprecated use skill_list.php
*/
$cidReset = true;

@ -5,8 +5,6 @@
* Create skill form.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.admin
*/
$cidReset = true;

@ -5,8 +5,6 @@
* Skill edit form.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.admin
*/
$cidReset = true;

@ -5,8 +5,6 @@ use Chamilo\SkillBundle\Entity\Level;
/**
* Add a skill Level.
*
* @package chamilo.skill
*/
$cidReset = true;

@ -5,8 +5,6 @@
* Skill list for management.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.admin
*/
$cidReset = true;

@ -6,8 +6,6 @@ use Chamilo\SkillBundle\Entity\Profile;
/**
* Add a skill Profile.
*
* @package chamilo.skill
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -6,7 +6,7 @@ use Chamilo\SkillBundle\Entity\SkillRelCourse;
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
if (api_get_configuration_value('allow_skill_rel_items') == false) {
if (false == api_get_configuration_value('allow_skill_rel_items')) {
api_not_allowed(true);
}

@ -23,13 +23,13 @@ if (isset($_GET['skill'])) {
/** @var Skill $skill */
$skill = $em->find('ChamiloCoreBundle:Skill', intval($_GET['skill']));
if ($action === 'name') {
if ('name' === $action) {
$variableLanguage = ChamiloApi::getLanguageVar(
$skill->getName(false),
'Skill'
);
$originalName = $skill->getName(false);
} elseif ($action === 'code') {
} elseif ('code' === $action) {
$variableLanguage = ChamiloApi::getLanguageVar(
$skill->getShortCode(false),
'SkillCode'
@ -93,7 +93,7 @@ $form->setDefaults([
'variable_language' => '$'.$variableLanguage,
'original_name' => $originalName,
'sub_language' => $languageId,
'new_language' => $action === 'code' ? $skill->getShortCode() : $skill->getName(),
'new_language' => 'code' === $action ? $skill->getShortCode() : $skill->getName(),
]);
$form->addRule('sub_language', get_lang('Required'), 'required');
$form->freeze(['variable_language', 'original_name']);

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -20,7 +17,7 @@ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'display';
// setting breadcrumbs
$tool_name = get_lang('Skills and assessments');
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('Administration')];
if ($action == 'add_skill') {
if ('add_skill' == $action) {
$interbreadcrumb[] = ['url' => 'skills_gradebook.php', 'name' => get_lang('Skills and assessments')];
$tool_name = get_lang('Add');
}

@ -3,7 +3,6 @@
/**
* This tool allows platform admins to add skills by uploading a CSV or XML file.
*
* @package chamilo.admin
* @documentation Some interesting basic skills can be found in the "Skills"
* section here: http://en.wikipedia.org/wiki/Personal_knowledge_management
*/
@ -112,7 +111,7 @@ $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
$user_id_error = [];
$error_message = '';
if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
if (!empty($_POST['formSent']) && 0 !== $_FILES['import_file']['size']) {
$file_type = $_POST['file_type'];
Security::clear_token();
$tok = Security::get_token();
@ -123,7 +122,7 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
$ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'], '.') + 1));
if (in_array($ext_import_file, $allowed_file_mimetype)) {
if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) {
if (0 === strcmp($file_type, 'csv') && $ext_import_file == $allowed_file_mimetype[0]) {
$skills = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($skills);
$error_kind_file = false;
@ -149,7 +148,7 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
}
}
if (strcmp($file_type, 'csv') === 0) {
if (0 === strcmp($file_type, 'csv')) {
save_data($skills_to_insert);
} else {
$error_message = get_lang('You must import a file corresponding to the selected format');
@ -161,7 +160,7 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
$see_message_import = get_lang('File imported');
}
if (count($errors) != 0) {
if (0 != count($errors)) {
$warning_message = '<ul>';
foreach ($errors as $index => $error_skill) {
$warning_message .= '<li><b>'.$error_skill['error'].'</b>: ';

@ -3,9 +3,6 @@
use ChamiloSession as Session;
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -27,18 +27,18 @@ Display::display_header($nameTools);
echo Display::page_header($nameTools);
if (count($_POST) == 0) {
if (0 == count($_POST)) {
echo Display::return_message(get_lang('Special exportsIntroduction'));
}
$error = 0;
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') ||
(isset($_POST['backup_option']) && $_POST['backup_option'] == 'full_backup')
if ((isset($_POST['action']) && 'course_select_form' == $_POST['action']) ||
(isset($_POST['backup_option']) && 'full_backup' == $_POST['backup_option'])
) {
$export = false;
if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') {
if (isset($_POST['action']) && 'course_select_form' == $_POST['action']) {
$FileZip = create_zip();
$to_group_id = 0;
$sql_session = "SELECT id, name FROM $tbl_session ";
@ -54,7 +54,7 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') ||
}
$zip_folder = new PclZip($FileZip['TEMP_FILE_ZIP']);
if (!isset($_POST['resource']) || count($_POST['resource']) == 0) {
if (!isset($_POST['resource']) || 0 == count($_POST['resource'])) {
echo Display::return_message(get_lang('There were no courses registered or may not have made the association with the sessions'), 'error');
} else {
$Resource = $_POST['resource'];
@ -125,10 +125,10 @@ if ($export && $name) {
echo '<br /><a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive_path=&archive='.urlencode($name).'">'.get_lang('Download').'</a>';
} else {
// Display forms especial export
if (isset($_POST['backup_option']) && $_POST['backup_option'] == 'select_items') {
if (isset($_POST['backup_option']) && 'select_items' == $_POST['backup_option']) {
$cb = new CourseBuilder();
$course = $cb->build_session_course();
if ($course === false) {
if (false === $course) {
echo Display::return_message(get_lang('There were no courses registered or may not have made the association with the sessions'), 'error');
form_special_export();
} else {
@ -163,7 +163,7 @@ function create_zip()
if (empty($path)) {
$path = '/';
}
$remove_dir = ($path != '/') ? substr($path, 0, strlen($path) - strlen(basename($path))) : '/';
$remove_dir = ('/' != $path) ? substr($path, 0, strlen($path) - strlen(basename($path))) : '/';
$sys_archive_path = api_get_path(SYS_ARCHIVE_PATH).'special_export/';
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$temp_zip_dir = $sys_archive_path;
@ -172,7 +172,7 @@ function create_zip()
} else {
$handle = opendir($temp_zip_dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if ("." != $file && ".." != $file) {
$Diff = (time() - filemtime("$temp_zip_dir/$file")) / 60 / 60; //the "age" of the file in hours
if ($Diff > 4) {
unlink("$temp_zip_dir/$file");
@ -193,8 +193,8 @@ function create_zip()
function rename_zip($FileZip)
{
Event::event_download(($FileZip['PATH'] == '/') ? 'full_export_'.date('Ymd').'.zip (folder)' : basename($FileZip['PATH']).'.zip (folder)');
$name = ($FileZip['PATH'] == '/') ? 'full_export_'.date('Ymd').'.zip' : basename($FileZip['PATH']).'.zip';
Event::event_download(('/' == $FileZip['PATH']) ? 'full_export_'.date('Ymd').'.zip (folder)' : basename($FileZip['PATH']).'.zip (folder)');
$name = ('/' == $FileZip['PATH']) ? 'full_export_'.date('Ymd').'.zip' : basename($FileZip['PATH']).'.zip';
if (file_exists($FileZip['PATH_TEMP_ARCHIVE'].'/'.$name)) {
unlink($FileZip['PATH_TEMP_ARCHIVE'].'/'.$name);
}
@ -227,7 +227,7 @@ function fullexportspecial()
if (count($list_course) > 0) {
foreach ($list_course as $_course) {
if ($FileZip['PATH'] == '/') {
if ('/' == $FileZip['PATH']) {
$querypath = ''; // to prevent ...path LIKE '//%'... in query
} else {
$querypath = $FileZip['PATH'];
@ -290,7 +290,7 @@ function fullexportspecial()
}
$name = rename_zip($FileZip);
if ($name === false) {
if (false === $name) {
$export = false;
return false;

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Manage specific fields.
*
* @package chamilo.admin
*/
// Resetting the course id.
$cidReset = true;
@ -64,7 +62,7 @@ function edit_filter($id, $url_params, $row)
return $return;
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
if (isset($_REQUEST['action']) && 'delete' == $_REQUEST['action']) {
delete_specific_field($_REQUEST['field_id']);
header('Location: specific_fields.php?message='.get_lang('Field removed'));
exit;

@ -3,8 +3,6 @@
/**
* Add form.
*
* @package chamilo.admin
*/
// Resetting the course id.
@ -35,7 +33,7 @@ $interbreadcrumb[] = [
$tool_name = get_lang('Add a specific search field');
if (isset($_GET['action']) && $_GET['action'] === 'edit') {
if (isset($_GET['action']) && 'edit' === $_GET['action']) {
$tool_name = get_lang('Edit specific search field');
}
// Create the form
@ -63,7 +61,7 @@ $form->addButtonCreate(get_lang('Add'), 'submit');
if ($form->validate()) {
$field = $form->exportValues();
$field_name = $field['field_name'];
if (is_numeric($field['field_id']) && $field['field_id'] != 0 && !empty($field['field_id'])) {
if (is_numeric($field['field_id']) && 0 != $field['field_id'] && !empty($field['field_id'])) {
edit_specific_field($field['field_id'], $field['field_name']);
$message = get_lang('Field added.');
} else {

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;

@ -313,7 +313,7 @@ if (
}
}
if ($report === 'user_session') {
if ('user_session' === $report) {
$htmlHeadXtra[] = api_get_jqgrid_js();
}
@ -439,13 +439,13 @@ switch ($report) {
$averageUser = 0;
$averageCoach = 0;
if (!empty($numberOfWeeks)) {
$sessionAverage = api_number_format($sessionCount/$numberOfWeeks, 2);
$sessionAverage = api_number_format($sessionCount / $numberOfWeeks, 2);
}
if (!empty($numberUsers)) {
$averageUser = api_number_format($sessionCount/$numberUsers, 2);
$averageUser = api_number_format($sessionCount / $numberUsers, 2);
}
if (!empty($uniqueCoaches)) {
$averageCoach = api_number_format($sessionCount/$uniqueCoaches, 2);
$averageCoach = api_number_format($sessionCount / $uniqueCoaches, 2);
}
$table = new HTML_Table(['class' => 'table table-responsive']);
@ -541,7 +541,7 @@ switch ($report) {
$content .= $table->toHtml();
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] === 'export') {
if (isset($_REQUEST['action']) && 'export' === $_REQUEST['action']) {
$data = $table->toArray();
Export::arrayToXls($data);
exit;
@ -674,7 +674,7 @@ switch ($report) {
$content .= Statistics::printToolStats();
break;
case 'coursebylanguage':
$content .= '<canvas class="col-md-12" id="canvas" height="300px" style="margin-bottom: 20px"></canvas>';
$content .= '<canvas class="col-md-12" id="canvas" height="300px" style="margin-bottom: 20px"></canvas>';
$result = Statistics::printCourseByLanguageStats();
$content .= Statistics::printStats(get_lang('CountCourseByLanguage'), $result, true);
break;
@ -687,21 +687,21 @@ switch ($report) {
$startDate = $values['daterange_start'];
$endDate = $values['daterange_end'];
$content .= '<div class="row">';
$content .= '<div class="col-md-4"><canvas id="canvas1" style="margin-bottom: 20px"></canvas></div>';
$content .= '<div class="col-md-4"><canvas id="canvas2" style="margin-bottom: 20px"></canvas></div>';
$content .= '<div class="col-md-4"><canvas id="canvas3" style="margin-bottom: 20px"></canvas></div>';
$content .= '</div>';
$content .= '<div class="row">';
$content .= '<div class="col-md-4"><canvas id="canvas1" style="margin-bottom: 20px"></canvas></div>';
$content .= '<div class="col-md-4"><canvas id="canvas2" style="margin-bottom: 20px"></canvas></div>';
$content .= '<div class="col-md-4"><canvas id="canvas3" style="margin-bottom: 20px"></canvas></div>';
$content .= '</div>';
$content .= '<div class="row">';
$content .= '<div class="col-md-6"><canvas id="canvas4" style="margin-bottom: 20px"></canvas></div>';
$content .= '<div class="col-md-6"><canvas id="canvas5" style="margin-bottom: 20px"></canvas></div>';
$content .= '</div>';
$content .= '<div class="row">';
$content .= '<div class="col-md-6"><canvas id="canvas4" style="margin-bottom: 20px"></canvas></div>';
$content .= '<div class="col-md-6"><canvas id="canvas5" style="margin-bottom: 20px"></canvas></div>';
$content .= '</div>';
$content .= '<div class="row">';
$content .= '<div class="col-md-6"><canvas id="canvas6" style="margin-bottom: 20px"></canvas></div>';
$content .= '<div class="col-md-6"><canvas id="canvas7" style="margin-bottom: 20px"></canvas></div>';
$content .= '</div>';
$content .= '<div class="row">';
$content .= '<div class="col-md-6"><canvas id="canvas6" style="margin-bottom: 20px"></canvas></div>';
$content .= '<div class="col-md-6"><canvas id="canvas7" style="margin-bottom: 20px"></canvas></div>';
$content .= '</div>';
$conditions = [];
$extraConditions = '';
@ -751,7 +751,7 @@ switch ($report) {
get_lang('UserBirthday'),
];
if (isset($_REQUEST['action_table']) && $_REQUEST['action_table'] === 'export') {
if (isset($_REQUEST['action_table']) && 'export' === $_REQUEST['action_table']) {
$first = 0;
$limit = $totalCount;
$data[] = $headers;
@ -798,14 +798,14 @@ switch ($report) {
$item[] = $residence;
$item[] = $career;
$item[] = $statusList[$user['status']];
$item[] = $user['active'] == 1 ? get_lang('Yes') : get_lang('No');
$item[] = 1 == $user['active'] ? get_lang('Yes') : get_lang('No');
$item[] = $certificate ? get_lang('Yes') : get_lang('No');
$item[] = $birthDate;
$data[] = $item;
$row++;
}
if (isset($_REQUEST['action_table']) && $_REQUEST['action_table'] === 'export') {
if (isset($_REQUEST['action_table']) && 'export' === $_REQUEST['action_table']) {
Export::arrayToXls($data);
exit;
}
@ -821,10 +821,10 @@ switch ($report) {
$table->set_header($column, $header, false);
$column++;
}
$content .= $table->return_table();
$content .= $table->return_table();
}
$content = $form->returnForm().$content;
$content = $form->returnForm().$content;
break;
case 'users':
@ -880,7 +880,7 @@ switch ($report) {
$content .= ZombieReport::create(['report' => 'zombies'])->display(true);
break;
case 'activities':
$content .=Statistics::printActivitiesStats();
$content .= Statistics::printActivitiesStats();
break;
case 'messagesent':
$messages_sent = Statistics::getMessages('sent');

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Script for sub-language administration.
*
* @package chamilo.admin.sub_language
*/
$cidReset = true;
$this_script = 'sub_language';
@ -76,7 +74,7 @@ if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) {
if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) {
$sublanguage_folder_error = $sub_language_file.' '.get_lang('is not writeable');
}
if (SubLanguageManager::check_if_exist_language_by_id($_GET['id']) === true) {
if (true === SubLanguageManager::check_if_exist_language_by_id($_GET['id'])) {
$language_id_exist = true;
} else {
$language_id_exist = false;
@ -89,7 +87,7 @@ if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) {
$intro = sprintf(get_lang('Define new terms for sub-language %s by searching some term, then save each translation by clicking the save button. You will then have to switch your own user language to see the new terms appear.'), strtolower($sub_language_name));
$path_folder = api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder'];
if (!is_dir($path_folder) || strlen($all_data_of_language['dokeos_folder']) == 0) {
if (!is_dir($path_folder) || 0 == strlen($all_data_of_language['dokeos_folder'])) {
api_not_allowed(true);
}
@ -162,7 +160,7 @@ function search_language_term(
}
$founded = false;
// searching the item in the parent tool
if (preg_match($term, $parent_variable_value) !== 0) {
if (0 !== preg_match($term, $parent_variable_value)) {
$founded = true;
}
if ($founded) {
@ -230,16 +228,16 @@ function search_language_term(
$founded = false;
if ($search_in_english && $search_in_variable) {
// searching the item in the parent tool
if (preg_match($term, $variable_value) !== 0 || preg_match($term, $name_variable) !== 0) {
if (0 !== preg_match($term, $variable_value) || 0 !== preg_match($term, $name_variable)) {
$founded = true;
}
} else {
if ($search_in_english) {
if (preg_match($term, $variable_value) !== 0) {
if (0 !== preg_match($term, $variable_value)) {
$founded = true;
}
} else {
if (preg_match($term, $name_variable) !== 0) {
if (0 !== preg_match($term, $name_variable)) {
$founded = true;
}
}
@ -305,7 +303,7 @@ function search_language_term(
$founded = false;
// searching the item in the parent tool
if (preg_match($term, $variable_value) !== 0) {
if (0 !== preg_match($term, $variable_value)) {
$founded = true;
}
if ($founded) {

@ -3,8 +3,6 @@
/**
* This script allows for the addition of sub-languages.
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -45,7 +43,7 @@ function add_sub_language($original_name, $english_name, $isocode, $sublanguage_
$sql = 'INSERT INTO '.$tbl_admin_languages.'(original_name,english_name,isocode,dokeos_folder,available,parent_id)
VALUES ("'.$original_name.'","'.$english_name.'","'.$isocode.'","'.$english_name.'","'.$sublanguage_available.'","'.$parent_id.'")';
$res = Database::query($sql);
if ($res === false) {
if (false === $res) {
return false;
}
@ -84,11 +82,11 @@ function check_if_language_exist($original_name, $english_name, $isocode, $subla
$has_error = false;
$message_information = [];
if ($count_original_name == 1) {
if (1 == $count_original_name) {
$has_error = true;
$message_information['original_name'] = true;
}
if ($count_english_name == 1) {
if (1 == $count_english_name) {
$has_error = true;
$message_information['english_name'] = true;
}
@ -100,10 +98,10 @@ function check_if_language_exist($original_name, $english_name, $isocode, $subla
$has_error = true;
$message_information['isocode'] = true;
}
if ($has_error === true) {
if (true === $has_error) {
$message_information['execute_add'] = false;
}
if ($has_error === false) {
if (false === $has_error) {
$message_information['execute_add'] = true;
}
@ -136,7 +134,7 @@ function ckeck_if_is_parent_of_sub_language($parent_id)
{
$sql = 'SELECT count(*) AS count FROM language WHERE parent_id= '.intval($parent_id);
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0 && Database::result($rs, 0, 'count') == 1) {
if (Database::num_rows($rs) > 0 && 1 == Database::result($rs, 0, 'count')) {
return true;
} else {
return false;
@ -162,7 +160,7 @@ function allow_get_all_information_of_sub_language($parent_id, $sub_language_id)
if (isset($_GET['sub_language_id']) && $_GET['sub_language_id'] == strval(intval($_GET['sub_language_id']))) {
$language_name = SubLanguageManager::get_name_of_language_by_id($_GET['sub_language_id']);
if (check_if_exist_language_by_id($_GET['sub_language_id']) === true) {
if (true === check_if_exist_language_by_id($_GET['sub_language_id'])) {
$sub_language_id = $_GET['sub_language_id'];
$sub_language_id_exist = true;
} else {
@ -174,7 +172,7 @@ $language_name = '';
if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) {
$language_details = SubLanguageManager::get_all_information_of_language($_GET['id']);
$language_name = $language_details['original_name'];
if (check_if_exist_language_by_id($_GET['id']) === true) {
if (true === check_if_exist_language_by_id($_GET['id'])) {
$parent_id = $_GET['id'];
$language_id_exist = true;
} else {
@ -189,7 +187,7 @@ if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) {
if ((isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) &&
(isset($_GET['sub_language_id']) && $_GET['sub_language_id'] == strval(intval($_GET['sub_language_id'])))
) {
if (check_if_exist_language_by_id($_GET['id']) === true && check_if_exist_language_by_id($_GET['sub_language_id']) === true) {
if (true === check_if_exist_language_by_id($_GET['id']) && true === check_if_exist_language_by_id($_GET['sub_language_id'])) {
$get_all_information = allow_get_all_information_of_sub_language($_GET['id'], $_GET['sub_language_id']);
$original_name = $get_all_information['original_name'];
$english_name = $get_all_information['english_name'];
@ -199,8 +197,8 @@ if ((isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) &&
$language_name = get_lang('Create sub-languageForLanguage').' ( '.strtolower($language_name).' )';
if (ckeck_if_is_parent_of_sub_language($parent_id) === true &&
isset($_GET['action']) && $_GET['action'] == 'deletesublanguage'
if (true === ckeck_if_is_parent_of_sub_language($parent_id) &&
isset($_GET['action']) && 'deletesublanguage' == $_GET['action']
) {
$language_name = get_lang('Delete sub-language');
}
@ -219,28 +217,28 @@ if (isset($_POST['SubmitAddNewLanguage'])) {
$check_information = check_if_language_exist($original_name, $english_name, $isocode, $sublanguage_available);
foreach ($check_information as $index_information => $value_information) {
$allow_insert_info = false;
if ($index_information == 'original_name') {
if ('original_name' == $index_information) {
$msg .= Display::return_message(
get_lang('Already exists').' "'.get_lang('Original name').'" '.'('.$original_name.')',
'error'
);
}
if ($index_information == 'english_name') {
if ('english_name' == $index_information) {
$msg .= Display::return_message(
get_lang('Already exists').' "'.get_lang('English name').'" '.'('.$english_name.')',
'error'
);
}
if ($index_information == 'isocode') {
if ('isocode' == $index_information) {
$msg .= Display::return_message(get_lang('This code does not exist').': '.$isocode.'', 'error');
}
if ($index_information == 'execute_add' && $value_information === true) {
if ('execute_add' == $index_information && true === $value_information) {
$allow_insert_info = true;
}
}
if (strlen($original_name) > 0 && strlen($english_name) > 0 && strlen($isocode) > 0) {
if ($allow_insert_info === true && $language_id_exist === true) {
if (true === $allow_insert_info && true === $language_id_exist) {
$english_name = str_replace(' ', '_', $english_name);
//Fixes BT#1636
$english_name = api_strtolower($english_name);
@ -251,7 +249,7 @@ if (isset($_POST['SubmitAddNewLanguage'])) {
$mkdir_result = SubLanguageManager::add_language_directory($english_name);
if ($mkdir_result) {
$sl_id = add_sub_language($original_name, $english_name, $isocode, $sublanguage_available, $parent_id);
if ($sl_id === false) {
if (false === $sl_id) {
SubLanguageManager::remove_language_directory($english_name);
$msg .= Display::return_message(get_lang('The /main/lang directory, used on this portal to store the languages, is not writable. Please contact your platform administrator and report this message.'), 'error');
} else {
@ -267,7 +265,7 @@ if (isset($_POST['SubmitAddNewLanguage'])) {
$msg .= Display::return_message(get_lang('The /main/lang directory, used on this portal to store the languages, is not writable. Please contact your platform administrator and report this message.'), 'error');
}
} else {
if ($language_id_exist === false) {
if (false === $language_id_exist) {
$msg .= Display::return_message(get_lang('The parent language does not exist.'), 'error');
}
}
@ -282,14 +280,14 @@ echo $msg;
if (isset($_POST['SubmitAddDeleteLanguage'])) {
$rs = SubLanguageManager::remove_sub_language($_GET['id'], $_GET['sub_language_id']);
if ($rs === true) {
if (true === $rs) {
echo Display::return_message(get_lang('The sub language has been removed'), 'confirm');
} else {
echo Display::return_message(get_lang('The sub-language has not been removed.'), 'error');
}
}
// ckeck_if_is_parent_of_sub_language($parent_id)===false
if (isset($_GET['action']) && $_GET['action'] == 'definenewsublanguage') {
if (isset($_GET['action']) && 'definenewsublanguage' == $_GET['action']) {
$text = $language_name;
$form = new FormValidator(
'addsublanguage',
@ -313,7 +311,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'definenewsublanguage') {
$form->setDefaults($values);
$form->display();
} else {
if (isset($_GET['action']) && $_GET['action'] == 'deletesublanguage') {
if (isset($_GET['action']) && 'deletesublanguage' == $_GET['action']) {
$text = $language_name;
$form = new FormValidator(
'deletesublanguage',
@ -328,7 +326,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'definenewsublanguage') {
$form->addButtonCreate(get_lang('Delete sub-language'), 'SubmitAddDeleteLanguage');
$form->display();
}
if (isset($_GET['action']) && $_GET['action'] == 'definenewsublanguage') {
if (isset($_GET['action']) && 'definenewsublanguage' == $_GET['action']) {
echo Display::return_message(get_lang('The sub-language of this language has been added'));
}
}

@ -5,8 +5,6 @@ use Chamilo\CoreBundle\Entity\ExtraField;
/**
* Sub language AJAX script to update variables.
*
* @package chamilo.admin.sub_language
*/
$this_script = 'sub_language';
require_once __DIR__.'/../inc/global.inc.php';
@ -41,7 +39,7 @@ if (isset($new_language) && isset($language_variable) && isset($file_id)) {
$variables_with_problems = '';
if (!empty($result_array)) {
foreach ($result_array as $key => $result) {
if ($result == false) {
if (false == $result) {
$variables_with_problems .= $key.' <br />';
}
}

@ -7,8 +7,6 @@
* you can select multiple users and courses and then click on
* 'Add to this(these) course(s)'.
*
* @package chamilo.admin
*
* @todo use formvalidator for the form
*/
$cidReset = true;
@ -55,7 +53,7 @@ $new_field_list = [];
if (is_array($extra_field_list)) {
foreach ($extra_field_list as $extra_field) {
// if is enabled to filter and is a "<select>" field type
if ($extra_field[8] == 1 && $extra_field[2] == ExtraField::FIELD_TYPE_SELECT) {
if (1 == $extra_field[8] && ExtraField::FIELD_TYPE_SELECT == $extra_field[2]) {
$new_field_list[] = [
'name' => $extra_field[3],
'type' => $extra_field[2],
@ -63,7 +61,7 @@ if (is_array($extra_field_list)) {
'data' => $extra_field[9],
];
}
if ($extra_field[8] == 1 && $extra_field[2] == ExtraField::FIELD_TYPE_TAG) {
if (1 == $extra_field[8] && ExtraField::FIELD_TYPE_TAG == $extra_field[2]) {
$options = UserManager::get_extra_user_data_for_tags($extra_field[1]);
$new_field_list[] = [
@ -88,15 +86,15 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$users[$key] = intval($value);
}
if ($form_sent == 1) {
if (count($users) == 0 || count($courses) == 0) {
if (1 == $form_sent) {
if (0 == count($users) || 0 == count($courses)) {
echo Display::return_message(get_lang('You must select at least one user and one course'), 'error');
} else {
$errorDrh = 0;
foreach ($courses as $course_code) {
foreach ($users as $user_id) {
$user = api_get_user_info($user_id);
if ($user['status'] != DRH) {
if (DRH != $user['status']) {
CourseManager::subscribeUser($user_id, $course_code);
} else {
$errorDrh = 1;
@ -104,7 +102,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
}
}
if ($errorDrh == 0) {
if (0 == $errorDrh) {
echo Display::return_message(get_lang('The selected users are subscribed to the selected course'), 'confirm');
} else {
echo Display::return_message(get_lang('Human resources managers should not be registered to courses. The corresponding users you selected have not been subscribed.'), 'error');
@ -137,9 +135,9 @@ if (is_array($extra_field_list)) {
$varname = 'field_'.$new_field['variable'];
$fieldtype = $new_field['type'];
if (UserManager::is_extra_field_available($new_field['variable'])) {
if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
if (isset($_POST[$varname]) && '0' != $_POST[$varname]) {
$use_extra_fields = true;
if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
if (ExtraField::FIELD_TYPE_TAG == $fieldtype) {
$extra_field_result[] = UserManager::get_extra_user_data_by_tags(
intval($_POST['field_id']),
$_POST[$varname]
@ -189,7 +187,7 @@ $target_name = 'lastname';
$orderBy = $target_name;
$showOfficialCode = false;
$orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
if ($orderListByOfficialCode === 'true') {
if ('true' === $orderListByOfficialCode) {
$showOfficialCode = true;
$orderBy = " official_code, lastname, firstname";
}
@ -202,7 +200,7 @@ $sql = "SELECT user_id, lastname, firstname, username, official_code
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sql = "SELECT u.user_id,lastname,firstname,username, official_code
FROM $tbl_user u
INNER JOIN $tbl_user_rel_access_url user_rel_url
@ -228,7 +226,7 @@ $sql = "SELECT code,visual_code,title
if (api_is_multiple_url_enabled()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sql = "SELECT code, visual_code, title
FROM $tbl_course as course
INNER JOIN $tbl_course_rel_access_url course_rel_url
@ -257,7 +255,7 @@ if (is_array($extra_field_list)) {
echo '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) {
$checked = '';
if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
if (ExtraField::FIELD_TYPE_TAG == $fieldtype) {
if (isset($_POST[$varname])) {
if ($_POST[$varname] == $option['tag']) {
$checked = 'selected="true"';
@ -274,7 +272,7 @@ if (is_array($extra_field_list)) {
}
}
echo '</select>';
$extraHidden = $fieldtype == ExtraField::FIELD_TYPE_TAG ? '<input type="hidden" name="field_id" value="'.$option['field_id'].'" />' : '';
$extraHidden = ExtraField::FIELD_TYPE_TAG == $fieldtype ? '<input type="hidden" name="field_id" value="'.$option['field_id'].'" />' : '';
echo $extraHidden;
echo '&nbsp;&nbsp;';
}

@ -4,8 +4,6 @@
/**
* This page allows the administrator to manage the system announcements.
*
* @package chamilo.admin.announcement
*/
// Resetting the course id.
@ -44,13 +42,13 @@ if (!empty($action)) {
"url" => "system_announcements.php",
"name" => get_lang('Portal news'),
];
if ($action == 'add') {
if ('add' == $action) {
$interbreadcrumb[] = [
"url" => '#',
"name" => get_lang('Add an announcement'),
];
}
if ($action == 'edit') {
if ('edit' == $action) {
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
}
} else {
@ -87,7 +85,7 @@ function showCareer() {
// Displaying the header.
Display::display_header($tool_name);
if ($action != 'add' && $action != 'edit') {
if ('add' != $action && 'edit' != $action) {
echo '<div class="actions">';
echo '<a href="?action=add">'.Display::return_icon('add.png', get_lang('Add an announcement'), [], 32).'</a>';
echo '</div>';
@ -107,7 +105,7 @@ switch ($action) {
case 'make_visible':
case 'make_invisible':
$status = false;
if ($action == 'make_visible') {
if ('make_visible' == $action) {
$status = true;
}
@ -172,10 +170,10 @@ switch ($action) {
}
if ($action_todo) {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') {
if (isset($_REQUEST['action']) && 'add' == $_REQUEST['action']) {
$form_title = get_lang('Add news');
$url = api_get_self();
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
} elseif (isset($_REQUEST['action']) && 'edit' == $_REQUEST['action']) {
$form_title = get_lang('Edit News');
$url = api_get_self().'?id='.intval($_GET['id']);
}
@ -316,12 +314,12 @@ if ($action_todo) {
$values['group'] = isset($values['group']) ? $values['group'] : '0';
$form->addElement('checkbox', 'send_mail', null, get_lang('Send mail'));
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') {
if (isset($_REQUEST['action']) && 'add' == $_REQUEST['action']) {
$form->addElement('checkbox', 'add_to_calendar', null, get_lang('Add to calendar'));
$text = get_lang('Add news');
$class = 'add';
$form->addElement('hidden', 'action', 'add');
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
} elseif (isset($_REQUEST['action']) && 'edit' == $_REQUEST['action']) {
$text = get_lang('Edit News');
$class = 'save';
$form->addElement('hidden', 'action', 'edit');
@ -340,7 +338,7 @@ if ($action_todo) {
$visibilityResult[$key] = (int) $values[$key];
}
if ($values['lang'] == 'all') {
if ('all' == $values['lang']) {
$values['lang'] = null;
}
@ -360,7 +358,7 @@ if ($action_todo) {
empty($values['send_email_test']) ? false : true
);
if ($announcement_id !== false) {
if (false !== $announcement_id) {
// ADD Picture
$picture = $_FILES['picture'];
if (!empty($picture['name'])) {

@ -7,8 +7,6 @@ use Doctrine\Common\Collections\Criteria;
/**
* Generate a teacher time report in platform by session only.
*
* @package chamilo.admin
*/
$cidReset = true;

@ -8,7 +8,7 @@ require_once __DIR__.'/../inc/global.inc.php';
// Access restrictions
api_protect_admin_script(true);
if (api_get_configuration_value('sync_db_with_schema') != true) {
if (true != api_get_configuration_value('sync_db_with_schema')) {
api_not_allowed(true);
}

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
// Including necessary libraries.
require_once __DIR__.'/../inc/global.inc.php';
@ -141,11 +138,11 @@ $form->applyFilter('official_code', 'trim');
// e-mail
$form->addElement('text', 'email', get_lang('e-mail'), ['size' => '40', 'autocomplete' => 'off', 'id' => 'email']);
$form->addRule('email', get_lang('e-mailWrong'), 'email');
if (api_get_setting('registration', 'email') == 'true') {
if ('true' == api_get_setting('registration', 'email')) {
$form->addRule('email', get_lang('e-mailWrong'), 'required');
}
if (api_get_setting('login_is_email') == 'true') {
if ('true' == api_get_setting('login_is_email')) {
$form->addRule('email', sprintf(get_lang('The login needs to be maximum %s characters long'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
$form->addRule('email', get_lang('This login is already in use'), 'username_available');
}
@ -163,7 +160,7 @@ $allowed_picture_types = api_get_supported_image_extensions(false);
$form->addRule('picture', get_lang('Only PNG, JPG or GIF images allowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
// Username
if (api_get_setting('login_is_email') != 'true') {
if ('true' != api_get_setting('login_is_email')) {
$form->addElement('text', 'username', get_lang('Login'), ['id' => 'username', 'maxlength' => USERNAME_MAX_LENGTH, 'autocomplete' => 'off']);
$form->addRule('username', get_lang('Required field'), 'required');
$form->addRule('username', sprintf(get_lang('The login needs to be maximum %s characters long'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
@ -182,7 +179,7 @@ if (isset($extAuthSource) && count($extAuthSource) > 0) {
// Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
// extAuthSource always on for CAS even if not activated
// same action for file user_edit.php
if (($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true') || ($key != CAS_AUTH_SOURCE)) {
if ((CAS_AUTH_SOURCE == $key && 'true' === api_get_setting('cas_activate')) || (CAS_AUTH_SOURCE != $key)) {
$auth_sources[$key] = $key;
$nb_ext_auth_source_added++;
}
@ -245,7 +242,7 @@ $form->addElement(
);
//drh list (display only if student)
$display = (isset($_POST['status']) && $_POST['status'] == STUDENT) || !isset($_POST['status']) ? 'block' : 'none';
$display = (isset($_POST['status']) && STUDENT == $_POST['status']) || !isset($_POST['status']) ? 'block' : 'none';
//@todo remove the drh list here. This code is unused
$form->addElement('html', '<div id="drh_list" style="display:'.$display.';">');
@ -368,28 +365,28 @@ if ($form->validate()) {
$hr_dept_id = isset($user['hr_dept_id']) ? (int) $user['hr_dept_id'] : 0;
if (isset($extAuthSource) && count($extAuthSource) > 0 &&
$user['password']['password_auto'] == '2'
'2' == $user['password']['password_auto']
) {
$auth_source = $user['password']['auth_source'];
$password = 'PLACEHOLDER';
} else {
$auth_source = PLATFORM_AUTH_SOURCE;
$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
$password = '1' == $user['password']['password_auto'] ? api_generate_password() : $user['password']['password'];
}
$expiration_date = null;
if ($user['radio_expiration_date'] == '1') {
if ('1' == $user['radio_expiration_date']) {
$expiration_date = $user['expiration_date'];
}
$active = (int) $user['active'];
if (api_get_setting('login_is_email') == 'true') {
if ('true' == api_get_setting('login_is_email')) {
$username = $email;
}
$extra = [];
foreach ($user as $key => $value) {
if (substr($key, 0, 6) == 'extra_') {
if ('extra_' == substr($key, 0, 6)) {
// An extra field
$extra[substr($key, 6)] = $value;
}

@ -3,9 +3,6 @@
use ChamiloSession as Session;
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -80,7 +77,7 @@ $sql = "SELECT u.*, a.user_id AS is_admin FROM $table_user u
LEFT JOIN $table_admin a ON a.user_id = u.id
WHERE u.id = '".$user_id."'";
$res = Database::query($sql);
if (Database::num_rows($res) != 1) {
if (1 != Database::num_rows($res)) {
header('Location: user_list.php');
exit;
}
@ -136,11 +133,11 @@ $form->applyFilter('official_code', 'trim');
// e-mail
$form->addElement('text', 'email', get_lang('e-mail'));
$form->addRule('email', get_lang('e-mailWrong'), 'email');
if (api_get_setting('registration', 'email') == 'true') {
if ('true' == api_get_setting('registration', 'email')) {
$form->addRule('email', get_lang('e-mailWrong'), 'required');
}
if (api_get_setting('login_is_email') == 'true') {
if ('true' == api_get_setting('login_is_email')) {
$form->addRule('email', sprintf(get_lang('The login needs to be maximum %s characters long'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
$form->addRule('email', get_lang('This login is already in use'), 'username_available', $user_data['username']);
}
@ -167,7 +164,7 @@ if (strlen($user_data['picture_uri']) > 0) {
}
// Username
if (api_get_setting('login_is_email') != 'true') {
if ('true' != api_get_setting('login_is_email')) {
$form->addElement('text', 'username', get_lang('Login'), ['maxlength' => USERNAME_MAX_LENGTH]);
$form->addRule('username', get_lang('Required field'), 'required');
$form->addRule('username', sprintf(get_lang('The login needs to be maximum %s characters long'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
@ -192,7 +189,7 @@ if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0
// Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
// extAuthSource always on for CAS even if not activated
// same action for file user_add.php
if (($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true') || ($key != CAS_AUTH_SOURCE)) {
if ((CAS_AUTH_SOURCE == $key && 'true' === api_get_setting('cas_activate')) || (CAS_AUTH_SOURCE != $key)) {
$auth_sources[$key] = $key;
$nb_ext_auth_source_added++;
}
@ -238,7 +235,7 @@ $form->addElement(
]
);
$display = isset($user_data['status']) && ($user_data['status'] == STUDENT || (isset($_POST['status']) && $_POST['status'] == STUDENT)) ? 'block' : 'none';
$display = isset($user_data['status']) && (STUDENT == $user_data['status'] || (isset($_POST['status']) && STUDENT == $_POST['status'])) ? 'block' : 'none';
// Platform admin
if (api_is_platform_admin()) {
@ -246,7 +243,7 @@ if (api_is_platform_admin()) {
$group[] = $form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'platform_admin', null, get_lang('No'), 0);
$user_data['status'] == 1 ? $display = 'block' : $display = 'none';
1 == $user_data['status'] ? $display = 'block' : $display = 'none';
$form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">');
$form->addGroup($group, 'admin', get_lang('Administration'), null, false);
@ -367,7 +364,7 @@ $error_drh = false;
if ($form->validate()) {
$user = $form->getSubmitValues(1);
$reset_password = intval($user['reset_password']);
if ($reset_password == 2 && empty($user['password'])) {
if (2 == $reset_password && empty($user['password'])) {
Display::addFlash(Display::return_message(get_lang('The password is too short')));
header('Location: '.api_get_self().'?user_id='.$user_id);
exit();
@ -375,7 +372,7 @@ if ($form->validate()) {
$is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']);
if ($user['status'] == DRH && $is_user_subscribed_in_course) {
if (DRH == $user['status'] && $is_user_subscribed_in_course) {
$error_drh = true;
} else {
$picture_element = $form->getElement('picture');
@ -409,7 +406,7 @@ if ($form->validate()) {
$language = $user['language'];
$address = isset($user['address']) ? $user['address'] : null;
if (!$user_data['platform_admin'] && $user['radio_expiration_date'] == '1') {
if (!$user_data['platform_admin'] && '1' == $user['radio_expiration_date']) {
$expiration_date = $user['expiration_date'];
} else {
$expiration_date = null;
@ -418,11 +415,11 @@ if ($form->validate()) {
$active = $user_data['platform_admin'] ? 1 : intval($user['active']);
//If the user is set to admin the status will be overwrite by COURSEMANAGER = 1
if ($platform_admin == 1) {
if (1 == $platform_admin) {
$status = COURSEMANAGER;
}
if (api_get_setting('login_is_email') == 'true') {
if ('true' == api_get_setting('login_is_email')) {
$username = $email;
}
@ -467,7 +464,7 @@ if ($form->validate()) {
UserManager::add_user_as_admin($userObj);
if ($user_id != $currentUserId) {
if ($platform_admin == 1) {
if (1 == $platform_admin) {
$userObj = api_get_user_entity($user_id);
UserManager::add_user_as_admin($userObj);
} else {

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -35,7 +32,7 @@ global $_configuration;
if (api_is_multiple_url_enabled()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sql = "SELECT code,visual_code,title
FROM $course_table as c
INNER JOIN $tbl_course_rel_access_url as course_rel_url
@ -86,7 +83,7 @@ if ($form->validate()) {
u.firstname AS FirstName,
u.email AS Email,
u.username AS UserName,
".(($_configuration['password_encryption'] != 'none') ? " " : "u.password AS Password, ")."
".(('none' != $_configuration['password_encryption']) ? " " : "u.password AS Password, ")."
u.auth_source AS AuthSource,
u.status AS Status,
u.official_code AS OfficialCode,
@ -112,7 +109,7 @@ if ($form->validate()) {
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sql .= " FROM $user_table u
INNER JOIN $tbl_user_rel_access_url as user_rel_url
ON (u.user_id= user_rel_url.user_id)
@ -128,8 +125,8 @@ if ($form->validate()) {
$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false);
if (!empty($export['addcsvheader'])) {
if ($export['addcsvheader'] == '1' && ($export['file_type'] == 'csv' || $export['file_type'] == 'xls')) {
if ($_configuration['password_encryption'] != 'none') {
if ('1' == $export['addcsvheader'] && ('csv' == $export['file_type'] || 'xls' == $export['file_type'])) {
if ('none' != $_configuration['password_encryption']) {
$data[] = [
'UserId',
'LastName',

@ -6,8 +6,6 @@ use ChamiloSession as Session;
/**
* This tool allows platform admins to add users by uploading a CSV or XML file.
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -33,7 +31,7 @@ function validate_data($users, $checkUniqueEmail = false)
// 1. Check if mandatory fields are set.
$mandatory_fields = ['LastName', 'FirstName'];
if (api_get_setting('registration', 'email') == 'true' || $checkUniqueEmail) {
if ('true' == api_get_setting('registration', 'email') || $checkUniqueEmail) {
$mandatory_fields[] = 'Email';
}
@ -60,7 +58,7 @@ function validate_data($users, $checkUniqueEmail = false)
}
// 2.1.1
$hasDash = strpos($username, '-');
if ($hasDash !== false) {
if (false !== $hasDash) {
$user['message'] .= Display::return_message(
get_lang('The username cannot contain the \' - \' character'),
'warning'
@ -82,7 +80,7 @@ function validate_data($users, $checkUniqueEmail = false)
if (isset($user['Email'])) {
$result = api_valid_email($user['Email']);
if ($result === false) {
if (false === $result) {
$user['message'] .= Display::return_message(get_lang('Please enter a valid e-mail address !'), 'warning');
$user['has_error'] = true;
}
@ -356,7 +354,7 @@ function parse_csv_data($users, $fileName, $sendEmail = 0, $checkUniqueEmail = t
$users = array_splice($users, 0, $readMax);
}
if ($resumeImport === false) {
if (false === $resumeImport) {
$users = $usersFromOrigin;
}
@ -435,7 +433,7 @@ function parse_xml_data($file)
foreach ($crawler as $domElement) {
$row = [];
foreach ($domElement->childNodes as $node) {
if ($node->nodeName != '#text') {
if ('#text' != $node->nodeName) {
$row[$node->nodeName] = $node->nodeValue;
}
}
@ -507,11 +505,11 @@ if (isset($extAuthSource) && is_array($extAuthSource)) {
$tool_name = get_lang('Import users list');
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('Administration')];
$reloadImport = (isset($_REQUEST['reload_import']) && (int) $_REQUEST['reload_import'] === 1);
$reloadImport = (isset($_REQUEST['reload_import']) && 1 === (int) $_REQUEST['reload_import']);
$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['size'] !== 0) {
if (isset($_POST['formSent']) && $_POST['formSent'] && 0 !== $_FILES['import_file']['size']) {
$file_type = $_POST['file_type'];
Security::clear_token();
$tok = Security::get_token();
@ -526,7 +524,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
$users = [];
if (in_array($ext_import_file, $allowed_file_mimetype)) {
if (strcmp($file_type, 'csv') === 0 &&
if (0 === strcmp($file_type, 'csv') &&
$ext_import_file == $allowed_file_mimetype[0]
) {
Session::erase('user_import_data_'.$userId);
@ -540,7 +538,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
);
$users = validate_data($users, $checkUniqueEmail);
$error_kind_file = false;
} elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) {
} elseif (0 === strcmp($file_type, 'xml') && $ext_import_file == $allowed_file_mimetype[1]) {
$users = parse_xml_data($_FILES['import_file']['tmp_name']);
$users = validate_data($users, $checkUniqueEmail);
$error_kind_file = false;
@ -622,7 +620,7 @@ if (!empty($importData)) {
if ($isResume) {
$resumeStop = $importData['counter'] >= count($importData['complete_list']);
if ($resumeStop == false) {
if (false == $resumeStop) {
$formContinue->addButtonImport(get_lang('ContinueImport'), 'import_continue');
}
}
@ -642,7 +640,7 @@ if (!empty($importData)) {
processUsers($users, $importData['send_email']);
$reload = '';
if ($isResume && $resumeStop === false) {
if ($isResume && false === $resumeStop) {
$reload = '?reload_import=1';
}
@ -778,7 +776,7 @@ if (api_get_configuration_value('plugin_redirection_enabled')) {
&lt;OfficialCode&gt;xxx&lt;/OfficialCode&gt;
&lt;language&gt;english/spanish/(other)&lt;/language&gt;
&lt;PhoneNumber&gt;xxx&lt;/PhoneNumber&gt;
&lt;Status&gt;user/teacher/drh&lt;/Status&gt;<?php if ($result_xml != '') {
&lt;Status&gt;user/teacher/drh&lt;/Status&gt;<?php if ('' != $result_xml) {
echo '<br /><span style="color:red;">', $result_xml;
echo '</span><br />';
} ?>

@ -8,8 +8,6 @@ use Chamilo\UserBundle\Entity\User;
* Script showing information about a user (name, e-mail, courses and sessions).
*
* @author Bart Mollet
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -158,7 +156,7 @@ $data = [
get_lang('Phone') => $user['phone'],
get_lang('Course code') => $user['official_code'],
get_lang('Online') => !empty($user['user_is_online']) ? Display::return_icon('online.png') : Display::return_icon('offline.png'),
get_lang('Status') => $user['status'] == 1 ? get_lang('Trainer') : get_lang('Learner'),
get_lang('Status') => 1 == $user['status'] ? get_lang('Trainer') : get_lang('Learner'),
];
$userInfo = [
@ -167,7 +165,7 @@ $userInfo = [
'phone' => $user['phone'],
'official_code' => $user['official_code'],
'user_is_online' => !empty($user['user_is_online']) ? Display::return_icon('online.png') : Display::return_icon('offline.png'),
'status' => $user['status'] == 1 ? get_lang('Trainer') : get_lang('Learner'),
'status' => 1 == $user['status'] ? get_lang('Trainer') : get_lang('Learner'),
'avatar' => $user['avatar'],
];
@ -204,7 +202,7 @@ $data = [
get_lang('Latest login') => $userInfo['last_connection'],
];
if (api_get_setting('allow_terms_conditions') === 'true') {
if ('true' === api_get_setting('allow_terms_conditions')) {
$extraFieldValue = new ExtraFieldValue('user');
$value = $extraFieldValue->get_values_by_handler_and_field_variable(
$userId,
@ -250,12 +248,12 @@ foreach ($data as $label => $item) {
/**
* Show social activity.
*/
if (api_get_setting('allow_social_tool') === 'true') {
if ('true' === api_get_setting('allow_social_tool')) {
$userObject = api_get_user_entity($userId);
$data = [];
// Calculate values
if (api_get_setting('allow_message_tool') === 'true') {
if ('true' === api_get_setting('allow_message_tool')) {
$messagesSent = SocialManager::getCountMessagesSent($userId);
$data[] = [get_lang('Number of messages sent'), $messagesSent];
$messagesReceived = SocialManager::getCountMessagesReceived($userId);
@ -342,7 +340,7 @@ if (count($sessions) > 0) {
'<a href="'.$courseInfo['course_public_url'].'?id_session='.$id_session.'">'.
Display::return_icon('course_home.png', get_lang('Course home')).'</a>';
if (!empty($my_course['status']) && $my_course['status'] == STUDENT) {
if (!empty($my_course['status']) && STUDENT == $my_course['status']) {
$tools .= '<a href="user_information.php?action=unsubscribe_session_course&course_id='.$courseInfo['real_id'].'&user_id='.$userId.'&id_session='.$id_session.'">'.
Display::return_icon('delete.png', get_lang('Delete')).'</a>';
}
@ -457,7 +455,7 @@ if (Database::num_rows($res) > 0) {
Display::return_icon('course_home.png', get_lang('Course home')).'</a>'.
'<a href="course_edit.php?id='.$course->c_id.'">'.
Display::return_icon('edit.png', get_lang('Edit')).'</a>';
if ($course->status == STUDENT) {
if (STUDENT == $course->status) {
$tools .= '<a href="user_information.php?action=unsubscribe&course_id='.$courseInfo['real_id'].'&user_id='.$userId.'">'.
Display::return_icon('delete.png', get_lang('Delete')).'</a>';
}
@ -478,7 +476,7 @@ if (Database::num_rows($res) > 0) {
$row = [
Display::url($courseCode, $courseInfo['course_public_url']),
$course->title,
$course->status == STUDENT ? get_lang('Learner') : get_lang('Trainer'),
STUDENT == $course->status ? get_lang('Learner') : get_lang('Trainer'),
$timeSpent,
$totalForumMessages,
$tools,
@ -571,7 +569,7 @@ if (isset($_GET['action'])) {
break;
}
if (CourseManager::getUserInCourseStatus($userId, $courseInfo['real_id']) == STUDENT) {
if (STUDENT == CourseManager::getUserInCourseStatus($userId, $courseInfo['real_id'])) {
CourseManager::unsubscribe_user($userId, $courseInfo['code'], $sessionId);
Display::addFlash(Display::return_message(get_lang('User is now unsubscribed')));
} else {
@ -658,7 +656,7 @@ if ($hrmList) {
echo '</div>';
}
if ($user['status'] == DRH) {
if (DRH == $user['status']) {
$usersAssigned = UserManager::get_users_followed_by_drh($userId);
if ($usersAssigned) {

@ -121,7 +121,7 @@ function getData(User $hrm, $status = HRM_REQUEST)
$line = [];
$studentLink = api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$request['user_id'];
$line[] = '<a href="'.$studentLink.'">'.api_get_person_name($request['firstname'], $request['lastname']).'</a>';
if ($status == HRM_REQUEST) {
if (HRM_REQUEST == $status) {
$line[] = Display::url(
$iconAccept,
$urlAccept.$request['user_id']

@ -6,8 +6,6 @@ use ChamiloSession as Session;
/**
* @author Bart Mollet
* @author Julio Montoya <gugli100@gmail.com> BeezNest 2011
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -20,7 +18,7 @@ $currentUserId = api_get_user_id();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
// Login as can be used by different roles
if (isset($_GET['user_id']) && $action == 'login_as') {
if (isset($_GET['user_id']) && 'login_as' == $action) {
$check = Security::check_token('get');
if ($check && api_can_login_as($_GET['user_id'])) {
$result = UserManager::loginAsUser($_GET['user_id']);
@ -268,7 +266,7 @@ function prepare_user_sql_query($getCount)
}
}
if ($atLeastOne == false) {
if (false == $atLeastOne) {
$keywordListValues = [];
}
@ -296,7 +294,7 @@ function prepare_user_sql_query($getCount)
$keyword_admin = '';
if (isset($keywordListValues['keyword_status']) &&
$keywordListValues['keyword_status'] == PLATFORM_ADMIN
PLATFORM_ADMIN == $keywordListValues['keyword_status']
) {
$query_admin_table = " , $admin_table a ";
$keyword_admin = ' AND a.user_id = u.id ';
@ -341,7 +339,7 @@ function prepare_user_sql_query($getCount)
}
$preventSessionAdminsToManageAllUsers = api_get_setting('prevent_session_admins_to_manage_all_users');
if (api_is_session_admin() && $preventSessionAdminsToManageAllUsers === 'true') {
if (api_is_session_admin() && 'true' === $preventSessionAdminsToManageAllUsers) {
$sql .= ' AND u.creator_id = '.$currentUserId;
}
@ -374,7 +372,7 @@ function prepare_user_sql_query($getCount)
if (empty($value)) {
continue;
}
if ($info['field_type'] == ExtraField::FIELD_TYPE_TAG) {
if (ExtraField::FIELD_TYPE_TAG == $info['field_type']) {
$result = $extraField->getAllUserPerTag(
$info['id'],
$value
@ -468,7 +466,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
alt="'.api_get_person_name($user[2], $user[3]).'"
title="'.api_get_person_name($user[2], $user[3]).'" />';
if ($user[7] == 1 && !empty($user['exp'])) {
if (1 == $user[7] && !empty($user['exp'])) {
// check expiration date
$expiration_time = convert_sql_date($user['exp']);
// if expiration date is passed, store a special value for active field
@ -805,20 +803,20 @@ function active_filter($active, $params, $row)
{
$_user = api_get_user_info();
if ($active == '1') {
if ('1' == $active) {
$action = 'Lock';
$image = 'accept';
} elseif ($active == '-1') {
} elseif ('-1' == $active) {
$action = 'edit';
$image = 'warning';
} elseif ($active == '0') {
} elseif ('0' == $active) {
$action = 'Unlock';
$image = 'error';
}
$result = '';
if ($action === 'edit') {
if ('edit' === $action) {
$result = Display::return_icon(
$image.'.png',
get_lang('Account expired'),
@ -1116,7 +1114,7 @@ $table->set_column_filter(8, 'active_filter');
$table->set_column_filter(11, 'modify_filter');
// Hide email column if login is email, to avoid column with same data
if (api_get_setting('login_is_email') === 'true') {
if ('true' === api_get_setting('login_is_email')) {
$table->setHideColumn(6);
}
@ -1135,7 +1133,7 @@ $table_result = $table->return_table();
$extra_search_options = '';
// Try to search the user everywhere
if ($table->get_total_number_of_items() == 0) {
if (0 == $table->get_total_number_of_items()) {
if (api_get_multiple_access_url() && isset($_REQUEST['keyword'])) {
$keyword = Database::escape_string($_REQUEST['keyword']);
$conditions = ['username' => $keyword];

@ -6,8 +6,6 @@ use ChamiloSession as Session;
/**
* @author Bart Mollet
* @author Julio Montoya <gugli100@gmail.com> BeezNest 2011
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -100,7 +98,7 @@ function prepare_user_sql_query($getCount)
}
}
if ($atLeastOne == false) {
if (false == $atLeastOne) {
$keywordListValues = [];
}
@ -121,7 +119,7 @@ function prepare_user_sql_query($getCount)
$keyword_admin = '';
if (isset($keywordListValues['keyword_status']) &&
$keywordListValues['keyword_status'] == PLATFORM_ADMIN
PLATFORM_ADMIN == $keywordListValues['keyword_status']
) {
$query_admin_table = " , $admin_table a ";
$keyword_admin = ' AND a.user_id = u.id ';
@ -159,7 +157,7 @@ function prepare_user_sql_query($getCount)
}
$preventSessionAdminsToManageAllUsers = api_get_setting('prevent_session_admins_to_manage_all_users');
if (api_is_session_admin() && $preventSessionAdminsToManageAllUsers === 'true') {
if (api_is_session_admin() && 'true' === $preventSessionAdminsToManageAllUsers) {
$sql .= " AND u.creator_id = ".api_get_user_id();
}
@ -225,7 +223,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
alt="'.api_get_person_name($user[2], $user[3]).'"
title="'.api_get_person_name($user[2], $user[3]).'" />';
if ($user[7] == 1 && !empty($user[10])) {
if (1 == $user[7] && !empty($user[10])) {
// check expiration date
$expiration_time = convert_sql_date($user[10]);
// if expiration date is passed, store a special value for active field
@ -396,20 +394,20 @@ function active_filter($active, $params, $row)
{
$_user = api_get_user_info();
if ($active == '1') {
if ('1' == $active) {
$action = 'Lock';
$image = 'accept';
} elseif ($active == '-1') {
} elseif ('-1' == $active) {
$action = 'edit';
$image = 'warning';
} elseif ($active == '0') {
} elseif ('0' == $active) {
$action = 'Unlock';
$image = 'error';
}
$result = '';
if ($action === 'edit') {
if ('edit' === $action) {
$result = Display::return_icon(
$image.'.png',
get_lang('Account expired'),

@ -3,8 +3,6 @@
/**
* User move script (to move between courses and sessions).
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -19,18 +17,18 @@ function compare_data($result_message)
{
foreach ($result_message as $table => $data) {
$title = $table;
if ($table == 'TRACK_E_EXERCISES') {
if ('TRACK_E_EXERCISES' == $table) {
$title = get_lang('Tests');
} elseif ($table == 'TRACK_E_EXERCISES_IN_LP') {
} elseif ('TRACK_E_EXERCISES_IN_LP' == $table) {
$title = get_lang('TestsInLp');
} elseif ($table == 'LP_VIEW') {
} elseif ('LP_VIEW' == $table) {
$title = get_lang('Learning paths');
}
echo '<br / ><h3>'.get_lang($title).' </h3><hr />';
if (is_array($data)) {
foreach ($data as $id => $item) {
if ($table == 'TRACK_E_EXERCISES' || $table == 'TRACK_E_EXERCISES_IN_LP') {
if ('TRACK_E_EXERCISES' == $table || 'TRACK_E_EXERCISES_IN_LP' == $table) {
echo "<br /><h3>".get_lang('Attempt')." #$id</h3>";
echo '<h3>';
echo get_lang('Test').' #'.$item['exe_exo_id'];
@ -102,7 +100,7 @@ if (isset($_REQUEST['load_ajax'])) {
$result_message_compare = [];
$update_database = true;
if (isset($_REQUEST['view_stat']) && $_REQUEST['view_stat'] == 1) {
if (isset($_REQUEST['view_stat']) && 1 == $_REQUEST['view_stat']) {
$update_database = false;
}
@ -610,7 +608,7 @@ if (isset($_REQUEST['load_ajax'])) {
echo '<tr>';
echo '<td width="50%" valign="top">';
if ($origin_session_id == 0) {
if (0 == $origin_session_id) {
echo '<h4>'.get_lang('Original course').'</h4>';
} else {
echo '<h4>'.get_lang('Original session').' #'.$origin_session_id.'</h4>';
@ -618,7 +616,7 @@ if (isset($_REQUEST['load_ajax'])) {
compare_data($result_message);
echo '</td>';
echo '<td width="50%" valign="top">';
if ($new_session_id == 0) {
if (0 == $new_session_id) {
echo '<h4>'.get_lang('Destination course').'</h4>';
} else {
echo '<h4>'.get_lang('Destination session').' #'.$new_session_id.'</h4>';

@ -4,8 +4,6 @@
/**
* This tool allows platform admins to add users by uploading a CSV or XML file.
*
* @package chamilo.admin
*/
/**
@ -26,7 +24,7 @@ function validate_data($users)
// 1. Check if mandatory fields are set.
$mandatory_fields = ['LastName', 'FirstName'];
if (api_get_setting('registration', 'email') == 'true') {
if ('true' == api_get_setting('registration', 'email')) {
$mandatory_fields[] = 'Email';
}
$classExistList = [];
@ -153,7 +151,7 @@ function updateUsers($users)
$userName = $user['UserName'];
$userInfo = api_get_user_info_from_username($userName);
$user_id = $userInfo['user_id'];
if ($user_id == 0) {
if (0 == $user_id) {
return false;
}
$firstName = isset($user['FirstName']) ? $user['FirstName'] : $userInfo['firstname'];
@ -165,7 +163,7 @@ function updateUsers($users)
$changePassMethod = 2;
}
$authSource = isset($user['AuthSource']) ? $user['AuthSource'] : '';
if ($changePassMethod === 2 && !empty($authSource) && $authSource != $userInfo['auth_source']) {
if (2 === $changePassMethod && !empty($authSource) && $authSource != $userInfo['auth_source']) {
$changePassMethod = 3;
}
$email = isset($user['Email']) ? $user['Email'] : $userInfo['email'];
@ -272,7 +270,7 @@ function parse_xml_data($file)
foreach ($crawler as $domElement) {
$row = [];
foreach ($domElement->childNodes as $node) {
if ($node->nodeName != '#text') {
if ('#text' != $node->nodeName) {
$row[$node->nodeName] = $node->nodeValue;
}
}
@ -301,7 +299,7 @@ $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
$user_id_error = [];
$error_message = '';
if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['size'] !== 0) {
if (isset($_POST['formSent']) && $_POST['formSent'] && 0 !== $_FILES['import_file']['size']) {
$file_type = 'csv';
Security::clear_token();
$tok = Security::get_token();
@ -312,11 +310,11 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
$ext_import_file = $uploadInfo['extension'];
if (in_array($ext_import_file, $allowed_file_mimetype)) {
if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) {
if (0 === strcmp($file_type, 'csv') && $ext_import_file == $allowed_file_mimetype[0]) {
$users = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users);
$error_kind_file = false;
} elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) {
} elseif (0 === strcmp($file_type, 'xml') && $ext_import_file == $allowed_file_mimetype[1]) {
$users = parse_xml_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users);
$error_kind_file = false;
@ -345,7 +343,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
}
$inserted_in_course = [];
if (strcmp($file_type, 'csv') === 0) {
if (0 === strcmp($file_type, 'csv')) {
updateUsers($users_to_insert);
}
@ -356,7 +354,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
}
$warning_message = '';
if (count($errors) != 0) {
if (0 != count($errors)) {
$warning_message = '<ul>';
foreach ($errors as $index => $error_user) {
$warning_message .= '<li><b>'.$error_user['error'].'</b>: ';

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -5,8 +5,6 @@
* This tool allows platform admins to add classes by uploading a CSV file.
*
* @todo Add some langvars to DLTT
*
* @package chamilo.admin
*/
/**
@ -18,7 +16,7 @@ function validate_data($classes)
$usergroup = new UserGroup();
foreach ($classes as $index => $class) {
// 1. Check of class name is available.
if (!isset($class['name']) || strlen(trim($class['name'])) == 0) {
if (!isset($class['name']) || 0 == strlen(trim($class['name']))) {
$class['line'] = $index + 2;
$class['error'] = get_lang('Missing class name');
$errors[] = $class;
@ -109,7 +107,7 @@ $form->addButtonImport(get_lang('Import'));
if ($form->validate()) {
$classes = Import::csvToArray($_FILES['import_file']['tmp_name']);
$errors = validate_data($classes);
if (count($errors) == 0) {
if (0 == count($errors)) {
$number_of_added_classes = save_data($classes);
Display::addFlash(Display::return_message($number_of_added_classes.' '.get_lang('Added'), 'normal'));
} else {

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
/**
* Code
* This tool allows platform admins to update class-user relations by uploading
@ -25,14 +23,14 @@ function validate_data($user_classes)
$mandatory_fields = ['UserName', 'ClassName'];
foreach ($mandatory_fields as $field) {
if (!isset($user_class[$field]) || strlen($user_class[$field]) == 0) {
if (!isset($user_class[$field]) || 0 == strlen($user_class[$field])) {
$user_class['error'] = get_lang($field.'Mandatory');
$errors[] = $user_class;
}
}
// 2. Check whether class code exists.
if (isset($user_class['ClassName']) && strlen($user_class['ClassName']) != 0) {
if (isset($user_class['ClassName']) && 0 != strlen($user_class['ClassName'])) {
// 2.1 Check whether code has been already used in this CVS-file.
if (!isset($classcodes[$user_class['ClassName']])) {
// 2.1.1 Check whether code exists in DB
@ -157,7 +155,7 @@ $errors = [];
if ($form->validate()) {
$users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users_classes);
if (count($errors) == 0) {
if (0 == count($errors)) {
$deleteUsersNotInList = isset($_REQUEST['unsubscribe']) && !empty($_REQUEST['unsubscribe']) ? true : false;
$return = save_data($users_classes, $deleteUsersNotInList);
}
@ -169,7 +167,7 @@ if (isset($return) && $return) {
echo $return;
}
if (count($errors) != 0) {
if (0 != count($errors)) {
$error_message = "\n";
foreach ($errors as $index => $error_class_user) {
$error_message .= get_lang('Line').' '.$error_class_user['line'].': '.$error_class_user['error'].'</b>';

@ -17,7 +17,7 @@ $usergroup->protectScript($userGroupInfo, true, true);
$allowEdit = api_is_platform_admin() || isset($userGroupInfo['author_id']) && $userGroupInfo['author_id'] == api_get_user_id();
$calendarPlugin = null;
if ($allowEdit && api_get_plugin_setting('learning_calendar', 'enabled') === 'true') {
if ($allowEdit && 'true' === api_get_plugin_setting('learning_calendar', 'enabled')) {
$calendarPlugin = LearningCalendarPlugin::create();
}
@ -326,7 +326,7 @@ $(function() {
$usergroup->showGroupTypeSetting = true;
// Action handling: Adding a note
if ($allowEdit && $action === 'delete' && is_numeric($_GET['id'])) {
if ($allowEdit && 'delete' === $action && is_numeric($_GET['id'])) {
$res = $usergroup->delete_user_rel_group($_GET['user_id'], $_GET['id']);
Display::addFlash(Display::return_message(get_lang('Deleted'), 'confirmation'));
header('Location: '.api_get_self().'?id='.$id);

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -75,7 +72,7 @@ switch ($action) {
$interbreadcrumb[] = ['url' => 'usergroups.php', 'name' => get_lang('Classes')];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
if (0 != api_get_session_id() && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
$form = new FormValidator(

@ -14,7 +14,6 @@ use Chamilo\CourseBundle\Entity\CAnnouncement;
* Announcements tool and also add the resource linker here. The database also needed refactoring
* as there was no title field (the title was merged into the content field)
*/
$use_anonymous = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -603,9 +603,9 @@ class AttendanceController
} else {
$result[$class_day['id']] = ' ';
}
++$cols;
$cols++;
}
++$count;
$count++;
$data_table[] = $result;
}
}
@ -620,7 +620,7 @@ class AttendanceController
$tables = [];
$changed = 1;
for ($i = 0; $i <= $rows; ++$i) {
for ($i = 0; $i <= $rows; $i++) {
$row = isset($data_table[$i]) ? $data_table[$i] : null;
$key = 1;
$max_dates_per_page = 10;
@ -630,14 +630,14 @@ class AttendanceController
if (!empty($item)) {
foreach ($item as $value) {
if ($count_j >= $max_dates_per_page) {
++$key;
$key++;
$max_dates_per_page = $max_dates_per_page_original * $key;
//magic hack
$tables[$key][$i][] = $tables[1][$i][0];
$tables[$key][$i][] = $tables[1][$i][1];
}
$tables[$key][$i][] = $value;
++$count_j;
$count_j++;
}
}
}

@ -251,7 +251,7 @@ if (api_is_allowed_to_edit(null, true) ||
</td>
</tr>
<?php
++$i;
$i++;
} ?>
</tbody>
</table>
@ -393,7 +393,7 @@ if (api_is_allowed_to_edit(null, true) ||
</td>';
}
echo '</tr>';
++$i;
$i++;
}
echo '</tbody></table>';
echo '</div></div>'; ?>

@ -4,10 +4,8 @@
* Layout (principal view) used for structuring course/session catalog.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.auth
*/
if (api_get_setting('course_catalog_published') !== 'true') {
if ('true' !== api_get_setting('course_catalog_published')) {
// Access rights: anonymous users can't do anything usefull here.
api_block_anonymous_users();
}

@ -23,14 +23,14 @@ $limit = CoursesController::getLimitArray();
// Section for the tabs.
$this_section = SECTION_CATALOG;
if (api_get_setting('course_catalog_published') !== 'true') {
if ('true' !== api_get_setting('course_catalog_published')) {
// Access rights: anonymous users can't do anything useful here.
api_block_anonymous_users();
}
// For students
$user_can_view_page = true;
if (api_get_setting('allow_students_to_browse_courses') === 'false') {
if ('false' === api_get_setting('allow_students_to_browse_courses')) {
$user_can_view_page = false;
}
@ -224,7 +224,7 @@ switch ($action) {
}
$registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription');
if ($registrationAllowed === 'true') {
if ('true' === $registrationAllowed) {
$entityManager = Database::getManager();
$repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
@ -262,7 +262,7 @@ switch ($action) {
if ($count <= 0) {
// no course in session -> return to catalog
$url = api_get_path(WEB_CODE_PATH).'auth/courses.php';
} elseif ($count == 1) {
} elseif (1 == $count) {
// only one course, so redirect directly to this course
foreach ($coursesList as $course) {
$url = api_get_path(WEB_COURSE_PATH).$course['directory'].'/index.php?id_session='.$sessionId;

@ -9,7 +9,7 @@ use Chamilo\CoreBundle\Framework\Container;
*
* @author Christian Fasanando <christian1827@gmail.com> - Beeznest
*/
if (isset($_REQUEST['action']) && Security::remove_XSS($_REQUEST['action']) !== 'subscribe') {
if (isset($_REQUEST['action']) && 'subscribe' !== Security::remove_XSS($_REQUEST['action'])) {
$stok = Security::get_token();
} else {
$stok = Security::getTokenFromSession();
@ -74,7 +74,7 @@ echo '<div class="row">
if ($showCourses) {
echo '<div class="col-md-'.($showSessions ? '4' : '6').'">';
if (!isset($_GET['hidden_links']) || intval($_GET['hidden_links']) != 1) {
if (!isset($_GET['hidden_links']) || 1 != intval($_GET['hidden_links'])) {
?>
<form method="post"
action="<?php echo CourseCategory::getCourseCategoryUrl(1, $pageLength, 'ALL', 0, 'subscribe'); ?>">
@ -114,7 +114,7 @@ if ($showCourses) {
echo '</div></div></div></div>';
if ($showCourses && $action != 'display_sessions') {
if ($showCourses && 'display_sessions' != $action) {
if (!empty($message)) {
echo Display::return_message($message, 'confirmation', false);
}
@ -130,7 +130,7 @@ if ($showCourses && $action != 'display_sessions') {
echo "<p><strong>".get_lang('Search results for:')." ".$searchTerm."</strong><br />";
}
$showTeacher = api_get_setting('display_teacher_in_courselist') === 'true';
$showTeacher = 'true' === api_get_setting('display_teacher_in_courselist');
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$user_id = api_get_user_id();
$categoryListFromDatabase = CourseCategory::getCategories();
@ -145,7 +145,7 @@ if ($showCourses && $action != 'display_sessions') {
if (!empty($browse_courses_in_category)) {
echo '<div class="grid-courses row">';
foreach ($browse_courses_in_category as $course) {
$course_hidden = $course['visibility'] == COURSE_VISIBILITY_HIDDEN;
$course_hidden = COURSE_VISIBILITY_HIDDEN == $course['visibility'];
if ($course_hidden) {
continue;
@ -155,13 +155,13 @@ if ($showCourses && $action != 'display_sessions') {
$userRegisteredInCourseAsTeacher = CourseManager::is_course_teacher($user_id, $course['code']);
$userRegistered = $userRegisteredInCourse && $userRegisteredInCourseAsTeacher;
$course_public = $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD;
$course_open = $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM;
$course_private = $course['visibility'] == COURSE_VISIBILITY_REGISTERED;
$course_closed = $course['visibility'] == COURSE_VISIBILITY_CLOSED;
$course_public = COURSE_VISIBILITY_OPEN_WORLD == $course['visibility'];
$course_open = COURSE_VISIBILITY_OPEN_PLATFORM == $course['visibility'];
$course_private = COURSE_VISIBILITY_REGISTERED == $course['visibility'];
$course_closed = COURSE_VISIBILITY_CLOSED == $course['visibility'];
$course_subscribe_allowed = $course['subscribe'] == 1;
$course_unsubscribe_allowed = $course['unsubscribe'] == 1;
$course_subscribe_allowed = 1 == $course['subscribe'];
$course_unsubscribe_allowed = 1 == $course['unsubscribe'];
$count_connections = $course['count_connections'];
$creation_date = substr($course['creation_date'], 0, 10);
@ -405,7 +405,7 @@ function return_title($course)
$html .= '<a title="'.$course['title'].'" href="'.$course['about_url'].'">'.$course['title'].'</a>';
$html .= '</h4></div>';
if (api_get_configuration_value('hide_course_rating') === false) {
if (false === api_get_configuration_value('hide_course_rating')) {
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$rating = Display::return_rating_system(
'star_'.$course['real_id'],
@ -452,7 +452,7 @@ function return_already_registered_label($in_status)
{
$icon = '<em class="fa fa-check"></em>';
$title = get_lang("YouAreATrainerOfThisCourse");
if ($in_status == 'student') {
if ('student' == $in_status) {
$icon = '<em class="fa fa-check"></em>';
$title = get_lang("Already subscribed");
}

@ -16,8 +16,6 @@ use Chamilo\CoreBundle\Repository\SequenceRepository;
* it should be included inside a dispatcher file (e.g: index.php)
*
* @author Christian Fasanando <christian1827@gmail.com> - BeezNest
*
* @package chamilo.auth
*/
class CoursesController
{
@ -62,7 +60,7 @@ class CoursesController
$listCategories = CoursesAndSessionsCatalog::getCourseCategoriesTree();
$data['countCoursesInCategory'] = CourseCategory::countCoursesInCategory($category_code);
if ($action === 'display_random_courses') {
if ('display_random_courses' === $action) {
// Random value is used instead limit filter
$data['browse_courses_in_category'] = CoursesAndSessionsCatalog::getCoursesInCategory(null, 12);
$data['countCoursesInCategory'] = count($data['browse_courses_in_category']);
@ -85,7 +83,7 @@ class CoursesController
$user_coursecodes = [];
// we need only the course codes as these will be used to match against the courses of the category
if ($user_courses != '') {
if ('' != $user_courses) {
foreach ($user_courses as $key => $value) {
$user_coursecodes[] = $value['code'];
}
@ -150,7 +148,7 @@ class CoursesController
$user_coursecodes = [];
// we need only the course codes as these will be used to match against the courses of the category
if ($user_courses != '') {
if ('' != $user_courses) {
foreach ($user_courses as $value) {
$user_coursecodes[] = $value['code'];
}
@ -254,7 +252,7 @@ class CoursesController
}
$catalogSessionAutoSubscriptionAllowed = false;
if (api_get_setting('catalog_allow_session_auto_subscription') === 'true') {
if ('true' === api_get_setting('catalog_allow_session_auto_subscription')) {
$catalogSessionAutoSubscriptionAllowed = true;
}
@ -357,7 +355,7 @@ class CoursesController
public function sessionList($action, $nameTools, $limit = [])
{
$date = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d');
$hiddenLinks = isset($_GET['hidden_links']) ? $_GET['hidden_links'] == 1 : false;
$hiddenLinks = isset($_GET['hidden_links']) ? 1 == $_GET['hidden_links'] : false;
$limit = isset($limit) ? $limit : self::getLimitArray();
$countSessions = CoursesAndSessionsCatalog::browseSessions($date, [], false, true);
@ -381,7 +379,7 @@ class CoursesController
$tpl->assign('actions', self::getTabList(2));
$tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
$tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
$tpl->assign('show_tutor', api_get_setting('show_session_coach') === 'true');
$tpl->assign('show_tutor', 'true' === api_get_setting('show_session_coach'));
$tpl->assign('course_url', $courseUrl);
$tpl->assign('catalog_pagination', $pagination);
$tpl->assign('hidden_links', $hiddenLinks);
@ -405,7 +403,7 @@ class CoursesController
public function sessionsListByName(array $limit)
{
$keyword = isset($_POST['keyword']) ? $_POST['keyword'] : null;
$hiddenLinks = isset($_GET['hidden_links']) ? (int) $_GET['hidden_links'] == 1 : false;
$hiddenLinks = isset($_GET['hidden_links']) ? 1 == (int) $_GET['hidden_links'] : false;
$courseUrl = CourseCategory::getCourseCategoryUrl(
1,
$limit['length'],
@ -421,7 +419,7 @@ class CoursesController
$tpl->assign('actions', self::getTabList(2));
$tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
$tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
$tpl->assign('show_tutor', api_get_setting('show_session_coach') === 'true' ? true : false);
$tpl->assign('show_tutor', 'true' === api_get_setting('show_session_coach') ? true : false);
$tpl->assign('course_url', $courseUrl);
$tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
$tpl->assign('hidden_links', $hiddenLinks);
@ -429,7 +427,7 @@ class CoursesController
$tpl->assign('keyword', Security::remove_XSS($keyword));
$tpl->assign('sessions', $sessionsBlocks);
$layout = $tpl->get_template('auth/session_catalog.html.twig');
$layout = $tpl->get_template('auth/session_catalog.html.twig');
$content = $tpl->fetch($layout);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
@ -447,14 +445,14 @@ class CoursesController
$url = CourseCategory::getCourseCategoryUrl(1, $pageLength, null, 0, 'display_sessions');
$headers = [];
if (CoursesAndSessionsCatalog::showCourses()) {
$headers[] = [
$headers[] = [
'url' => api_get_self(),
'content' => get_lang('CourseManagement'),
];
}
if (CoursesAndSessionsCatalog::showSessions()) {
$headers[] = [
$headers[] = [
'url' => $url,
'content' => get_lang('SessionList'),
];
@ -472,7 +470,7 @@ class CoursesController
{
$searchTag = isset($_POST['search_tag']) ? $_POST['search_tag'] : null;
$searchDate = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d');
$hiddenLinks = isset($_GET['hidden_links']) ? (int) $_GET['hidden_links'] == 1 : false;
$hiddenLinks = isset($_GET['hidden_links']) ? 1 == (int) $_GET['hidden_links'] : false;
$courseUrl = CourseCategory::getCourseCategoryUrl(
1,
$limit['length'],
@ -487,7 +485,7 @@ class CoursesController
$tpl = new Template();
$tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
$tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
$tpl->assign('show_tutor', api_get_setting('show_session_coach') === 'true' ? true : false);
$tpl->assign('show_tutor', 'true' === api_get_setting('show_session_coach') ? true : false);
$tpl->assign('course_url', $courseUrl);
$tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
$tpl->assign('hidden_links', $hiddenLinks);
@ -584,7 +582,7 @@ class CoursesController
$hasRequirements = false;
foreach ($sequences['sequences'] as $sequence) {
if (count($sequence['requirements']) === 0) {
if (0 === count($sequence['requirements'])) {
continue;
}
$hasRequirements = true;

@ -6,8 +6,6 @@ use ChamiloSession as Session;
/**
* This script displays a form for registering new users.
*
* @package chamilo.auth
*/
//quick hack to adapt the registration form result to the selected registration language
@ -27,7 +25,7 @@ $allowedFields = [
];
$allowedFieldsConfiguration = api_get_configuration_value('allow_fields_inscription');
if ($allowedFieldsConfiguration !== false) {
if (false !== $allowedFieldsConfiguration) {
$allowedFields = isset($allowedFieldsConfiguration['fields']) ? $allowedFieldsConfiguration['fields'] : [];
$allowedFields['extra_fields'] = isset($allowedFieldsConfiguration['extra_fields']) ? $allowedFieldsConfiguration['extra_fields'] : [];
}
@ -36,8 +34,8 @@ $extraFieldsLoaded = false;
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#pass1');
// User is not allowed if Terms and Conditions are disabled and
// registration is disabled too.
$isNotAllowedHere = api_get_setting('allow_terms_conditions') === 'false' &&
api_get_setting('allow_registration') === 'false';
$isNotAllowedHere = 'false' === api_get_setting('allow_terms_conditions') &&
'false' === api_get_setting('allow_registration');
if ($isNotAllowedHere) {
api_not_allowed(true, get_lang('Sorry, you are trying to access the registration page for this portal, but registration is currently disabled. Please contact the administrator (see contact information in the footer). If you already have an account on this site.'));
@ -59,7 +57,7 @@ if ($extraConditions && isset($extraConditions['conditions'])) {
$extraConditions = $extraConditions['conditions'];
foreach ($extraConditions as $condition) {
$exists = $userExtraField->get_handler_field_info_by_field_variable($condition['variable']);
if ($exists == false) {
if (false == $exists) {
$params = [
'field_type' => ExtraField::FIELD_TYPE_CHECKBOX,
'variable' => $condition['variable'],
@ -77,7 +75,7 @@ if ($extraConditions && isset($extraConditions['conditions'])) {
$form = new FormValidator('registration');
$user_already_registered_show_terms = false;
if (api_get_setting('allow_terms_conditions') === 'true') {
if ('true' === api_get_setting('allow_terms_conditions')) {
$user_already_registered_show_terms = isset($_SESSION['term_and_condition']['user_id']);
}
@ -104,11 +102,11 @@ if (!empty($course_code_redirect)) {
Session::write('exercise_redirect', $exercise_redirect);
}
if ($user_already_registered_show_terms === false &&
api_get_setting('allow_registration') !== 'false'
if (false === $user_already_registered_show_terms &&
'false' !== api_get_setting('allow_registration')
) {
// STUDENT/TEACHER
if (api_get_setting('allow_registration_as_teacher') != 'false') {
if ('false' != api_get_setting('allow_registration_as_teacher')) {
if (in_array('status', $allowedFields)) {
$form->addRadio(
'status',
@ -138,13 +136,13 @@ if ($user_already_registered_show_terms === false &&
// EMAIL
$form->addElement('text', 'email', get_lang('e-mail'), ['size' => 40]);
if (api_get_setting('registration', 'email') === 'true') {
if ('true' === api_get_setting('registration', 'email')) {
$form->addRule('email', get_lang('Required field'), 'required');
}
if (api_get_setting('login_is_email') === 'true') {
if ('true' === api_get_setting('login_is_email')) {
$form->applyFilter('email', 'trim');
if (api_get_setting('registration', 'email') != 'true') {
if ('true' != api_get_setting('registration', 'email')) {
$form->addRule('email', get_lang('Required field'), 'required');
}
$form->addRule(
@ -162,7 +160,7 @@ if ($user_already_registered_show_terms === false &&
$form->addRule('email', get_lang('e-mailWrong'), 'email');
// USERNAME
if (api_get_setting('login_is_email') != 'true') {
if ('true' != api_get_setting('login_is_email')) {
$form->addText(
'username',
get_lang('Username'),
@ -215,7 +213,7 @@ if ($user_already_registered_show_terms === false &&
get_lang('Phone'),
['size' => 20]
);
if (api_get_setting('registration', 'phone') == 'true') {
if ('true' == api_get_setting('registration', 'phone')) {
$form->addRule(
'phone',
get_lang('Required field'),
@ -226,7 +224,7 @@ if ($user_already_registered_show_terms === false &&
// Language
if (in_array('language', $allowedFields)) {
if (api_get_setting('registration', 'language') == 'true') {
if ('true' == api_get_setting('registration', 'language')) {
$form->addSelectLanguage(
'language',
get_lang('Language')
@ -241,7 +239,7 @@ if ($user_already_registered_show_terms === false &&
get_lang('Code'),
['size' => 40]
);
if (api_get_setting('registration', 'officialcode') == 'true') {
if ('true' == api_get_setting('registration', 'officialcode')) {
$form->addRule(
'official_code',
get_lang('Required field'),
@ -251,8 +249,8 @@ if ($user_already_registered_show_terms === false &&
}
// EXTENDED FIELDS
if (api_get_setting('extended_profile') == 'true' &&
api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true'
if ('true' == api_get_setting('extended_profile') &&
'true' == api_get_setting('extendedprofile_registration', 'mycomptetences')
) {
$form->addHtmlEditor(
'competences',
@ -263,8 +261,8 @@ if ($user_already_registered_show_terms === false &&
);
}
if (api_get_setting('extended_profile') == 'true' &&
api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true'
if ('true' == api_get_setting('extended_profile') &&
'true' == api_get_setting('extendedprofile_registration', 'mydiplomas')
) {
$form->addHtmlEditor(
'diplomas',
@ -275,8 +273,8 @@ if ($user_already_registered_show_terms === false &&
);
}
if (api_get_setting('extended_profile') == 'true' &&
api_get_setting('extendedprofile_registration', 'myteach') == 'true'
if ('true' == api_get_setting('extended_profile') &&
'true' == api_get_setting('extendedprofile_registration', 'myteach')
) {
$form->addHtmlEditor(
'teach',
@ -287,8 +285,8 @@ if ($user_already_registered_show_terms === false &&
);
}
if (api_get_setting('extended_profile') == 'true' &&
api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true'
if ('true' == api_get_setting('extended_profile') &&
'true' == api_get_setting('extendedprofile_registration', 'mypersonalopenarea')
) {
$form->addHtmlEditor(
'openarea',
@ -299,24 +297,24 @@ if ($user_already_registered_show_terms === false &&
);
}
if (api_get_setting('extended_profile') === 'true') {
if (api_get_setting('extendedprofile_registration', 'mycomptetences') === 'true' &&
api_get_setting('extendedprofile_registrationrequired', 'mycomptetences') === 'true'
if ('true' === api_get_setting('extended_profile')) {
if ('true' === api_get_setting('extendedprofile_registration', 'mycomptetences') &&
'true' === api_get_setting('extendedprofile_registrationrequired', 'mycomptetences')
) {
$form->addRule('competences', get_lang('Required field'), 'required');
}
if (api_get_setting('extendedprofile_registration', 'mydiplomas') === 'true' &&
api_get_setting('extendedprofile_registrationrequired', 'mydiplomas') === 'true'
if ('true' === api_get_setting('extendedprofile_registration', 'mydiplomas') &&
'true' === api_get_setting('extendedprofile_registrationrequired', 'mydiplomas')
) {
$form->addRule('diplomas', get_lang('Required field'), 'required');
}
if (api_get_setting('extendedprofile_registration', 'myteach') === 'true' &&
api_get_setting('extendedprofile_registrationrequired', 'myteach') === 'true'
if ('true' === api_get_setting('extendedprofile_registration', 'myteach') &&
'true' === api_get_setting('extendedprofile_registrationrequired', 'myteach')
) {
$form->addRule('teach', get_lang('Required field'), 'required');
}
if (api_get_setting('extendedprofile_registration', 'mypersonalopenarea') === 'true' &&
api_get_setting('extendedprofile_registrationrequired', 'mypersonalopenarea') === 'true'
if ('true' === api_get_setting('extendedprofile_registration', 'mypersonalopenarea') &&
'true' === api_get_setting('extendedprofile_registrationrequired', 'mypersonalopenarea')
) {
$form->addRule('openarea', get_lang('Required field'), 'required');
}
@ -359,7 +357,7 @@ if ($user_already_registered_show_terms === false &&
// CAPTCHA
$captcha = api_get_setting('allow_captcha');
$allowCaptcha = $captcha === 'true';
$allowCaptcha = 'true' === $captcha;
if ($allowCaptcha) {
$ajax = api_get_path(WEB_AJAX_PATH).'form.ajax.php?a=get_captcha';
@ -406,7 +404,7 @@ if ($user_already_registered_show_terms === false &&
}
}
if (isset($_SESSION['user_language_choice']) && $_SESSION['user_language_choice'] != '') {
if (isset($_SESSION['user_language_choice']) && '' != $_SESSION['user_language_choice']) {
$defaults['language'] = $_SESSION['user_language_choice'];
} else {
$defaults['language'] = api_get_setting('platformLanguage');
@ -435,10 +433,10 @@ $tool_name = get_lang('Registration');
if (!CustomPages::enabled()) {
// Load terms & conditions from the current lang
if (api_get_setting('allow_terms_conditions') === 'true') {
if ('true' === api_get_setting('allow_terms_conditions')) {
$get = array_keys($_GET);
if (isset($get)) {
if (isset($get[0]) && $get[0] == 'legal') {
if (isset($get[0]) && 'legal' == $get[0]) {
$language = api_get_interface_language();
$language = api_get_language_id($language);
$term_preview = LegalManager::get_last_condition($language);
@ -466,7 +464,7 @@ if (!CustomPages::enabled()) {
}
}
if (api_get_setting('allow_terms_conditions') === 'true' && $user_already_registered_show_terms) {
if ('true' === api_get_setting('allow_terms_conditions') && $user_already_registered_show_terms) {
$tool_name = get_lang('Terms and Conditions');
}
}
@ -476,18 +474,18 @@ if ($isNotAllowedHere) {
api_not_allowed(true, get_lang('Sorry, you are trying to access the registration page for this portal, but registration is currently disabled. Please contact the administrator (see contact information in the footer). If you already have an account on this site.'));
}
if (api_get_setting('allow_registration') === 'approval') {
if ('approval' === api_get_setting('allow_registration')) {
$content .= Display::return_message(get_lang('Your account has to be approved'));
}
$showTerms = false;
// Terms and conditions
if (api_get_setting('allow_terms_conditions') === 'true' && $user_already_registered_show_terms) {
if ('true' === api_get_setting('allow_terms_conditions') && $user_already_registered_show_terms) {
if (!api_is_platform_admin()) {
if (api_get_setting('show_terms_if_profile_completed') === 'true') {
if ('true' === api_get_setting('show_terms_if_profile_completed')) {
$userInfo = api_get_user_info();
if ($userInfo && $userInfo['status'] != ANONYMOUS) {
if ((int) $userInfo['profile_completed'] !== 1) {
if ($userInfo && ANONYMOUS != $userInfo['status']) {
if (1 !== (int) $userInfo['profile_completed']) {
api_not_allowed(true);
}
}
@ -517,7 +515,7 @@ if (api_get_setting('allow_terms_conditions') === 'true' && $user_already_regist
$form->addHidden('legal_info', $term_preview['id'].':'.$term_preview['language_id']);
// Show if only HTML type
if ($term_preview['type'] == '2') {
if ('2' == $term_preview['type']) {
$termExtraFields = new ExtraFieldValue('terms_and_condition');
$values = $termExtraFields->getAllValuesByItem($term_preview['id']);
foreach ($values as $value) {
@ -527,7 +525,7 @@ if (api_get_setting('allow_terms_conditions') === 'true' && $user_already_regist
}
}
if ($term_preview['type'] == 1) {
if (1 == $term_preview['type']) {
$form->addElement(
'checkbox',
'legal_accept',
@ -547,7 +545,7 @@ if (api_get_setting('allow_terms_conditions') === 'true' && $user_already_regist
$allowDoubleValidation = api_get_configuration_value('allow_double_validation_in_registration');
$formContainsSendButton = false;
if ($allowDoubleValidation && $showTerms == false) {
if ($allowDoubleValidation && false == $showTerms) {
$htmlHeadXtra[] = '<script>
$(function() {
$("#pre_validation").click(function() {
@ -578,9 +576,9 @@ if ($allowDoubleValidation && $showTerms == false) {
// registration is allowed in any way or if the user is already registered
// but needs to confirm terms. If not, send not allowed message
if (
api_get_setting('allow_registration') === 'approval' ||
api_get_setting('allow_registration') === 'true' ||
api_get_setting('allow_registration') === 'confirmation' ||
'approval' === api_get_setting('allow_registration') ||
'true' === api_get_setting('allow_registration') ||
'confirmation' === api_get_setting('allow_registration') ||
$user_already_registered_show_terms ||
$showTerms
) {
@ -630,7 +628,7 @@ if ($form->validate()) {
$values['username'] = api_substr($values['username'], 0, USERNAME_MAX_LENGTH);
}
if (api_get_setting('allow_registration_as_teacher') === 'false') {
if ('false' === api_get_setting('allow_registration_as_teacher')) {
$values['status'] = STUDENT;
}
@ -638,12 +636,12 @@ if ($form->validate()) {
$values['official_code'] = api_strtoupper($values['username']);
}
if (api_get_setting('login_is_email') === 'true') {
if ('true' === api_get_setting('login_is_email')) {
$values['username'] = $values['email'];
}
if ($user_already_registered_show_terms &&
api_get_setting('allow_terms_conditions') === 'true'
'true' === api_get_setting('allow_terms_conditions')
) {
$user_id = $_SESSION['term_and_condition']['user_id'];
$is_admin = UserManager::is_admin($user_id);
@ -653,10 +651,10 @@ if ($form->validate()) {
// Register extra fields
$extras = [];
foreach ($values as $key => $value) {
if (substr($key, 0, 6) == 'extra_') {
if ('extra_' == substr($key, 0, 6)) {
//an extra field
$extras[substr($key, 6)] = $value;
} elseif (strpos($key, 'remove_extra_') !== false) {
} elseif (false !== strpos($key, 'remove_extra_')) {
$extra_value = Security::filter_filename(urldecode(key($value)));
// To remove from user_field_value and folder
UserManager::update_extra_field_value(
@ -726,29 +724,29 @@ if ($form->validate()) {
$store_extended = false;
$sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_USER)." SET ";
if (api_get_setting('extended_profile') == 'true' &&
api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true'
if ('true' == api_get_setting('extended_profile') &&
'true' == api_get_setting('extendedprofile_registration', 'mycomptetences')
) {
$sql_set[] = "competences = '".Database::escape_string($values['competences'])."'";
$store_extended = true;
}
if (api_get_setting('extended_profile') == 'true' &&
api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true'
if ('true' == api_get_setting('extended_profile') &&
'true' == api_get_setting('extendedprofile_registration', 'mydiplomas')
) {
$sql_set[] = "diplomas = '".Database::escape_string($values['diplomas'])."'";
$store_extended = true;
}
if (api_get_setting('extended_profile') == 'true' &&
api_get_setting('extendedprofile_registration', 'myteach') == 'true'
if ('true' == api_get_setting('extended_profile') &&
'true' == api_get_setting('extendedprofile_registration', 'myteach')
) {
$sql_set[] = "teach = '".Database::escape_string($values['teach'])."'";
$store_extended = true;
}
if (api_get_setting('extended_profile') == 'true' &&
api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true'
if ('true' == api_get_setting('extended_profile') &&
'true' == api_get_setting('extendedprofile_registration', 'mypersonalopenarea')
) {
$sql_set[] = "openarea = '".Database::escape_string($values['openarea'])."'";
$store_extended = true;
@ -795,7 +793,7 @@ if ($form->validate()) {
/* If the account has to be approved then we set the account to inactive,
sent a mail to the platform admin and exit the page.*/
if (api_get_setting('allow_registration') === 'approval') {
if ('approval' === api_get_setting('allow_registration')) {
// 1. Send mail to all platform admin
$emailsubject = get_lang('Approval for new account').': '.$values['username'];
$emailbody = get_lang('Approval for new account')."\n";
@ -853,7 +851,7 @@ if ($form->validate()) {
echo $content;
Display::display_footer();
exit;
} elseif (api_get_setting('allow_registration') === 'confirmation') {
} elseif ('confirmation' === api_get_setting('allow_registration')) {
// 1. Send mail to the user
$thisUser = api_get_user_entity($user_id);
UserManager::sendUserConfirmationMail($thisUser);
@ -880,7 +878,7 @@ if ($form->validate()) {
}
// Terms & Conditions
if (api_get_setting('allow_terms_conditions') === 'true') {
if ('true' === api_get_setting('allow_terms_conditions')) {
// Update the terms & conditions.
if (isset($values['legal_accept_type'])) {
$cond_array = explode(':', $values['legal_accept_type']);
@ -937,7 +935,7 @@ if ($form->validate()) {
$_user['user_id'] = $user_id;
Session::write('_user', $_user);
$is_allowedCreateCourse = isset($values['status']) && $values['status'] == 1;
$is_allowedCreateCourse = isset($values['status']) && 1 == $values['status'];
$usersCanCreateCourse = api_is_allowed_to_create_course();
Session::write('is_allowedCreateCourse', $is_allowedCreateCourse);
@ -966,8 +964,8 @@ if ($form->validate()) {
'go_button' => '',
];
if (api_get_setting('allow_terms_conditions') === 'true' && $user_already_registered_show_terms) {
if (api_get_setting('load_term_conditions_section') === 'login') {
if ('true' === api_get_setting('allow_terms_conditions') && $user_already_registered_show_terms) {
if ('login' === api_get_setting('load_term_conditions_section')) {
$form_data['action'] = api_get_path(WEB_PATH).'user_portal.php';
} else {
$courseInfo = api_get_course_info();
@ -991,7 +989,7 @@ if ($form->validate()) {
}
$form_data['action'] = api_get_path(WEB_CODE_PATH).'create_course/add_course.php';
if (api_get_setting('course_validation') === 'true') {
if ('true' === api_get_setting('course_validation')) {
$form_data['button'] = Display::button(
'next',
get_lang('Create a course request'),
@ -1010,7 +1008,7 @@ if ($form->validate()) {
).'</a>';
}
} else {
if (api_get_setting('allow_students_to_browse_courses') == 'true') {
if ('true' == api_get_setting('allow_students_to_browse_courses')) {
$form_data['action'] = 'courses.php?action=subscribe';
$form_data['message'] = '<p>'.get_lang('You can now select, in the list, the course you want access to').".</p>";
} else {

@ -6,7 +6,7 @@ require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users(true);
$allowJustification = api_get_plugin_setting('justification', 'tool_enable') === 'true';
$allowJustification = 'true' === api_get_plugin_setting('justification', 'tool_enable');
if (!$allowJustification) {
api_not_allowed(true);
@ -79,7 +79,7 @@ switch ($action) {
$justificationId = isset($_REQUEST['justification_id']) ? (int) $_REQUEST['justification_id'] : '';
$userJustification = $plugin->getUserJustification($justificationId);
$justification = $plugin->getJustification($userJustification['justification_document_id']);
if ($justification['date_manual_on'] == 0) {
if (0 == $justification['date_manual_on']) {
api_not_allowed(true);
}
$formEdit = new FormValidator('edit', 'post', api_get_self().'?a=edit_justification&justification_id='.$justificationId);
@ -146,7 +146,7 @@ if (!empty($userJustifications)) {
$table->setCellContents($row, $col++, $date);
$actions = '';
if ($justification['date_manual_on'] == 1) {
if (1 == $justification['date_manual_on']) {
$actions .= Display::url(get_lang('Edit'), api_get_self().'?a=edit_justification&justification_id='.$userJustification['id'], ['class' => 'btn btn-primary']);
}
$actions .= '&nbsp;'.Display::url(get_lang('Delete'), api_get_self().'?a=delete_justification&justification_id='.$userJustification['id'], ['class' => 'btn btn-danger']);
@ -170,10 +170,8 @@ $headers = [
];
$justificationTab = Display::tabsOnlyLink($headers, 2);
$justification = $justificationTab.$formValidator->returnForm().$userJustificationList;
$tpl = new Template(get_lang('ModifyProfile'));
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'home');

@ -5,8 +5,6 @@
* Layout (principal view) used for structuring other views.
*
* @author Christian Fasanando <christian1827@gmail.com> - Beeznest
*
* @package chamilo.auth
*/
// Header

@ -12,8 +12,6 @@
* to generate a new one.
*
* @todo refactor, move relevant functions to code libraries
*
* @package chamilo.auth
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -22,7 +20,7 @@ require_once __DIR__.'/../inc/global.inc.php';
// already be some display output.
// Forbidden to retrieve the lost password
if (api_get_setting('allow_lostpassword') == 'false') {
if ('false' == api_get_setting('allow_lostpassword')) {
api_not_allowed(true);
}
@ -63,7 +61,7 @@ $form->addText(
);
$captcha = api_get_setting('allow_captcha');
$allowCaptcha = $captcha === 'true';
$allowCaptcha = 'true' === $captcha;
if ($allowCaptcha) {
$ajax = api_get_path(WEB_AJAX_PATH).'form.ajax.php?a=get_captcha';
@ -120,7 +118,7 @@ if ($form->validate()) {
$passwordEncryption = api_get_configuration_value('password_encryption');
if ($passwordEncryption === 'none') {
if ('none' === $passwordEncryption) {
$messageText = Login::send_password_to_user($user, true);
if (CustomPages::enabled() && CustomPages::exists(CustomPages::INDEX_UNLOGGED)) {
@ -138,7 +136,7 @@ if ($form->validate()) {
exit;
}
if ($user['auth_source'] == 'extldap') {
if ('extldap' == $user['auth_source']) {
Display::addFlash(
Display::return_message(get_lang('Could not reset password, contact your helpdesk.'), 'info', false)
);
@ -148,7 +146,7 @@ if ($form->validate()) {
$userResetPasswordSetting = api_get_setting('user_reset_password');
if ($userResetPasswordSetting === 'true') {
if ('true' === $userResetPasswordSetting) {
$userObj = api_get_user_entity($user['uid']);
Login::sendResetEmail($userObj);

@ -3,8 +3,6 @@
/**
* Reporting page on the user's own progress.
*
* @package chamilo.tracking
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -28,7 +26,7 @@ $(function() {
});
</script>";
$pluginCalendar = api_get_plugin_setting('learning_calendar', 'enabled') === 'true';
$pluginCalendar = 'true' === api_get_plugin_setting('learning_calendar', 'enabled');
if ($pluginCalendar) {
$plugin = LearningCalendarPlugin::create();
@ -55,7 +53,7 @@ if (!empty($courseUserList)) {
$courseId = $result['c_id'];
$courseInfo = api_get_course_info_by_id($courseId);
if ($count == 1) {
if (1 == $count) {
$first = '<a href="#'.$login.'">'.get_lang('First').'</a>';
}
if ($count == $last_item) {
@ -99,9 +97,9 @@ if (!empty($dates)) {
$content .= '</div></div>';
}
if (api_get_configuration_value('private_messages_about_user_visible_to_user') === true) {
if (true === api_get_configuration_value('private_messages_about_user_visible_to_user')) {
$allowMessages = api_get_configuration_value('private_messages_about_user');
if ($allowMessages === true) {
if (true === $allowMessages) {
// Messages
$content .= Display::page_subheader2(get_lang('Messages'));
$content .= MessageManager::getMessagesAboutUserToString(api_get_user_info());

@ -16,7 +16,7 @@ $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_MYPROFILE;
$allowSocialTool = api_get_setting('allow_social_tool') == 'true';
$allowSocialTool = 'true' == api_get_setting('allow_social_tool');
if ($allowSocialTool) {
$this_section = SECTION_SOCIAL;
}
@ -74,7 +74,7 @@ function show_image(image,width,height) {
</script>';
$jquery_ready_content = '';
if (api_get_setting('allow_message_tool') === 'true') {
if ('true' === api_get_setting('allow_message_tool')) {
$jquery_ready_content = <<<EOF
$(".message-content .message-delete").click(function(){
$(this).parents(".message-content").animate({ opacity: "hide" }, "slow");
@ -83,7 +83,7 @@ if (api_get_setting('allow_message_tool') === 'true') {
EOF;
}
$tool_name = api_get_setting('profile.is_editable') === 'true' ? get_lang('Edit Profile') : get_lang('View my e-portfolio');
$tool_name = 'true' === api_get_setting('profile.is_editable') ? get_lang('Edit Profile') : get_lang('View my e-portfolio');
$table_user = Database::get_main_table(TABLE_MAIN_USER);
/*
@ -103,8 +103,8 @@ $id_temp_key = UserManager::get_api_key_id(api_get_user_id(), 'dokeos');
$value_array = $array_list_key[$id_temp_key];
$user_data['api_key_generate'] = $value_array;
if ($user_data !== false) {
if (api_get_setting('login_is_email') == 'true') {
if (false !== $user_data) {
if ('true' == api_get_setting('login_is_email')) {
$user_data['username'] = $user_data['email'];
}
if (is_null($user_data['language'])) {
@ -146,7 +146,7 @@ $form->addElement(
'size' => USERNAME_MAX_LENGTH,
]
);
if (!in_array('login', $profileList) || api_get_setting('login_is_email') == 'true') {
if (!in_array('login', $profileList) || 'true' == api_get_setting('login_is_email')) {
$form->freeze('username');
}
$form->applyFilter('username', 'stripslashes');
@ -162,7 +162,7 @@ if (!in_array('officialcode', $profileList)) {
$form->applyFilter('official_code', 'stripslashes');
$form->applyFilter('official_code', 'trim');
$form->applyFilter('official_code', 'html_filter');
if (api_get_setting('registration', 'officialcode') === 'true' &&
if ('true' === api_get_setting('registration', 'officialcode') &&
in_array('officialcode', $profileList)
) {
$form->addRule('official_code', get_lang('Required field'), 'required');
@ -174,7 +174,7 @@ if (!in_array('email', $profileList)) {
$form->freeze('email');
}
if (api_get_setting('registration', 'email') == 'true' && in_array('email', $profileList)
if ('true' == api_get_setting('registration', 'email') && in_array('email', $profileList)
) {
$form->applyFilter('email', 'stripslashes');
$form->applyFilter('email', 'trim');
@ -192,11 +192,11 @@ $form->applyFilter('phone', 'trim');
$form->applyFilter('phone', 'html_filter');
// PICTURE
if (api_get_setting('profile.is_editable') === 'true' && in_array('picture', $profileList)) {
if ('true' === api_get_setting('profile.is_editable') && in_array('picture', $profileList)) {
$form->addFile(
'picture',
[
$user_data['picture_uri'] != '' ? get_lang('Update Image') : get_lang('Add image'),
'' != $user_data['picture_uri'] ? get_lang('Update Image') : get_lang('Add image'),
get_lang('Only PNG, JPG or GIF images allowed'),
],
[
@ -228,7 +228,7 @@ if (!in_array('language', $profileList)) {
}
// THEME
if (api_get_setting('profile.is_editable') === 'true' && api_get_setting('user_selected_theme') === 'true') {
if ('true' === api_get_setting('profile.is_editable') && 'true' === api_get_setting('user_selected_theme')) {
$form->addElement('SelectTheme', 'theme', get_lang('Graphical theme'));
if (!in_array('theme', $profileList)) {
$form->freeze('theme');
@ -237,7 +237,7 @@ if (api_get_setting('profile.is_editable') === 'true' && api_get_setting('user_s
}
// EXTENDED PROFILE this make the page very slow!
if (api_get_setting('extended_profile') === 'true') {
if ('true' === api_get_setting('extended_profile')) {
$width_extended_profile = 500;
// MY COMPETENCES
$form->addHtmlEditor(
@ -299,8 +299,8 @@ if (api_get_setting('extended_profile') === 'true') {
}
// PASSWORD, if auth_source is platform
if ($user_data['auth_source'] == PLATFORM_AUTH_SOURCE &&
api_get_setting('profile.is_editable') === 'true' &&
if (PLATFORM_AUTH_SOURCE == $user_data['auth_source'] &&
'true' === api_get_setting('profile.is_editable') &&
in_array('password', $profileList)
) {
$form->addElement('password', 'password0', [get_lang('Pass'), get_lang('Enter2passToChange')], ['size' => 40]);
@ -348,7 +348,7 @@ if (in_array('apikeys', $profileList)) {
);
}
// SUBMIT
if (api_get_setting('profile.is_editable') === 'true') {
if ('true' === api_get_setting('profile.is_editable')) {
$form->addButtonUpdate(get_lang('Save settings'), 'apply_change');
} else {
$form->freeze();
@ -414,8 +414,8 @@ if ($form->validate()) {
}
$allow_users_to_change_email_with_no_password = true;
if (isset($user_data['auth_source']) && $user_data['auth_source'] == PLATFORM_AUTH_SOURCE &&
api_get_setting('allow_users_to_change_email_with_no_password') === 'false'
if (isset($user_data['auth_source']) && PLATFORM_AUTH_SOURCE == $user_data['auth_source'] &&
'false' === api_get_setting('allow_users_to_change_email_with_no_password')
) {
$allow_users_to_change_email_with_no_password = false;
}
@ -573,9 +573,9 @@ if ($form->validate()) {
unset($user_data['api_key_generate']);
foreach ($user_data as $key => $value) {
if (substr($key, 0, 6) === 'extra_') { //an extra field
if ('extra_' === substr($key, 0, 6)) { //an extra field
continue;
} elseif (strpos($key, 'remove_extra_') !== false) {
} elseif (false !== strpos($key, 'remove_extra_')) {
} else {
if (in_array($key, $available_values_to_modify)) {
$sql .= " $key = '".Database::escape_string($value)."',";
@ -624,7 +624,7 @@ if ($form->validate()) {
Session::write('_locale_user', $user_data['language']);
}
if ($passwordWasChecked == false) {
if (false == $passwordWasChecked) {
Display::addFlash(
Display:: return_message(get_lang('Your new profile has been saved'), 'normal', false)
);
@ -666,8 +666,8 @@ if ($form->validate()) {
$actions = '';
if ($allowSocialTool) {
if (api_get_setting('extended_profile') === 'true') {
if (api_get_setting('allow_message_tool') === 'true') {
if ('true' === api_get_setting('extended_profile')) {
if ('true' === api_get_setting('allow_message_tool')) {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
Display::return_icon('shared_profile.png', get_lang('View shared profile')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
@ -675,7 +675,7 @@ if ($allowSocialTool) {
}
$show = isset($_GET['show']) ? '&amp;show='.Security::remove_XSS($_GET['show']) : '';
if (isset($_GET['type']) && $_GET['type'] === 'extended') {
if (isset($_GET['type']) && 'extended' === $_GET['type']) {
$actions .= '<a href="profile.php?type=reduced'.$show.'">'.
Display::return_icon('edit.png', get_lang('Edit normal profile'), '', 16).'</a>';
} else {
@ -685,7 +685,7 @@ if ($allowSocialTool) {
}
}
$show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') === 'true' ? true : false;
$show_delete_account_button = 'true' === api_get_setting('platform_unsubscribe_allowed') ? true : false;
$tpl = new Template(get_lang('Profile'));
@ -698,7 +698,7 @@ if ($actions) {
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
$allowJustification = api_get_plugin_setting('justification', 'tool_enable') === 'true';
$allowJustification = 'true' === api_get_plugin_setting('justification', 'tool_enable');
$justification = '';
if ($allowJustification) {
$plugin = Justification::create();

@ -194,7 +194,7 @@ switch ($action) {
Database::query($sql);
Display::addFlash(Display::return_message(get_lang('Update successful')));
if ($redirect === 'home') {
if ('home' === $redirect) {
$url = api_get_path(WEB_PATH).'user_portal.php';
header('Location: '.$url);
exit;
@ -211,7 +211,7 @@ Display::display_header();
$stok = Security::get_token();
$courses_without_category = isset($courses_in_category[0]) ? $courses_in_category[0] : null;
echo '<div id="actions" class="actions">';
if ($action != 'createcoursecategory') {
if ('createcoursecategory' != $action) {
echo '<a class="ajax" href="'.$currentUrl.'?action=createcoursecategory">';
echo Display::return_icon('new_folder.png', get_lang('Create a personal courses category'), '', '32');
echo '</a>';
@ -234,7 +234,7 @@ if (!empty($user_course_categories)) {
echo '<a name="category'.$row['id'].'"></a>';
$url = $currentUrl.'?categoryid='.$row['id'].'&sec_token='.$stok;
if ($allowCollapsable) {
if (isset($row['collapsed']) && $row['collapsed'] == 0) {
if (isset($row['collapsed']) && 0 == $row['collapsed']) {
echo Display::url(
'<i class="fa fa-folder-open"></i>',
$url.'&action=set_collapsable&option=1'
@ -306,13 +306,13 @@ if (!empty($user_course_categories)) {
echo CourseManager::getTeacherListFromCourseCodeToString($course['code']);
echo '<br />';
if (api_get_setting('display_teacher_in_courselist') === 'true') {
if ('true' === api_get_setting('display_teacher_in_courselist')) {
echo $course['tutor'];
}
echo '</td><td valign="top">'; ?>
<div style="float:left;width:110px;">
<?php
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
if ('true' == api_get_setting('show_courses_descriptions_in_catalog')) {
$icon_title = get_lang('Course description').' - '.$course['title']; ?>
<a href="<?php echo api_get_path(WEB_CODE_PATH); ?>inc/ajax/course_home.ajax.php?a=show_course_information&code=<?php echo $course['code']; ?>" data-title="<?php echo $icon_title; ?>" title="<?php echo $icon_title; ?>" class="ajax">
<?php
@ -347,8 +347,8 @@ if (!empty($user_course_categories)) {
</div>
<div style="float:left; margin-right:10px;">
<?php
if ($course['status'] != 1) {
if ($course['unsubscr'] == 1) {
if (1 != $course['status']) {
if (1 == $course['unsubscr']) {
?>
<form action="<?php echo api_get_self(); ?>" method="post" onsubmit="javascript: if (!confirm('<?php echo addslashes(api_htmlentities(get_lang("Are you sure you want to unsubscribe?"), ENT_QUOTES, api_get_system_encoding())); ?>')) return false">
@ -386,13 +386,13 @@ if (!empty($courses_without_category)) {
echo CourseManager::getTeacherListFromCourseCodeToString($course['code']);
echo '<br />';
if (api_get_setting('display_teacher_in_courselist') === 'true') {
if ('true' === api_get_setting('display_teacher_in_courselist')) {
echo $course['tutor'];
}
echo '</td><td valign="top">'; ?>
<div style="float:left; width:110px">
<?php
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
if ('true' == api_get_setting('show_courses_descriptions_in_catalog')) {
$icon_title = get_lang('Course description').' - '.$course['title']; ?>
<a href="<?php echo api_get_path(WEB_CODE_PATH); ?>inc/ajax/course_home.ajax.php?a=show_course_information&code=<?php echo $course['code']; ?>" data-title="<?php echo $icon_title; ?>" title="<?php echo $icon_title; ?>" class="ajax">
<?php echo Display::return_icon('info.png', $icon_title, '', '22'); ?>
@ -430,8 +430,8 @@ if (!empty($courses_without_category)) {
</div>
<div style="float:left; margin-right:10px;">
<?php
if ($course['status'] != 1) {
if ($course['unsubscr'] == 1) {
if (1 != $course['status']) {
if (1 == $course['unsubscr']) {
?>
<!-- changed link to submit to avoid action by the search tool indexer -->
<form action="<?php echo api_get_self(); ?>" method="post" onsubmit="javascript: if (!confirm('<?php echo addslashes(api_htmlentities(get_lang("Are you sure you want to unsubscribe?"), ENT_QUOTES, api_get_system_encoding())); ?>')) return false;">

@ -3,7 +3,7 @@
require_once __DIR__.'/../inc/global.inc.php';
if (api_get_setting('platform_unsubscribe_allowed') != 'true') {
if ('true' != api_get_setting('platform_unsubscribe_allowed')) {
api_not_allowed();
}

@ -5,8 +5,6 @@
* Show information about a new assertion.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.badge
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -15,7 +13,7 @@ $skillId = isset($_GET['skill']) ? (int) $_GET['skill'] : 0;
$courseId = isset($_GET['course']) ? (int) $_GET['course'] : 0;
$sessionId = isset($_GET['session']) ? (int) $_GET['session'] : 0;
if ($userId === 0 || $skillId === 0) {
if (0 === $userId || 0 === $skillId) {
exit;
}
@ -32,7 +30,7 @@ $userSkill = $objSkillRelUser->getByUserAndSkill(
$sessionId
);
if ($userSkill == false) {
if (false == $userSkill) {
exit;
}

@ -120,7 +120,7 @@ if (!$profile) {
break;
}
if (!$profile && $parent['parent_id'] == 0) {
if (!$profile && 0 == $parent['parent_id']) {
$profile = $skillLevelRepo->findAll();
$profile = isset($profile[0]) ? $profile[0] : false;
}
@ -227,7 +227,7 @@ $form->addHidden('user', $user->getId());
$form->addHidden('id', $skillId);
$form->addRule('skill', get_lang('Required field'), 'required');
$showLevels = api_get_configuration_value('hide_skill_levels') === false;
$showLevels = false === api_get_configuration_value('hide_skill_levels');
if ($showLevels) {
$form->addSelect('acquired_level', get_lang('Level acquired'), $acquiredLevel);
@ -364,7 +364,7 @@ if (api_is_drh()) {
'url' => api_get_path(WEB_CODE_PATH).'mySpace/index.php',
"name" => get_lang('Reporting'),
];
if ($user->getStatus() == COURSEMANAGER) {
if (COURSEMANAGER == $user->getStatus()) {
$interbreadcrumb[] = [
"url" => api_get_path(WEB_CODE_PATH).'mySpace/teachers.php',
'name' => get_lang('Trainers'),

@ -5,8 +5,6 @@
* Show information about the OpenBadge class.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.badge
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -5,8 +5,6 @@
* Show information about OpenBadge criteria.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.badge
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -10,8 +10,6 @@ use SkillRelUser as SkillRelUserManager;
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @author José Loguercio Silva <jose.loguercio@beeznest.com>
*
* @package chamilo.badge
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -55,7 +53,7 @@ if (!Skill::isToolAvailable()) {
api_not_allowed(true);
}
$showLevels = api_get_configuration_value('hide_skill_levels') === false;
$showLevels = false === api_get_configuration_value('hide_skill_levels');
$skillInfo = [
'id' => $skill->getId(),
@ -145,7 +143,7 @@ if (!$profile) {
break;
}
if (!$profile && $parent['parent_id'] == 0) {
if (!$profile && 0 == $parent['parent_id']) {
$profile = $skillLevelRepo->findAll();
if ($profile) {
$profile = $profile[0];
@ -233,7 +231,7 @@ if ($allowExport) {
$backpack = 'https://backpack.openbadges.org/';
$configBackpack = api_get_setting('openbadges_backpack');
if (strcmp($backpack, $configBackpack) !== 0) {
if (0 !== strcmp($backpack, $configBackpack)) {
$backpack = $configBackpack;
}

@ -9,8 +9,6 @@ use SkillRelUser as SkillRelUserManager;
* Show information about all issued badges with same skill by user.
*
* @author José Loguercio Silva <jose.loguercio@beeznest.com>
*
* @package chamilo.badge
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -130,7 +128,7 @@ foreach ($userSkills as $index => $skillIssue) {
break;
}
if (!$profile && $parent['parent_id'] == 0) {
if (!$profile && 0 == $parent['parent_id']) {
$profile = $skillLevelRepo->findAll();
$profile = !empty($profile) ? $profile[0] : [];
}
@ -220,7 +218,7 @@ foreach ($userSkills as $index => $skillIssue) {
$backpack = 'https://backpack.openbadges.org/';
$configBackpack = api_get_setting('openbadges_backpack');
if (strcmp($backpack, $configBackpack) !== 0) {
if (0 !== strcmp($backpack, $configBackpack)) {
$backpack = $configBackpack;
}
@ -275,7 +273,7 @@ foreach ($userSkills as $index => $skillIssue) {
$template = new Template(get_lang('Issued badge information'));
$template->assign('user_badges', $allUserBadges);
$template->assign('show_level', api_get_configuration_value('hide_skill_levels') == false);
$template->assign('show_level', false == api_get_configuration_value('hide_skill_levels'));
$content = $template->fetch(
$template->get_template('skill/issued_all.tpl')

@ -5,8 +5,6 @@
* Show information about the OpenBadge issuer.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.badge
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -135,15 +135,15 @@ if (!empty($_GET['unregister'])) {
Blog::unsubscribeUser($_GET['blog_id'], $_GET['user_id']);
}
if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
if (isset($_GET['do']) && $_GET['do'] == 'delete') {
if (isset($_GET['action']) && 'manage_tasks' == $_GET['action']) {
if (isset($_GET['do']) && 'delete' == $_GET['do']) {
Blog::deleteTask($blog_id, (int) $_GET['task_id']);
Display::addFlash(
Display::return_message(get_lang('The task has been deleted.'), 'success')
);
}
if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') {
if (isset($_GET['do']) && 'delete_assignment' == $_GET['do']) {
Blog::deleteAssignedTask($blog_id, intval($_GET['task_id']), intval($_GET['user_id']));
Display::addFlash(
Display::return_message(get_lang('The task assignment has been deleted.'), 'success')
@ -151,10 +151,10 @@ if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
}
}
if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
if (isset($_GET['action']) && 'view_post' == $_GET['action']) {
$task_id = (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') {
if (isset($_GET['do']) && 'delete_comment' == $_GET['do']) {
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) {
Blog::deleteComment($blog_id, (int) $_GET['post_id'], (int) $_GET['comment_id']);
Display::addFlash(
@ -167,7 +167,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
}
}
if (isset($_GET['do']) && $_GET['do'] == 'delete_article') {
if (isset($_GET['do']) && 'delete_article' == $_GET['do']) {
if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) {
Blog::deletePost($blog_id, (int) $_GET['article_id']);
$action = ''; // Article is gone, go to blog home
@ -180,8 +180,8 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
);
}
}
if (isset($_GET['do']) && $_GET['do'] == 'rate') {
if (isset($_GET['type']) && $_GET['type'] == 'post') {
if (isset($_GET['do']) && 'rate' == $_GET['do']) {
if (isset($_GET['type']) && 'post' == $_GET['type']) {
if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) {
Blog::addRating('post', $blog_id, (int) $_GET['post_id'], (int) $_GET['rating']);
Display::addFlash(
@ -189,7 +189,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
);
}
}
if (isset($_GET['type']) && $_GET['type'] == 'comment') {
if (isset($_GET['type']) && 'comment' == $_GET['type']) {
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
Blog::addRating('comment', $blog_id, (int) $_GET['comment_id'], (int) $_GET['rating']);
Display::addFlash(
@ -269,7 +269,7 @@ $calendarBlog = Blog::displayMiniMonthCalendar($month, $year, $blog_id);
//task blogs
$taskBlog = Blog::getPersonalTasksList();
if (isset($flag) && $flag == '1') {
if (isset($flag) && '1' == $flag) {
$action = "manage_tasks";
Blog::displayTaskAssignmentForm($blog_id);
}
@ -295,7 +295,7 @@ if (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) {
$result = Database::query($sql);
$row = Database::fetch_array($result);
if ($row['number'] == 1) {
if (1 == $row['number']) {
$user_task = true;
}
}
@ -368,19 +368,19 @@ switch ($action) {
case 'manage_tasks':
if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) {
$task = null;
if (isset($_GET['do']) && $_GET['do'] == 'add') {
if (isset($_GET['do']) && 'add' == $_GET['do']) {
$task .= Blog::displayTaskCreateForm($blog_id);
}
if (isset($_GET['do']) && $_GET['do'] == 'assign') {
if (isset($_GET['do']) && 'assign' == $_GET['do']) {
$task .= Blog::displayTaskAssignmentForm($blog_id);
}
if (isset($_GET['do']) && $_GET['do'] == 'edit') {
if (isset($_GET['do']) && 'edit' == $_GET['do']) {
$task .= Blog::displayTaskEditForm(
$blog_id,
intval($_GET['task_id'])
);
}
if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') {
if (isset($_GET['do']) && 'edit_assignment' == $_GET['do']) {
$task .= Blog::displayAssignedTaskEditForm(
$blog_id,
intval($_GET['task_id']),

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save