Remove legacy/unused code

pull/3924/head
Julio Montoya 4 years ago
parent 831a38d765
commit 4e6228dfc6
  1. 4
      psalm.xml
  2. 2
      public/main/chat/chat.php
  3. 60
      public/main/inc/lib/api.lib.php
  4. 108
      public/main/inc/lib/social.lib.php
  5. 54
      public/main/inc/lib/template.lib.php
  6. 11
      public/main/inc/lib/userportal.lib.php
  7. 5
      src/CoreBundle/ToolChain.php

@ -15,7 +15,6 @@
<directory name="public/main/attendance"/>
<directory name="public/main/auth"/>
<!-- <directory name="public/main/badge"/>-->
<directory name="public/main/blog"/>
<directory name="public/main/calendar"/>
<!-- <directory name="public/main/chat"/>-->
<directory name="public/main/course_description"/>
@ -53,7 +52,6 @@
<!-- <directory name="public/main/upload" />-->
<directory name="public/main/user" />
<!-- <directory name="public/main/webservices" />-->
<!-- <directory name="public/main/wiki" />-->
<directory name="public/main/work" />
<file name="public/main/inc/lib/access_url_edit_courses_to_url_functions.lib.php"/>
@ -68,7 +66,6 @@
<file name="public/main/inc/lib/attendance.lib.php"/>
<file name="public/main/inc/lib/auth.lib.php"/>
<!-- <file name="public/main/inc/lib/baker.lib.php"/>-->
<!-- <file name="public/main/inc/lib/blog.lib.php"/>-->
<file name="public/main/inc/lib/career.lib.php"/>
<file name="public/main/inc/lib/certificate.lib.php"/>
<file name="public/main/inc/lib/course.lib.php"/>
@ -154,7 +151,6 @@
<directory name="src/CourseBundle/Component/CourseCopy"/>
<directory name="src/LtiBundle"/>
<directory name="public/main/inc/lib/javascript" />
<directory name="public/main/inc/lib/kses-0.2.2" />
<directory name="public/main/inc/lib/mimetex" />

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
define('CHAMILO_LOAD_WYSIWYG', false);
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(true);

@ -143,7 +143,7 @@ define('TOOL_COURSE_RIGHTS_OVERVIEW', 'course_rights');
define('TOOL_UPLOAD', 'file_upload');
define('TOOL_COURSE_MAINTENANCE', 'course_maintenance');
define('TOOL_SURVEY', 'survey');
define('TOOL_WIKI', 'wiki');
//define('TOOL_WIKI', 'wiki');
define('TOOL_GLOSSARY', 'glossary');
define('TOOL_GRADEBOOK', 'gradebook');
define('TOOL_NOTEBOOK', 'notebook');
@ -224,7 +224,7 @@ define('LOG_PROMOTION_DELETE', 'promotion_deleted');
define('LOG_CAREER_CREATE', 'career_created');
define('LOG_CAREER_DELETE', 'career_deleted');
define('LOG_USER_PERSONAL_DOC_DELETED', 'user_doc_deleted');
define('LOG_WIKI_ACCESS', 'wiki_page_view');
//define('LOG_WIKI_ACCESS', 'wiki_page_view');
// All results from an exercise
define('LOG_EXERCISE_RESULT_DELETE', 'exe_result_deleted');
// Logs only the one attempt
@ -262,7 +262,7 @@ define('LOG_PROMOTION_ID', 'promotion_id');
define('LOG_GRADEBOOK_LOCKED', 'gradebook_locked');
define('LOG_GRADEBOOK_UNLOCKED', 'gradebook_unlocked');
define('LOG_GRADEBOOK_ID', 'gradebook_id');
define('LOG_WIKI_PAGE_ID', 'wiki_page_id');
//define('LOG_WIKI_PAGE_ID', 'wiki_page_id');
define('LOG_EXERCISE_ID', 'exercise_id');
define('LOG_EXERCISE_AND_USER_ID', 'exercise_and_user_id');
define('LOG_LP_ID', 'lp_id');
@ -557,11 +557,6 @@ define('TF', 1);
define('MCMA', 2);
define('FIB', 3);
// Skills
define('SKILL_TYPE_REQUIREMENT', 'required');
define('SKILL_TYPE_ACQUIRED', 'acquired');
define('SKILL_TYPE_BOTH', 'both');
// Message
define('MESSAGE_STATUS_NEW', 0);
define('MESSAGE_STATUS_UNREAD', 1);
@ -644,7 +639,7 @@ define('RESOURCE_SCORM', 'Scorm');
define('RESOURCE_SURVEY', 'survey');
define('RESOURCE_SURVEYQUESTION', 'survey_question');
define('RESOURCE_SURVEYINVITATION', 'survey_invitation');
define('RESOURCE_WIKI', 'wiki');
//define('RESOURCE_WIKI', 'wiki');
define('RESOURCE_THEMATIC', 'thematic');
define('RESOURCE_ATTENDANCE', 'attendance');
define('RESOURCE_WORK', 'work');
@ -655,17 +650,6 @@ define('ADD_THEMATIC_PLAN', 6);
// Max online users to show per page (whoisonline)
define('MAX_ONLINE_USERS', 12);
// Number of characters maximum to show in preview of course blog posts
define('BLOG_MAX_PREVIEW_CHARS', 800);
// HTML string to replace with a 'Read more...' link
define('BLOG_PAGE_BREAK', '<div style="page-break-after: always"><span style="display: none;">&nbsp;</span></div>');
// Make sure the CHAMILO_LOAD_WYSIWYG constant is defined
// To remove CKeditor libs from HTML, set this constant to true before loading
if (!defined('CHAMILO_LOAD_WYSIWYG')) {
define('CHAMILO_LOAD_WYSIWYG', true);
}
define('TOOL_AUTHORING', 'toolauthoring');
define('TOOL_INTERACTION', 'toolinteraction');
define('TOOL_COURSE_PLUGIN', 'toolcourseplugin'); //all plugins that can be enabled in courses
@ -691,14 +675,8 @@ define('XAPIAN_PREFIX_COURSEID', 'C');
define('XAPIAN_PREFIX_TOOLID', 'O');
/**
* Returns a path to a certain resource within the Chamilo area, specifyed through a parameter.
* Also, this function provides conversion between path types, in this case the input path points inside the Chamilo area too.
*
* See $_configuration['course_folder'] in the configuration.php to alter the WEB_COURSE_PATH and SYS_COURSE_PATH parameters.
*
* @param string $path (optional) A path which type is to be converted. Also, it may be a defined constant for a path.
* This parameter has meaning when $type parameter has one of the following values: TO_WEB, TO_SYS, TO_REL. Otherwise it is ignored.
* Returns a path to a certain resource within Chamilo.
* @param string $path A path which type is to be converted. Also, it may be a defined constant for a path.
*
* @return string the requested path or the converted path
*
@ -712,9 +690,6 @@ define('XAPIAN_PREFIX_TOOLID', 'O');
* It has not been identified as needed yet.
* 4. Also, resolving the meta-symbols "." and ".." within paths has not been implemented, it is to be identified as needed.
*
* For examples go to: *
* See main/admin/system_status.php?section=paths
*
* Vchamilo changes : allow using an alternate configuration
* to get vchamilo instance paths
*/
@ -895,9 +870,6 @@ function api_valid_email($address)
return filter_var($address, FILTER_VALIDATE_EMAIL);
}
/* PROTECTION FUNCTIONS
Use these functions to protect your scripts. */
/**
* Function used to protect a course script.
* The function blocks access when
@ -1126,13 +1098,6 @@ function api_block_inactive_user()
$msg .= '<p class="text-center">
<a class="btn btn-default" href="'.$homeUrl.'">'.get_lang('BackHome').'</a></p>';
if (api_is_anonymous()) {
/*$form = api_get_not_allowed_login_form();
$msg .= '<div class="well">';
$msg .= $form->returnForm();
$msg .= '</div>';*/
}
$tpl->assign('content', $msg);
$tpl->display_one_col_template();
exit;
@ -1250,14 +1215,6 @@ function api_get_navigator()
return ['name' => $navigator, 'version' => $version];
}
/**
* @return true if user self registration is allowed, false otherwise
*/
function api_is_self_registration_allowed()
{
return isset($GLOBALS['allowSelfReg']) ? $GLOBALS['allowSelfReg'] : false;
}
/**
* This function returns the id of the user which is stored in the $_user array.
*
@ -1364,7 +1321,7 @@ function _api_format_user($user, $add_password = false, $loadAvatars = true)
}
foreach ($attributes as $attribute) {
$result[$attribute] = isset($user[$attribute]) ? $user[$attribute] : null;
$result[$attribute] = $user[$attribute] ?? null;
}
$user_id = (int) $user['id'];
@ -2231,7 +2188,6 @@ function api_format_course_array(Course $course = null)
$courseData['legal'] = $course->getLegal();
$courseData['show_score'] = $course->getShowScore(); //used in the work tool
//$coursePath = api_get_path(WEB_COURSE_PATH);
$coursePath = '/course/';
$webCourseHome = $coursePath.$courseData['real_id'].'/home';
@ -5421,7 +5377,7 @@ function api_get_tools_lists($my_tool = null)
TOOL_UPLOAD,
TOOL_COURSE_MAINTENANCE,
TOOL_SURVEY,
TOOL_WIKI,
//TOOL_WIKI,
TOOL_GLOSSARY,
TOOL_GRADEBOOK,
TOOL_NOTEBOOK,

@ -1245,8 +1245,9 @@ class SocialManager extends UserManager
$userPicture = $user_info['avatar'];
$officialCode = '';
if ('true' == api_get_setting('show_official_code_whoisonline')) {
$officialCode .= '<div class="items-user-official-code"><p style="min-height: 30px;" title="'.get_lang('Code').'">'.$user_info['official_code'].'</p></div>';
if ('true' === api_get_setting('show_official_code_whoisonline')) {
$officialCode .= '<div class="items-user-official-code">
<p style="min-height: 30px;" title="'.get_lang('Code').'">'.$user_info['official_code'].'</p></div>';
}
if (true === $hide) {
@ -1285,109 +1286,6 @@ class SocialManager extends UserManager
return $html;
}
/**
* Displays the information of an individual user.
*
* @param int $user_id
*
* @return string
*/
public static function display_individual_user($user_id)
{
global $interbreadcrumb;
$safe_user_id = (int) $user_id;
$currentUserId = api_get_user_id();
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT * FROM $user_table WHERE user_id = ".$safe_user_id;
$result = Database::query($sql);
$html = null;
if (1 == Database::num_rows($result)) {
$user_object = Database::fetch_object($result);
$userInfo = api_get_user_info($user_id);
$alt = $userInfo['complete_name'].($currentUserId == $user_id ? '&nbsp;('.get_lang('Me').')' : '');
$status = get_status_from_code($user_object->status);
$interbreadcrumb[] = ['url' => 'whoisonline.php', 'name' => get_lang('Online users list')];
$html .= '<div class ="thumbnail">';
$fullurl = $userInfo['avatar'];
$html .= '<img src="'.$fullurl.'" alt="'.$alt.'" />';
if (!empty($status)) {
$html .= '<div class="caption">'.$status.'</div>';
}
$html .= '</div>';
if ('true' == api_get_setting('show_email_addresses')) {
$html .= Display::encrypted_mailto_link($user_object->email, $user_object->email).'<br />';
}
if ($user_object->competences) {
$html .= Display::page_subheader(get_lang('My competences'));
$html .= '<p>'.$user_object->competences.'</p>';
}
if ($user_object->diplomas) {
$html .= Display::page_subheader(get_lang('My diplomas'));
$html .= '<p>'.$user_object->diplomas.'</p>';
}
if ($user_object->teach) {
$html .= Display::page_subheader(get_lang('What I am able to teach'));
$html .= '<p>'.$user_object->teach.'</p>';
}
self::display_productions($user_object->user_id);
if ($user_object->openarea) {
$html .= Display::page_subheader(get_lang('My personal open area'));
$html .= '<p>'.$user_object->openarea.'</p>';
}
} else {
$html .= '<div class="actions-title">';
$html .= get_lang('Online users list');
$html .= '</div>';
}
return $html;
}
/**
* Display productions in who is online.
*
* @param int $user_id User id
*/
public static function display_productions($user_id)
{
/*$webdir_array = UserManager::get_user_picture_path_by_id($user_id, 'web');
$sysdir = UserManager::getUserPathById($user_id, 'system');
$webdir = UserManager::getUserPathById($user_id, 'web');
if (!is_dir($sysdir)) {
mkdir($sysdir, api_get_permissions_for_new_directories(), true);
}
$productions = UserManager::get_user_productions($user_id);
if (count($productions) > 0) {
echo '<dt><strong>'.get_lang('Productions').'</strong></dt>';
echo '<dd><ul>';
foreach ($productions as $file) {
// Only display direct file links to avoid browsing an empty directory
if (is_file($sysdir.$file) && $file != $webdir_array['file']) {
echo '<li><a href="'.$webdir.urlencode($file).'" target=_blank>'.$file.'</a></li>';
}
// Real productions are under a subdirectory by the User's id
if (is_dir($sysdir.$file)) {
$subs = scandir($sysdir.$file);
foreach ($subs as $my => $sub) {
if ('.' != substr($sub, 0, 1) && is_file($sysdir.$file.'/'.$sub)) {
echo '<li><a href="'.$webdir.urlencode($file).'/'.urlencode($sub).'" target=_blank>'.$sub.'</a></li>';
}
}
}
}
echo '</ul></dd>';
}*/
}
/**
* @param string $content
* @param string $span_count

@ -805,60 +805,6 @@ class Template
return $theme;
}
/**
* @return string
*/
public function handleLoginFailed()
{
$message = get_lang('Login failed - incorrect login or password.');
if (!isset($_GET['error'])) {
if (api_is_self_registration_allowed()) {
$message = get_lang('Login failed - if you are not registered, you can do so using the <a href=claroline/auth/inscription.php>registration form</a>');
}
} else {
switch ($_GET['error']) {
case '':
if (api_is_self_registration_allowed()) {
$message = get_lang('Login failed - if you are not registered, you can do so using the <a href=claroline/auth/inscription.php>registration form</a>');
}
break;
case 'account_expired':
$message = get_lang('Account expired');
break;
case 'account_inactive':
$message = get_lang('Account inactive');
if ('confirmation' === api_get_setting('allow_registration')) {
$message = get_lang('Your account is inactive because you have not confirmed it yet. Check your email and follow the instructions or click the following link to resend the email').PHP_EOL;
$message .= Display::url(
get_lang('Send confirmation mail again'),
api_get_path(WEB_PATH).'main/auth/resend_confirmation_mail.php',
['class' => 'alert-link']
);
}
break;
case 'user_password_incorrect':
$message = get_lang('Login failed - incorrect login or password.');
break;
case 'access_url_inactive':
$message = get_lang('Account inactive for this URL');
break;
case 'wrong_captcha':
$message = get_lang('The text you entered doesn\'t match the picture.');
break;
case 'blocked_by_captcha':
$message = get_lang('Account blocked by captcha.');
break;
case 'multiple_connection_not_allowed':
$message = get_lang('This user is already logged in');
break;
}
}
return Display::return_message($message, 'error', false);
}
/**
* @return string
*/

@ -246,17 +246,6 @@ class IndexManager
return $items;
}
/**
* Reacts on a failed login:
* Displays an explanation with a link to the registration form.
*
* @version 1.0.1
*/
public function handle_login_failed()
{
return $this->tpl->handleLoginFailed();
}
/**
* Display list of courses in a category.
* (for anonymous users).

@ -178,9 +178,9 @@ class ToolChain
'chat',
'student_publication',
'survey',
'wiki',
//'wiki',
'notebook',
'blog',
//'blog',
'course_tool',
'tracking',
'course_setting',
@ -199,6 +199,7 @@ class ToolChain
if (!isset($toolList[$tool->getName()])) {
continue;
}
/** @var Tool $toolEntity */
$toolEntity = $toolRepo->findOneBy($criteria);
$position = $toolList[$tool->getName()] + 1;

Loading…
Cancel
Save