@ -279,8 +279,12 @@ if ($_GET['view']) {
$rest_time=$max_edit_time-$time_editing;
$rest_time=$max_edit_time-$time_editing;
$userinfo=Database::get_user_info_from_id($last_row['is_editing']);
$userinfo=Database::get_user_info_from_id($last_row['is_editing']);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
$is_being_edited= get_lang('ThisPageisBeginEditedBy').' < a href = ../user/userInfo.php?uInfo='.$userinfo['user_id'].' > '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('.$userinfo['username'].')< / a > . '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
$is_being_edited= get_lang('ThisPageisBeginEditedBy').' < a href = ../user/userInfo.php?uInfo='.
$userinfo['user_id'].'>'.
Display::tag('span', api_get_person_name($userinfo['firstname'], $userinfo['lastname'], array('title'=>$username))).
get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
Display::display_normal_message($is_being_edited, false);
Display::display_normal_message($is_being_edited, false);
} else {
} else {
@ -1006,9 +1010,18 @@ if ($_GET['action']=='mactiveusers') {
$row = array ();
$row = array ();
while ($obj = Database::fetch_object($allpages)) {
while ($obj = Database::fetch_object($allpages)) {
$userinfo=Database::get_user_info_from_id($obj->user_id);
$userinfo=Database::get_user_info_from_id($obj->user_id);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
$row = array ();
$row = array ();
$row[] = $obj->user_id < >0 ? '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')< / a > < a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=usercontrib&user_id='.urlencode($row['user_id']).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > < / a > ' : get_lang('Anonymous').' ('.$obj->user_ip.')';
if ($obj->user_id < > 0) {
$row[] = '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.
Display::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).
'< / a > < a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=usercontrib&user_id='.urlencode($row['user_id']).
'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'"></a>';
}
else {
$row[] = get_lang('Anonymous').' ('.$obj->user_ip.')';
}
$row[] ='< a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=usercontrib&user_id='.urlencode($obj->user_id).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > '.$obj->NUM_EDIT.'< / a > ';
$row[] ='< a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=usercontrib&user_id='.urlencode($obj->user_id).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > '.$obj->NUM_EDIT.'< / a > ';
$rows[] = $row;
$rows[] = $row;
}
}
@ -1025,9 +1038,12 @@ if ($_GET['action']=='mactiveusers') {
if ($_GET['action']=='usercontrib') {
if ($_GET['action']=='usercontrib') {
$userinfo=Database::get_user_info_from_id($_GET['user_id']);
$userinfo=Database::get_user_info_from_id($_GET['user_id']);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
echo '< div class = "actions" > '.get_lang('UserContributions').': < a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')< / a > < a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=usercontrib&user_id='.urlencode($row['user_id']).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > < / a > < / div > ';
echo '< div class = "actions" > '.get_lang('UserContributions').': < a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.
Display::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).
'< / a > < a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=usercontrib&user_id='.urlencode($row['user_id']).
'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'"></a></div>';
if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' AND user_id="'.Database::escape_string($_GET['user_id']).'"';
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' AND user_id="'.Database::escape_string($_GET['user_id']).'"';
@ -1537,6 +1553,7 @@ if ($_GET['action']=='links') {
while ($obj = Database::fetch_object($allpages)) {
while ($obj = Database::fetch_object($allpages)) {
//get author
//get author
$userinfo=Database::get_user_info_from_id($obj->user_id);
$userinfo=Database::get_user_info_from_id($obj->user_id);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
//get time
//get time
$year = substr($obj->dtime, 0, 4);
$year = substr($obj->dtime, 0, 4);
@ -1558,7 +1575,13 @@ if ($_GET['action']=='links') {
$row = array ();
$row = array ();
$row[] =$ShowAssignment;
$row[] =$ShowAssignment;
$row[] = '< a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > '.api_htmlentities($obj->title).'< / a > ';
$row[] = '< a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > '.api_htmlentities($obj->title).'< / a > ';
$row[] = $obj->user_id < >0 ? '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')< / a > ' : get_lang('Anonymous').' ('.$obj->user_ip.')';
if ($obj->user_id < >0) {
$row[] = '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.
Display::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).'< / a > ';
}
else {
$row[] = get_lang('Anonymous').' ('.$obj->user_ip.')';
}
$row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
$row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
$rows[] = $row;
$rows[] = $row;
}
}
@ -1809,8 +1832,13 @@ if ($_GET['action']=='edit') {
$rest_time=$max_edit_time-$time_editing;
$rest_time=$max_edit_time-$time_editing;
$userinfo=Database::get_user_info_from_id($row['is_editing']);
$userinfo=Database::get_user_info_from_id($row['is_editing']);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
$is_being_edited= get_lang('ThisPageisBeginEditedBy').' < a href = ../user/userInfo.php?uInfo='.$userinfo['user_id'].' > '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')< / a > . '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
$is_being_edited= get_lang('ThisPageisBeginEditedBy').
' < a href = ../user/userInfo.php?uInfo='.
$userinfo['user_id'].'>'.
Display::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).
'< / a > . '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
Display::display_normal_message($is_being_edited, false);
Display::display_normal_message($is_being_edited, false);
exit;
exit;
}
}
@ -2060,6 +2088,7 @@ if ($_GET['action']=='history' or $_POST['HistoryDifferences']) {
while ($row=Database::fetch_array($result)) {
while ($row=Database::fetch_array($result)) {
$userinfo=Database::get_user_info_from_id($row['user_id']);
$userinfo=Database::get_user_info_from_id($row['user_id']);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
echo '< li style = "margin-bottom: 5px;" > ';
echo '< li style = "margin-bottom: 5px;" > ';
($counter==0) ? $oldstyle='style="visibility: hidden;"':$oldstyle='';
($counter==0) ? $oldstyle='style="visibility: hidden;"':$oldstyle='';
@ -2076,7 +2105,9 @@ if ($_GET['action']=='history' or $_POST['HistoryDifferences']) {
echo ' ('.get_lang('Version').' '.$row['version'].')';
echo ' ('.get_lang('Version').' '.$row['version'].')';
echo ' '.get_lang('By').' ';
echo ' '.get_lang('By').' ';
if ($row['user_id']< >0) {
if ($row['user_id']< >0) {
echo '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')< / a > ';
echo '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.
Displat::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).
'< / a > ';
} else {
} else {
echo get_lang('Anonymous').' ('.api_htmlentities($row[user_ip]).')';
echo get_lang('Anonymous').' ('.api_htmlentities($row[user_ip]).')';
}
}
@ -2212,6 +2243,7 @@ if ($_GET['action']=='recentchanges') {
while ($obj = Database::fetch_object($allpages)) {
while ($obj = Database::fetch_object($allpages)) {
//get author
//get author
$userinfo=Database::get_user_info_from_id($obj->user_id);
$userinfo=Database::get_user_info_from_id($obj->user_id);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
//get type assignment icon
//get type assignment icon
if ($obj->assignment==1) {
if ($obj->assignment==1) {
@ -2235,7 +2267,14 @@ if ($_GET['action']=='recentchanges') {
$row[] = $ShowAssignment.$icon_task;
$row[] = $ShowAssignment.$icon_task;
$row[] = '< a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&view='.$obj->id.'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > '.api_htmlentities($obj->title).'< / a > ';
$row[] = '< a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&view='.$obj->id.'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > '.api_htmlentities($obj->title).'< / a > ';
$row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy');
$row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy');
$row[] = $obj->user_id < > 0 ? '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')< / a > ' : get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')';
if ($obj->user_id < > 0 ) {
$row[] = '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.
Display::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).
'< / a > ';
}
else {
$row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')';
}
$rows[] = $row;
$rows[] = $row;
}
}
@ -2280,6 +2319,7 @@ if ($_GET['action']=='allpages') {
while ($obj = Database::fetch_object($allpages)) {
while ($obj = Database::fetch_object($allpages)) {
//get author
//get author
$userinfo=Database::get_user_info_from_id($obj->user_id);
$userinfo=Database::get_user_info_from_id($obj->user_id);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
//get type assignment icon
//get type assignment icon
if ($obj->assignment==1) {
if ($obj->assignment==1) {
@ -2300,7 +2340,14 @@ if ($_GET['action']=='allpages') {
$row = array ();
$row = array ();
$row[] =$ShowAssignment.$icon_task;
$row[] =$ShowAssignment.$icon_task;
$row[] = '< a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > '.api_htmlentities($obj->title).'< / a > ';
$row[] = '< a href = "'.api_get_self().'?cidReq='.$_course['id'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" > '.api_htmlentities($obj->title).'< / a > ';
$row[] = $obj->user_id < >0 ? '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')< / a > ' : get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')';
if ($obj->user_id < >0) {
$row[] = '< a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.
Display::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).
'< / a > ';
}
else {
$row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')';
}
$row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get());
$row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get());
if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
@ -2343,6 +2390,7 @@ if ($_GET['action']=='discuss') {
$row=Database::fetch_array($result);
$row=Database::fetch_array($result);
$lastversiondate=api_get_local_time($row['dtime'], null, date_default_timezone_get());
$lastversiondate=api_get_local_time($row['dtime'], null, date_default_timezone_get());
$lastuserinfo=Database::get_user_info_from_id($row['user_id']);
$lastuserinfo=Database::get_user_info_from_id($row['user_id']);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $lastuserinfo['username']), ENT_QUOTES);
//select page to discuss
//select page to discuss
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.' ORDER BY id ASC';
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.' ORDER BY id ASC';
@ -2431,7 +2479,9 @@ if ($_GET['action']=='discuss') {
echo $icon_assignment.' '.api_htmlentities($row['title']);
echo $icon_assignment.' '.api_htmlentities($row['title']);
echo ' ('.get_lang('MostRecentVersionBy').' < a href = "../user/userInfo.php?uInfo='.$lastuserinfo['user_id'].'" > '.api_htmlentities(api_get_person_name($lastuserinfo['firstname'], $lastuserinfo['lastname'])).' ('.$lastuserinfo['username'].')< / a > '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read average score
echo ' ('.get_lang('MostRecentVersionBy').' < a href = "../user/userInfo.php?uInfo='.$lastuserinfo['user_id'].'" > '.
Display::tag('span', api_htmlentities(api_get_person_name($lastuserinfo['firstname'], $lastuserinfo['lastname'])), array('title'=>$username)).
'< / a > '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read average score
echo '< / div > ';
echo '< / div > ';
@ -2529,6 +2579,8 @@ if ($_GET['action']=='discuss') {
while ($row=Database::fetch_array($result)) {
while ($row=Database::fetch_array($result)) {
$userinfo=Database::get_user_info_from_id($row['userc_id']);
$userinfo=Database::get_user_info_from_id($row['userc_id']);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
if (($userinfo['status'])=="5") {
if (($userinfo['status'])=="5") {
$author_status=get_lang('Student');
$author_status=get_lang('Student');
} else {
} else {
@ -2536,7 +2588,7 @@ if ($_GET['action']=='discuss') {
}
}
$user_id=$row['userc_id'];
$user_id=$row['userc_id'];
$name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('.$userinfo['username'].')' ;
$name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
$attrb=array();
$attrb=array();
if ($user_id< >0) {
if ($user_id< >0) {
$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);
@ -2588,7 +2640,9 @@ if ($_GET['action']=='discuss') {
echo '< p > < table > ';
echo '< p > < table > ';
echo '< tr > ';
echo '< tr > ';
echo '< td rowspan = "2" > '.$author_photo.'< / td > ';
echo '< td rowspan = "2" > '.$author_photo.'< / td > ';
echo '< td style = " color:#999999" > < a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')< / a > ('.$author_status.') '.api_get_local_time($row['dtime'], null, date_default_timezone_get()).' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' < / td > ';
echo '< td style = " color:#999999" > < a href = "../user/userInfo.php?uInfo='.$userinfo['user_id'].'" > '.
Display::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).
'< / a > ('.$author_status.') '.api_get_local_time($row['dtime'], null, date_default_timezone_get()).' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' < / td > ';
echo '< / tr > ';
echo '< / tr > ';
echo '< tr > ';
echo '< tr > ';
echo '< td > '.api_htmlentities($row['comment']).'< / td > ';
echo '< td > '.api_htmlentities($row['comment']).'< / td > ';