Merge 1.10.x

1.10.x
Julio Montoya 10 years ago
commit 28ed19d76b
  1. 2
      custompages/registration-dist.php
  2. 8
      index.php
  3. 16
      main/admin/configure_homepage.php
  4. 16
      main/admin/settings.lib.php
  5. 11
      main/admin/user_edit.php
  6. 16
      main/auth/courses_controller.php
  7. 2
      main/auth/lostPassword.php
  8. 14
      main/auth/profile.php
  9. 4
      main/chat/chat_functions.lib.php
  10. 5
      main/chat/chat_whoisonline.php
  11. 2
      main/course_info/delete_course.php
  12. 3
      main/course_info/maintenance.php
  13. 4
      main/coursecopy/import_backup.php
  14. 13
      main/css/base.css
  15. 4
      main/document/showinframes.php
  16. 2
      main/exercice/exercise.class.php
  17. 4
      main/exercice/qti2.php
  18. 12
      main/exercice/question_list_admin.inc.php
  19. 2
      main/forum/forumqualify.php
  20. 7
      main/gradebook/lib/fe/displaygradebook.php
  21. 6
      main/gradebook/user_info.php
  22. 4
      main/group/group_space.php
  23. 4
      main/help/help.php
  24. 28
      main/inc/ajax/model.ajax.php
  25. 2
      main/inc/ajax/social.ajax.php
  26. 7
      main/inc/course_document.inc.php
  27. 2
      main/inc/lib/add_course.lib.inc.php
  28. 4
      main/inc/lib/api.lib.php
  29. 16
      main/inc/lib/career.lib.php
  30. 14
      main/inc/lib/certificate.lib.php
  31. 9
      main/inc/lib/course.lib.php
  32. 25
      main/inc/lib/display.lib.php
  33. 68
      main/inc/lib/events.lib.php
  34. 6
      main/inc/lib/extra_field_value.lib.php
  35. 81
      main/inc/lib/group_portal_manager.lib.php
  36. 33
      main/inc/lib/hook/HookResubscribe.php
  37. 21
      main/inc/lib/hook/interfaces/HookResubscribeEventInterface.php
  38. 20
      main/inc/lib/hook/interfaces/HookResubscribeObserverInterface.php
  39. 4
      main/inc/lib/message.lib.php
  40. 4
      main/inc/lib/nanogong.lib.php
  41. 13
      main/inc/lib/plugin.class.php
  42. 2
      main/inc/lib/security.lib.php
  43. 24
      main/inc/lib/sessionmanager.lib.php
  44. 48
      main/inc/lib/social.lib.php
  45. 6
      main/inc/lib/sub_language.class.php
  46. 8
      main/inc/lib/svg-edit/extensions/imagelib/users.php
  47. 29
      main/inc/lib/template.lib.php
  48. 81
      main/inc/lib/usermanager.lib.php
  49. 51
      main/install/database.sql
  50. 8
      main/install/update-files-1.9.0-1.10.0.inc.php
  51. 2
      main/messages/download.php
  52. 8
      main/mySpace/myStudents.php
  53. 2
      main/social/friends.php
  54. 20
      main/social/groups.php
  55. 2
      main/social/profile.php
  56. 4
      main/template/default/agenda/event_list.tpl
  57. 4
      main/template/default/auth/courses_list.php
  58. 2
      main/template/default/auth/sessions_catalog.tpl
  59. 2
      main/template/default/course_description/edit.tpl
  60. 2
      main/template/default/layout/course_navigation.tpl
  61. 1
      main/template/default/layout/head.tpl
  62. 2
      main/template/default/learnpath/record_voice.tpl
  63. 4
      main/template/default/skill/drh_report.tpl
  64. 2
      main/template/default/skill/profile.tpl
  65. 4
      main/template/default/skill/skill_tree.tpl
  66. 2
      main/template/default/skill/skill_wheel.tpl
  67. 2
      main/template/default/skill/skill_wheel_student.tpl
  68. 4
      main/user/user.php
  69. 7
      main/user/userInfo.php
  70. 27
      main/wiki/wiki.inc.php
  71. 2
      plugin/add_cas_login_button/template.tpl
  72. 2
      plugin/add_cas_logout_button/template.tpl
  73. 2
      plugin/add_shibboleth_login_button/template.tpl
  74. 2
      plugin/bbb/listing.tpl
  75. 8
      plugin/buycourses/view/index.tpl
  76. 2
      plugin/openmeetings/listing.tpl
  77. 4
      plugin/resubscription/README.md
  78. 9
      plugin/resubscription/config.php
  79. 8
      plugin/resubscription/index.php
  80. 10
      plugin/resubscription/install.php
  81. 13
      plugin/resubscription/lang/english.php
  82. 13
      plugin/resubscription/lang/spanish.php
  83. 10
      plugin/resubscription/plugin.php
  84. 2
      plugin/resubscription/readme.txt
  85. 105
      plugin/resubscription/src/HookResubscription.php
  86. 78
      plugin/resubscription/src/Resubscription.php
  87. 10
      plugin/resubscription/uninstall.php
  88. 2
      plugin/search_course/lib/search_course_widget.class.php
  89. 20
      src/Chamilo/CoreBundle/Component/Editor/Driver/PersonalDriver.php
  90. 6
      tests/main/inc/lib/events.lib.inc.test.php

@ -41,7 +41,7 @@ $form_template = <<<EOT
<div class="clear"> <div class="clear">
&nbsp; &nbsp;
</div> </div>
<p><a href="#" class="btn" onclick="$('#registration-form').submit()"><span>S'inscrire</span></a></p> <p><a href="#" class="btn btn-primary" onclick="$('#registration-form').submit()"><span>S'inscrire</span></a></p>
</form> </form>
EOT; EOT;

@ -49,7 +49,13 @@ $_setting['display_courses_to_anonymous_users'] = 'true';
*/ */
if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) { if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) {
$i = api_get_anonymous_id(); $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.'; echo 'Attempted breakin - sysadmins notified.';
session_destroy(); session_destroy();
die(); die();

@ -323,7 +323,13 @@ if (!empty($action)) {
fputs($fp, "<b>$notice_title</b><br />\n$notice_text"); fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
fclose($fp); 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; break;
case 'edit_news': case 'edit_news':
//Filter //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; break;
case 'insert_tabs': case 'insert_tabs':
case 'edit_tabs': case 'edit_tabs':

@ -765,7 +765,13 @@ function handle_templates() {
// Add event to the system log. // Add event to the system log.
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$category = $_GET['category']; $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 { } else {
if ($action == 'delete' && is_numeric($_GET['id'])) { if ($action == 'delete' && is_numeric($_GET['id'])) {
delete_template($_GET['id']); delete_template($_GET['id']);
@ -773,7 +779,13 @@ function handle_templates() {
// Add event to the system log // Add event to the system log
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$category = $_GET['category']; $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(); display_templates();
} }

@ -429,6 +429,8 @@ if ($error_drh) {
$message = Display::return_message($err_msg, 'error'); $message = Display::return_message($err_msg, 'error');
} }
$gravatarEnabled = api_get_configuration_value('gravatar_enabled');
// USER PICTURE // USER PICTURE
$image_path = UserManager::get_user_picture_path_by_id($user_id,'web'); $image_path = UserManager::get_user_picture_path_by_id($user_id,'web');
$image_dir = $image_path['dir']; $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_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown.jpg');
$image_size = api_getimagesize($image_file); $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']).'" ' .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; padding:5px;" '; .'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_size = api_getimagesize($big_image);
$big_image_width = $big_image_size['width']; $big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height']; $big_image_height = $big_image_size['height'];
$url_big_image = $image_file;
if (!$gravatarEnabled) {
$url_big_image = $big_image.'?rnd='.time(); $url_big_image = $big_image.'?rnd='.time();
}
$content = null; $content = null;
if ($image == '') { if ($image == '') {

@ -498,9 +498,23 @@ class CoursesController
api_get_path(WEB_CODE_PATH)."inc/email_editor.php?action=subscribe_me_to_session&session=". api_get_path(WEB_CODE_PATH)."inc/email_editor.php?action=subscribe_me_to_session&session=".
Security::remove_XSS($sessionData); 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', '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;
} }
/** /**

@ -75,7 +75,7 @@ if (api_get_setting('allow_lostpassword') == 'false') {
if (isset($_GET['reset']) && isset($_GET['id'])) { if (isset($_GET['reset']) && isset($_GET['id'])) {
$message = Display::return_message(Login::reset_password($_GET["reset"], $_GET["id"], true), 'normal', false); $message = Display::return_message(Login::reset_password($_GET["reset"], $_GET["id"], true), 'normal', false);
$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/lostPassword.php" class="btn" >'.get_lang('Back').'</a>'; $message .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/lostPassword.php" class="btn btn-back" >'.get_lang('Back').'</a>';
echo $message; echo $message;
} else { } else {
$form = new FormValidator('lost_password'); $form = new FormValidator('lost_password');

@ -323,8 +323,7 @@ function is_profile_editable() {
* @return The filename of the new production or FALSE if the upload has failed * @return The filename of the new production or FALSE if the upload has failed
*/ */
function upload_user_production($user_id) { function upload_user_production($user_id) {
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'system'); $production_repository = UserManager::getUserPathById($user_id, 'system');
$production_repository = $image_path['dir'];
if (!file_exists($production_repository)) { if (!file_exists($production_repository)) {
@mkdir($production_repository, api_get_permissions_for_new_directories(), true); @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)); Display::addFlash(Display :: return_message($warning_msg, 'warning', false));
} }
$gravatarEnabled = api_get_configuration_value('gravatar_enabled');
// User picture size is calculated from SYSTEM path // 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 = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system', false, true);
$image_syspath['dir'].$image_syspath['file']; $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_dir = $image_path['dir'];
$image = $image_path['file']; $image = $image_path['file'];
$image_file = $image_dir.$image; $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']).'" ' .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; margin-top:0px;padding:5px;" '; .'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_size = api_getimagesize($big_image);
$big_image_width = $big_image_size['width']; $big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height']; $big_image_height = $big_image_size['height'];
$url_big_image = $image_file;
if (!$gravatarEnabled) {
$url_big_image = $big_image.'?rnd='.time(); $url_big_image = $big_image.'?rnd='.time();
}
$show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false; $show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false;
$tpl = new Template(get_lang('ModifyProfile')); $tpl = new Template(get_lang('ModifyProfile'));

@ -222,6 +222,10 @@ function saveMessage($message, $userId, $_course, $session_id, $group_id, $previ
$userPhoto = $userImage['dir'].$userImage['file']; $userPhoto = $userImage['dir'].$userImage['file'];
} }
if (api_get_configuration_value('gravatar_enabled')) {
$userPhoto = $userImage['file'];
}
$filePhoto = '<img class="chat-image" src="'.$userPhoto.'"/>'; $filePhoto = '<img class="chat-image" src="'.$userPhoto.'"/>';
if ($isMaster) { if ($isMaster) {

@ -123,6 +123,11 @@ if (!empty($course)) {
} else { } else {
$fileUrl = $userImage['dir'].$userImage['file']; $fileUrl = $userImage['dir'].$userImage['file'];
} }
if (api_get_configuration_value('gravatar_enabled')) {
$fileUrl = $userImage['file'];
}
$email = $user['email']; $email = $user['email'];
$url_user_profile=api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user['user_id'].'&'; $url_user_profile=api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user['user_id'].'&';
?> ?>

@ -44,7 +44,7 @@ if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
$message = '<h3>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h3>'; $message = '<h3>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h3>';
$message .= '<p>'.get_lang('ByDel').'</p>'; $message .= '<p>'.get_lang('ByDel').'</p>';
$message .= '<p><a class="btn btn-primary" href="'.api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq().'">'. $message .= '<p><a class="btn btn-primary" href="'.api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq().'">'.
get_lang('No').'</a>&nbsp;<a class="btn" href="'.api_get_self().'?delete=yes&'.api_get_cidreq().'">'. get_lang('No').'</a>&nbsp;<a class="btn btn-danger" href="'.api_get_self().'?delete=yes&'.api_get_cidreq().'">'.
get_lang('Yes').'</a></p>'; get_lang('Yes').'</a></p>';
$interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance')); $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
} }

@ -35,9 +35,6 @@ echo Display::page_header($nameTools);
<div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang('CopyCourse')); ?>&nbsp;&nbsp;<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CopyCourse'); ?></a></div> <div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang('CopyCourse')); ?>&nbsp;&nbsp;<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CopyCourse'); ?></a></div>
<div class="sectioncomment"><?php echo get_lang('DescriptionCopyCourse'); ?></div> <div class="sectioncomment"><?php echo get_lang('DescriptionCopyCourse'); ?></div>
<div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang('CopySurvey')); ?>&nbsp;&nbsp;<a href="../survey/copy_survey.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CopySurvey'); ?></a></div>
<div class="sectioncomment"><?php echo get_lang('DescriptionCopySurvey'); ?></div>
<div class="sectiontitle"><?php Display::display_icon('tool_delete.gif', get_lang('recycle_course')); ?>&nbsp;&nbsp;<a href="../coursecopy/recycle_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('recycle_course'); ?></a></div> <div class="sectiontitle"><?php Display::display_icon('tool_delete.gif', get_lang('recycle_course')); ?>&nbsp;&nbsp;<a href="../coursecopy/recycle_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('recycle_course'); ?></a></div>
<div class="sectioncomment"><?php echo get_lang('DescriptionRecycleCourse'); ?></div> <div class="sectioncomment"><?php echo get_lang('DescriptionRecycleCourse'); ?></div>

@ -137,10 +137,10 @@ if (Security::check_token('post') && (
CourseSelectForm::display_form($course, $hiddenFields); CourseSelectForm::display_form($course, $hiddenFields);
} elseif ($filename === false) { } elseif ($filename === false) {
Display::display_error_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin')); Display::display_error_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'));
echo '<a class="btn" href="import_backup.php?' . api_get_cidreq() . '">' . get_lang('TryAgain') . '</a>'; echo '<a class="btn btn-default" href="import_backup.php?' . api_get_cidreq() . '">' . get_lang('TryAgain') . '</a>';
} else { } else {
Display::display_warning_message(get_lang('NoResourcesInBackupFile')); Display::display_warning_message(get_lang('NoResourcesInBackupFile'));
echo '<a class="btn" href="import_backup.php?' . api_get_cidreq() . '">' . get_lang('TryAgain') . '</a>'; echo '<a class="btn btn-default" href="import_backup.php?' . api_get_cidreq() . '">' . get_lang('TryAgain') . '</a>';
} }
} else { } else {
$user = api_get_user_info(); $user = api_get_user_info();

@ -2672,6 +2672,7 @@ div.admin_section h4 {
float:left; float:left;
line-height: 16px; line-height: 16px;
padding-top: 5px; padding-top: 5px;
margin: 0;
} }
.ribbon .rib-total { .ribbon .rib-total {
@ -3774,7 +3775,7 @@ a:active{
height: 20px; height: 20px;
width: 20px; width: 20px;
position:absolute; 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 { .online_user {
@ -3793,21 +3794,21 @@ a:active{
margin-right: 4px; margin-right: 4px;
} }
.send_msg_in_text { .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; height: 16px;
width: 17px; width: 17px;
display: inline-block; display: inline-block;
margin-right: 4px; margin-right: 4px;
} }
.send_inv_in_text { .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; height: 16px;
width: 17px; width: 17px;
display: inline-block; display: inline-block;
margin-right: 4px; margin-right: 4px;
} }
.teacher_online { .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; height: 16px;
width: 17px; width: 17px;
display: inline-block; display: inline-block;
@ -3815,7 +3816,7 @@ a:active{
} }
.student_online { .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; height: 16px;
width: 17px; width: 17px;
display: inline-block; display: inline-block;
@ -3827,7 +3828,7 @@ a:active{
} }
.offline_user_in_text { .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; height: 16px;
width: 17px; width: 17px;
display: inline-block; display: inline-block;

@ -329,7 +329,7 @@ $file_url_web = $file_url.'?'.api_get_cidreq();
if (!$is_nanogong_available) { if (!$is_nanogong_available) {
if (in_array(strtolower($pathinfo['extension']) , array('html', "htm"))) { if (in_array(strtolower($pathinfo['extension']) , array('html', "htm"))) {
echo '<a class="btn" href="'.$file_url_web.'" target="_blank">'.get_lang('CutPasteLink').'</a>'; echo '<a class="btn btn-default" href="'.$file_url_web.'" target="_blank">'.get_lang('CutPasteLink').'</a>';
} }
} }
@ -426,7 +426,7 @@ if ($is_freemind_available) {
if ($is_nanogong_available) { if ($is_nanogong_available) {
$file_url_web = DocumentManager::generateAudioTempFolder($file_url_sys); $file_url_web = DocumentManager::generateAudioTempFolder($file_url_sys);
echo '<div align="center">'; echo '<div align="center">';
echo '<a class="btn" href="'.$file_url_web.'" target="_blank">'.get_lang('Download').'</a>'; echo '<a class="btn btn-default" href="'.$file_url_web.'" target="_blank"><i class="fa fa-download"></i> '.get_lang('Download').'</a>';
echo '<br/>'; echo '<br/>';
echo '<br/>'; echo '<br/>';
echo DocumentManager::readNanogongFile($to_url); echo DocumentManager::readNanogongFile($to_url);

@ -1621,7 +1621,7 @@ class Exercise
$this->id, $this->id,
null, null,
null, null,
api_get_course_id(), api_get_course_int_id(),
$session_id $session_id
); );

@ -46,8 +46,8 @@ function ch_qti2_display_form()
); );
$formValidator->addElement('header', $name_tools); $formValidator->addElement('header', $name_tools);
$formValidator->addElement('file', 'userFile', get_lang('DownloadFile')); $formValidator->addElement('file', 'userFile', get_lang('DownloadFile'));
$formValidator->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"'); $formValidator->addButtonImport(get_lang('Upload'));
$form .= $formValidator->return_form(); $form .= $formValidator->returnForm();
echo $form; echo $form;
} }

@ -141,11 +141,11 @@ if (!$inATest) {
echo "<div class='table-responsive'>"; echo "<div class='table-responsive'>";
echo "<table class='table table-condensed'>"; echo "<table class='table table-condensed'>";
echo "<tr>"; echo "<tr>";
echo "<th>" .get_lang('Questions'). "</th>"; echo "<th style=\"width: 50%;\">" .get_lang('Questions'). "</th>";
echo "<th>" .get_lang('Type'). "</th>"; echo "<th style=\"width: 6%;\">" .get_lang('Type'). "</th>";
echo "<th>" .get_lang('Category'). "</th>"; echo "<th style=\"width: 22%; text-align:center;\">" .get_lang('Category'). "</th>";
echo "<th>" .get_lang('Difficulty'). "</th>"; echo "<th style=\"width: 6%;\">" .get_lang('Difficulty'). "</th>";
echo "<th>" .get_lang('Score'). "</th>"; echo "<th style=\"width: 16%; float:left;\">" .get_lang('Score'). "</th>";
echo "</tr>"; echo "</tr>";
echo "</table>"; echo "</table>";
echo "</div>"; echo "</div>";
@ -156,7 +156,7 @@ if (!$inATest) {
$questionList = $objExercise->selectQuestionList(true); $questionList = $objExercise->selectQuestionList(true);
// Style for columns // Style for columns
$styleQuestion = "width:50%; float:left;"; $styleQuestion = "width:50%; float:left; margin-left: 25px;";
$styleType = "width:4%; float:left; text-align:center;"; $styleType = "width:4%; float:left; text-align:center;";
$styleCat = "width:22%; float:left; text-align:center;"; $styleCat = "width:22%; float:left; text-align:center;";
$styleLevel = "width:6%; float:left; text-align:center;"; $styleLevel = "width:6%; float:left; text-align:center;";

@ -228,7 +228,7 @@ if ($allowed_to_edit) {
} }
echo '<h4>'.get_lang('QualificationChangesHistory').'</h4>'; echo '<h4>'.get_lang('QualificationChangesHistory').'</h4>';
if ($_GET['type'] == 'false') { if ($_GET['type'] == 'false') {
$buttons = '<a class="btn" href="forumqualify.php?'.api_get_cidreq().'&amp;forum='.Security::remove_XSS($_GET['forum']).'&amp;origin='.$origin.'&amp;thread='.$threadid.'&amp;user='.Security::remove_XSS($_GET['user']).'&amp;user_id='.Security::remove_XSS($_GET['user_id']).'&amp;type=true&amp;idtextqualify='.$act_qualify.$view_gradebook.'#history">'. $buttons = '<a class="btn btn-default" href="forumqualify.php?'.api_get_cidreq().'&amp;forum='.Security::remove_XSS($_GET['forum']).'&amp;origin='.$origin.'&amp;thread='.$threadid.'&amp;user='.Security::remove_XSS($_GET['user']).'&amp;user_id='.Security::remove_XSS($_GET['user_id']).'&amp;type=true&amp;idtextqualify='.$act_qualify.$view_gradebook.'#history">'.
get_lang('MoreRecent').'</a> <a class="btn disabled" >'.get_lang('Older').'</a>'; get_lang('MoreRecent').'</a> <a class="btn disabled" >'.get_lang('Older').'</a>';
} else { } else {
$buttons = '<a class="btn disabled">'.get_lang('MoreRecent').'</a> $buttons = '<a class="btn disabled">'.get_lang('MoreRecent').'</a>

@ -720,7 +720,12 @@ class DisplayGradebook
//Web path //Web path
$image_path = UserManager::get_user_picture_path_by_id($userid, 'web', false, true); $image_path = UserManager::get_user_picture_path_by_id($userid, 'web', false, true);
$image_file = $image_path['dir'] . $image_path['file']; $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) { if ($image_size[0] > 200) {
//limit display width to 200px //limit display width to 200px
$img_attributes .= 'width="200" '; $img_attributes .= 'width="200" ';

@ -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_path = UserManager::get_user_picture_path_by_id($user_id,'web',false,true);
$image_file = $image_path['dir'].$image_path['file']; $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']).'" ' .'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:left; padding:5px;" '; .'style="float:left; padding:5px;" ';

@ -103,7 +103,7 @@ echo '<a href="group.php">'.
*/ */
$subscribe_group = ''; $subscribe_group = '';
if (GroupManager :: is_self_registration_allowed($user_id, $current_group['id'])) { if (GroupManager :: is_self_registration_allowed($user_id, $current_group['id'])) {
$subscribe_group = '<a class="btn" href="'.api_get_self().'?selfReg=1&group_id='.$current_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'. $subscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfReg=1&group_id='.$current_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'.
get_lang("RegIntoGroup").'</a>'; get_lang("RegIntoGroup").'</a>';
} }
@ -112,7 +112,7 @@ if (GroupManager :: is_self_registration_allowed($user_id, $current_group['id'])
*/ */
$unsubscribe_group = ''; $unsubscribe_group = '';
if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])) { if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])) {
$unsubscribe_group = '<a class="btn" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."'".')) return false;">'. $unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."'".')) return false;">'.
get_lang("StudentUnsubscribe").'</a>'; get_lang("StudentUnsubscribe").'</a>';
} }
echo '&nbsp;</div>'; echo '&nbsp;</div>';

@ -16,7 +16,7 @@ if (empty($help_name)) {
} }
?> ?>
<a class="btn" href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/faq.php"> <a class="btn btn-default" href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/faq.php">
<?php echo get_lang('AccessToFaq'); ?> <?php echo get_lang('AccessToFaq'); ?>
</a> </a>
<div class="page-header"> <div class="page-header">
@ -24,6 +24,6 @@ if (empty($help_name)) {
</div> </div>
<?php echo get_lang($help_name.'Content'); ?> <?php echo get_lang($help_name.'Content'); ?>
<hr> <hr>
<a class="btn" href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/faq.php"> <a class="btn btn-default" href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/faq.php">
<?php echo get_lang('AccessToFaq'); ?> <?php echo get_lang('AccessToFaq'); ?>
</a> </a>

@ -213,8 +213,21 @@ switch ($action) {
if ($searchByGroups) { if ($searchByGroups) {
$groups = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_ADMIN); $groups = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_ADMIN);
$groupsId = array_keys($groups); $groupsId = array_keys($groups);
$subgroupsId = [];
if (is_array($groupsId)) { if (is_array($groupsId)) {
foreach ($groupsId as $groupId) {
$subgroupsId = array_merge(
$subgroupsId,
GroupPortalManager::getGroupsByDepthLevel($groupId)
);
}
$groupsId = array_merge(
$groupsId,
$subgroupsId
);
foreach ($groupsId as $groupId) { foreach ($groupsId as $groupId) {
$groupUsers = GroupPortalManager::get_users_by_group($groupId); $groupUsers = GroupPortalManager::get_users_by_group($groupId);
@ -263,6 +276,11 @@ switch ($action) {
$sessionIdList = array_unique($sessionIdList); $sessionIdList = array_unique($sessionIdList);
} }
if (api_is_student_boss() && empty($userIdList)) {
$count = 0;
break;
}
if ($action == 'get_user_course_report') { if ($action == 'get_user_course_report') {
$count = CourseManager::get_count_user_list_from_course_code( $count = CourseManager::get_count_user_list_from_course_code(
false, false,
@ -567,6 +585,11 @@ switch ($action) {
//$sidx = 'training_hours'; //$sidx = 'training_hours';
} }
if (api_is_student_boss() && empty($userIdList)) {
$result = [];
break;
}
$result = CourseManager::get_user_list_from_course_code( $result = CourseManager::get_user_list_from_course_code(
null, null,
null, null,
@ -621,6 +644,11 @@ switch ($action) {
$sidx = 'title'; $sidx = 'title';
} }
if (api_is_student_boss() && empty($userIdList)) {
$result = [];
break;
}
$result = CourseManager::get_user_list_from_course_code( $result = CourseManager::get_user_list_from_course_code(
null, null,
null, null,

@ -93,7 +93,7 @@ switch ($action) {
$friend_html.='<img src="'.$friends_profile['file'].'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" />'; $friend_html.='<img src="'.$friends_profile['file'].'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" />';
$friend_html.='<div class="caption">'; $friend_html.='<div class="caption">';
$friend_html.='<a href="profile.php?u='.$friend['friend_user_id'].'"><h5>'.$user_name.'</h5></a>'; $friend_html.='<a href="profile.php?u='.$friend['friend_user_id'].'"><h5>'.$user_name.'</h5></a>';
$friend_html.='<p><button class="btn" onclick="delete_friend(this)" id=img_'.$friend['friend_user_id'].'>'.get_lang('Delete').'</button></p>'; $friend_html.='<p><button class="btn btn-danger" onclick="delete_friend(this)" id=img_'.$friend['friend_user_id'].'>'.get_lang('Delete').'</button></p>';
$friend_html.='</div>'; $friend_html.='</div>';
$friend_html.='</div>'; $friend_html.='</div>';

@ -64,10 +64,9 @@ if (api_is_in_course()) {
$http_www = $_configuration['root_web'].'home/default_platform_document/'; $http_www = $_configuration['root_web'].'home/default_platform_document/';
} else { } else {
// 4. The user is outside courses. // 4. The user is outside courses.
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'system'); $userId = api_get_user_id();
$base_work_dir = $my_path['dir'].'my_files/'; $base_work_dir = UserManager::getUserPathById($userId, 'system').'my_files/';
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'web'); $http_www = UserManager::getUserPathById($userId, 'web').'my_files/';
$http_www = $my_path['dir'].'my_files/';
} }
} }

@ -1439,7 +1439,7 @@ class AddCourse
$code, $code,
api_get_utc_datetime(), api_get_utc_datetime(),
$user_id, $user_id,
$code $course_id
); );
$send_mail_to_admin = api_get_setting( $send_mail_to_admin = api_get_setting(

@ -1422,8 +1422,7 @@ function _api_format_user($user, $add_password = false)
} }
$image_sys_path = api_get_path(SYS_CODE_PATH).$dir.$picture_filename; $image_sys_path = api_get_path(SYS_CODE_PATH).$dir.$picture_filename;
if ($picture_filename) { if ($picture_filename && file_exists($image_sys_path)) {
if (file_exists($image_sys_path)) {
$result['avatar'] = api_get_path(WEB_CODE_PATH).$dir.$picture_filename; $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_small'] = api_get_path(WEB_CODE_PATH).$dir.'small_'.$picture_filename;
$result['avatar_sys_path'] = api_get_path(SYS_CODE_PATH).$dir.$picture_filename; $result['avatar_sys_path'] = api_get_path(SYS_CODE_PATH).$dir.$picture_filename;
@ -1443,7 +1442,6 @@ function _api_format_user($user, $add_password = false)
$result[$key] = UserManager::getGravatar($userEmail, $avatarSize, $gravatarType); $result[$key] = UserManager::getGravatar($userEmail, $avatarSize, $gravatarType);
} }
} }
}
if (isset($user['user_is_online'])) { if (isset($user['user_is_online'])) {
$result['user_is_online'] = $user['user_is_online'] == true ? 1 : 0; $result['user_is_online'] = $user['user_is_online'] == true ? 1 : 0;

@ -213,7 +213,13 @@ class Career extends Model
{ {
$id = parent::save($params); $id = parent::save($params);
if (!empty($id)) { 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; return $id;
@ -226,6 +232,12 @@ class Career extends Model
public function delete($id) public function delete($id)
{ {
parent::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()
);
} }
} }

@ -89,15 +89,15 @@ class Certificate extends Model
$this->certification_user_path = null; $this->certification_user_path = null;
//Setting certification path //Setting certification path
$path_info = UserManager::get_user_picture_path_by_id($this->user_id, 'system'); $path_info = UserManager::getUserPathById($this->user_id, 'system');
$web_path_info = UserManager::get_user_picture_path_by_id($this->user_id, 'web'); $web_path_info = UserManager::getUserPathById($this->user_id, 'web');
if (!empty($path_info) && isset($path_info['dir'])) { if (!empty($path_info) && isset($path_info)) {
$this->certification_user_path = $path_info['dir'].'certificate/'; $this->certification_user_path = $path_info.'certificate/';
$this->certification_web_user_path = $web_path_info['dir'].'certificate/'; $this->certification_web_user_path = $web_path_info.'certificate/';
if (!is_dir($path_info['dir'])) { if (!is_dir($path_info)) {
mkdir($path_info['dir'], 0777, true); mkdir($path_info, 0777, true);
} }
if (!is_dir($this->certification_user_path)) { if (!is_dir($this->certification_user_path)) {
mkdir($this->certification_user_path, 0777); mkdir($this->certification_user_path, 0777);

@ -2236,8 +2236,11 @@ class CourseManager
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $table_stats_online WHERE c_id = $courseId"; $sql = "DELETE FROM $table_stats_online WHERE c_id = $courseId";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $table_stats_default WHERE c_id = $courseId"; // Do not delete rows from track_e_default as these include course
Database::query($sql); // 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"; $sql = "DELETE FROM $table_stats_downloads WHERE c_id = $courseId";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $table_stats_links WHERE c_id = $courseId"; $sql = "DELETE FROM $table_stats_links WHERE c_id = $courseId";
@ -2293,7 +2296,7 @@ class CourseManager
$code, $code,
api_get_utc_datetime(), api_get_utc_datetime(),
$user_id, $user_id,
$code $courseId
); );
} }
} }

@ -745,7 +745,8 @@ class Display
$size = ICON_SIZE_SMALL, $size = ICON_SIZE_SMALL,
$show_text = true, $show_text = true,
$return_only_path = false $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); $w_code_path = api_get_path(WEB_CODE_PATH);
@ -772,6 +773,28 @@ class Display
//Checking the img/ folder //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); $icon = api_get_cdn_path($icon);
if ($return_only_path) { if ($return_only_path) {
return $icon; return $icon;

@ -629,12 +629,14 @@ class Event
/** /**
* Records information for common (or admin) events (in the track_e_default table) * Records information for common (or admin) events (in the track_e_default table)
* @author Yannick Warnier <yannick.warnier@beeznest.com> * @author Yannick Warnier <yannick.warnier@beeznest.com>
* @param string Type of event * @param string $event_type Type of event
* @param string Type of value * @param string $event_value_type Type of value
* @param string Value * @param string $event_value Value
* @param string Timestamp (defaults to null) * @param string $datetime Datetime (UTC) (defaults to null)
* @param integer User ID (defaults to null) * @param int $user_id User ID (defaults to null)
* @param string Course code (defaults to null) * @param int $course_id Course ID (defaults to null)
* @param int $sessionId Session ID
* @return bool
* @assert ('','','') === false * @assert ('','','') === false
*/ */
public static function addEvent( public static function addEvent(
@ -643,7 +645,7 @@ class Event
$event_value, $event_value,
$datetime = null, $datetime = null,
$user_id = null, $user_id = null,
$course_code = null, $course_id = null,
$sessionId = 0 $sessionId = 0
) { ) {
$TABLETRACK_DEFAULT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); $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_type = Database::escape_string($event_type);
$event_value_type = Database::escape_string($event_value_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 //Clean the user_info
if ($event_value_type == LOG_USER_OBJECT) { if ($event_value_type == LOG_USER_OBJECT) {
@ -673,16 +685,8 @@ class Event
} }
$event_value = Database::escape_string($event_value); $event_value = Database::escape_string($event_value);
$course_info = api_get_course_info($course_code);
$sessionId = empty($sessionId) ? api_get_session_id() : intval($sessionId); $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)) { if (!isset($datetime)) {
$datetime = api_get_utc_datetime(); $datetime = api_get_utc_datetime();
} }
@ -1060,22 +1064,16 @@ class Event
} }
if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) { if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) {
$sql = "DELETE FROM $track_e_exercises WHERE exe_id IN (" . implode( $sql = "DELETE FROM $track_e_exercises
',', WHERE exe_id IN (" . implode(',', $exe_list) . ")";
$exe_list
) . ")";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $track_attempts WHERE exe_id IN (" . implode( $sql = "DELETE FROM $track_attempts
',', WHERE exe_id IN (" . implode(',', $exe_list) . ")";
$exe_list
) . ")";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $recording_table WHERE exe_id IN (" . implode( $sql = "DELETE FROM $recording_table
',', WHERE exe_id IN (" . implode(',', $exe_list) . ")";
$exe_list
) . ")";
Database::query($sql); Database::query($sql);
} }
@ -1085,7 +1083,7 @@ class Event
$lp_id, $lp_id,
null, null,
null, null,
$course['code'], $course_id,
$session_id $session_id
); );
} }
@ -1120,7 +1118,7 @@ class Event
$exercise_id . '-' . $user_id, $exercise_id . '-' . $user_id,
null, null,
null, null,
$course_code, $course_id,
$session_id $session_id
); );
} }
@ -1684,7 +1682,7 @@ class Event
$exe_id . '-' . $question_id, $exe_id . '-' . $question_id,
null, null,
null, null,
$courseInfo['code'], $courseId,
$session_id $session_id
); );
} }
@ -1694,8 +1692,9 @@ class Event
* @param $user_id * @param $user_id
* @param int $courseId * @param int $courseId
* @param $question_id * @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); $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
@ -1703,6 +1702,9 @@ class Event
$user_id = intval($user_id); $user_id = intval($user_id);
$courseId = intval($courseId); $courseId = intval($courseId);
$question_id = intval($question_id); $question_id = intval($question_id);
if (!isset($sessionId)) {
$sessionId = api_get_session_id();
}
$sql = "DELETE FROM $table_track_attempt $sql = "DELETE FROM $table_track_attempt
WHERE hotspot_exe_id = $exe_id AND WHERE hotspot_exe_id = $exe_id AND
@ -1716,8 +1718,8 @@ class Event
$exe_id . '-' . $question_id, $exe_id . '-' . $question_id,
null, null,
null, null,
$course_code, $courseId,
$session_id $sessionId
); );
} }

@ -173,8 +173,7 @@ class ExtraFieldValue extends Model
$fileDir = "upload/sessions/"; $fileDir = "upload/sessions/";
break; break;
case 'user': case 'user':
$userPath = UserManager::get_user_picture_path_by_id($this->handler_id); $fileDir = UserManager::getUserPathById($this->handler_id);
$fileDir = $userPath['dir'];
break; break;
} }
@ -213,8 +212,7 @@ class ExtraFieldValue extends Model
$fileDir = "upload/sessions/"; $fileDir = "upload/sessions/";
break; break;
case 'user': case 'user':
$userPath = UserManager::get_user_picture_path_by_id($this->handler_id); $fileDir = UserManager::getUserPathById($this->handler_id);
$fileDir = $userPath['dir'];
break; break;
} }

@ -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 $root
* @param int $level * @param int $level
@ -245,24 +294,24 @@ class GroupPortalManager
} }
$sql = $select_part.' '.$cond_part; $sql = $select_part.' '.$cond_part;
$res = Database::query($sql); $res = Database::query($sql);
$toreturn = array(); $toReturn = array();
while ($item = Database::fetch_assoc($res)) { while ($item = Database::fetch_assoc($res)) {
foreach ($item as $key => $value) { foreach ($item as $key => $value) {
if ($key == 'id_1') { if ($key == 'id_1') {
$toreturn[$value]['name'] = $item['name_1']; $toReturn[$value]['name'] = $item['name_1'];
} else { } else {
$temp = explode('_', $key); $temp = explode('_', $key);
$index_key = $temp[1]; $indexKey = $temp[1];
$string_key = $temp[0]; $stringKey = $temp[0];
$previous_key = $string_key.'_'.$index_key - 1; $previousKey = $stringKey.'_'.$indexKey - 1;
if ($string_key == 'id' && isset($item[$key])) { if ($stringKey == 'id' && isset($item[$key])) {
$toreturn[$item[$previous_key]]['hrms'][$index_key]['name'] = $item['name_'.$index_id]; $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'"; $sql = $select_part.' '.$cond_part."WHERE rg0.subgroup_id='$group_id'";
$res = Database::query($sql); $res = Database::query($sql);
$temp_arr = Database::fetch_array($res, 'NUM'); $temp_arr = Database::fetch_array($res, 'NUM');
$toreturn = array(); $toReturn = array();
if (is_array($temp_arr)) { if (is_array($temp_arr)) {
foreach ($temp_arr as $elt) { foreach ($temp_arr as $elt) {
if (isset($elt)) { if (isset($elt)) {
$toreturn[] = $elt; $toReturn[] = $elt;
} }
} }
} }
return $toreturn; return $toReturn;
} }
/** /**
@ -912,8 +961,10 @@ class GroupPortalManager
$base = ''; $base = '';
} }
$noPicturePath = array('dir' => $base.'img/', 'file' => 'unknown.jpg');
if (empty($id) || empty($type)) { 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); $id = intval($id);
@ -923,7 +974,7 @@ class GroupPortalManager
$res = Database::query($sql); $res = Database::query($sql);
if (!Database::num_rows($res)) { 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); $user = Database::fetch_array($res);
@ -940,9 +991,11 @@ class GroupPortalManager
} else { } else {
$dir = $base.'upload/users/groups/'.$id.'/'; $dir = $base.'upload/users/groups/'.$id.'/';
} }
if (empty($picture_filename) && $anonymous) { if (empty($picture_filename) && $anonymous) {
return array('dir' => $base.'img/', 'file' => 'unknown.jpg'); return $noPicturePath;
} }
return array('dir' => $dir, 'file' => $picture_filename); return array('dir' => $dir, 'file' => $picture_filename);
} }

@ -0,0 +1,33 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Class HookResubscribe
* @var \SplObjectStorage $observers
*/
class HookResubscribe extends HookEvent implements HookResubscribeEventInterface
{
/**
* Constructor
*/
protected function __construct()
{
parent::__construct('HookResubscribe');
}
/**
* Update all the observers
* @param int $type
*
* @return int
*/
public function notifyResubscribe($type)
{
/** @var \HookResubscribeObserverInterface $observer */
$this->eventData['type'] = $type;
foreach ($this->observers as $observer) {
$observer->hookResubscribe($this);
}
return 1;
}
}

@ -0,0 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes
* @package chamilo.library.hook
*/
/**
* Interface HookResubscribeEventInterface
*/
interface HookResubscribeEventInterface extends HookEventInterface
{
/**
* Update all the observers
* @param int $type
*
* @return int
*/
public function notifyResubscribe($type);
}

@ -0,0 +1,20 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes
* @package chamilo.library.hook
*/
/**
* Interface ResubscribeHookInterface
*/
interface HookResubscribeObserverInterface extends HookObserverInterface
{
/**
* @param HookResubscribeObserverInterface $hook
*
* @return int
*/
public function hookResubscribe(HookResubscribeEventInterface $hook);
}

@ -502,7 +502,7 @@ class MessageManager
if (!empty($group_id)) { if (!empty($group_id)) {
$path_user_info = GroupPortalManager::get_group_picture_path_by_id($group_id, 'system', true); $path_user_info = GroupPortalManager::get_group_picture_path_by_id($group_id, 'system', true);
} else { } else {
$path_user_info = UserManager::get_user_picture_path_by_id($message_user_id, 'system', true); $path_user_info['dir'] = UserManager::getUserPathById($message_user_id, 'system');
} }
$path_message_attach = $path_user_info['dir'].'message_attachments/'; $path_message_attach = $path_user_info['dir'].'message_attachments/';
@ -548,7 +548,7 @@ class MessageManager
if (!empty($group_id)) { if (!empty($group_id)) {
$path_user_info = GroupPortalManager::get_group_picture_path_by_id($group_id, 'system', true); $path_user_info = GroupPortalManager::get_group_picture_path_by_id($group_id, 'system', true);
} else { } else {
$path_user_info = UserManager::get_user_picture_path_by_id($message_uid, 'system', true); $path_user_info['dir'] = UserManager::getUserPathById($message_uid, 'system');
} }
$path_message_attach = $path_user_info['dir'].'message_attachments/'; $path_message_attach = $path_user_info['dir'].'message_attachments/';

@ -604,7 +604,7 @@ class Nanogong
$html .= '<form name="form_nanogong_advanced">'; $html .= '<form name="form_nanogong_advanced">';
$html .= '<input type="hidden" name="is_nano" value="1">'; $html .= '<input type="hidden" name="is_nano" value="1">';
$html .= '<a href="#" class="btn" onclick="send_voice()" />'.get_lang('SendRecord').'</a>'; $html .= '<a href="#" class="btn btn-default" onclick="send_voice()" />'.get_lang('SendRecord').'</a>';
$html .= '</form></div>'; $html .= '</form></div>';
@ -614,7 +614,7 @@ class Nanogong
//$html .= Display::return_message(get_lang('BrowserNotSupportNanogongSend'), 'warning'); //$html .= Display::return_message(get_lang('BrowserNotSupportNanogongSend'), 'warning');
$html .= '<form id="form_nanogong_simple" class="form-search" action="'.$url.'" name="form_nanogong" method="POST" enctype="multipart/form-data">'; $html .= '<form id="form_nanogong_simple" class="form-search" action="'.$url.'" name="form_nanogong" method="POST" enctype="multipart/form-data">';
$html .= '<input type="file" name="file">'; $html .= '<input type="file" name="file">';
$html .= '<a href="#" class="btn" onclick="upload_file()" />'.get_lang('UploadFile').'</a>'; $html .= '<a href="#" class="btn btn-default" onclick="upload_file()" /><i class="fa fa-upload"></i> '.get_lang('UploadFile').'</a>';
$html .= '</form>'; $html .= '</form>';
$html .= '</div>'; $html .= '</div>';
$html .= '</center>'; $html .= '</center>';

@ -180,6 +180,11 @@ class Plugin
} }
foreach ($this->fields as $name => $type) { 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); $value = $this->get($name);
@ -230,6 +235,14 @@ class Plugin
$element->_attributes['value'] = 'true'; $element->_attributes['value'] = 'true';
$checkboxGroup[] = $element; $checkboxGroup[] = $element;
break; break;
case 'select':
$result->addElement(
$type,
$name,
array($this->get_lang($name), $help),
$options
);
break;
} }
} }

@ -446,7 +446,7 @@ class Security
*/ */
public static function filter_img_path($image_path) 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. $image_path = htmlspecialchars(trim($image_path)); // No html code is allowed.
// We allow static images only, query strings are forbidden. // We allow static images only, query strings are forbidden.
if (strpos($image_path, '?') !== false) { if (strpos($image_path, '?') !== false) {

@ -228,7 +228,13 @@ class SessionManager
// add event to system log // add event to system log
$user_id = api_get_user_id(); $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; return $session_id;
} }
@ -1498,7 +1504,13 @@ class SessionManager
Database::query($sql_delete_sfv); Database::query($sql_delete_sfv);
// Add event to system log // 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(); $id_session = Database::insert_id();
// Add event to system log // Add event to system log
$user_id = api_get_user_id(); $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; return $id_session;
} }

@ -643,8 +643,12 @@ class SocialManager extends UserManager
$img_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true, true); $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 = UserManager::get_picture_user($user_id, $img_array['file'], '', USER_IMAGE_SIZE_BIG);
$big_image = $big_image['file'].'?'.uniqid(); $big_image = $big_image['file'];
$normal_image = $img_array['dir'].$img_array['file'].'?'.uniqid(); $normal_image = $img_array['dir'].$img_array['file'];
if (!api_get_configuration_value('gravatar_enabled')) {
$big_image .= '?'.uniqid();
$normal_image .= '?'.uniqid();
}
//--- User image //--- User image
if ($img_array['file'] != 'unknown.jpg') { if ($img_array['file'] != 'unknown.jpg') {
@ -953,13 +957,14 @@ class SocialManager extends UserManager
$status_icon = Display::span('', array('class' => 'online_user_in_text')); $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')); $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['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_180_100.jpg';
$img = '<img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'">';
} else {
$friends_profile = UserManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_ORIGINAL); $friends_profile = UserManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_ORIGINAL);
$img = '<img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'">'; 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 = '<img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'">';
$name = '<a href="'.$url.'">'.$status_icon.$user_status.$name.'</a><br>'; $name = '<a href="'.$url.'">'.$status_icon.$user_status.$name.'</a><br>';
$html .= '<li class="col-md-'.($column_size / 3).' thumbnail">'.$img.'<div class="caption">'.$name.'</div></li>'; $html .= '<li class="col-md-'.($column_size / 3).' thumbnail">'.$img.'<div class="caption">'.$name.'</div></li>';
} }
@ -997,12 +1002,16 @@ class SocialManager extends UserManager
$interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList')); $interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList'));
$html .= '<div class ="thumbnail">'; $html .= '<div class ="thumbnail">';
if (strlen(trim($user_object->picture_uri)) > 0) {
$sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system'); $sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system');
$sysdir = $sysdir_array['dir']; $sysdir = $sysdir_array['dir'];
$webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web'); $webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web');
if (strlen(trim($user_object->picture_uri)) > 0) {
$webdir = $webdir_array['dir']; $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; $system_image_path = $sysdir.$user_object->picture_uri;
list($width, $height, $type, $attr) = @getimagesize($system_image_path); list($width, $height, $type, $attr) = @getimagesize($system_image_path);
$height += 30; $height += 30;
@ -1016,7 +1025,9 @@ class SocialManager extends UserManager
//echo '<a href="javascript:void()" onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');" >'; //echo '<a href="javascript:void()" onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');" >';
$html .= '<img src="'.$fullurl.'" alt="'.$alt.'" />'; $html .= '<img src="'.$fullurl.'" alt="'.$alt.'" />';
} else { } else {
$html .= Display::return_icon('unknown.jpg', get_lang('Unknown')); $html .= api_get_configuration_value('gravatar_enabled') ?
'<img src="'.$webdir_array['file'].'" alt="'.$alt.'" />' :
Display::return_icon('unknown.jpg', get_lang('Unknown'));
} }
if (!empty($status)) { if (!empty($status)) {
$html .= '<div class="caption">'.$status.'</div>'; $html .= '<div class="caption">'.$status.'</div>';
@ -1059,10 +1070,9 @@ class SocialManager extends UserManager
*/ */
public static function display_productions($user_id) 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_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)) { if (!is_dir($sysdir)) {
mkdir($sysdir, api_get_permissions_for_new_directories(), true); 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); $tbl_message_attach = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT);
// create directory // create directory
$pathUserInfo = UserManager::get_user_picture_path_by_id($userId, 'system', true);
$social = '/social/'; $social = '/social/';
$pathMessageAttach = $pathUserInfo['dir'] . 'message_attachments'. $social; $pathMessageAttach = UserManager::getUserPathById($userId, 'system').'message_attachments'.$social;
$safeFileComment = Database::escape_string($fileComment); $safeFileComment = Database::escape_string($fileComment);
$safeFileName = Database::escape_string($fileAttach['name']); $safeFileName = Database::escape_string($fileAttach['name']);
@ -1246,6 +1255,7 @@ class SocialManager extends UserManager
if (empty($start)) { if (empty($start)) {
$start = '0000-00-00'; $start = '0000-00-00';
} }
$tblMessage = Database::get_main_table(TABLE_MESSAGE); $tblMessage = Database::get_main_table(TABLE_MESSAGE);
$tblMessageAttachement = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); $tblMessageAttachement = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT);
@ -1426,9 +1436,13 @@ class SocialManager extends UserManager
$wallImage = ''; $wallImage = '';
if (!empty($message['path'])) { if (!empty($message['path'])) {
$pathUserInfo = UserManager::get_user_picture_path_by_id($authorId, 'web', true); $pathUserInfo = UserManager::get_user_picture_path_by_id($authorId, 'web', true);
$pathImg = $pathUserInfo['dir'] . 'message_attachments'; $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); $imageBig = $pathImg .self::getImagePath($message['path'], IMAGE_WALL_BIG);
$imageSmall = $pathImg. self::getImagePath($message['path'], IMAGE_WALL_SMALL); $imageSmall = $pathImg. self::getImagePath($message['path'], IMAGE_WALL_SMALL);
}
$wallImage = '<a class="thumbnail ajax" href="'.$imageBig.'"><img src="'.$imageSmall.'"></a>'; $wallImage = '<a class="thumbnail ajax" href="'.$imageBig.'"><img src="'.$imageSmall.'"></a>';
} }
@ -1633,7 +1647,7 @@ class SocialManager extends UserManager
$friendHtml.='</ul>'; $friendHtml.='</ul>';
} else { } else {
$friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />' $friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
.'<a class="btn" href="'.api_get_path(WEB_PATH).'whoisonline.php">'. get_lang('TryAndFindSomeFriends').'</a></div>'; .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><i class="fa fa-search"></i> '. get_lang('TryAndFindSomeFriends').'</a></div>';
} }
return $friendHtml; return $friendHtml;

@ -355,7 +355,11 @@ class SubLanguageManager
$lang = Database::fetch_array($result); $lang = Database::fetch_array($result);
$sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "' WHERE variable='platformLanguage'"; $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "' WHERE variable='platformLanguage'";
$result_2 = Database::query($sql_update_2); $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; return $result_2 !== false;
} }

@ -10,11 +10,9 @@ require_once '../../../../../inc/global.inc.php';
api_protect_course_script(); api_protect_course_script();
api_block_anonymous_users(); api_block_anonymous_users();
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system'); $userId = api_get_user_id();
$user_disk_path = $my_path['dir'].'my_files/'; $user_disk_path = UserManager::getUserPathById($userId, 'system').'my_files/';
$user_web_path = UserManager::getUserPathById($userId, 'web').'my_files/';
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'web');
$user_web_path = $my_path['dir'].'my_files/';
//get all files and folders //get all files and folders
$scan_files = scandir($user_disk_path); $scan_files = scandir($user_disk_path);

@ -885,6 +885,35 @@ class Template
'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1) 'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1)
); );
//} //}
$socialMeta = '';
$metaTitle = api_get_setting('meta_title');
if (!empty($metaTitle)) {
$socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n";
$socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n";
$socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n";
$metaDescription = api_get_setting('meta_description');
if (!empty($metaDescription)) {
$socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n";
}
$metaSite = api_get_setting('meta_twitter_site');
if (!empty($metaSite)) {
$socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
$metaCreator = api_get_setting('meta_twitter_creator');
if (!empty($metaCreator)) {
$socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\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 .= '<meta property="og:image" content="' . $path . '" />' . "\n";
}
}
}
$this->assign('social_meta', $socialMeta);
} }
/** /**

@ -474,8 +474,20 @@ class UserManager
// Add event to system log // Add event to system log
$user_id_manager = api_get_user_id(); $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(
Event::addEvent(LOG_USER_DELETE, LOG_USER_OBJECT, $user_info, api_get_utc_datetime(), $user_id_manager, null, $user_info); 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; return true;
} }
@ -798,6 +810,7 @@ class UserManager
/** /**
* Disables a user * Disables a user
* @param int User id * @param int User id
* @return bool
* @uses UserManager::change_active_state() to actually disable the user * @uses UserManager::change_active_state() to actually disable the user
* @assert (0) === false * @assert (0) === false
*/ */
@ -807,11 +820,13 @@ class UserManager
return false; return false;
} }
self::change_active_state($user_id, 0); self::change_active_state($user_id, 0);
return true;
} }
/** /**
* Enable a user * Enable a user
* @param int User id * @param int User id
* @return bool
* @uses UserManager::change_active_state() to actually disable the user * @uses UserManager::change_active_state() to actually disable the user
* @assert (0) === false * @assert (0) === false
*/ */
@ -821,6 +836,7 @@ class UserManager
return false; return false;
} }
self::change_active_state($user_id, 1); 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. default: // Base: empty, the result path below will be relative.
$base = ''; $base = '';
} }
$gravatarEnabled = api_get_configuration_value('gravatar_enabled');
$noPicturePath = array('dir' => $base.'img/', 'file' => 'unknown.jpg'); $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' => ''); 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; $sql = "SELECT email, picture_uri FROM $user_table WHERE user_id=".$user_id;
$res = Database::query($sql); $res = Database::query($sql);
if (!Database::num_rows($res)) { if (!Database::num_rows($res) && !$gravatarEnabled) {
return $anonymous ? $noPicturePath : array('dir' => '', 'file' => ''); return $anonymous ? $noPicturePath : array('dir' => '', 'file' => '');
} }
@ -1250,14 +1266,7 @@ class UserManager
$dir = $base.$userPath; $dir = $base.$userPath;
} }
if (empty($picture_filename) || if ($gravatarEnabled) {
(!empty($picture_filename) && !file_exists($systemImagePath.$picture_filename))
) {
if ($anonymous) {
return $noPicturePath;
}
if (api_get_configuration_value('gravatar_enabled')) {
$avatarSize = api_getimagesize($noPicturePath['dir'].$noPicturePath['file']); $avatarSize = api_getimagesize($noPicturePath['dir'].$noPicturePath['file']);
$avatarSize = $avatarSize['width'] > $avatarSize['height'] ? $avatarSize = $avatarSize['width'] > $avatarSize['height'] ?
$avatarSize['width'] : $avatarSize['width'] :
@ -1271,6 +1280,9 @@ class UserManager
) )
); );
} }
if (empty($picture_filename) && $anonymous) {
return $noPicturePath;
} }
return array('dir' => $dir, 'file' => $picture_filename); return array('dir' => $dir, 'file' => $picture_filename);
@ -1989,7 +2001,11 @@ class UserManager
if ($result) { if ($result) {
//echo "id returned"; //echo "id returned";
$return = Database::insert_id(); $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 { } else {
//echo "false - failed" ; //echo "false - failed" ;
return false; 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 = '') 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 = array();
$picture['style'] = $style; $picture['style'] = $style;
if ($picture_file == 'unknown.jpg') { if ($picture_file == 'unknown.jpg') {
@ -3246,8 +3263,10 @@ class UserManager
break; break;
} }
$picture['file'] = api_get_path(WEB_CODE_PATH).'img/'.$picture_file; $picture['file'] = api_get_path(WEB_CODE_PATH).'img/'.$picture_file;
if (!$gravatarEnabled) {
return $picture; return $picture;
} }
}
switch ($size_picture) { switch ($size_picture) {
case USER_IMAGE_SIZE_ORIGINAL : case USER_IMAGE_SIZE_ORIGINAL :
@ -3304,6 +3323,9 @@ class UserManager
} }
} }
} }
if ($gravatarEnabled) {
$picture['file'] = $image_array['file'];
}
return $picture; return $picture;
} }
@ -5275,4 +5297,35 @@ EOF;
} }
return $url; 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;
}
} }

@ -376,59 +376,63 @@ LOCK TABLES language WRITE;
INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0), ('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),
('Asturianu','asturian','ast','asturian',0), ('Asturianu','asturian','ast','asturian',0),
('Euskara','basque','eu','basque',1),
('&#2476;&#2494;&#2434;&#2482;&#2494;','bengali','bn','bengali',0), ('&#2476;&#2494;&#2434;&#2482;&#2494;','bengali','bn','bengali',0),
('&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;','bulgarian','bg','bulgarian',1),
('Bosanski','bosnian','bs','bosnian',1), ('Bosanski','bosnian','bs','bosnian',1),
('Portugu&ecirc;s do Brasil','brazilian','pt-BR','brazilian',1),
('&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;','bulgarian','bg','bulgarian',1),
('Catal&agrave;','catalan','ca','catalan',0), ('Catal&agrave;','catalan','ca','catalan',0),
('&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;','simpl_chinese','zh','simpl_chinese',0), ('Hrvatski','croatian','hr','croatian',0),
('&#32321;&#39636;&#20013;&#25991;','trad_chinese','zh-TW','trad_chinese',0),
('&#268;esky','czech','cs','czech',0), ('&#268;esky','czech','cs','czech',0),
('Dansk','danish','da','danish',0), ('Dansk','danish','da','danish',0),
('&#1583;&#1585;&#1740;','dari','prs','dari',0), ('&#1583;&#1585;&#1740;','dari','prs','dari',0),
('Deutsch','german','de','german',1), ('Nederlands','dutch','nl','dutch',1),
('&Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;&#940;','greek','el','greek',0),
('English','english','en','english',1), ('English','english','en','english',1),
('Espa&ntilde;ol','spanish','es','spanish',1),
('Esperanto','esperanto','eo','esperanto',0), ('Esperanto','esperanto','eo','esperanto',0),
('Euskara','basque','eu','basque',0), ('Føroyskt', 'faroese', 'fo', 'faroese', 0),
('&#1601;&#1575;&#1585;&#1587;&#1740;','persian','fa','persian',0), ('Suomi','finnish','fi','finnish',0),
('Fran&ccedil;ais','french','fr','french',1), ('Fran&ccedil;ais','french','fr','french',1),
('Furlan','friulian','fur','friulian',0), ('Furlan','friulian','fur','friulian',0),
('Galego','galician','gl','galician',0), ('Galego','galician','gl','galician',1),
('&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;','georgian','ka','georgian',0), ('&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;','georgian','ka','georgian',0),
('Hrvatski','croatian','hr','croatian',0), ('Deutsch','german','de','german',1),
('&Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;&#940;','greek','el','greek',1),
('&#1506;&#1489;&#1512;&#1497;&#1514;','hebrew','he','hebrew',0), ('&#1506;&#1489;&#1512;&#1497;&#1514;','hebrew','he','hebrew',0),
('&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;','hindi','hi','hindi',0), ('&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;','hindi','hi','hindi',0),
('Magyar','hungarian','hu','hungarian',1),
('Bahasa Indonesia','indonesian','id','indonesian',1), ('Bahasa Indonesia','indonesian','id','indonesian',1),
('Italiano','italian','it','italian',1), ('Italiano','italian','it','italian',1),
('&#26085;&#26412;&#35486;','japanese','ja','japanese',0),
('&#54620;&#44397;&#50612;','korean','ko','korean',0), ('&#54620;&#44397;&#50612;','korean','ko','korean',0),
('Latvie&scaron;u','latvian','lv','latvian',0), ('Latvie&scaron;u','latvian','lv','latvian',1),
('Lietuvi&#371;','lithuanian','lt','lithuanian',0), ('Lietuvi&#371;','lithuanian','lt','lithuanian',0),
('&#1052;&#1072;&#1082;&#1077;&#1076;&#1086;&#1085;&#1089;&#1082;&#1080;','macedonian','mk','macedonian',0), ('&#1052;&#1072;&#1082;&#1077;&#1076;&#1086;&#1085;&#1089;&#1082;&#1080;','macedonian','mk','macedonian',0),
('Magyar','hungarian','hu','hungarian',1),
('Bahasa Melayu','malay','ms','malay',0), ('Bahasa Melayu','malay','ms','malay',0),
('Nederlands','dutch','nl','dutch',1),
('&#26085;&#26412;&#35486;','japanese','ja','japanese',0),
('Norsk','norwegian','no','norwegian',0), ('Norsk','norwegian','no','norwegian',0),
('Occitan','occitan','oc','occitan',0), ('Occitan','occitan','oc','occitan',0),
('&#1662;&#1690;&#1578;&#1608;','pashto','ps','pashto',0), ('&#1662;&#1690;&#1578;&#1608;','pashto','ps','pashto',0),
('Polski','polish','pl','polish',0), ('&#1601;&#1575;&#1585;&#1587;&#1740;','persian','fa','persian',0),
('Polski','polish','pl','polish',1),
('Portugu&ecirc;s europeu','portuguese','pt','portuguese',1), ('Portugu&ecirc;s europeu','portuguese','pt','portuguese',1),
('Portugu&ecirc;s do Brasil','brazilian','pt-BR','brazilian',1),
('Rom&acirc;n&#259;','romanian','ro','romanian',0),
('Runasimi','quechua_cusco','qu','quechua_cusco',0), ('Runasimi','quechua_cusco','qu','quechua_cusco',0),
('Rom&acirc;n&#259;','romanian','ro','romanian',0),
('&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;','russian','ru','russian',0), ('&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;','russian','ru','russian',0),
('Sloven&#269;ina','slovak','sk','slovak',0), ('Srpski','serbian','sr','serbian',0),
('&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;','simpl_chinese','zh','simpl_chinese',0),
('Sloven&#269;ina','slovak','sk','slovak',1),
('Sloven&scaron;&#269;ina','slovenian','sl','slovenian',1), ('Sloven&scaron;&#269;ina','slovenian','sl','slovenian',1),
('&#1575;&#1604;&#1589;&#1608;&#1605;&#1575;&#1604;&#1610;&#1577;','somali','so','somali',0), ('&#1575;&#1604;&#1589;&#1608;&#1605;&#1575;&#1604;&#1610;&#1577;','somali','so','somali',0),
('Srpski','serbian','sr','serbian',0), ('Espa&ntilde;ol','spanish','es','spanish',1),
('Suomi','finnish','fi','finnish',0), ('Kiswahili','swahili','sw','swahili',0),
('Svenska','swedish','sv','swedish',0), ('Svenska','swedish','sv','swedish',0),
('Tagalog', 'tagalog', 'tl', 'tagalog',1),
('&#3652;&#3607;&#3618;','thai','th','thai',0), ('&#3652;&#3607;&#3618;','thai','th','thai',0),
('Tibetan', 'tibetan', 'bo', 'tibetan', 0),
('&#32321;&#39636;&#20013;&#25991;','trad_chinese','zh-TW','trad_chinese',0),
('T&uuml;rk&ccedil;e','turkish','tr','turkish',0), ('T&uuml;rk&ccedil;e','turkish','tr','turkish',0),
('&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;','ukrainian','uk','ukrainian',0), ('&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;','ukrainian','uk','ukrainian',0),
('Ti&#7871;ng Vi&#7879;t','vietnamese','vi','vietnamese',0), ('Ti&#7871;ng Vi&#7879;t','vietnamese','vi','vietnamese',0),
('Kiswahili','swahili','sw','swahili',0), ('isiXhosa', 'xhosa', 'xh', 'xhosa', 0),
('Yor&ugrave;b&aacute;','yoruba','yo','yoruba',0); ('Yor&ugrave;b&aacute;','yoruba','yo','yoruba',0);
-- The chosen during the installation platform language should be enabled. -- 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), ('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), ('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), ('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); ('chamilo_database_version', NULL, 'textfield',NULL, '0', 'DatabaseVersion','', NULL, NULL, 0);
UNLOCK TABLES; UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */; /*!40000 ALTER TABLE settings_current ENABLE KEYS */;

@ -137,7 +137,8 @@ if (defined('SYSTEM_INSTALLATION')) {
); );
$list = scandir($langPath); $list = scandir($langPath);
foreach ($list as $entry) { 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) { foreach ($filesToDelete as $file) {
if (is_file($langPath . $entry . '/' . $file . '.inc.php')) { if (is_file($langPath . $entry . '/' . $file . '.inc.php')) {
unlink($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 // Remove the "main/conference/" directory that wasn't used since years long
// past - see rrmdir function declared below // past - see rrmdir function declared below
@rrmdir(api_get_path(SYS_CODE_PATH).'conference'); @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 { } else {
echo 'You are not allowed here !'. __FILE__; echo 'You are not allowed here !'. __FILE__;

@ -78,7 +78,7 @@ if ($not_allowed_to_edit) {
if (!empty($row_users['group_id'])) { if (!empty($row_users['group_id'])) {
$path_user_info = GroupPortalManager::get_group_picture_path_by_id($row_users['group_id'], 'system', true); $path_user_info = GroupPortalManager::get_group_picture_path_by_id($row_users['group_id'], 'system', true);
} else { } 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; $full_file_name = $path_user_info['dir'].'message_attachments/'.$file_url;

@ -461,6 +461,7 @@ if (!empty($student_id)) {
echo '<table width="100%" border="0">'; echo '<table width="100%" border="0">';
echo '<tr>'; echo '<tr>';
$gravatarEnabled = api_get_configuration_value('gravatar_enabled');
$image_array = UserManager :: get_user_picture_path_by_id($user_info['user_id'], 'web', false, true); $image_array = UserManager :: get_user_picture_path_by_id($user_info['user_id'], 'web', false, true);
echo '<td class="borderRight" width="10%" valign="top">'; echo '<td class="borderRight" width="10%" valign="top">';
@ -470,8 +471,13 @@ if (!empty($student_id)) {
$big_image_size = api_getimagesize($big_image); $big_image_size = api_getimagesize($big_image);
$big_image_width = $big_image_size['width']; $big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height']; $big_image_height = $big_image_size['height'];
$url_big_image = $image_file;
if (!$gravatarEnabled) {
$url_big_image = $big_image.'?rnd=' . time(); $url_big_image = $big_image.'?rnd=' . time();
$img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . $image_file .= '?rnd=' . time();
}
$img_attributes = 'src="' . $image_file . '" ' .
'alt="' . $user_info['complete_name']. '" ' . 'alt="' . $user_info['complete_name']. '" ' .
'style="float:' . ($text_dir == 'rtl' ? 'right' : 'left') . '; padding:5px;" '; 'style="float:' . ($text_dir == 'rtl' ? 'right' : 'left') . '; padding:5px;" ';

@ -99,7 +99,7 @@ $social_right_content = '<div class="span8">';
if (count($friends) == 0) { if (count($friends) == 0) {
$social_right_content .= get_lang('NoFriendsInYourContactList').'<br /><br />'; $social_right_content .= get_lang('NoFriendsInYourContactList').'<br /><br />';
$social_right_content .= '<a class="btn" href="search.php">'.get_lang('TryAndFindSomeFriends').'</a>'; $social_right_content .= '<a class="btn btn-primary" href="search.php"><i class="fa fa-search"></i>'.get_lang('TryAndFindSomeFriends').'</a>';
} else { } else {
$social_right_content .= get_lang('Search').'&nbsp;&nbsp; : &nbsp;&nbsp;'; $social_right_content .= get_lang('Search').'&nbsp;&nbsp; : &nbsp;&nbsp;';
$social_right_content .= '<input class="social-search-image" type="text" id="id_search_image" name="id_search_image" onkeyup="search_image_social()" />'; $social_right_content .= '<input class="social-search-image" type="text" id="id_search_image" name="id_search_image" onkeyup="search_image_social()" />';

@ -331,10 +331,10 @@ if ($group_id != 0) {
) )
) )
) { ) {
$social_right_content .= '<a class="btn" href="groups.php?id=' . $group_id . '&action=join&u=' . api_get_user_id( $social_right_content .= '<a class="btn btn-default" href="groups.php?id=' . $group_id . '&action=join&u=' . api_get_user_id(
) . '">' . get_lang('JoinGroup') . '</a>'; ) . '">' . get_lang('JoinGroup') . '</a>';
} elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) { } elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) {
$social_right_content .= '<a class="btn" href="groups.php?id=' . $group_id . '&action=join&u=' . api_get_user_id( $social_right_content .= '<a class="btn btn-default" href="groups.php?id=' . $group_id . '&action=join&u=' . api_get_user_id(
) . '">' . get_lang('YouHaveBeenInvitedJoinNow') . '</a>'; ) . '">' . get_lang('YouHaveBeenInvitedJoinNow') . '</a>';
} }
$social_right_content .= '<br /><br />'; $social_right_content .= '<br /><br />';
@ -447,10 +447,10 @@ if ($group_id != 0) {
) )
) )
) { ) {
$social_right_content .= '<a class="btn" href="groups.php?id=' . $group_id . '&action=join&u=' . api_get_user_id( $social_right_content .= '<a class="btn btn-default" href="groups.php?id=' . $group_id . '&action=join&u=' . api_get_user_id(
) . '">' . get_lang('JoinGroup') . '</a>'; ) . '">' . get_lang('JoinGroup') . '</a>';
} elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) { } elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) {
$social_right_content .= '<a class="btn" href="groups.php?id=' . $group_id . '&action=join&u=' . api_get_user_id( $social_right_content .= '<a class="btn btn-default" href="groups.php?id=' . $group_id . '&action=join&u=' . api_get_user_id(
) . '">' . get_lang('YouHaveBeenInvitedJoinNow') . '</a>'; ) . '">' . get_lang('YouHaveBeenInvitedJoinNow') . '</a>';
} }
} }
@ -618,7 +618,7 @@ if ($group_id != 0) {
//Avoiding my groups //Avoiding my groups
$join_url = ''; $join_url = '';
if (!in_array($id, $my_group_list)) { if (!in_array($id, $my_group_list)) {
$join_url = '<a class="btn" href="groups.php?id=' . $id . '&action=join&u=' . api_get_user_id( $join_url = '<a class="btn btn-default" href="groups.php?id=' . $id . '&action=join&u=' . api_get_user_id(
) . '">' . get_lang('JoinGroup') . '</a> '; ) . '">' . get_lang('JoinGroup') . '</a> ';
} }
@ -705,7 +705,7 @@ if ($group_id != 0) {
$join_url = ''; $join_url = '';
if (!in_array($id, $my_group_list)) { if (!in_array($id, $my_group_list)) {
$join_url = '<a class="btn" href="groups.php?id=' . $id . '&action=join&u=' . api_get_user_id( $join_url = '<a class="btn btn-default" href="groups.php?id=' . $id . '&action=join&u=' . api_get_user_id(
) . '">' . get_lang('JoinGroup') . '</a> '; ) . '">' . get_lang('JoinGroup') . '</a> ';
} }
$item_4 = '<div class="box_description_group_actions" >' . $join_url . '</div>'; $item_4 = '<div class="box_description_group_actions" >' . $join_url . '</div>';
@ -740,7 +740,7 @@ if ($group_id != 0) {
'allow_students_to_create_groups_in_social' 'allow_students_to_create_groups_in_social'
) == 'true' ) == 'true'
) { ) {
$create_group_item = '<a class="btn" href="' . api_get_path( $create_group_item = '<a class="btn btn-default" href="' . api_get_path(
WEB_PATH WEB_PATH
) . 'main/social/group_add.php">' . get_lang( ) . 'main/social/group_add.php">' . get_lang(
'CreateASocialGroup' 'CreateASocialGroup'
@ -748,7 +748,7 @@ if ($group_id != 0) {
//$my_group_content = $create_group_item. $my_group_content; //$my_group_content = $create_group_item. $my_group_content;
} else { } else {
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$create_group_item = '<a class="btn" href="' . api_get_path( $create_group_item = '<a class="btn btn-default" href="' . api_get_path(
WEB_PATH WEB_PATH
) . 'main/social/group_add.php">' . get_lang( ) . 'main/social/group_add.php">' . get_lang(
'CreateASocialGroup' 'CreateASocialGroup'
@ -816,7 +816,7 @@ if ($group_id != 0) {
'allow_students_to_create_groups_in_social' 'allow_students_to_create_groups_in_social'
) == 'true' ) == 'true'
) { ) {
$create_group_item = '<a class="btn" href="' . api_get_path( $create_group_item = '<a class="btn btn-default" href="' . api_get_path(
WEB_PATH WEB_PATH
) . 'main/social/group_add.php">' . get_lang( ) . 'main/social/group_add.php">' . get_lang(
'CreateASocialGroup' 'CreateASocialGroup'
@ -824,7 +824,7 @@ if ($group_id != 0) {
//$my_group_content = $create_group_item. $my_group_content; //$my_group_content = $create_group_item. $my_group_content;
} else { } else {
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$create_group_item = '<a class="btn" href="' . api_get_path( $create_group_item = '<a class="btn btn-default" href="' . api_get_path(
WEB_PATH WEB_PATH
) . 'main/social/group_add.php">' . get_lang( ) . 'main/social/group_add.php">' . get_lang(
'CreateASocialGroup' 'CreateASocialGroup'

@ -662,7 +662,7 @@ if ($show_full_profile) {
); );
$invitations .= '<br />'; $invitations .= '<br />';
$invitations .= '<a id="btn_accepted_'.$user_invitation_id.'"' $invitations .= '<a id="btn_accepted_'.$user_invitation_id.'"'
.' class="btn" onclick="register_friend(this)" href="javascript:void(0)">' .' class="btn btn-default" onclick="register_friend(this)" href="javascript:void(0)">'
.get_lang('SocialAddToFriends') .get_lang('SocialAddToFriends')
.'</a>'; .'</a>';
$invitations .= '<div id="id_response"></div>'; $invitations .= '<div id="id_response"></div>';

@ -44,12 +44,12 @@
{% if is_allowed_to_edit %} {% if is_allowed_to_edit %}
<td> <td>
{% if event.visibility == 1 %} {% if event.visibility == 1 %}
<a class="btn" href="{% if url %}{{ url }}{% else %}{{ event.url }}{% endif %}&action=change_visibility&visibility=0&id={{ event.real_id }}"> <a class="btn btn-default" href="{% if url %}{{ url }}{% else %}{{ event.url }}{% endif %}&action=change_visibility&visibility=0&id={{ event.real_id }}">
<img title="{{ 'Invisible' }}" src="{{'visible.png'|icon(32)}} "> <img title="{{ 'Invisible' }}" src="{{'visible.png'|icon(32)}} ">
</a> </a>
{% else %} {% else %}
{% if event.type == 'course' or event.type == 'session' %} {% if event.type == 'course' or event.type == 'session' %}
<a class="btn" href="{% if url %}{{ url }}{% else %}{{ event.url }}{% endif %}&action=change_visibility&visibility=1&id={{ event.real_id }}"> <a class="btn btn-default" href="{% if url %}{{ url }}{% else %}{{ event.url }}{% endif %}&action=change_visibility&visibility=1&id={{ event.real_id }}">
<img title="{{ 'Visible' }}" src="{{'invisible.png'|icon(32)}} "> <img title="{{ 'Visible' }}" src="{{'invisible.png'|icon(32)}} ">
</a> </a>
{% endif %} {% endif %}

@ -162,7 +162,7 @@ if (!empty($user_course_categories)) {
<form action="<?php echo api_get_self(); ?>" method="post" onsubmit="javascript: if (!confirm('<?php echo addslashes(api_htmlentities(get_lang("ConfirmUnsubscribeFromCourse"), ENT_QUOTES, api_get_system_encoding()))?>')) return false"> <form action="<?php echo api_get_self(); ?>" method="post" onsubmit="javascript: if (!confirm('<?php echo addslashes(api_htmlentities(get_lang("ConfirmUnsubscribeFromCourse"), ENT_QUOTES, api_get_system_encoding()))?>')) return false">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>"> <input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="unsubscribe" value="<?php echo $course['code']; ?>" /> <input type="hidden" name="unsubscribe" value="<?php echo $course['code']; ?>" />
<button class="btn" value="<?php echo get_lang('Unsubscribe'); ?>" name="unsub"> <button class="btn btn-default" value="<?php echo get_lang('Unsubscribe'); ?>" name="unsub">
<?php echo get_lang('Unsubscribe'); ?> <?php echo get_lang('Unsubscribe'); ?>
</button> </button>
</form> </form>
@ -262,7 +262,7 @@ if (!empty($courses_without_category)) {
<form action="<?php echo api_get_self(); ?>" method="post" onsubmit="javascript: if (!confirm('<?php echo addslashes(api_htmlentities(get_lang("ConfirmUnsubscribeFromCourse"), ENT_QUOTES, api_get_system_encoding())) ?>')) return false;"> <form action="<?php echo api_get_self(); ?>" method="post" onsubmit="javascript: if (!confirm('<?php echo addslashes(api_htmlentities(get_lang("ConfirmUnsubscribeFromCourse"), ENT_QUOTES, api_get_system_encoding())) ?>')) return false;">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>"> <input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="unsubscribe" value="<?php echo $course['code']; ?>" /> <input type="hidden" name="unsubscribe" value="<?php echo $course['code']; ?>" />
<button class="btn" value="<?php echo get_lang('Unsubscribe'); ?>" name="unsub"> <button class="btn btn-default" value="<?php echo get_lang('Unsubscribe'); ?>" name="unsub">
<?php echo get_lang('Unsubscribe'); ?> <?php echo get_lang('Unsubscribe'); ?>
</button> </button>
</form> </form>

@ -73,7 +73,7 @@
{% endif %} {% endif %}
{% if coursesCategoriesList is not empty %} {% if coursesCategoriesList is not empty %}
<a class="btn" href="{{ api_get_self }}?action=display_random_courses">{{ 'RandomPick' | get_lang }}</a> <a class="btn btn-default" href="{{ api_get_self }}?action=display_random_courses">{{ 'RandomPick' | get_lang }}</a>
{% endif %} {% endif %}
</div> </div>

@ -7,7 +7,7 @@
{% if is_allowed_to_edit %} {% if is_allowed_to_edit %}
<div class="btn-toolbar actions-bar" > <div class="btn-toolbar actions-bar" >
<div class="btn-group"> <div class="btn-group">
<a href="{{root}}&amp;action=listing" class="btn" title="{{'ImportCSV'|get_lang}}"> <a href="{{root}}&amp;action=listing" class="btn btn-default" title="{{'ImportCSV'|get_lang}}">
<i class="size-32 icon-back"></i> <i class="size-32 icon-back"></i>
</a> </a>
</div> </div>

@ -55,7 +55,7 @@
createCookie('menu_state',0,10); createCookie('menu_state',0,10);
} }
} }
document.write('<div class="col-md-12 pull-right"> <a class="btn" href="javascript: void(0);" id="swap_menu_link" onclick="javascript: swap_menu();">{{'Hide'|get_lang}}<\/a></div>'); document.write('<div class="col-md-12 pull-right"> <a class="btn btn-default" href="javascript: void(0);" id="swap_menu_link" onclick="javascript: swap_menu();">{{'Hide'|get_lang}}<\/a></div>');
</script> </script>
{{ show_course_navigation_menu }} {{ show_course_navigation_menu }}
{% endif %} {% endif %}

@ -12,6 +12,7 @@
{# Improve usability in portal devices #} {# Improve usability in portal devices #}
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title_string }}</title> <title>{{ title_string }}</title>
{{ social_meta }}
{{ css_static_file_to_string }} {{ css_static_file_to_string }}
{{ js_file_to_string }} {{ js_file_to_string }}
<script> <script>

@ -8,7 +8,7 @@
<span id="progress-info"></span> <span id="progress-info"></span>
<br /> <br />
<a id="record" class="btn btn-danger" >{{ 'RecordAudio' | get_lang }}</a> <a id="record" class="btn btn-danger" >{{ 'RecordAudio' | get_lang }}</a>
<button id="stop" class="btn" disabled="">{{ 'StopRecordingAudio' | get_lang }}</button> <button id="stop" class="btn btn-default" disabled="">{{ 'StopRecordingAudio' | get_lang }}</button>
</div> </div>
<div id="wami" style="float:left; z-index:6000"> <div id="wami" style="float:left; z-index:6000">

@ -19,7 +19,7 @@
<option value="{{ course.id }}" {{ (course.id == selectedCourse) ? 'selected' : '' }}>{{ course.title }}</option> <option value="{{ course.id }}" {{ (course.id == selectedCourse) ? 'selected' : '' }}>{{ course.title }}</option>
{% endfor %} {% endfor %}
</select> </select>
<button type="submit" class="btn">{{ 'Filter' | get_lang }}</button> <button type="submit" class="btn btn-default">{{ 'Filter' | get_lang }}</button>
</form> </form>
</div> </div>
<div class="span6"> <div class="span6">
@ -31,7 +31,7 @@
<option value="{{ skill.id }}" {{ (skill.id == selectedSkill) ? 'selected' : '' }}>{{ skill.name }}</option> <option value="{{ skill.id }}" {{ (skill.id == selectedSkill) ? 'selected' : '' }}>{{ skill.name }}</option>
{% endfor %} {% endfor %}
</select> </select>
<button type="submit" class="btn">{{ 'Filter' | get_lang }}</button> <button type="submit" class="btn btn-default"><i class="fa fa-filter"></i>{{ 'Filter' | get_lang }}</button>
</form> </form>
</div> </div>
</div> </div>

@ -9,7 +9,7 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<a id="add_profile" class="btn" href="#"> {{"SaveThisSearch"|get_lang}}</a> <a id="add_profile" class="btn btn-default" href="#"><i class="fa fa-floppy-o"></i> {{"SaveThisSearch"|get_lang}}</a>
</div> </div>
{% endif %} {% endif %}

@ -415,8 +415,8 @@ $(document).ready(function() {
<h3>{{'Skills'|get_lang}}</h3> <h3>{{'Skills'|get_lang}}</h3>
<div class="btn-group"> <div class="btn-group">
<a style="z-index: 1000" class="btn" id="add_item_link" href="#">{{'AddSkill'|get_lang}}</a> <a style="z-index: 1000" class="btn" id="add_item_link" href="#">{{'AddSkill'|get_lang}}</a>
<a style="z-index: 1000" class="btn" id="return_to_root" href="#">{{'Root'|get_lang}}</a> <a style="z-index: 1000" class="btn btn-default" id="return_to_root" href="#">{{'Root'|get_lang}}</a>
<a style="z-index: 1000" class="btn" id="return_to_admin" href="{{_p.web_main}}admin">{{'BackToAdmin'|get_lang}}</a> <a style="z-index: 1000" class="btn btn-default" id="return_to_admin" href="{{_p.web_main}}admin">{{'BackToAdmin'|get_lang}}</a>
</div> </div>
</div> </div>

@ -502,7 +502,7 @@ $(document).ready(function() {
<select id="skill_id" name="skill_id" /></select> <select id="skill_id" name="skill_id" /></select>
<div class="button-skill"> <div class="button-skill">
<a class="btn btn-default btn-block btn-large btn-danger load_root" rel="0" href="#">{{ "ViewSkillsWheel"|get_lang }}</a> <a class="btn btn-default btn-block btn-large btn-danger load_root" rel="0" href="#">{{ "ViewSkillsWheel"|get_lang }}</a>
<!-- <a id="clear_selection" class="btn">{{ "Clear"|get_lang }}</a> --> <!-- <a id="clear_selection" class="btn btn-danger">{{ "Clear"|get_lang }}</a> -->
</div> </div>
<ul id="skill_holder" class="holder_simple border"></ul> <ul id="skill_holder" class="holder_simple border"></ul>
</form> </form>

@ -334,7 +334,7 @@ $(document).ready(function() {
<select id="skill_id" name="skill_id" /></select> <select id="skill_id" name="skill_id" /></select>
<div class="button-skill"> <div class="button-skill">
<a class="btn btn-default btn-block btn-large btn-danger load_root" rel="0" href="#">{{ "ViewSkillsWheel"|get_lang }}</a> <a class="btn btn-default btn-block btn-large btn-danger load_root" rel="0" href="#">{{ "ViewSkillsWheel"|get_lang }}</a>
<!-- <a id="clear_selection" class="btn">{{ "Clear"|get_lang }}</a> --> <!-- <a id="clear_selection" class="btn btn-danger">{{ "Clear"|get_lang }}</a> -->
</div> </div>
<ul id="skill_holder" class="holder_simple"></ul> <ul id="skill_holder" class="holder_simple"></ul>
</form> </form>

@ -485,13 +485,13 @@ if (api_is_allowed_to_edit(null, true)) {
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or
api_is_platform_admin() api_is_platform_admin()
) { ) {
$actions .= ' <a class="btn" href="class.php?'.api_get_cidreq().'">'.get_lang('Classes').'</a>'; $actions .= ' <a class="btn btn-default" href="class.php?'.api_get_cidreq().'">'.get_lang('Classes').'</a>';
} }
if (api_is_allowed_to_edit() && if (api_is_allowed_to_edit() &&
isset($_configuration['allow_tutors_to_assign_students_to_session']) && isset($_configuration['allow_tutors_to_assign_students_to_session']) &&
$_configuration['allow_tutors_to_assign_students_to_session'] == 'true') { $_configuration['allow_tutors_to_assign_students_to_session'] == 'true') {
$actions .= ' <a class="btn" href="session_list.php?'.api_get_cidreq().'">'.get_lang('Sessions').'</a>'; $actions .= ' <a class="btn btn-default" href="session_list.php?'.api_get_cidreq().'">'.get_lang('Sessions').'</a>';
} }
// Build search-form // Build search-form

@ -300,7 +300,10 @@ elseif ($displayMode == "viewContentEdit") {
$big_image_size = api_getimagesize($big_image); $big_image_size = api_getimagesize($big_image);
$big_image_width= $big_image_size['width']; $big_image_width= $big_image_size['width'];
$big_image_height= $big_image_size['height']; $big_image_height= $big_image_size['height'];
$url_big_image = $image_array['file'];
if (!api_get_configuration_value('gravatar_enabled')) {
$url_big_image = $big_image.'?rnd='.time(); $url_big_image = $big_image.'?rnd='.time();
}
if ($image_array['file']=='unknown.jpg') { if ($image_array['file']=='unknown.jpg') {
echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">'; echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
@ -387,8 +390,10 @@ elseif ($displayMode == "viewContentEdit") {
$big_image_size = api_getimagesize($big_image); $big_image_size = api_getimagesize($big_image);
$big_image_width= $big_image_size['width']; $big_image_width= $big_image_size['width'];
$big_image_height= $big_image_size['height']; $big_image_height= $big_image_size['height'];
$url_big_image = $image_array['file'];
if (!api_get_configuration_value('gravatar_enabled')) {
$url_big_image = $big_image.'?rnd='.time(); $url_big_image = $big_image.'?rnd='.time();
}
if ($image_array['file']=='unknown.jpg') { if ($image_array['file']=='unknown.jpg') {
echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">'; echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
} else { } else {

@ -1853,23 +1853,25 @@ class Wiki
$all_students_pages = array(); $all_students_pages = array();
//data about teacher //data about teacher
$userinfo = api_get_user_info(api_get_user_id()); $userId = api_get_user_id();
$userinfo = api_get_user_info($userId);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES)); $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES));
$name = $userinfo['complete_name']." - ".$username; $name = $userinfo['complete_name']." - ".$username;
if (api_get_user_id()<>0) {
$image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',false, true); $photo= '<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.$name.'" width="40" height="50" align="top" title="'.$name.'" />';
if ($userId) {
$image_path = UserManager::get_user_picture_path_by_id($userId, 'web', false, true);
$image_repository = $image_path['dir']; $image_repository = $image_path['dir'];
$existing_image = $image_path['file']; $existing_image = $image_path['file'];
$photo = '<img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />'; $photo = '<img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />';
} else {
$photo= '<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.$name.'" width="40" height="50" align="top" title="'.$name.'" />';
} }
//teacher assignment title //teacher assignment title
$title_orig = $values['title']; $title_orig = $values['title'];
//teacher assignment reflink //teacher assignment reflink
$link2teacher = $values['title'] = $title_orig."_uass".api_get_user_id(); $link2teacher = $values['title'] = $title_orig."_uass".$userId;
//first: teacher name, photo, and assignment description (original content) //first: teacher name, photo, and assignment description (original content)
// $content_orig_A='<div align="center" style="background-color: #F5F8FB; border:double">'.$photo.'<br />'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'<br />('.get_lang('Teacher').')</div><br/><div>'; // $content_orig_A='<div align="center" style="background-color: #F5F8FB; border:double">'.$photo.'<br />'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'<br />('.get_lang('Teacher').')</div><br/><div>';
@ -1883,7 +1885,7 @@ class Wiki
//Second: student list (names, photo and links to their works). //Second: student list (names, photo and links to their works).
//Third: Create Students work pages. //Third: Create Students work pages.
foreach ($a_users_to_add as $o_user_to_add) { foreach ($a_users_to_add as $o_user_to_add) {
if ($o_user_to_add['user_id'] != api_get_user_id()) { if ($o_user_to_add['user_id'] != $userId) {
//except that puts the task //except that puts the task
$assig_user_id = $o_user_to_add['user_id']; //identifies each page as created by the student, not by teacher $assig_user_id = $o_user_to_add['user_id']; //identifies each page as created by the student, not by teacher
$image_path = UserManager::get_user_picture_path_by_id($assig_user_id,'web',false, true); $image_path = UserManager::get_user_picture_path_by_id($assig_user_id,'web',false, true);
@ -1933,7 +1935,7 @@ class Wiki
} }
foreach ($a_users_to_add as $o_user_to_add) { foreach ($a_users_to_add as $o_user_to_add) {
if ($o_user_to_add['user_id'] == api_get_user_id()) { if ($o_user_to_add['user_id'] == $userId) {
$assig_user_id=$o_user_to_add['user_id']; $assig_user_id=$o_user_to_add['user_id'];
if ($assignment_type == 1) { if ($assignment_type == 1) {
$values['title']= $title_orig; $values['title']= $title_orig;
@ -3193,7 +3195,7 @@ class Wiki
FROM $tbl_wiki_discuss FROM $tbl_wiki_discuss
WHERE c_id = $course_id AND publication_id = '".$id."' AND NOT p_score='-' WHERE c_id = $course_id AND publication_id = '".$id."' AND NOT p_score='-'
ORDER BY id DESC"; ORDER BY id DESC";
$result2=Database::query($sql); $result2=Database::query($sql) or die(Database::error());
$row2=Database::fetch_array($result2); $row2=Database::fetch_array($result2);
$sql = "SELECT * FROM $tbl_wiki_discuss $sql = "SELECT * FROM $tbl_wiki_discuss
@ -3229,13 +3231,14 @@ class Wiki
$user_id = $row['userc_id']; $user_id = $row['userc_id'];
$name = $userinfo['complete_name']; $name = $userinfo['complete_name'];
if ($user_id<>0) {
$author_photo= '<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.api_htmlentities($name).'" width="40" height="50" align="top" title="'.api_htmlentities($name).'" />';
if ($user_id) {
$image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true); $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true);
$image_repository = $image_path['dir']; $image_repository = $image_path['dir'];
$existing_image = $image_path['file']; $existing_image = $image_path['file'];
$author_photo= '<img src="'.$image_repository.$existing_image.'" alt="'.api_htmlentities($name).'" width="40" height="50" align="top" title="'.api_htmlentities($name).'" />'; $author_photo= '<img src="'.$image_repository.$existing_image.'" alt="'.api_htmlentities($name).'" width="40" height="50" align="top" title="'.api_htmlentities($name).'" />';
} else {
$author_photo= '<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.api_htmlentities($name).'" width="40" height="50" align="top" title="'.api_htmlentities($name).'" />';
} }
//stars //stars

@ -11,7 +11,7 @@
<div class='cas_plugin_comm'>{{ add_cas_login_button.comm_label }}</div> <div class='cas_plugin_comm'>{{ add_cas_login_button.comm_label }}</div>
{% if add_cas_login_button.cas_activated %} {% if add_cas_login_button.cas_activated %}
{% if add_cas_login_button.cas_configured %} {% if add_cas_login_button.cas_configured %}
<button class="btn" onclick="javascript:self.location.href='main/auth/cas/logincas.php'">{{"LoginEnter"|get_lang}}</button> <button class="btn btn-default" onclick="javascript:self.location.href='main/auth/cas/logincas.php'">{{"LoginEnter"|get_lang}}</button>
{% else %} {% else %}
CAS isn't configured. Go to Admin > Configuration > CAS.<br/> CAS isn't configured. Go to Admin > Configuration > CAS.<br/>
{% endif %} {% endif %}

@ -9,7 +9,7 @@
<div class='cas_plugin_clear'>&nbsp;</div> <div class='cas_plugin_clear'>&nbsp;</div>
{% endif %} {% endif %}
<div class='cas_plugin_comm'>{{add_cas_logout_button.logout_comment}}</div> <div class='cas_plugin_comm'>{{add_cas_logout_button.logout_comment}}</div>
<button class="btn" onclick="javascript:self.location.href='main/auth/cas/logout.php'">{{"Logout"|get_lang}}</button> <button class="btn btn-default" onclick="javascript:self.location.href='main/auth/cas/logout.php'">{{"Logout"|get_lang}}</button>
</div> </div>
{% endif %} {% endif %}

@ -10,6 +10,6 @@
<div class='shibboleth_plugin_clear'>&nbsp;</div> <div class='shibboleth_plugin_clear'>&nbsp;</div>
{% endif %} {% endif %}
<div class='shibboleth_plugin_comm'>{{ add_shibboleth_login_button.comm_label }}</div> <div class='shibboleth_plugin_comm'>{{ add_shibboleth_login_button.comm_label }}</div>
<button class="btn" onclick="javascript:self.location.href='main/auth/shibboleth/login.php'">{{ "LoginEnter"|get_lang }}</button> <button class="btn btn-default" onclick="javascript:self.location.href='main/auth/shibboleth/login.php'">{{ "LoginEnter"|get_lang }}</button>
</div> </div>
{% endif %} {% endif %}

@ -52,7 +52,7 @@
{% if allow_to_edit %} {% if allow_to_edit %}
<td> <td>
{% if meeting.status == 1 %} {% if meeting.status == 1 %}
<a class="btn" href="{{ meeting.end_url }} "> {{ 'CloseMeeting'|get_lang }}</a> <a class="btn btn-default" href="{{ meeting.end_url }} "> {{ 'CloseMeeting'|get_lang }}</a>
{% else %} {% else %}
{{ meeting.action_links }} {{ meeting.action_links }}
{% endif %} {% endif %}

@ -30,7 +30,7 @@
<img src="resources/img/128/buycourses.png"> <img src="resources/img/128/buycourses.png">
</a> </a>
<div class="caption"> <div class="caption">
<a class="btn" href="src/list.php">{{ BuyCourses }}</a> <a class="btn btn-default" href="src/list.php">{{ BuyCourses }}</a>
</div> </div>
</div> </div>
</div> </div>
@ -41,7 +41,7 @@
<img src="resources/img/128/settings.png"> <img src="resources/img/128/settings.png">
</a> </a>
<div class="caption"> <div class="caption">
<a class="btn" href="src/configuration.php">{{ ConfigurationOfCoursesAndPrices }}</a> <a class="btn btn-default" href="src/configuration.php">{{ ConfigurationOfCoursesAndPrices }}</a>
</div> </div>
</div> </div>
</div> </div>
@ -51,7 +51,7 @@
<img src="resources/img/128/paymentsettings.png"> <img src="resources/img/128/paymentsettings.png">
</a> </a>
<div class="caption"> <div class="caption">
<a class="btn" href="src/paymentsetup.php">{{ ConfigurationOfPayments }} </a> <a class="btn btn-default" href="src/paymentsetup.php">{{ ConfigurationOfPayments }} </a>
</div> </div>
</div> </div>
</div> </div>
@ -61,7 +61,7 @@
<img src="resources/img/128/backlogs.png"> <img src="resources/img/128/backlogs.png">
</a> </a>
<div class="caption"> <div class="caption">
<a class="btn" href="src/pending_orders.php"> {{ OrdersPendingOfPayment }} </a> <a class="btn btn-default" href="src/pending_orders.php"> {{ OrdersPendingOfPayment }} </a>
</div> </div>
</div> </div>
</div> </div>

@ -48,7 +48,7 @@
{% if allow_to_edit %} {% if allow_to_edit %}
<td> <td>
{% if meeting.status == 1 %} {% if meeting.status == 1 %}
<a class="btn" href="{{ meeting.end_url }} "> {{ 'CloseMeeting' | get_lang }}</a> <a class="btn btn-default" href="{{ meeting.end_url }} "> {{ 'CloseMeeting' | get_lang }}</a>
{% endif %} {% endif %}
<a class="btn btn-danger" href="{{ meeting.delete_url }} "> {{ 'DeleteMeeting' | get_lang }}</a> <a class="btn btn-danger" href="{{ meeting.delete_url }} "> {{ 'DeleteMeeting' | get_lang }}</a>
</td> </td>

@ -0,0 +1,4 @@
Resubscription
==============
Limit session resubscriptions

@ -0,0 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
require_once api_get_path(SYS_PATH) . 'main/inc/global.inc.php';

@ -0,0 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
require_once __DIR__ . '/config.php';

@ -0,0 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Initialization install
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
require_once __DIR__ . '/config.php';
Resubscription::create()->install();

@ -0,0 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Strings to english L10n
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
$strings['plugin_title'] = 'Resubscription';
$strings['plugin_comment'] = 'This plugin limits session resubscription.';
$strings['resubscription_limit'] = 'Resubscription limit';
$strings['resubscription_limit_help'] = 'This limits how often a user can be resubscribed';
$strings['CanResubscribeFromX'] = 'Subscription available from %s';

@ -0,0 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Strings to spanish L10n
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
$strings['plugin_title'] = 'Reinscripción';
$strings['plugin_comment'] = 'Este plugin limita las reinscripiones a sesiones.';
$strings['resubscription_limit'] = 'Límite de reinscripción';
$strings['resubscription_limit_help'] = 'Esto limita cada cuánto puede reinscribirse un usuario';
$strings['CanResubscribeFromX'] = 'Inscripción posible a partir del %s';

@ -0,0 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Get the plugin info
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
require_once __DIR__.'/config.php';
$plugin_info = Resubscription::create()->get_info();

@ -0,0 +1,2 @@
<h1>Resubscription</h1>
<p>Limit session resubscriptions</p>

@ -0,0 +1,105 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Hook to limit session resubscriptions
*
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
class HookResubscription extends HookObserver implements HookResubscribeObserverInterface
{
/**
* Class constructor
*/
public function __construct()
{
parent::__construct(
'plugin/resubscription/src/Resubscription.php', 'resubscription'
);
}
/**
* Limit session resubscription when a Chamilo user is resubscribed to a session
* @param HookCreateUserEventInterface $hook The hook
*/
public function hookResubscribe(HookResubscribeEventInterface $hook)
{
$data = $hook->getEventData();
if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
$resubscriptionLimit = Resubscription::create()->get('resubscription_limit');
$limitDate = gmdate('Y-m-d');
switch ($resubscriptionLimit) {
case 'calendar_year':
$resubscriptionLimit = "1 year";
$limitDate = gmdate('Y-m-d', strtotime(gmdate('Y-m-d')." -$resubscriptionLimit"));
break;
}
$join = " INNER JOIN ".Database::get_main_table(TABLE_MAIN_SESSION)."ON id = id_session";
// User sessions and courses
$userSessions = Database::select(
'id_session, date_end',
Database::get_main_table(TABLE_MAIN_SESSION_USER).$join,
array(
'where' => array(
'id_user = ? AND date_end >= ?' => array(
api_get_user_id(),
$limitDate
)
),
'order' => 'date_end DESC'
)
);
$userSessionCourses = array();
foreach ($userSessions as $userSession) {
$userSessionCourseResult = Database::select(
'course_code',
Database::get_main_table(TABLE_MAIN_SESSION_COURSE),
array(
'where' => array(
'id_session = ?' => array(
$userSession['id_session']
)
)
)
);
foreach ($userSessionCourseResult as $userSessionCourse) {
if (!isset($userSessionCourses[$userSessionCourse['course_code']])) {
$userSessionCourses[$userSessionCourse['course_code']] = $userSession['date_end'];
}
}
}
// Current session and courses
$currentSessionCourseResult = Database::select(
'course_code',
Database::get_main_table(TABLE_MAIN_SESSION_COURSE),
array(
'where' => array(
'id_session = ?' => array(
$data['session_id']
)
)
)
);
// Check if current course code matches with one of the users
foreach ($currentSessionCourseResult as $currentSessionCourse) {
if (isset($userSessionCourses[$currentSessionCourse['course_code']])) {
$endDate = $userSessionCourses[$currentSessionCourse['course_code']];
$resubscriptionDate = gmdate('Y-m-d', strtotime($endDate." +$resubscriptionLimit"));
$icon = Display::return_icon('students.gif', get_lang('Student'));
$canResubscribeFrom = sprintf(get_plugin_lang('CanResubscribeFromX', 'resubscription'), $resubscriptionDate);
throw new Exception(Display::label($icon . ' ' . $canResubscribeFrom, "info"));
}
}
}
}
}

@ -0,0 +1,78 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Limit session resubscriptions
*
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
class Resubscription extends Plugin implements HookPluginInterface
{
/**
* Class constructor
*/
protected function __construct()
{
$options = array(
'calendar_year' => get_lang('CalendarYear')
);
$parameters = array(
'resubscription_limit' => array(
'type' => 'select',
'options' => $options
)
);
parent::__construct('0.1', 'Imanol Losada Oriol', $parameters);
}
/**
* Instance the plugin
* @staticvar null $result
* @return Resubscription
*/
static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* Install the plugin
*/
public function install()
{
$this->installHook();
}
/**
* Uninstall the plugin
* @return void
*/
public function uninstall()
{
$this->uninstallHook();
}
/**
* Install the Resubscription hook
*/
public function installHook()
{
$hook = HookResubscription::create();
HookResubscribe::create()->attach($hook);
}
/**
* Uninstall the Resubscription hook
*/
public function uninstallHook()
{
$hook = HookResubscription::create();
HookResubscribe::create()->detach($hook);
}
}

@ -0,0 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Initialization uninstall
* @author Imanol Losada Oriol <imanol.losada@beeznest.com>
* @package chamilo.plugin.resubscription
*/
require_once __DIR__ . '/config.php';
Resubscription::create()->uninstall();

@ -207,7 +207,7 @@ EOT;
<input type="hidden" name="sec_token" value="$stok" /> <input type="hidden" name="sec_token" value="$stok" />
<input type="hidden" name="search_course" value="1" /> <input type="hidden" name="search_course" value="1" />
<input type="text" name="search_term" class="span2" value="$search_term" /> <input type="text" name="search_term" class="span2" value="$search_term" />
&nbsp;<input class="btn" type="submit" value="$search_label" /> &nbsp;<input class="btn btn-default" type="submit" value="$search_label" />
</form> </form>
EOT; EOT;
echo $form; echo $form;

@ -18,9 +18,9 @@ class PersonalDriver extends Driver implements DriverInterface
public function setup() public function setup()
{ {
$userId = api_get_user_id(); $userId = api_get_user_id();
$path = \UserManager::get_user_picture_path_by_id($userId, 'none'); $path = \UserManager::getUserPathById($userId);
if (!empty($path['dir'])) { if (!empty($path)) {
$dir = api_get_path(SYS_CODE_PATH) . $path['dir']; $dir = api_get_path(SYS_CODE_PATH) . $path;
if (!is_dir($dir)) { if (!is_dir($dir)) {
mkdir($dir); mkdir($dir);
@ -44,21 +44,15 @@ class PersonalDriver extends Driver implements DriverInterface
if (!empty($userId)) { if (!empty($userId)) {
// Adding user personal files // Adding user personal files
$dir = \UserManager::get_user_picture_path_by_id( $dir = \UserManager::getUserPathById($userId, 'system');
$userId,
'system'
);
$dirWeb = \UserManager::get_user_picture_path_by_id( $dirWeb = \UserManager::getUserPathById($userId, 'web');
$userId,
'web'
);
$driver = array( $driver = array(
'driver' => 'PersonalDriver', 'driver' => 'PersonalDriver',
'alias' => get_lang('MyFiles'), 'alias' => get_lang('MyFiles'),
'path' => $dir['dir'] . 'my_files', 'path' => $dir.'my_files',
'URL' => $dirWeb['dir'] . 'my_files', 'URL' => $dirWeb.'my_files',
'accessControl' => array($this, 'access') 'accessControl' => array($this, 'access')
); );

@ -91,9 +91,9 @@ class TestEvents extends UnitTestCase {
global $_configuration; global $_configuration;
global $_user; global $_user;
global $TABLETRACK_DEFAULT; global $TABLETRACK_DEFAULT;
$event_type = Database::escape_string($event_type); $event_type = 'bla';
$event_value_type = Database::escape_string($event_value_type); $event_value_type = 'blo';
$event_value = Database::escape_string($event_value); $event_value = 'bli';
$res=Event::addEvent($event_type, $event_value_type, $event_value); $res=Event::addEvent($event_type, $event_value_type, $event_value);
$this->assertTrue(is_bool($res)); $this->assertTrue(is_bool($res));
//var_dump($res); //var_dump($res);

Loading…
Cancel
Save