diff --git a/custompages/registration-dist.php b/custompages/registration-dist.php index aeb4fc0f83..c0206a1149 100644 --- a/custompages/registration-dist.php +++ b/custompages/registration-dist.php @@ -41,7 +41,7 @@ $form_template = <<   -

S'inscrire

+

S'inscrire

EOT; diff --git a/index.php b/index.php index 7c0a1cddc2..f7bca34ea7 100755 --- a/index.php +++ b/index.php @@ -49,7 +49,13 @@ $_setting['display_courses_to_anonymous_users'] = 'true'; */ if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) { $i = api_get_anonymous_id(); - Event::addEvent(LOG_ATTEMPTED_FORCED_LOGIN, 'tried_hacking_get', $_SERVER['REMOTE_ADDR'].(empty($_POST['login'])?'':'/'.$_POST['login']),null,$i); + Event::addEvent( + LOG_ATTEMPTED_FORCED_LOGIN, + 'tried_hacking_get', + $_SERVER['REMOTE_ADDR'].(empty($_POST['login'])?'':'/'.$_POST['login']), + null, + $i + ); echo 'Attempted breakin - sysadmins notified.'; session_destroy(); die(); diff --git a/main/admin/configure_homepage.php b/main/admin/configure_homepage.php index 659680cd4a..257ba0fa8c 100755 --- a/main/admin/configure_homepage.php +++ b/main/admin/configure_homepage.php @@ -323,7 +323,13 @@ if (!empty($action)) { fputs($fp, "$notice_title
\n$notice_text"); fclose($fp); } - Event::addEvent(LOG_HOMEPAGE_CHANGED, 'edit_notice', cut(strip_tags($notice_title), 254), api_get_utc_datetime(), api_get_user_id()); + Event::addEvent( + LOG_HOMEPAGE_CHANGED, + 'edit_notice', + cut(strip_tags($notice_title), 254), + api_get_utc_datetime(), + api_get_user_id() + ); break; case 'edit_news': //Filter @@ -365,7 +371,13 @@ if (!empty($action)) { } } } - Event::addEvent(LOG_HOMEPAGE_CHANGED, 'edit_news', strip_tags(cut($home_news, 254)), api_get_utc_datetime(), api_get_user_id()); + Event::addEvent( + LOG_HOMEPAGE_CHANGED, + 'edit_news', + strip_tags(cut($home_news, 254)), + api_get_utc_datetime(), + api_get_user_id() + ); break; case 'insert_tabs': case 'edit_tabs': diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index 4834dc19e7..4478577067 100755 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -765,7 +765,13 @@ function handle_templates() { // Add event to the system log. $user_id = api_get_user_id(); $category = $_GET['category']; - Event::addEvent(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id); + Event::addEvent( + LOG_CONFIGURATION_SETTINGS_CHANGE, + LOG_CONFIGURATION_SETTINGS_CATEGORY, + $category, + api_get_utc_datetime(), + $user_id + ); } else { if ($action == 'delete' && is_numeric($_GET['id'])) { delete_template($_GET['id']); @@ -773,7 +779,13 @@ function handle_templates() { // Add event to the system log $user_id = api_get_user_id(); $category = $_GET['category']; - Event::addEvent(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id); + Event::addEvent( + LOG_CONFIGURATION_SETTINGS_CHANGE, + LOG_CONFIGURATION_SETTINGS_CATEGORY, + $category, + api_get_utc_datetime(), + $user_id + ); } display_templates(); } diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php index 627468c619..360cf2d56e 100755 --- a/main/admin/user_edit.php +++ b/main/admin/user_edit.php @@ -429,6 +429,8 @@ if ($error_drh) { $message = Display::return_message($err_msg, 'error'); } +$gravatarEnabled = api_get_configuration_value('gravatar_enabled'); + // USER PICTURE $image_path = UserManager::get_user_picture_path_by_id($user_id,'web'); $image_dir = $image_path['dir']; @@ -436,7 +438,11 @@ $image = $image_path['file']; $image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown.jpg'); $image_size = api_getimagesize($image_file); -$img_attributes = 'src="'.$image_file.'?rand='.time().'" ' +if (!$gravatarEnabled) { + $image_file .= '?rand='.time(); +} + +$img_attributes = 'src="'.$image_file.'" ' .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" ' .'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; padding:5px;" '; @@ -449,7 +455,10 @@ $big_image = $image_dir.'big_'.$image; $big_image_size = api_getimagesize($big_image); $big_image_width = $big_image_size['width']; $big_image_height = $big_image_size['height']; -$url_big_image = $big_image.'?rnd='.time(); +$url_big_image = $image_file; +if (!$gravatarEnabled) { + $url_big_image = $big_image.'?rnd='.time(); +} $content = null; if ($image == '') { diff --git a/main/auth/courses_controller.php b/main/auth/courses_controller.php index b878919c58..5070c0fec0 100755 --- a/main/auth/courses_controller.php +++ b/main/auth/courses_controller.php @@ -498,9 +498,23 @@ class CoursesController api_get_path(WEB_CODE_PATH)."inc/email_editor.php?action=subscribe_me_to_session&session=". Security::remove_XSS($sessionData); - return Display::url(get_lang('Subscribe'), $url, array( + $result = Display::url(get_lang('Subscribe'), $url, array( 'class' => 'btn btn-large btn-primary', )); + + $hook = HookResubscribe::create(); + if (!empty($hook)) { + $hook->setEventData(array( + 'session_id' => intval($sessionData) + )); + try { + $hook->notifyResubscribe(HOOK_EVENT_TYPE_PRE); + } catch (Exception $exception) { + $result = $exception->getMessage(); + } + } + + return $result; } /** diff --git a/main/auth/lostPassword.php b/main/auth/lostPassword.php index f9131cbb80..7b0f627e93 100755 --- a/main/auth/lostPassword.php +++ b/main/auth/lostPassword.php @@ -75,7 +75,7 @@ if (api_get_setting('allow_lostpassword') == 'false') { if (isset($_GET['reset']) && isset($_GET['id'])) { $message = Display::return_message(Login::reset_password($_GET["reset"], $_GET["id"], true), 'normal', false); - $message .= ''.get_lang('Back').''; + $message .= ''.get_lang('Back').''; echo $message; } else { $form = new FormValidator('lost_password'); diff --git a/main/auth/profile.php b/main/auth/profile.php index 6b6d759513..a989e25936 100755 --- a/main/auth/profile.php +++ b/main/auth/profile.php @@ -323,8 +323,7 @@ function is_profile_editable() { * @return The filename of the new production or FALSE if the upload has failed */ function upload_user_production($user_id) { - $image_path = UserManager::get_user_picture_path_by_id($user_id, 'system'); - $production_repository = $image_path['dir']; + $production_repository = UserManager::getUserPathById($user_id, 'system'); if (!file_exists($production_repository)) { @mkdir($production_repository, api_get_permissions_for_new_directories(), true); @@ -692,6 +691,8 @@ if (!empty($msg_is_not_password)){ Display::addFlash(Display :: return_message($warning_msg, 'warning', false)); } +$gravatarEnabled = api_get_configuration_value('gravatar_enabled'); + // User picture size is calculated from SYSTEM path $image_syspath = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system', false, true); $image_syspath['dir'].$image_syspath['file']; @@ -701,7 +702,10 @@ $image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', $image_dir = $image_path['dir']; $image = $image_path['file']; $image_file = $image_dir.$image; -$img_attributes = 'src="'.$image_file.'?rand='.time().'" ' +if (!$gravatarEnabled) { + $image_file .= '?rand='.time(); +} +$img_attributes = 'src="'.$image_file.'" ' .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" ' .'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; margin-top:0px;padding:5px;" '; @@ -711,8 +715,10 @@ $big_image = $image_dir.'big_'.$image; $big_image_size = api_getimagesize($big_image); $big_image_width = $big_image_size['width']; $big_image_height = $big_image_size['height']; -$url_big_image = $big_image.'?rnd='.time(); - +$url_big_image = $image_file; +if (!$gravatarEnabled) { + $url_big_image = $big_image.'?rnd='.time(); +} $show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false; $tpl = new Template(get_lang('ModifyProfile')); diff --git a/main/chat/chat_functions.lib.php b/main/chat/chat_functions.lib.php index bc0df7c67d..ac46b479c1 100755 --- a/main/chat/chat_functions.lib.php +++ b/main/chat/chat_functions.lib.php @@ -222,6 +222,10 @@ function saveMessage($message, $userId, $_course, $session_id, $group_id, $previ $userPhoto = $userImage['dir'].$userImage['file']; } + if (api_get_configuration_value('gravatar_enabled')) { + $userPhoto = $userImage['file']; + } + $filePhoto = ''; if ($isMaster) { diff --git a/main/chat/chat_whoisonline.php b/main/chat/chat_whoisonline.php index c4b2cc647e..d3a4352336 100755 --- a/main/chat/chat_whoisonline.php +++ b/main/chat/chat_whoisonline.php @@ -123,6 +123,11 @@ if (!empty($course)) { } else { $fileUrl = $userImage['dir'].$userImage['file']; } + + if (api_get_configuration_value('gravatar_enabled')) { + $fileUrl = $userImage['file']; + } + $email = $user['email']; $url_user_profile=api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user['user_id'].'&'; ?> diff --git a/main/course_info/delete_course.php b/main/course_info/delete_course.php index 7b768bbbc7..2aabb54e86 100755 --- a/main/course_info/delete_course.php +++ b/main/course_info/delete_course.php @@ -44,7 +44,7 @@ if (isset($_GET['delete']) && $_GET['delete'] == 'yes') { $message = '

'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.')

'; $message .= '

'.get_lang('ByDel').'

'; $message .= '

'. - get_lang('No').' '. + get_lang('No').' '. get_lang('Yes').'

'; $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance')); } diff --git a/main/course_info/maintenance.php b/main/course_info/maintenance.php index e0f24c40f0..bf1f19126c 100755 --- a/main/course_info/maintenance.php +++ b/main/course_info/maintenance.php @@ -35,9 +35,6 @@ echo Display::page_header($nameTools);
  
-
  
-
-
  
diff --git a/main/coursecopy/import_backup.php b/main/coursecopy/import_backup.php index cee700ca0c..48cf94412f 100755 --- a/main/coursecopy/import_backup.php +++ b/main/coursecopy/import_backup.php @@ -137,10 +137,10 @@ if (Security::check_token('post') && ( CourseSelectForm::display_form($course, $hiddenFields); } elseif ($filename === false) { Display::display_error_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin')); - echo '' . get_lang('TryAgain') . ''; + echo '' . get_lang('TryAgain') . ''; } else { Display::display_warning_message(get_lang('NoResourcesInBackupFile')); - echo '' . get_lang('TryAgain') . ''; + echo '' . get_lang('TryAgain') . ''; } } else { $user = api_get_user_info(); diff --git a/main/css/base.css b/main/css/base.css index 3a7709edc9..3ceeb4b687 100755 --- a/main/css/base.css +++ b/main/css/base.css @@ -2672,6 +2672,7 @@ div.admin_section h4 { float:left; line-height: 16px; padding-top: 5px; + margin: 0; } .ribbon .rib-total { @@ -3774,7 +3775,7 @@ a:active{ height: 20px; width: 20px; position:absolute; - background: url("offline.png") no-repeat scroll right center transparent; + background: url("../img/offline.png") no-repeat scroll right center transparent; } .online_user { @@ -3793,21 +3794,21 @@ a:active{ margin-right: 4px; } .send_msg_in_text { - background: url("send_msg.png") no-repeat scroll right center transparent; + background: url("../img/mail_send.png") no-repeat scroll right center transparent; height: 16px; width: 17px; display: inline-block; margin-right: 4px; } .send_inv_in_text { - background: url("send_inv.png") no-repeat scroll right center transparent; + background: url("../img/invitation.png") no-repeat scroll right center transparent; height: 16px; width: 17px; display: inline-block; margin-right: 4px; } .teacher_online { - background: url("teacher.png") no-repeat scroll right center transparent; + background: url("../img/icons/16/teacher.png") no-repeat scroll right center transparent; height: 16px; width: 17px; display: inline-block; @@ -3815,7 +3816,7 @@ a:active{ } .student_online { - background: url("student.png") no-repeat scroll right center transparent; + background: url("../img/icons/16/user.png") no-repeat scroll right center transparent; height: 16px; width: 17px; display: inline-block; @@ -3827,7 +3828,7 @@ a:active{ } .offline_user_in_text { - background: url("offline.png") no-repeat scroll right center transparent; + background: url("../img/offline.png") no-repeat scroll right center transparent; height: 16px; width: 17px; display: inline-block; diff --git a/main/document/showinframes.php b/main/document/showinframes.php index 15111f775a..a198c41bbd 100755 --- a/main/document/showinframes.php +++ b/main/document/showinframes.php @@ -329,7 +329,7 @@ $file_url_web = $file_url.'?'.api_get_cidreq(); if (!$is_nanogong_available) { if (in_array(strtolower($pathinfo['extension']) , array('html', "htm"))) { - echo ''.get_lang('CutPasteLink').''; + echo ''.get_lang('CutPasteLink').''; } } @@ -426,7 +426,7 @@ if ($is_freemind_available) { if ($is_nanogong_available) { $file_url_web = DocumentManager::generateAudioTempFolder($file_url_sys); echo '
'; - echo ''.get_lang('Download').''; + echo ' '.get_lang('Download').''; echo '
'; echo '
'; echo DocumentManager::readNanogongFile($to_url); diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 5c44bce5cd..3a53fd3a02 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -1621,7 +1621,7 @@ class Exercise $this->id, null, null, - api_get_course_id(), + api_get_course_int_id(), $session_id ); diff --git a/main/exercice/qti2.php b/main/exercice/qti2.php index aa119c237c..d2b2b13dcf 100755 --- a/main/exercice/qti2.php +++ b/main/exercice/qti2.php @@ -35,7 +35,7 @@ function ch_qti2_display_form() $name_tools = get_lang('ImportQtiQuiz'); $form = '
'; $form .= ''. - Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; + Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).''; $form .= '
'; $formValidator = new FormValidator( 'qti_upload', @@ -46,8 +46,8 @@ function ch_qti2_display_form() ); $formValidator->addElement('header', $name_tools); $formValidator->addElement('file', 'userFile', get_lang('DownloadFile')); - $formValidator->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"'); - $form .= $formValidator->return_form(); + $formValidator->addButtonImport(get_lang('Upload')); + $form .= $formValidator->returnForm(); echo $form; } diff --git a/main/exercice/question_list_admin.inc.php b/main/exercice/question_list_admin.inc.php index 8fa20e2117..ce6910fe41 100755 --- a/main/exercice/question_list_admin.inc.php +++ b/main/exercice/question_list_admin.inc.php @@ -141,11 +141,11 @@ if (!$inATest) { echo "
"; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; echo "
" .get_lang('Questions'). "" .get_lang('Type'). "" .get_lang('Category'). "" .get_lang('Difficulty'). "" .get_lang('Score'). "" .get_lang('Questions'). "" .get_lang('Type'). "" .get_lang('Category'). "" .get_lang('Difficulty'). "" .get_lang('Score'). "
"; echo "
"; @@ -156,7 +156,7 @@ if (!$inATest) { $questionList = $objExercise->selectQuestionList(true); // Style for columns - $styleQuestion = "width:50%; float:left;"; + $styleQuestion = "width:50%; float:left; margin-left: 25px;"; $styleType = "width:4%; float:left; text-align:center;"; $styleCat = "width:22%; float:left; text-align:center;"; $styleLevel = "width:6%; float:left; text-align:center;"; diff --git a/main/forum/forumqualify.php b/main/forum/forumqualify.php index 6508591d24..2f40651cc2 100755 --- a/main/forum/forumqualify.php +++ b/main/forum/forumqualify.php @@ -228,7 +228,7 @@ if ($allowed_to_edit) { } echo '

'.get_lang('QualificationChangesHistory').'

'; if ($_GET['type'] == 'false') { - $buttons = ''. + $buttons = ''. get_lang('MoreRecent').' '.get_lang('Older').''; } else { $buttons = ''.get_lang('MoreRecent').' diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php index ca6543df93..1dabf61414 100755 --- a/main/gradebook/lib/fe/displaygradebook.php +++ b/main/gradebook/lib/fe/displaygradebook.php @@ -720,7 +720,12 @@ class DisplayGradebook //Web path $image_path = UserManager::get_user_picture_path_by_id($userid, 'web', false, true); $image_file = $image_path['dir'] . $image_path['file']; - $img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . 'alt="' . $user['complete_name'] . '" '; + + if (!api_get_configuration_value('gravatar_enabled')) { + $image_file .= '?rand='.time(); + } + + $img_attributes = 'src="' . $image_file . '" ' . 'alt="' . $user['complete_name'] . '" '; if ($image_size[0] > 200) { //limit display width to 200px $img_attributes .= 'width="200" '; diff --git a/main/gradebook/user_info.php b/main/gradebook/user_info.php index 134c844928..f623536083 100755 --- a/main/gradebook/user_info.php +++ b/main/gradebook/user_info.php @@ -48,7 +48,11 @@ $image_size = getimagesize($image_syspath['dir'].$image_syspath['file']); $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false,true); $image_file = $image_path['dir'].$image_path['file']; -$img_attributes = 'src="'.$image_file.'?rand='.time().'" ' +if (!api_get_configuration_value('gravatar_enabled')) { + $image_file .= '?rand='.time(); +} + +$img_attributes = 'src="'.$image_file.'" ' .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" ' .'style="float:left; padding:5px;" '; diff --git a/main/group/group_space.php b/main/group/group_space.php index 7524a62259..9a3a51e3e4 100755 --- a/main/group/group_space.php +++ b/main/group/group_space.php @@ -103,7 +103,7 @@ echo ''. */ $subscribe_group = ''; if (GroupManager :: is_self_registration_allowed($user_id, $current_group['id'])) { - $subscribe_group = ''. + $subscribe_group = ''. get_lang("RegIntoGroup").''; } @@ -112,7 +112,7 @@ if (GroupManager :: is_self_registration_allowed($user_id, $current_group['id']) */ $unsubscribe_group = ''; if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])) { - $unsubscribe_group = ''. + $unsubscribe_group = ''. get_lang("StudentUnsubscribe").''; } echo ' 
'; diff --git a/main/help/help.php b/main/help/help.php index b1eed1b258..b9af28169a 100755 --- a/main/help/help.php +++ b/main/help/help.php @@ -16,7 +16,7 @@ if (empty($help_name)) { } ?> - +
- + diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php index 3dfee3e6e5..8912a22524 100755 --- a/main/inc/ajax/model.ajax.php +++ b/main/inc/ajax/model.ajax.php @@ -213,8 +213,21 @@ switch ($action) { if ($searchByGroups) { $groups = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_ADMIN); $groupsId = array_keys($groups); + $subgroupsId = []; if (is_array($groupsId)) { + foreach ($groupsId as $groupId) { + $subgroupsId = array_merge( + $subgroupsId, + GroupPortalManager::getGroupsByDepthLevel($groupId) + ); + } + + $groupsId = array_merge( + $groupsId, + $subgroupsId + ); + foreach ($groupsId as $groupId) { $groupUsers = GroupPortalManager::get_users_by_group($groupId); @@ -263,6 +276,11 @@ switch ($action) { $sessionIdList = array_unique($sessionIdList); } + if (api_is_student_boss() && empty($userIdList)) { + $count = 0; + break; + } + if ($action == 'get_user_course_report') { $count = CourseManager::get_count_user_list_from_course_code( false, @@ -567,6 +585,11 @@ switch ($action) { //$sidx = 'training_hours'; } + if (api_is_student_boss() && empty($userIdList)) { + $result = []; + break; + } + $result = CourseManager::get_user_list_from_course_code( null, null, @@ -621,6 +644,11 @@ switch ($action) { $sidx = 'title'; } + if (api_is_student_boss() && empty($userIdList)) { + $result = []; + break; + } + $result = CourseManager::get_user_list_from_course_code( null, null, diff --git a/main/inc/ajax/social.ajax.php b/main/inc/ajax/social.ajax.php index bbfc28320e..0a58d48b16 100755 --- a/main/inc/ajax/social.ajax.php +++ b/main/inc/ajax/social.ajax.php @@ -93,7 +93,7 @@ switch ($action) { $friend_html.=''; $friend_html.='
'; $friend_html.='
'.$user_name.'
'; - $friend_html.='

'; + $friend_html.='

'; $friend_html.='
'; $friend_html.=''; diff --git a/main/inc/course_document.inc.php b/main/inc/course_document.inc.php index 44b75f1c23..6bd71b26a3 100755 --- a/main/inc/course_document.inc.php +++ b/main/inc/course_document.inc.php @@ -64,10 +64,9 @@ if (api_is_in_course()) { $http_www = $_configuration['root_web'].'home/default_platform_document/'; } else { // 4. The user is outside courses. - $my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'system'); - $base_work_dir = $my_path['dir'].'my_files/'; - $my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'web'); - $http_www = $my_path['dir'].'my_files/'; + $userId = api_get_user_id(); + $base_work_dir = UserManager::getUserPathById($userId, 'system').'my_files/'; + $http_www = UserManager::getUserPathById($userId, 'web').'my_files/'; } } diff --git a/main/inc/lib/add_course.lib.inc.php b/main/inc/lib/add_course.lib.inc.php index 1cd29f4146..8c606dd370 100755 --- a/main/inc/lib/add_course.lib.inc.php +++ b/main/inc/lib/add_course.lib.inc.php @@ -1439,7 +1439,7 @@ class AddCourse $code, api_get_utc_datetime(), $user_id, - $code + $course_id ); $send_mail_to_admin = api_get_setting( diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 951d603c18..5a2fe7d725 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -1422,26 +1422,24 @@ function _api_format_user($user, $add_password = false) } $image_sys_path = api_get_path(SYS_CODE_PATH).$dir.$picture_filename; - if ($picture_filename) { - if (file_exists($image_sys_path)) { - $result['avatar'] = api_get_path(WEB_CODE_PATH).$dir.$picture_filename; - $result['avatar_small'] = api_get_path(WEB_CODE_PATH).$dir.'small_'.$picture_filename; - $result['avatar_sys_path'] = api_get_path(SYS_CODE_PATH).$dir.$picture_filename; - } else if (api_get_configuration_value('gravatar_enabled')) { - $userEmail = isset($user['email']) ? $user['email'] : ''; - $gravatarType = api_get_configuration_value('gravatar_type'); - $avatarPaths = array( - 'avatar' => $result['avatar'], - 'avatar_small' => $result['avatar_small'], - 'avatar_sys_path' => $result['avatar_sys_path'] - ); - foreach ($avatarPaths as $key => $value) { - $avatarSize = api_getimagesize($value); - $avatarSize = $avatarSize['width'] > $avatarSize['height'] ? - $avatarSize['width'] : - $avatarSize['height']; - $result[$key] = UserManager::getGravatar($userEmail, $avatarSize, $gravatarType); - } + if ($picture_filename && file_exists($image_sys_path)) { + $result['avatar'] = api_get_path(WEB_CODE_PATH).$dir.$picture_filename; + $result['avatar_small'] = api_get_path(WEB_CODE_PATH).$dir.'small_'.$picture_filename; + $result['avatar_sys_path'] = api_get_path(SYS_CODE_PATH).$dir.$picture_filename; + } else if (api_get_configuration_value('gravatar_enabled')) { + $userEmail = isset($user['email']) ? $user['email'] : ''; + $gravatarType = api_get_configuration_value('gravatar_type'); + $avatarPaths = array( + 'avatar' => $result['avatar'], + 'avatar_small' => $result['avatar_small'], + 'avatar_sys_path' => $result['avatar_sys_path'] + ); + foreach ($avatarPaths as $key => $value) { + $avatarSize = api_getimagesize($value); + $avatarSize = $avatarSize['width'] > $avatarSize['height'] ? + $avatarSize['width'] : + $avatarSize['height']; + $result[$key] = UserManager::getGravatar($userEmail, $avatarSize, $gravatarType); } } diff --git a/main/inc/lib/career.lib.php b/main/inc/lib/career.lib.php index 5259ae06ef..84563ac8ad 100755 --- a/main/inc/lib/career.lib.php +++ b/main/inc/lib/career.lib.php @@ -213,7 +213,13 @@ class Career extends Model { $id = parent::save($params); if (!empty($id)) { - Event::addEvent(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); + Event::addEvent( + LOG_CAREER_CREATE, + LOG_CAREER_ID, + $id, + api_get_utc_datetime(), + api_get_user_id() + ); } return $id; @@ -226,6 +232,12 @@ class Career extends Model public function delete($id) { parent::delete($id); - Event::addEvent(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); + Event::addEvent( + LOG_CAREER_DELETE, + LOG_CAREER_ID, + $id, + api_get_utc_datetime(), + api_get_user_id() + ); } } diff --git a/main/inc/lib/certificate.lib.php b/main/inc/lib/certificate.lib.php index 8314e9f1fc..4dc7a3a1f0 100755 --- a/main/inc/lib/certificate.lib.php +++ b/main/inc/lib/certificate.lib.php @@ -89,15 +89,15 @@ class Certificate extends Model $this->certification_user_path = null; //Setting certification path - $path_info = UserManager::get_user_picture_path_by_id($this->user_id, 'system'); - $web_path_info = UserManager::get_user_picture_path_by_id($this->user_id, 'web'); + $path_info = UserManager::getUserPathById($this->user_id, 'system'); + $web_path_info = UserManager::getUserPathById($this->user_id, 'web'); - if (!empty($path_info) && isset($path_info['dir'])) { - $this->certification_user_path = $path_info['dir'].'certificate/'; - $this->certification_web_user_path = $web_path_info['dir'].'certificate/'; + if (!empty($path_info) && isset($path_info)) { + $this->certification_user_path = $path_info.'certificate/'; + $this->certification_web_user_path = $web_path_info.'certificate/'; - if (!is_dir($path_info['dir'])) { - mkdir($path_info['dir'], 0777, true); + if (!is_dir($path_info)) { + mkdir($path_info, 0777, true); } if (!is_dir($this->certification_user_path)) { mkdir($this->certification_user_path, 0777); diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 2e8e3089eb..fd794aed0d 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -2236,8 +2236,11 @@ class CourseManager Database::query($sql); $sql = "DELETE FROM $table_stats_online WHERE c_id = $courseId"; Database::query($sql); - $sql = "DELETE FROM $table_stats_default WHERE c_id = $courseId"; - Database::query($sql); + // Do not delete rows from track_e_default as these include course + // creation and other important things that do not take much space + // but give information on the course history + //$sql = "DELETE FROM $table_stats_default WHERE c_id = $courseId"; + //Database::query($sql); $sql = "DELETE FROM $table_stats_downloads WHERE c_id = $courseId"; Database::query($sql); $sql = "DELETE FROM $table_stats_links WHERE c_id = $courseId"; @@ -2293,7 +2296,7 @@ class CourseManager $code, api_get_utc_datetime(), $user_id, - $code + $courseId ); } } diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 8bc7895d86..77032bad90 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -745,19 +745,20 @@ class Display $size = ICON_SIZE_SMALL, $show_text = true, $return_only_path = false - ) { + ) + { - $code_path = api_get_path(SYS_CODE_PATH); + $code_path = api_get_path(SYS_CODE_PATH); $w_code_path = api_get_path(WEB_CODE_PATH); $image = trim($image); - $theme = 'css/'.api_get_visual_theme().'/icons/'; + $theme = 'css/' . api_get_visual_theme() . '/icons/'; $icon = ''; $size_extra = ''; if (isset($size)) { $size = intval($size); - $size_extra = $size.'/'; + $size_extra = $size . '/'; } else { $size = ICON_SIZE_SMALL; } @@ -770,8 +771,30 @@ class Display $icon = $w_code_path.'img/icons/'.$size_extra.$image; } else { //Checking the img/ folder - $icon = $w_code_path.'img/'.$image; + $icon = $w_code_path . 'img/' . $image; + } + + // Special code to enable SVG - refs #7359 - Needs more work + // The code below does something else to "test out" SVG: for each icon, + // it checks if there is an SVG version. If so, it uses it. + // When moving this to production, the return_icon() calls should + // ask for the SVG version directly + if (Chamilo::is_test_server()) { + $svgImage = substr($image, 0, -3) . 'svg'; + if (is_file($code_path . $theme . 'svg/' . $svgImage)) { + $icon = $w_code_path . $theme . 'svg/' . $svgImage; + } elseif (is_file($code_path . 'img/icons/svg/' . $svgImage)) { + $icon = $w_code_path . 'img/icons/svg/' . $svgImage; + } + + if (empty($additional_attributes['height'])) { + $additional_attributes['height'] = $size; + } + if (empty($additional_attributes['width'])) { + $additional_attributes['width'] = $size; + } } + $icon = api_get_cdn_path($icon); if ($return_only_path) { return $icon; diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.php old mode 100755 new mode 100644 similarity index 98% rename from main/inc/lib/events.lib.inc.php rename to main/inc/lib/events.lib.php index f51b090b93..22f1336802 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.php @@ -629,12 +629,14 @@ class Event /** * Records information for common (or admin) events (in the track_e_default table) * @author Yannick Warnier - * @param string Type of event - * @param string Type of value - * @param string Value - * @param string Timestamp (defaults to null) - * @param integer User ID (defaults to null) - * @param string Course code (defaults to null) + * @param string $event_type Type of event + * @param string $event_value_type Type of value + * @param string $event_value Value + * @param string $datetime Datetime (UTC) (defaults to null) + * @param int $user_id User ID (defaults to null) + * @param int $course_id Course ID (defaults to null) + * @param int $sessionId Session ID + * @return bool * @assert ('','','') === false */ public static function addEvent( @@ -643,7 +645,7 @@ class Event $event_value, $datetime = null, $user_id = null, - $course_code = null, + $course_id = null, $sessionId = 0 ) { $TABLETRACK_DEFAULT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); @@ -653,6 +655,16 @@ class Event } $event_type = Database::escape_string($event_type); $event_value_type = Database::escape_string($event_value_type); + if (!empty($course_id)) { + $course_id = intval($course_id); + } else { + $course_id = api_get_course_int_id(); + } + if (!empty($sessionId)) { + $sessionId = intval($sessionId); + } else { + $sessionId = api_get_session_id(); + } //Clean the user_info if ($event_value_type == LOG_USER_OBJECT) { @@ -673,16 +685,8 @@ class Event } $event_value = Database::escape_string($event_value); - $course_info = api_get_course_info($course_code); $sessionId = empty($sessionId) ? api_get_session_id() : intval($sessionId); - if (!empty($course_info)) { - $course_id = $course_info['real_id']; - } else { - $course_id = null; - $course_code = null; - } - if (!isset($datetime)) { $datetime = api_get_utc_datetime(); } @@ -1060,22 +1064,16 @@ class Event } if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) { - $sql = "DELETE FROM $track_e_exercises WHERE exe_id IN (" . implode( - ',', - $exe_list - ) . ")"; + $sql = "DELETE FROM $track_e_exercises + WHERE exe_id IN (" . implode(',', $exe_list) . ")"; Database::query($sql); - $sql = "DELETE FROM $track_attempts WHERE exe_id IN (" . implode( - ',', - $exe_list - ) . ")"; + $sql = "DELETE FROM $track_attempts + WHERE exe_id IN (" . implode(',', $exe_list) . ")"; Database::query($sql); - $sql = "DELETE FROM $recording_table WHERE exe_id IN (" . implode( - ',', - $exe_list - ) . ")"; + $sql = "DELETE FROM $recording_table + WHERE exe_id IN (" . implode(',', $exe_list) . ")"; Database::query($sql); } @@ -1085,7 +1083,7 @@ class Event $lp_id, null, null, - $course['code'], + $course_id, $session_id ); } @@ -1120,7 +1118,7 @@ class Event $exercise_id . '-' . $user_id, null, null, - $course_code, + $course_id, $session_id ); } @@ -1684,7 +1682,7 @@ class Event $exe_id . '-' . $question_id, null, null, - $courseInfo['code'], + $courseId, $session_id ); } @@ -1694,8 +1692,9 @@ class Event * @param $user_id * @param int $courseId * @param $question_id + * @param int $sessionId */ - public static function delete_attempt_hotspot($exe_id, $user_id, $courseId, $question_id) + public static function delete_attempt_hotspot($exe_id, $user_id, $courseId, $question_id, $sessionId = null) { $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); @@ -1703,6 +1702,9 @@ class Event $user_id = intval($user_id); $courseId = intval($courseId); $question_id = intval($question_id); + if (!isset($sessionId)) { + $sessionId = api_get_session_id(); + } $sql = "DELETE FROM $table_track_attempt WHERE hotspot_exe_id = $exe_id AND @@ -1716,8 +1718,8 @@ class Event $exe_id . '-' . $question_id, null, null, - $course_code, - $session_id + $courseId, + $sessionId ); } diff --git a/main/inc/lib/extra_field_value.lib.php b/main/inc/lib/extra_field_value.lib.php index 793c79f6dc..93a1edd38d 100755 --- a/main/inc/lib/extra_field_value.lib.php +++ b/main/inc/lib/extra_field_value.lib.php @@ -173,8 +173,7 @@ class ExtraFieldValue extends Model $fileDir = "upload/sessions/"; break; case 'user': - $userPath = UserManager::get_user_picture_path_by_id($this->handler_id); - $fileDir = $userPath['dir']; + $fileDir = UserManager::getUserPathById($this->handler_id); break; } @@ -213,8 +212,7 @@ class ExtraFieldValue extends Model $fileDir = "upload/sessions/"; break; case 'user': - $userPath = UserManager::get_user_picture_path_by_id($this->handler_id); - $fileDir = $userPath['dir']; + $fileDir = UserManager::getUserPathById($this->handler_id); break; } diff --git a/main/inc/lib/group_portal_manager.lib.php b/main/inc/lib/group_portal_manager.lib.php index f527f86291..73da630502 100755 --- a/main/inc/lib/group_portal_manager.lib.php +++ b/main/inc/lib/group_portal_manager.lib.php @@ -217,6 +217,55 @@ class GroupPortalManager } } + /** + * Get the subgroups ID from a group. + * The default $levels value is 10 considering it as a extensive level of depth + * @param int $groupId The parent group ID + * @param int $levels The depth levels + * @return array The list of ID + */ + public static function getGroupsByDepthLevel($groupId, $levels = 10) + { + $groups = array(); + $groupId = intval($groupId); + + $groupTable = Database::get_main_table(TABLE_MAIN_GROUP); + $groupRelGroupTable = Database :: get_main_table(TABLE_MAIN_GROUP_REL_GROUP); + + $select = "SELECT "; + $from = "FROM $groupTable g1 "; + + for ($i = 1; $i <= $levels; $i++) { + $tableIndexNumber = $i; + $tableIndexJoinNumber = $i - 1; + + $select .= "g$i.id as id_$i "; + + $select .= ($i != $levels ? ", " : null); + + if ($i == 1) { + $from .= "INNER JOIN $groupRelGroupTable gg0 ON g1.id = gg0.subgroup_id and gg0.group_id = $groupId "; + } else { + $from .= "LEFT JOIN $groupRelGroupTable gg$tableIndexJoinNumber "; + $from .= " ON g$tableIndexJoinNumber.id = gg$tableIndexJoinNumber.group_id "; + $from .= "LEFT JOIN $groupTable g$tableIndexNumber "; + $from .= " ON gg$tableIndexJoinNumber.subgroup_id = g$tableIndexNumber.id "; + } + } + + $result = Database::query("$select $from"); + + while ($item = Database::fetch_assoc($result)) { + foreach ($item as $groupId) { + if (!empty($groupId)) { + $groups[] = $groupId; + } + } + } + + return array_map('intval', $groups); + } + /** * @param int $root * @param int $level @@ -234,7 +283,7 @@ class GroupPortalManager if ($i == $level) { $select_part .= "g$i.id as id_$i, g$i.name as name_$i "; } else { - $select_part .="g$i.id as id_$i, g$i.name name_$i, "; + $select_part .= "g$i.id as id_$i, g$i.name name_$i, "; } if ($i == 1) { $cond_part .= "FROM $t_group g1 JOIN $t_rel_group rg0 on g1.id = rg0.subgroup_id and rg0.group_id = $root "; @@ -245,24 +294,24 @@ class GroupPortalManager } $sql = $select_part.' '.$cond_part; $res = Database::query($sql); - $toreturn = array(); + $toReturn = array(); while ($item = Database::fetch_assoc($res)) { foreach ($item as $key => $value) { if ($key == 'id_1') { - $toreturn[$value]['name'] = $item['name_1']; + $toReturn[$value]['name'] = $item['name_1']; } else { $temp = explode('_', $key); - $index_key = $temp[1]; - $string_key = $temp[0]; - $previous_key = $string_key.'_'.$index_key - 1; - if ($string_key == 'id' && isset($item[$key])) { - $toreturn[$item[$previous_key]]['hrms'][$index_key]['name'] = $item['name_'.$index_id]; + $indexKey = $temp[1]; + $stringKey = $temp[0]; + $previousKey = $stringKey.'_'.$indexKey - 1; + if ($stringKey == 'id' && isset($item[$key])) { + $toReturn[$item[$previousKey]]['hrms'][$indexKey]['name'] = $item['name_'.$indexKey]; } } } } - return $toreturn; + return $toReturn; } /** @@ -292,16 +341,16 @@ class GroupPortalManager $sql = $select_part.' '.$cond_part."WHERE rg0.subgroup_id='$group_id'"; $res = Database::query($sql); $temp_arr = Database::fetch_array($res, 'NUM'); - $toreturn = array(); + $toReturn = array(); if (is_array($temp_arr)) { foreach ($temp_arr as $elt) { if (isset($elt)) { - $toreturn[] = $elt; + $toReturn[] = $elt; } } } - return $toreturn; + return $toReturn; } /** @@ -912,8 +961,10 @@ class GroupPortalManager $base = ''; } + $noPicturePath = array('dir' => $base.'img/', 'file' => 'unknown.jpg'); + if (empty($id) || empty($type)) { - return $anonymous ? array('dir' => $base.'img/', 'file' => 'unknown.jpg') : array('dir' => '', 'file' => ''); + return $anonymous ? $noPicturePath : array('dir' => '', 'file' => ''); } $id = intval($id); @@ -923,7 +974,7 @@ class GroupPortalManager $res = Database::query($sql); if (!Database::num_rows($res)) { - return $anonymous ? array('dir' => $base.'img/', 'file' => 'unknown.jpg') : array('dir' => '', 'file' => ''); + return $anonymous ? $noPicturePath : array('dir' => '', 'file' => ''); } $user = Database::fetch_array($res); @@ -940,9 +991,11 @@ class GroupPortalManager } else { $dir = $base.'upload/users/groups/'.$id.'/'; } + if (empty($picture_filename) && $anonymous) { - return array('dir' => $base.'img/', 'file' => 'unknown.jpg'); + return $noPicturePath; } + return array('dir' => $dir, 'file' => $picture_filename); } diff --git a/main/inc/lib/hook/HookResubscribe.php b/main/inc/lib/hook/HookResubscribe.php new file mode 100644 index 0000000000..c88bdfa7ac --- /dev/null +++ b/main/inc/lib/hook/HookResubscribe.php @@ -0,0 +1,33 @@ +eventData['type'] = $type; + foreach ($this->observers as $observer) { + $observer->hookResubscribe($this); + } + return 1; + } +} diff --git a/main/inc/lib/hook/interfaces/HookResubscribeEventInterface.php b/main/inc/lib/hook/interfaces/HookResubscribeEventInterface.php new file mode 100644 index 0000000000..e386c032fd --- /dev/null +++ b/main/inc/lib/hook/interfaces/HookResubscribeEventInterface.php @@ -0,0 +1,21 @@ +'; $html .= ''; - $html .= ''.get_lang('SendRecord').''; + $html .= ''.get_lang('SendRecord').''; $html .= ''; @@ -614,7 +614,7 @@ class Nanogong //$html .= Display::return_message(get_lang('BrowserNotSupportNanogongSend'), 'warning'); $html .= ''; $html .= ''; $html .= ''; diff --git a/main/inc/lib/plugin.class.php b/main/inc/lib/plugin.class.php index 0af1b48b7f..5096d682e8 100755 --- a/main/inc/lib/plugin.class.php +++ b/main/inc/lib/plugin.class.php @@ -180,6 +180,11 @@ class Plugin } foreach ($this->fields as $name => $type) { + $options = null; + if (is_array($type) && isset($type['type']) && $type['type'] === "select") { + $options = $type['options']; + $type = $type['type']; + } $value = $this->get($name); @@ -230,6 +235,14 @@ class Plugin $element->_attributes['value'] = 'true'; $checkboxGroup[] = $element; break; + case 'select': + $result->addElement( + $type, + $name, + array($this->get_lang($name), $help), + $options + ); + break; } } diff --git a/main/inc/lib/security.lib.php b/main/inc/lib/security.lib.php index aaf4a3fbd0..da22ea3226 100755 --- a/main/inc/lib/security.lib.php +++ b/main/inc/lib/security.lib.php @@ -446,7 +446,7 @@ class Security */ public static function filter_img_path($image_path) { - static $allowed_extensions = array('png', 'gif', 'jpg', 'jpeg'); + static $allowed_extensions = array('png', 'gif', 'jpg', 'jpeg', 'svg', 'webp'); $image_path = htmlspecialchars(trim($image_path)); // No html code is allowed. // We allow static images only, query strings are forbidden. if (strpos($image_path, '?') !== false) { diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index 5ef0572a22..a1732162d5 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -228,7 +228,13 @@ class SessionManager // add event to system log $user_id = api_get_user_id(); - Event::addEvent(LOG_SESSION_CREATE, LOG_SESSION_ID, $session_id, api_get_utc_datetime(), $user_id); + Event::addEvent( + LOG_SESSION_CREATE, + LOG_SESSION_ID, + $session_id, + api_get_utc_datetime(), + $user_id + ); } return $session_id; } @@ -1498,7 +1504,13 @@ class SessionManager Database::query($sql_delete_sfv); // Add event to system log - Event::addEvent(LOG_SESSION_DELETE, LOG_SESSION_ID, $id_checked, api_get_utc_datetime(), $userId); + Event::addEvent( + LOG_SESSION_DELETE, + LOG_SESSION_ID, + $id_checked, + api_get_utc_datetime(), + $userId + ); } /** @@ -2335,7 +2347,13 @@ class SessionManager $id_session = Database::insert_id(); // Add event to system log $user_id = api_get_user_id(); - Event::addEvent(LOG_SESSION_CATEGORY_CREATE, LOG_SESSION_CATEGORY_ID, $id_session, api_get_utc_datetime(), $user_id); + Event::addEvent( + LOG_SESSION_CATEGORY_CREATE, + LOG_SESSION_CATEGORY_ID, + $id_session, + api_get_utc_datetime(), + $user_id + ); return $id_session; } diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index c87179670d..f9b0b8460f 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -643,8 +643,12 @@ class SocialManager extends UserManager $img_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true, true); $big_image = UserManager::get_picture_user($user_id, $img_array['file'], '', USER_IMAGE_SIZE_BIG); - $big_image = $big_image['file'].'?'.uniqid(); - $normal_image = $img_array['dir'].$img_array['file'].'?'.uniqid(); + $big_image = $big_image['file']; + $normal_image = $img_array['dir'].$img_array['file']; + if (!api_get_configuration_value('gravatar_enabled')) { + $big_image .= '?'.uniqid(); + $normal_image .= '?'.uniqid(); + } //--- User image if ($img_array['file'] != 'unknown.jpg') { @@ -953,13 +957,14 @@ class SocialManager extends UserManager $status_icon = Display::span('', array('class' => 'online_user_in_text')); $user_status = $user_info['status'] == 1 ? Display::span('', array('class' => 'teacher_online')) : Display::span('', array('class' => 'student_online')); - if ($image_array['file'] == 'unknown.jpg' || !file_exists($image_array['dir'].$image_array['file'])) { + $friends_profile = UserManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_ORIGINAL); + if (($image_array['file'] == 'unknown.jpg' + || !file_exists($image_array['dir'].$image_array['file'])) && + !api_get_configuration_value('gravatar_enabled')) { $friends_profile['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_180_100.jpg'; - $img = ''.$name.''; - } else { - $friends_profile = UserManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_ORIGINAL); - $img = ''.$name.''; + } + $img = ''.$name.''; $name = ''.$status_icon.$user_status.$name.'
'; $html .= '
  • '.$img.'
    '.$name.'
  • '; } @@ -997,12 +1002,16 @@ class SocialManager extends UserManager $interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList')); $html .= '
    '; + + $sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system'); + $sysdir = $sysdir_array['dir']; + $webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web'); if (strlen(trim($user_object->picture_uri)) > 0) { - $sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system'); - $sysdir = $sysdir_array['dir']; - $webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web'); $webdir = $webdir_array['dir']; - $fullurl = $webdir.$user_object->picture_uri; + $fullurl = $webdir; + $fullurl .= api_get_configuration_value('gravatar_enabled') ? + $webdir_array['file'] : + $user_object->picture_uri; $system_image_path = $sysdir.$user_object->picture_uri; list($width, $height, $type, $attr) = @getimagesize($system_image_path); $height += 30; @@ -1016,7 +1025,9 @@ class SocialManager extends UserManager //echo ''; $html .= ''.$alt.''; } else { - $html .= Display::return_icon('unknown.jpg', get_lang('Unknown')); + $html .= api_get_configuration_value('gravatar_enabled') ? + ''.$alt.'' : + Display::return_icon('unknown.jpg', get_lang('Unknown')); } if (!empty($status)) { $html .= '
    '.$status.'
    '; @@ -1059,10 +1070,9 @@ class SocialManager extends UserManager */ public static function display_productions($user_id) { - $sysdir_array = UserManager::get_user_picture_path_by_id($user_id, 'system', true); - $sysdir = $sysdir_array['dir']; $webdir_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true); - $webdir = $webdir_array['dir']; + $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); @@ -1190,9 +1200,8 @@ class SocialManager extends UserManager $tbl_message_attach = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); // create directory - $pathUserInfo = UserManager::get_user_picture_path_by_id($userId, 'system', true); $social = '/social/'; - $pathMessageAttach = $pathUserInfo['dir'] . 'message_attachments'. $social; + $pathMessageAttach = UserManager::getUserPathById($userId, 'system').'message_attachments'.$social; $safeFileComment = Database::escape_string($fileComment); $safeFileName = Database::escape_string($fileAttach['name']); @@ -1246,6 +1255,7 @@ class SocialManager extends UserManager if (empty($start)) { $start = '0000-00-00'; } + $tblMessage = Database::get_main_table(TABLE_MESSAGE); $tblMessageAttachement = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); @@ -1254,10 +1264,10 @@ class SocialManager extends UserManager $limit = intval($limit); $sql = "SELECT id, user_sender_id,user_receiver_id, send_date, content, parent_id, - (SELECT ma.path FROM $tblMessageAttachement ma WHERE ma.message_id = tm.id ) as path, - (SELECT ma.filename FROM $tblMessageAttachement ma WHERE ma.message_id = tm.id ) as filename - FROM $tblMessage tm - WHERE user_receiver_id = $userId + (SELECT ma.path FROM $tblMessageAttachement ma WHERE ma.message_id = tm.id ) as path, + (SELECT ma.filename FROM $tblMessageAttachement ma WHERE ma.message_id = tm.id ) as filename + FROM $tblMessage tm + WHERE user_receiver_id = $userId AND send_date > '$start' "; $sql .= (empty($messageStatus) || is_null($messageStatus)) ? '' : " AND msg_status = '$messageStatus' "; $sql .= (empty($parentId) || is_null($parentId)) ? '' : " AND parent_id = '$parentId' "; @@ -1426,9 +1436,13 @@ class SocialManager extends UserManager $wallImage = ''; if (!empty($message['path'])) { $pathUserInfo = UserManager::get_user_picture_path_by_id($authorId, 'web', true); - $pathImg = $pathUserInfo['dir'] . 'message_attachments'; - $imageBig = $pathImg .self::getImagePath($message['path'], IMAGE_WALL_BIG); - $imageSmall = $pathImg. self::getImagePath($message['path'], IMAGE_WALL_SMALL); + $imageBig = $pathUserInfo['file']; + $imageSmall = $pathUserInfo['file']; + if (!api_get_configuration_value('gravatar_enabled')) { + $pathImg = UserManager::getUserPathById($authorId, 'web').'message_attachments'; + $imageBig = $pathImg .self::getImagePath($message['path'], IMAGE_WALL_BIG); + $imageSmall = $pathImg. self::getImagePath($message['path'], IMAGE_WALL_SMALL); + } $wallImage = '
    '; } @@ -1633,7 +1647,7 @@ class SocialManager extends UserManager $friendHtml.=''; } else { $friendHtml.= '
    '.get_lang('NoFriendsInYourContactList').'
    ' - .''. get_lang('TryAndFindSomeFriends').'
    '; + .' '. get_lang('TryAndFindSomeFriends').'
    '; } return $friendHtml; diff --git a/main/inc/lib/sub_language.class.php b/main/inc/lib/sub_language.class.php index 1f55dcbfd5..817802e60c 100644 --- a/main/inc/lib/sub_language.class.php +++ b/main/inc/lib/sub_language.class.php @@ -355,7 +355,11 @@ class SubLanguageManager $lang = Database::fetch_array($result); $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "' WHERE variable='platformLanguage'"; $result_2 = Database::query($sql_update_2); - Event::addEvent(LOG_PLATFORM_LANGUAGE_CHANGE, LOG_PLATFORM_LANGUAGE, $lang['english_name']); + Event::addEvent( + LOG_PLATFORM_LANGUAGE_CHANGE, + LOG_PLATFORM_LANGUAGE, + $lang['english_name'] + ); return $result_2 !== false; } diff --git a/main/inc/lib/svg-edit/extensions/imagelib/users.php b/main/inc/lib/svg-edit/extensions/imagelib/users.php index 38b4e4b235..74e633b3d6 100755 --- a/main/inc/lib/svg-edit/extensions/imagelib/users.php +++ b/main/inc/lib/svg-edit/extensions/imagelib/users.php @@ -10,11 +10,9 @@ require_once '../../../../../inc/global.inc.php'; api_protect_course_script(); api_block_anonymous_users(); -$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system'); -$user_disk_path = $my_path['dir'].'my_files/'; - -$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'web'); -$user_web_path = $my_path['dir'].'my_files/'; +$userId = api_get_user_id(); +$user_disk_path = UserManager::getUserPathById($userId, 'system').'my_files/'; +$user_web_path = UserManager::getUserPathById($userId, 'web').'my_files/'; //get all files and folders $scan_files = scandir($user_disk_path); diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 93403c40af..1b944dce36 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -885,6 +885,35 @@ class Template 'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1) ); //} + + $socialMeta = ''; + $metaTitle = api_get_setting('meta_title'); + if (!empty($metaTitle)) { + $socialMeta .= '' . "\n"; + $socialMeta .= '' . "\n"; + $socialMeta .= '' . "\n"; + $metaDescription = api_get_setting('meta_description'); + if (!empty($metaDescription)) { + $socialMeta .= '' . "\n"; + } + $metaSite = api_get_setting('meta_twitter_site'); + if (!empty($metaSite)) { + $socialMeta .= '' . "\n"; + $metaCreator = api_get_setting('meta_twitter_creator'); + if (!empty($metaCreator)) { + $socialMeta .= '' . "\n"; + } + } + $metaImage = api_get_setting('meta_image_path'); + if (!empty($metaImage)) { + if (is_file(api_get_path(SYS_PATH) . $metaImage)) { + $path = api_get_path(WEB_PATH) . $metaImage; + $socialMeta .= '' . "\n"; + } + } + } + + $this->assign('social_meta', $socialMeta); } /** diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 041f47a245..21d15c9b8d 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -474,8 +474,20 @@ class UserManager // Add event to system log $user_id_manager = api_get_user_id(); - Event::addEvent(LOG_USER_DELETE, LOG_USER_ID, $user_id, api_get_utc_datetime(), $user_id_manager, null, $user_info); - Event::addEvent(LOG_USER_DELETE, LOG_USER_OBJECT, $user_info, api_get_utc_datetime(), $user_id_manager, null, $user_info); + Event::addEvent( + LOG_USER_DELETE, + LOG_USER_ID, + $user_id, + api_get_utc_datetime(), + $user_id_manager + ); + Event::addEvent( + LOG_USER_DELETE, + LOG_USER_OBJECT, + $user_info, + api_get_utc_datetime(), + $user_id_manager + ); return true; } @@ -530,7 +542,7 @@ class UserManager $sql = "UPDATE $table_user SET active = 0 WHERE user_id IN ($ids)"; $r = Database::query($sql); if ($r !== false) { - Event::addEvent(LOG_USER_DISABLE,LOG_USER_ID,$ids); + Event::addEvent(LOG_USER_DISABLE, LOG_USER_ID, $ids); } return $r; } @@ -790,7 +802,7 @@ class UserManager $ev = LOG_USER_ENABLE; } if ($r !== false) { - Event::addEvent($ev,LOG_USER_ID,$user_id); + Event::addEvent($ev, LOG_USER_ID, $user_id); } return $r; } @@ -798,6 +810,7 @@ class UserManager /** * Disables a user * @param int User id + * @return bool * @uses UserManager::change_active_state() to actually disable the user * @assert (0) === false */ @@ -807,11 +820,13 @@ class UserManager return false; } self::change_active_state($user_id, 0); + return true; } /** * Enable a user * @param int User id + * @return bool * @uses UserManager::change_active_state() to actually disable the user * @assert (0) === false */ @@ -821,6 +836,7 @@ class UserManager return false; } self::change_active_state($user_id, 1); + return true; } /** @@ -1219,10 +1235,10 @@ class UserManager default: // Base: empty, the result path below will be relative. $base = ''; } - + $gravatarEnabled = api_get_configuration_value('gravatar_enabled'); $noPicturePath = array('dir' => $base.'img/', 'file' => 'unknown.jpg'); - if (empty($id) || empty($type)) { + if ((empty($id) || empty($type)) && !$gravatarEnabled) { return $anonymous ? $noPicturePath : array('dir' => '', 'file' => ''); } @@ -1232,7 +1248,7 @@ class UserManager $sql = "SELECT email, picture_uri FROM $user_table WHERE user_id=".$user_id; $res = Database::query($sql); - if (!Database::num_rows($res)) { + if (!Database::num_rows($res) && !$gravatarEnabled) { return $anonymous ? $noPicturePath : array('dir' => '', 'file' => ''); } @@ -1250,27 +1266,23 @@ class UserManager $dir = $base.$userPath; } - if (empty($picture_filename) || - (!empty($picture_filename) && !file_exists($systemImagePath.$picture_filename)) - ) { - if ($anonymous) { - return $noPicturePath; - } + if ($gravatarEnabled) { + $avatarSize = api_getimagesize($noPicturePath['dir'].$noPicturePath['file']); + $avatarSize = $avatarSize['width'] > $avatarSize['height'] ? + $avatarSize['width'] : + $avatarSize['height']; + return array( + 'dir' => '', + 'file' => self::getGravatar( + $user['email'], + $avatarSize, + api_get_configuration_value('gravatar_type') + ) + ); + } - if (api_get_configuration_value('gravatar_enabled')) { - $avatarSize = api_getimagesize($noPicturePath['dir'].$noPicturePath['file']); - $avatarSize = $avatarSize['width'] > $avatarSize['height'] ? - $avatarSize['width'] : - $avatarSize['height']; - return array( - 'dir' => '', - 'file' => self::getGravatar( - $user['email'], - $avatarSize, - api_get_configuration_value('gravatar_type') - ) - ); - } + if (empty($picture_filename) && $anonymous) { + return $noPicturePath; } return array('dir' => $dir, 'file' => $picture_filename); @@ -1989,7 +2001,11 @@ class UserManager if ($result) { //echo "id returned"; $return = Database::insert_id(); - Event::addEvent(LOG_USER_FIELD_CREATE, LOG_USER_FIELD_VARIABLE, Database::escape_string($fieldvarname)); + Event::addEvent( + LOG_USER_FIELD_CREATE, + LOG_USER_FIELD_VARIABLE, + $fieldvarname + ); } else { //echo "false - failed" ; return false; @@ -3232,6 +3248,7 @@ class UserManager */ public static function get_picture_user($user_id, $picture_file, $height, $size_picture = USER_IMAGE_SIZE_MEDIUM, $style = '') { + $gravatarEnabled = api_get_configuration_value('gravatar_enabled'); $picture = array(); $picture['style'] = $style; if ($picture_file == 'unknown.jpg') { @@ -3246,7 +3263,9 @@ class UserManager break; } $picture['file'] = api_get_path(WEB_CODE_PATH).'img/'.$picture_file; - return $picture; + if (!$gravatarEnabled) { + return $picture; + } } switch ($size_picture) { @@ -3304,6 +3323,9 @@ class UserManager } } } + if ($gravatarEnabled) { + $picture['file'] = $image_array['file']; + } return $picture; } @@ -5275,4 +5297,35 @@ EOF; } return $url; } + + /** + * Get user path from user ID (returns an array). + * The return format is a complete path to a folder ending with "/" + * @param integer User ID + * @param string Optional. Type of path to return (can be 'system', 'rel', 'web') + * @return string User folder path (i.e. /var/www/chamilo/main/upload/users/1/1/) + */ + public static function getUserPathById($id, $type = null) + { + $user_id = intval($id); + if (!$user_id) { + return null; + } + $userPath = "upload/users/$user_id/"; + if (api_get_setting('split_users_upload_directory') === 'true') { + $userPath = 'upload/users/'.substr((string) $user_id, 0, 1).'/'.$user_id.'/'; + } + switch ($type) { + case 'system': // Base: absolute system path. + $userPath = api_get_path(SYS_CODE_PATH).$userPath; + break; + case 'rel': // Base: semi-absolute web path (no server base). + $userPath = api_get_path(REL_CODE_PATH).$userPath; + break; + case 'web': // Base: absolute web path. + $userPath = api_get_path(WEB_CODE_PATH).$userPath; + break; + } + return $userPath; + } } diff --git a/main/install/database.sql b/main/install/database.sql index a8dd017138..3d54dc6c8b 100644 --- a/main/install/database.sql +++ b/main/install/database.sql @@ -376,59 +376,63 @@ LOCK TABLES language WRITE; INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('العربية','arabic','ar','arabic',0), ('Asturianu','asturian','ast','asturian',0), +('Euskara','basque','eu','basque',1), ('বাংলা','bengali','bn','bengali',0), -('Български','bulgarian','bg','bulgarian',1), ('Bosanski','bosnian','bs','bosnian',1), +('Português do Brasil','brazilian','pt-BR','brazilian',1), +('Български','bulgarian','bg','bulgarian',1), ('Català','catalan','ca','catalan',0), -('中文(简体)','simpl_chinese','zh','simpl_chinese',0), -('繁體中文','trad_chinese','zh-TW','trad_chinese',0), +('Hrvatski','croatian','hr','croatian',0), ('Česky','czech','cs','czech',0), ('Dansk','danish','da','danish',0), ('دری','dari','prs','dari',0), -('Deutsch','german','de','german',1), -('Ελληνικά','greek','el','greek',0), +('Nederlands','dutch','nl','dutch',1), ('English','english','en','english',1), -('Español','spanish','es','spanish',1), ('Esperanto','esperanto','eo','esperanto',0), -('Euskara','basque','eu','basque',0), -('فارسی','persian','fa','persian',0), +('Føroyskt', 'faroese', 'fo', 'faroese', 0), +('Suomi','finnish','fi','finnish',0), ('Français','french','fr','french',1), ('Furlan','friulian','fur','friulian',0), -('Galego','galician','gl','galician',0), +('Galego','galician','gl','galician',1), ('ქართული','georgian','ka','georgian',0), -('Hrvatski','croatian','hr','croatian',0), +('Deutsch','german','de','german',1), +('Ελληνικά','greek','el','greek',1), ('עברית','hebrew','he','hebrew',0), ('हिन्दी','hindi','hi','hindi',0), +('Magyar','hungarian','hu','hungarian',1), ('Bahasa Indonesia','indonesian','id','indonesian',1), ('Italiano','italian','it','italian',1), +('日本語','japanese','ja','japanese',0), ('한국어','korean','ko','korean',0), -('Latviešu','latvian','lv','latvian',0), +('Latviešu','latvian','lv','latvian',1), ('Lietuvių','lithuanian','lt','lithuanian',0), ('Македонски','macedonian','mk','macedonian',0), -('Magyar','hungarian','hu','hungarian',1), ('Bahasa Melayu','malay','ms','malay',0), -('Nederlands','dutch','nl','dutch',1), -('日本語','japanese','ja','japanese',0), ('Norsk','norwegian','no','norwegian',0), ('Occitan','occitan','oc','occitan',0), ('پښتو','pashto','ps','pashto',0), -('Polski','polish','pl','polish',0), +('فارسی','persian','fa','persian',0), +('Polski','polish','pl','polish',1), ('Português europeu','portuguese','pt','portuguese',1), -('Português do Brasil','brazilian','pt-BR','brazilian',1), -('Română','romanian','ro','romanian',0), ('Runasimi','quechua_cusco','qu','quechua_cusco',0), +('Română','romanian','ro','romanian',0), ('Русский','russian','ru','russian',0), -('Slovenčina','slovak','sk','slovak',0), +('Srpski','serbian','sr','serbian',0), +('中文(简体)','simpl_chinese','zh','simpl_chinese',0), +('Slovenčina','slovak','sk','slovak',1), ('Slovenščina','slovenian','sl','slovenian',1), ('الصومالية','somali','so','somali',0), -('Srpski','serbian','sr','serbian',0), -('Suomi','finnish','fi','finnish',0), +('Español','spanish','es','spanish',1), +('Kiswahili','swahili','sw','swahili',0), ('Svenska','swedish','sv','swedish',0), +('Tagalog', 'tagalog', 'tl', 'tagalog',1), ('ไทย','thai','th','thai',0), +('Tibetan', 'tibetan', 'bo', 'tibetan', 0), +('繁體中文','trad_chinese','zh-TW','trad_chinese',0), ('Türkçe','turkish','tr','turkish',0), ('Українська','ukrainian','uk','ukrainian',0), ('Tiếng Việt','vietnamese','vi','vietnamese',0), -('Kiswahili','swahili','sw','swahili',0), +('isiXhosa', 'xhosa', 'xh', 'xhosa', 0), ('Yorùbá','yoruba','yo','yoruba',0); -- The chosen during the installation platform language should be enabled. @@ -886,6 +890,11 @@ VALUES ('prevent_session_admins_to_manage_all_users', NULL, 'radio', 'Session', 'false', 'PreventSessionAdminsToManageAllUsersTitle', 'PreventSessionAdminsToManageAllUsersComment', NULL, NULL, 1), ('documents_default_visibility_defined_in_course', NULL,'radio','Tools','false','DocumentsDefaultVisibilityDefinedInCourseTitle','DocumentsDefaultVisibilityDefinedInCourseComment',NULL, NULL, 1), ('enabled_mathjax', NULL, 'radio', 'Editor', 'false', 'EnableMathJaxTitle', 'EnableMathJaxComment', NULL, NULL, 0), +('meta_twitter_site', NULL, 'textfield', 'Tracking', '', 'MetaTwitterSiteTitle', 'MetaTwitterSiteComment', NULL, NULL, 1), +('meta_twitter_creator', NULL, 'textfield', 'Tracking', '', 'MetaTwitterCreatorTitle', 'MetaTwitterCreatorComment', NULL, NULL, 1), +('meta_title', NULL, 'textfield', 'Tracking', '', 'MetaTitleTitle', 'MetaTitleComment', NULL, NULL, 1), +('meta_description', NULL, 'textfield', 'Tracking', '', 'MetaDescriptionTitle', 'MetaDescriptionComment', NULL, NULL, 1), +('meta_image_path', NULL, 'textfield', 'Tracking', '', 'MetaImagePathTitle', 'MetaImagePathComment', NULL, NULL, 1), ('chamilo_database_version', NULL, 'textfield',NULL, '0', 'DatabaseVersion','', NULL, NULL, 0); UNLOCK TABLES; /*!40000 ALTER TABLE settings_current ENABLE KEYS */; diff --git a/main/install/update-files-1.9.0-1.10.0.inc.php b/main/install/update-files-1.9.0-1.10.0.inc.php index fec171a820..463a0deedd 100644 --- a/main/install/update-files-1.9.0-1.10.0.inc.php +++ b/main/install/update-files-1.9.0-1.10.0.inc.php @@ -137,10 +137,11 @@ if (defined('SYSTEM_INSTALLATION')) { ); $list = scandir($langPath); foreach ($list as $entry) { - if (is_dir($langPath.$entry) && in_array($entry, $officialLanguages)) { + if (is_dir($langPath . $entry) && in_array($entry, $officialLanguages) + ) { foreach ($filesToDelete as $file) { - if (is_file($langPath.$entry.'/'.$file.'.inc.php')) { - unlink($langPath.$entry.'/'.$file.'.inc.php'); + if (is_file($langPath . $entry . '/' . $file . '.inc.php')) { + unlink($langPath . $entry . '/' . $file . '.inc.php'); } } } @@ -148,6 +149,11 @@ if (defined('SYSTEM_INSTALLATION')) { // Remove the "main/conference/" directory that wasn't used since years long // past - see rrmdir function declared below @rrmdir(api_get_path(SYS_CODE_PATH).'conference'); + // Other files that we renamed + // events.lib.inc.php has been renamed to events.lib.php + if (is_file(api_get_path(LIBRARY_PATH).'events.lib.inc.php')) { + @unlink(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); + } } else { echo 'You are not allowed here !'. __FILE__; diff --git a/main/messages/download.php b/main/messages/download.php index b3b60933f0..f77f28fc72 100755 --- a/main/messages/download.php +++ b/main/messages/download.php @@ -78,7 +78,7 @@ if ($not_allowed_to_edit) { if (!empty($row_users['group_id'])) { $path_user_info = GroupPortalManager::get_group_picture_path_by_id($row_users['group_id'], 'system', true); } else { - $path_user_info = UserManager::get_user_picture_path_by_id($message_uid, 'system', true); + $path_user_info['dir'] = UserManager::getUserPathById($message_uid, 'system'); } $full_file_name = $path_user_info['dir'].'message_attachments/'.$file_url; diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 1044c5a504..6cb063b843 100755 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -461,6 +461,7 @@ if (!empty($student_id)) { echo ''; echo ''; + $gravatarEnabled = api_get_configuration_value('gravatar_enabled'); $image_array = UserManager :: get_user_picture_path_by_id($user_info['user_id'], 'web', false, true); echo '
    '; @@ -470,8 +471,13 @@ if (!empty($student_id)) { $big_image_size = api_getimagesize($big_image); $big_image_width = $big_image_size['width']; $big_image_height = $big_image_size['height']; - $url_big_image = $big_image . '?rnd=' . time(); - $img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . + $url_big_image = $image_file; + if (!$gravatarEnabled) { + $url_big_image = $big_image.'?rnd=' . time(); + $image_file .= '?rnd=' . time(); + } + + $img_attributes = 'src="' . $image_file . '" ' . 'alt="' . $user_info['complete_name']. '" ' . 'style="float:' . ($text_dir == 'rtl' ? 'right' : 'left') . '; padding:5px;" '; diff --git a/main/social/friends.php b/main/social/friends.php index 701da12666..6345e70c10 100755 --- a/main/social/friends.php +++ b/main/social/friends.php @@ -99,7 +99,7 @@ $social_right_content = '
    '; if (count($friends) == 0) { $social_right_content .= get_lang('NoFriendsInYourContactList').'

    '; - $social_right_content .= ''.get_lang('TryAndFindSomeFriends').''; + $social_right_content .= ''.get_lang('TryAndFindSomeFriends').''; } else { $social_right_content .= get_lang('Search').'   :   '; $social_right_content .= ''; diff --git a/main/social/groups.php b/main/social/groups.php index 0b3c7363cb..f22df53ec7 100755 --- a/main/social/groups.php +++ b/main/social/groups.php @@ -331,10 +331,10 @@ if ($group_id != 0) { ) ) ) { - $social_right_content .= '' . get_lang('JoinGroup') . ''; } elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) { - $social_right_content .= '' . get_lang('YouHaveBeenInvitedJoinNow') . ''; } $social_right_content .= '

    '; @@ -447,10 +447,10 @@ if ($group_id != 0) { ) ) ) { - $social_right_content .= '' . get_lang('JoinGroup') . ''; } elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) { - $social_right_content .= '' . get_lang('YouHaveBeenInvitedJoinNow') . ''; } } @@ -618,7 +618,7 @@ if ($group_id != 0) { //Avoiding my groups $join_url = ''; if (!in_array($id, $my_group_list)) { - $join_url = '' . get_lang('JoinGroup') . ' '; } @@ -705,7 +705,7 @@ if ($group_id != 0) { $join_url = ''; if (!in_array($id, $my_group_list)) { - $join_url = '' . get_lang('JoinGroup') . ' '; } $item_4 = '
    ' . $join_url . '
    '; @@ -740,7 +740,7 @@ if ($group_id != 0) { 'allow_students_to_create_groups_in_social' ) == 'true' ) { - $create_group_item = '' . get_lang( 'CreateASocialGroup' @@ -748,7 +748,7 @@ if ($group_id != 0) { //$my_group_content = $create_group_item. $my_group_content; } else { if (api_is_allowed_to_edit(null, true)) { - $create_group_item = '' . get_lang( 'CreateASocialGroup' @@ -816,7 +816,7 @@ if ($group_id != 0) { 'allow_students_to_create_groups_in_social' ) == 'true' ) { - $create_group_item = '' . get_lang( 'CreateASocialGroup' @@ -824,7 +824,7 @@ if ($group_id != 0) { //$my_group_content = $create_group_item. $my_group_content; } else { if (api_is_allowed_to_edit(null, true)) { - $create_group_item = '' . get_lang( 'CreateASocialGroup' diff --git a/main/social/profile.php b/main/social/profile.php index 9088d58063..9810ac292d 100755 --- a/main/social/profile.php +++ b/main/social/profile.php @@ -662,7 +662,7 @@ if ($show_full_profile) { ); $invitations .= '
    '; $invitations .= '
    ' + .' class="btn btn-default" onclick="register_friend(this)" href="javascript:void(0)">' .get_lang('SocialAddToFriends') .''; $invitations .= '
    '; diff --git a/main/template/default/agenda/event_list.tpl b/main/template/default/agenda/event_list.tpl index 4af213398e..682dc92408 100755 --- a/main/template/default/agenda/event_list.tpl +++ b/main/template/default/agenda/event_list.tpl @@ -44,12 +44,12 @@ {% if is_allowed_to_edit %}
    {% if event.visibility == 1 %} - + {% else %} {% if event.type == 'course' or event.type == 'session' %} - + {% endif %} diff --git a/main/template/default/auth/courses_list.php b/main/template/default/auth/courses_list.php index 7671c6f44a..4255f807ba 100755 --- a/main/template/default/auth/courses_list.php +++ b/main/template/default/auth/courses_list.php @@ -162,7 +162,7 @@ if (!empty($user_course_categories)) {
    ')) return false"> -
    @@ -262,7 +262,7 @@ if (!empty($courses_without_category)) {
    ')) return false;"> -
    diff --git a/main/template/default/auth/sessions_catalog.tpl b/main/template/default/auth/sessions_catalog.tpl index c4e1428b79..4f680328d2 100644 --- a/main/template/default/auth/sessions_catalog.tpl +++ b/main/template/default/auth/sessions_catalog.tpl @@ -73,7 +73,7 @@ {% endif %} {% if coursesCategoriesList is not empty %} - {{ 'RandomPick' | get_lang }} + {{ 'RandomPick' | get_lang }} {% endif %} diff --git a/main/template/default/course_description/edit.tpl b/main/template/default/course_description/edit.tpl index 72339f9be5..6c2b68841f 100755 --- a/main/template/default/course_description/edit.tpl +++ b/main/template/default/course_description/edit.tpl @@ -7,7 +7,7 @@ {% if is_allowed_to_edit %}
    diff --git a/main/template/default/layout/course_navigation.tpl b/main/template/default/layout/course_navigation.tpl index de993570c2..e49d1cbb11 100755 --- a/main/template/default/layout/course_navigation.tpl +++ b/main/template/default/layout/course_navigation.tpl @@ -55,7 +55,7 @@ createCookie('menu_state',0,10); } } - document.write(''); + document.write(''); {{ show_course_navigation_menu }} {% endif %} diff --git a/main/template/default/layout/head.tpl b/main/template/default/layout/head.tpl index 239a099e50..43b1c6f9ae 100755 --- a/main/template/default/layout/head.tpl +++ b/main/template/default/layout/head.tpl @@ -12,6 +12,7 @@ {# Improve usability in portal devices #} {{ title_string }} +{{ social_meta }} {{ css_static_file_to_string }} {{ js_file_to_string }}