Minor - format code merge from 1.11x

ofaj
Julio Montoya 6 years ago
parent fc98c65e31
commit 8e54b2342c
  1. 5
      main/admin/course_list.php
  2. 4
      main/admin/user_add.php
  3. 2
      main/admin/user_information.php
  4. 8
      main/admin/user_list.php
  5. 1
      main/chat/chat.php
  6. 2
      main/course_home/course_home.php
  7. 1
      main/course_info/about.php
  8. 9
      main/forum/viewthread.php
  9. 4
      main/gradebook/lib/be/exerciselink.class.php
  10. 1
      main/group/group.php
  11. 3
      main/group/member_settings.php
  12. 5
      main/inc/ajax/session.ajax.php
  13. 2
      main/inc/global-min.inc.php
  14. 17
      main/inc/lib/api.lib.php
  15. 127
      main/inc/lib/sessionmanager.lib.php
  16. 5
      main/inc/lib/template.lib.php
  17. 5
      main/inc/lib/userportal.lib.php
  18. 3
      main/session/about.php
  19. 3
      main/session/resume_session.php
  20. 1
      main/tracking/messages.php

@ -1,18 +1,15 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script shows a list of courses and allows searching for courses codes
* and names.
*
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : null;
/**

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

@ -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';

@ -46,7 +46,6 @@ if (isset($_GET['user_id']) && $action === 'login_as') {
}
api_protect_admin_script(true);
trimVariables();
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=get_user_courses';
@ -272,13 +271,6 @@ function prepare_user_sql_query($getCount)
$keywordListValues = [];
}
/*
// This block is never executed because $keyword_extra_data never exists
if (isset($keyword_extra_data) && !empty($keyword_extra_data)) {
$extra_info = UserManager::get_extra_field_information_by_name($keyword_extra_data);
$field_id = $extra_info['id'];
$sql.= " INNER JOIN user_field_values ufv ON u.id=ufv.user_id AND ufv.field_id=$field_id ";
} */
if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
$keywordFiltered = Database::escape_string("%".$_GET['keyword']."%");
$sql .= " WHERE (

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
define('CHAMILO_LOAD_WYSIWYG', false);

@ -144,7 +144,7 @@ if ($isSpecialCourse) {
$action = !empty($_GET['action']) ? Security::remove_XSS($_GET['action']) : '';
if ($action == 'subscribe') {
if ($action === 'subscribe') {
if (Security::check_token('get')) {
Security::clear_token();
$result = CourseManager::autoSubscribeToCourse($course_code);

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CForumPost;
@ -29,15 +30,7 @@ $my_search = null;
$forumId = isset($_GET['forum']) ? (int) $_GET['forum'] : 0;
$threadId = isset($_GET['thread']) ? (int) $_GET['thread'] : 0;
/* MAIN DISPLAY SECTION */
/* Retrieving forum and forum category information */
// We are getting all the information about the current forum and forum category.
// Note pcool: I tried to use only one sql statement (and function) for this,
// but the problem is that the visibility of the forum AND forum category are stored in the item_property table.
// Note: This has to be validated that it is an existing thread
$current_thread = get_thread_information($forumId, $threadId);
// Note: This has to be validated that it is an existing forum.
$current_forum = get_forum_information($current_thread['forum_id']);
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
$whatsnew_post_info = isset($_SESSION['whatsnew_post_info']) ? $_SESSION['whatsnew_post_info'] : null;

@ -204,10 +204,6 @@ class ExerciseLink extends AbstractLink
break;
case 'ranking':
return [null, null];
/*
$newList = [];
$ranking = AbstractLink::getCurrentUserRanking($stud_id, $link->getUserScoreList());
return $ranking;*/
break;
default:
if (!empty($stud_id)) {

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -8,8 +9,6 @@
* @author various contributors
* @author Roan Embrechts (VUB), partial code cleanup, initial virtual course support
*
* @package chamilo.group
*
* @todo course admin functionality to create groups based on who is in which course (or class).
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\UserBundle\Entity\User;
@ -266,9 +267,7 @@ switch ($action) {
if ('get_basic_course_documents_list' === $action) {
$courseInfo = api_get_course_info_by_id($course->getId());
$exists = DocumentManager::folderExists('/basic-course-documents', $courseInfo, $session->getId(), 0);
if (!$exists) {
$courseDir = $courseInfo['directory'].'/document';
$sysCoursePath = api_get_path(SYS_COURSE_PATH);
@ -290,7 +289,6 @@ switch ($action) {
} else {
$id = DocumentManager::get_document_id($courseInfo, $folderName, $session->getId());
}
$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/document';
$documentAndFolders = DocumentManager::getAllDocumentData(
@ -302,6 +300,7 @@ switch ($action) {
false,
$session->getId()
);
$documentAndFolders = array_filter(
$documentAndFolders,
function (array $documentData) {

@ -55,6 +55,8 @@ $libraryPath = __DIR__.'/lib/';
// @todo convert this libs in classes
require_once $libraryPath.'database.constants.inc.php';
require_once $libraryPath.'text.lib.php';
require_once $libraryPath.'array.lib.php';
require_once $libraryPath.'online.inc.php';
require_once $libraryPath.'banner.lib.php';
// Doctrine ORM configuration

@ -191,6 +191,8 @@ define('LOG_GROUP_PORTAL_USER_UPDATE_ROLE', 'soc_gr_update_role');
define('LOG_USER_DELETE', 'user_deleted');
define('LOG_USER_CREATE', 'user_created');
define('LOG_USER_UPDATE', 'user_updated');
define('LOG_USER_PASSWORD_UPDATE', 'user_password_updated');
define('LOG_USER_ENABLE', 'user_enable');
define('LOG_USER_DISABLE', 'user_disable');
define('LOG_USER_ANONYMIZE', 'user_anonymized');
@ -212,6 +214,7 @@ define('LOG_PLATFORM_LANGUAGE_CHANGE', 'platform_lng_changed'); //changed in 1.9
define('LOG_SUBSCRIBE_USER_TO_COURSE', 'user_subscribed');
define('LOG_UNSUBSCRIBE_USER_FROM_COURSE', 'user_unsubscribed');
define('LOG_ATTEMPTED_FORCED_LOGIN', 'attempted_forced_login');
define('LOG_PLUGIN_CHANGE', 'plugin_changed');
define('LOG_HOMEPAGE_CHANGED', 'homepage_changed');
@ -252,6 +255,9 @@ define('LOG_SESSION_CATEGORY_ID', 'session_category_id');
define('LOG_CONFIGURATION_SETTINGS_CATEGORY', 'settings_category');
define('LOG_CONFIGURATION_SETTINGS_VARIABLE', 'settings_variable');
define('LOG_PLATFORM_LANGUAGE', 'default_platform_language');
define('LOG_PLUGIN_UPLOAD', 'plugin_upload');
define('LOG_PLUGIN_ENABLE', 'plugin_enable');
define('LOG_PLUGIN_SETTINGS_CHANGE', 'plugin_settings_change');
define('LOG_CAREER_ID', 'career_id');
define('LOG_PROMOTION_ID', 'promotion_id');
define('LOG_GRADEBOOK_LOCKED', 'gradebook_locked');
@ -1373,9 +1379,8 @@ function api_get_navigator()
if (strpos($version, '.') === false) {
$version = number_format(doubleval($version), 1);
}
$return = ['name' => $navigator, 'version' => $version];
return $return;
return ['name' => $navigator, 'version' => $version];
}
/**
@ -2850,9 +2855,8 @@ function api_get_plugin_setting($plugin, $variable)
function api_get_settings_params($params)
{
$table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$result = Database::select('*', $table, ['where' => $params]);
return $result;
return Database::select('*', $table, ['where' => $params]);
}
/**
@ -2863,9 +2867,8 @@ function api_get_settings_params($params)
function api_get_settings_params_simple($params)
{
$table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$result = Database::select('*', $table, ['where' => $params], 'one');
return $result;
return Database::select('*', $table, ['where' => $params], 'one');
}
/**
@ -3571,6 +3574,8 @@ function api_is_allowed_to_session_edit($tutor = false, $coach = false)
}
}
}
return false;
}
/**

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;
@ -514,6 +515,7 @@ class SessionManager
$extraFieldModel = new ExtraFieldModel('session');
$conditions = $extraFieldModel->parseConditions($options);
$sqlInjectJoins = $conditions['inject_joins'];
$where .= $conditions['where'];
$sqlInjectWhere = $conditions['inject_where'];
@ -529,7 +531,7 @@ class SessionManager
} else {
if (!empty($columns['column_model'])) {
foreach ($columns['column_model'] as $column) {
if ($column['name'] == 'users') {
if ($column['name'] === 'users') {
$showCountUsers = true;
}
}
@ -967,7 +969,6 @@ class SessionManager
}
$formattedSessions = [];
$categories = self::get_all_session_category();
$orderedCategories = [];
if (!empty($categories)) {
@ -978,14 +979,15 @@ class SessionManager
$activeIcon = Display::return_icon('accept.png', get_lang('Active'));
$inactiveIcon = Display::return_icon('error.png', get_lang('Inactive'));
$webPath = api_get_path(WEB_PATH);
foreach ($sessions as $session) {
if ($showCountUsers) {
$session['users'] = self::get_users_by_session($session['id'], 0, true);
}
$url = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session['id'];
$url = $webPath.'main/session/resume_session.php?id_session='.$session['id'];
if ($extraFieldsToLoad || api_is_drh()) {
$url = api_get_path(WEB_PATH).'session/'.$session['id'].'/about/';
$url = $webPath.'session/'.$session['id'].'/about/';
}
$session['name'] = Display::url($session['name'], $url);
@ -1008,7 +1010,6 @@ class SessionManager
$session[$field['variable']] = $fieldDataToString;
}
}
if (isset($session['session_active']) && $session['session_active'] == 1) {
$session['session_active'] = $activeIcon;
} else {
@ -1672,7 +1673,6 @@ class SessionManager
$date_to = '',
$options
) {
//escaping variables
$sessionId = intval($sessionId);
$courseId = intval($courseId);
$studentId = intval($studentId);
@ -4252,14 +4252,14 @@ class SessionManager
$row['access_end_date'] = null;
}
if ($row['coach_access_start_date'] == '0000-00-00 00:00:00' ||
$row['coach_access_start_date'] == '0000-00-00'
if ($row['coach_access_start_date'] === '0000-00-00 00:00:00' ||
$row['coach_access_start_date'] === '0000-00-00'
) {
$row['coach_access_start_date'] = null;
}
if ($row['coach_access_end_date'] == '0000-00-00 00:00:00' ||
$row['coach_access_end_date'] == '0000-00-00'
if ($row['coach_access_end_date'] === '0000-00-00 00:00:00' ||
$row['coach_access_end_date'] === '0000-00-00'
) {
$row['coach_access_end_date'] = null;
}
@ -7913,7 +7913,7 @@ SQL;
/**
* @param int $sessionId
* @param array $extraFieldsToInclude
* @param array $extraFieldsToInclude (empty means all)
*
* @return array
*/
@ -7982,7 +7982,7 @@ SQL;
*/
public static function isValidId($sessionId)
{
$sessionId = intval($sessionId);
$sessionId = (int) $sessionId;
if ($sessionId > 0) {
$rows = Database::select(
'id',
@ -8882,7 +8882,7 @@ SQL;
}
if (isset($params['access_start_date'])) {
$params[''] = api_format_date($params['access_start_date'], DATE_TIME_FORMAT_SHORT);
$params['access_start_date'] = api_format_date($params['access_start_date'], DATE_TIME_FORMAT_SHORT);
}
if (isset($params['access_end_date'])) {
@ -9677,6 +9677,85 @@ SQL;
return $result;
}
public static function getStatusList()
{
return [
self::STATUS_PLANNED => get_lang('Planned'),
self::STATUS_PROGRESS => get_lang('InProgress'),
self::STATUS_FINISHED => get_lang('Finished'),
self::STATUS_CANCELLED => get_lang('Cancelled'),
];
}
public static function getStatusLabel($status)
{
$list = self::getStatusList();
if (!isset($list[$status])) {
return get_lang('NoStatus');
}
return $list[$status];
}
public static function getDefaultSessionTab()
{
$default = 'all';
$view = api_get_configuration_value('default_session_list_view');
if (!empty($view)) {
$default = $view;
}
return $default;
}
/**
* @return array
*/
public static function getSessionListTabs($listType)
{
$tabs = [
[
'content' => get_lang('AllSessionsShort'),
'url' => api_get_path(WEB_CODE_PATH).'session/session_list.php?list_type=all',
],
[
'content' => get_lang('ActiveSessionsShort'),
'url' => api_get_path(WEB_CODE_PATH).'session/session_list.php?list_type=active',
],
[
'content' => get_lang('ClosedSessionsShort'),
'url' => api_get_path(WEB_CODE_PATH).'session/session_list.php?list_type=close',
],
[
'content' => get_lang('SessionListCustom'),
'url' => api_get_path(WEB_CODE_PATH).'session/session_list.php?list_type=custom',
],
/*[
'content' => get_lang('Complete'),
'url' => api_get_path(WEB_CODE_PATH).'session/session_list_simple.php?list_type=complete',
],*/
];
switch ($listType) {
case 'all':
$default = 1;
break;
case 'active':
$default = 2;
break;
case 'close':
$default = 3;
break;
case 'custom':
$default = 4;
break;
}
return Display::tabsOnlyLink($tabs, $default);
}
/**
* @param int $id
*
@ -9814,26 +9893,4 @@ SQL;
return -1;
}
}
public static function getStatusList()
{
return [
self::STATUS_PLANNED => get_lang('Planned'),
self::STATUS_PROGRESS => get_lang('InProgress'),
self::STATUS_FINISHED => get_lang('Finished'),
self::STATUS_CANCELLED => get_lang('Cancelled'),
];
}
public static function getStatusLabel($status)
{
$list = self::getStatusList();
if (!isset($list[$status])) {
return get_lang('NoStatus');
}
return $list[$status];
}
}

@ -94,7 +94,6 @@ class Template
];
$urlId = api_get_current_access_url_id();
$cache_folder = api_get_path(SYS_ARCHIVE_PATH).'twig/'.$urlId.'/';
if (!is_dir($cache_folder)) {
@ -182,6 +181,10 @@ class Template
'name' => 'date_to_time_ago',
'callable' => 'Display::dateToStringAgoAndLongDate',
],
[
'name' => 'remove_xss',
'callable' => 'Security::remove_XSS',
],
];
foreach ($filters as $filter) {

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -109,11 +110,11 @@ class IndexManager
{
$hideAnnouncements = api_get_setting('hide_global_announcements_when_not_connected');
$currentUserId = api_get_user_id();
if ($hideAnnouncements == 'true' && empty($currentUserId)) {
if ($hideAnnouncements === 'true' && empty($currentUserId)) {
return null;
}
$announcement = isset($_GET['announcement']) ? $_GET['announcement'] : null;
$announcement = intval($announcement);
$announcement = (int) $announcement;
if (!api_is_anonymous() && $this->user_id) {
$visibility = SystemAnnouncementManager::getCurrentUserVisibility();

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;
@ -14,8 +15,6 @@ use Chamilo\UserBundle\Entity\User;
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @author Julio Montoya
*
* @package chamilo.session
*/
$cidReset = true;

@ -12,7 +12,6 @@ use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
/**
* @author Bart Mollet, Julio Montoya lot of fixes
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -49,7 +48,6 @@ $table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER
$em = Database::getManager();
$sessionInfo = api_get_session_info($sessionId);
/** @var SessionRepository $sessionRepository */
$sessionRepository = $em->getRepository('ChamiloCoreBundle:Session');
/** @var Session $session */
@ -178,6 +176,7 @@ if ($session->getNbrCourses() === 0) {
$course,
$session
);
// Get coachs of the courses in session
$namesOfCoaches = [];
$coachSubscriptions = $session->getUserCourseSubscriptionsByStatus($course, Session::COACH)

@ -17,6 +17,7 @@ if (!$allowUser) {
$fromUserId = isset($_GET['from_user']) ? (int) $_GET['from_user'] : 0;
$toUserId = isset($_GET['to_user']) ? (int) $_GET['to_user'] : 0;
if (empty($fromUserId) || empty($toUserId)) {
api_not_allowed(true);
}

Loading…
Cancel
Save