diff --git a/psalm.xml b/psalm.xml index 53014fcf47..9d10fc4c38 100644 --- a/psalm.xml +++ b/psalm.xml @@ -15,7 +15,6 @@ - @@ -53,7 +52,6 @@ - @@ -68,7 +66,6 @@ - @@ -154,7 +151,6 @@ - diff --git a/public/main/chat/chat.php b/public/main/chat/chat.php index 4c7acec3e7..661bb22cba 100644 --- a/public/main/chat/chat.php +++ b/public/main/chat/chat.php @@ -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); diff --git a/public/main/inc/lib/api.lib.php b/public/main/inc/lib/api.lib.php index 620fb62ce5..4ff0b10d72 100644 --- a/public/main/inc/lib/api.lib.php +++ b/public/main/inc/lib/api.lib.php @@ -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', '
 
'); - -// 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 .= '

'.get_lang('BackHome').'

'; - if (api_is_anonymous()) { - /*$form = api_get_not_allowed_login_form(); - $msg .= '
'; - $msg .= $form->returnForm(); - $msg .= '
';*/ - } - $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, diff --git a/public/main/inc/lib/social.lib.php b/public/main/inc/lib/social.lib.php index efc75ab855..396941d2ce 100644 --- a/public/main/inc/lib/social.lib.php +++ b/public/main/inc/lib/social.lib.php @@ -1245,8 +1245,9 @@ class SocialManager extends UserManager $userPicture = $user_info['avatar']; $officialCode = ''; - if ('true' == api_get_setting('show_official_code_whoisonline')) { - $officialCode .= '

'.$user_info['official_code'].'

'; + if ('true' === api_get_setting('show_official_code_whoisonline')) { + $officialCode .= '
+

'.$user_info['official_code'].'

'; } 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 ? ' ('.get_lang('Me').')' : ''); - $status = get_status_from_code($user_object->status); - $interbreadcrumb[] = ['url' => 'whoisonline.php', 'name' => get_lang('Online users list')]; - - $html .= '
'; - $fullurl = $userInfo['avatar']; - - $html .= ''.$alt.''; - - if (!empty($status)) { - $html .= '
'.$status.'
'; - } - $html .= '
'; - - if ('true' == api_get_setting('show_email_addresses')) { - $html .= Display::encrypted_mailto_link($user_object->email, $user_object->email).'
'; - } - - if ($user_object->competences) { - $html .= Display::page_subheader(get_lang('My competences')); - $html .= '

'.$user_object->competences.'

'; - } - if ($user_object->diplomas) { - $html .= Display::page_subheader(get_lang('My diplomas')); - $html .= '

'.$user_object->diplomas.'

'; - } - if ($user_object->teach) { - $html .= Display::page_subheader(get_lang('What I am able to teach')); - $html .= '

'.$user_object->teach.'

'; - } - self::display_productions($user_object->user_id); - if ($user_object->openarea) { - $html .= Display::page_subheader(get_lang('My personal open area')); - $html .= '

'.$user_object->openarea.'

'; - } - } else { - $html .= '
'; - $html .= get_lang('Online users list'); - $html .= '
'; - } - - 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 '
'.get_lang('Productions').'
'; - echo '
    '; - 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 '
  • '.$file.'
  • '; - } - // 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 '
  • '.$sub.'
  • '; - } - } - } - } - echo '
'; - }*/ - } - /** * @param string $content * @param string $span_count diff --git a/public/main/inc/lib/template.lib.php b/public/main/inc/lib/template.lib.php index 8b2877e710..f0a2bb7094 100644 --- a/public/main/inc/lib/template.lib.php +++ b/public/main/inc/lib/template.lib.php @@ -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 registration form'); - } - } 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 registration form'); - } - 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 */ diff --git a/public/main/inc/lib/userportal.lib.php b/public/main/inc/lib/userportal.lib.php index ca8258c497..1279ff7b93 100644 --- a/public/main/inc/lib/userportal.lib.php +++ b/public/main/inc/lib/userportal.lib.php @@ -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). diff --git a/src/CoreBundle/ToolChain.php b/src/CoreBundle/ToolChain.php index eed3f85645..77a1475707 100644 --- a/src/CoreBundle/ToolChain.php +++ b/src/CoreBundle/ToolChain.php @@ -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;