Fixing wiki errors see #6092

1.9.x
Julio Montoya 11 years ago
parent ef1b7dab87
commit 5e3fd4b4dc
  1. 7
      main/wiki/index.php
  2. 496
      main/wiki/wiki.inc.php

@ -102,9 +102,11 @@ $view = isset($_GET['view']) ? $_GET['view'] : null;
$wiki->page = $page;
$wiki->action = $action;
/* MAIN CODE */
// Setting wiki data
if (!empty($view)) {
$wiki->setWikiData($view);
}
/* ACTIONS */
$wiki->blockConcurrentEditions(api_get_user_id(), $action);
/* MAIN WIKI AREA */
@ -118,7 +120,6 @@ Display::display_header($tool_name, 'Wiki');
// check last version
if (!empty($view)) {
$wiki->setWikiData($view);
$wiki->checkLastVersion($view);
}

@ -41,6 +41,8 @@ class Wiki
$this->condition_session = api_get_session_condition($this->session_id);
$this->course_id = api_get_course_int_id();
$this->group_id = api_get_group_id();
if (!empty($this->group_id)) {
$this->groupfilter = ' group_id="'.$this->group_id.'"';
}
@ -50,11 +52,11 @@ class Wiki
/**
* Check whether this title is already used
* @param string $paramwk
* @param string $link
* @return bool False if title is already taken
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
**/
public function checktitle($paramwk)
public function checktitle($link)
{
$tbl_wiki = $this->tbl_wiki;
$condition_session = $this->condition_session;
@ -64,7 +66,7 @@ class Wiki
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE
c_id = '.$course_id.' AND
reflink="'.Database::escape_string($paramwk).'" AND
reflink="'.Database::escape_string($link).'" AND
'.$groupfilter.$condition_session.'';
$result = Database::query($sql);
$numberofresults = Database::num_rows($result);
@ -366,19 +368,38 @@ class Wiki
* @author Juan Carlos Raña <herodoto@telefonica.net>
* @return string Message of success (to be printed on screen)
**/
public function restore_wikipage($r_page_id, $r_reflink, $r_title, $r_content, $r_group_id, $r_assignment, $r_progress, $c_version, $r_version, $r_linksto)
{
public function restore_wikipage(
$r_page_id,
$r_reflink,
$r_title,
$r_content,
$r_group_id,
$r_assignment,
$r_progress,
$c_version,
$r_version,
$r_linksto
) {
$tbl_wiki = $this->tbl_wiki;
$_course = $this->courseInfo;
$r_user_id= api_get_user_id();
$r_dtime = date( "Y-m-d H:i:s" );
$r_user_id = api_get_user_id();
$r_dtime = api_get_utc_datetime();
$r_version = $r_version+1;
$r_comment = get_lang('RestoredFromVersion').': '.$c_version;
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$sql="INSERT INTO ".$tbl_wiki." (c_id, page_id, reflink, title, content, user_id, group_id, dtime, assignment, comment, progress, version, linksto, user_ip, session_id) VALUES
$r_page_id = Database::escape_string($r_page_id);
$r_title = Database::escape_string($r_title);
$r_content = Database::escape_string($r_content);
$r_group_id = Database::escape_string($r_group_id);
$r_assignment = Database::escape_string($r_assignment);
$r_progress = Database::escape_string($r_progress);
$r_version = Database::escape_string($r_version);
$r_linksto = Database::escape_string($r_linksto);
$r_comment = Database::escape_string($r_comment);
$sql = "INSERT INTO ".$tbl_wiki." (c_id, page_id, reflink, title, content, user_id, group_id, dtime, assignment, comment, progress, version, linksto, user_ip, session_id) VALUES
($course_id, '".$r_page_id."','".$r_reflink."','".$r_title."','".$r_content."','".$r_user_id."','".$r_group_id."','".$r_dtime."','".$r_assignment."','".$r_comment."','".$r_progress."','".$r_version."','".$r_linksto."','".Database::escape_string($_SERVER['REMOTE_ADDR'])."','".Database::escape_string($session_id)."')";
Database::query($sql);
@ -454,8 +475,8 @@ class Wiki
} else {
$page = str_replace(' ','_',$values['title']);
}
$_clean['reflink'] = Database::escape_string(strip_tags(api_htmlentities($page)));
$_clean['title'] = Database::escape_string(strip_tags(trim($values['title'])));
$_clean['reflink'] = Database::escape_string($page);
$_clean['title'] = Database::escape_string(trim($values['title']));
$_clean['content'] = Database::escape_string($values['content']);
if (api_get_setting('htmlpurifier_wiki') == 'true'){
@ -524,7 +545,7 @@ class Wiki
self::setMessage(Display::display_warning_message(get_lang('GoAndEditMainPage'), false, true));
} else {
$var = $_clean['reflink'];
$group_id = Security::remove_XSS($_GET['group_id']);
$group_id = intval($_GET['group_id']);
if (!self::checktitle($var)) {
return get_lang('WikiPageTitleExist').'<a href="index.php?action=edit&amp;title='.$var.'&group_id='.$group_id.'">'.$values['title'].'</a>';
} else {
@ -702,7 +723,7 @@ class Wiki
$filter = null;
if (isset($_GET['view']) && $_GET['view']) {
$_clean['view']=(int)Database::escape_string($_GET['view']);
$_clean['view'] = Database::escape_string($_GET['view']);
$filter =' AND w.id="'.$_clean['view'].'"';
}
@ -743,19 +764,18 @@ class Wiki
// if both are empty and we are displaying the index page then we display the default text.
if ($row['content']=='' AND $row['title']=='' AND $page=='index') {
if (api_is_allowed_to_edit(false,true) || api_is_platform_admin() || GroupManager :: is_user_in_group(api_get_user_id(), api_get_group_id())) {
if (api_is_allowed_to_edit(false,true) || api_is_platform_admin() || GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())) {
//Table structure for better export to pdf
$default_table_for_content_Start='<table align="center" border="0"><tr><td align="center">';
$default_table_for_content_End='</td></tr></table>';
$content=$default_table_for_content_Start.sprintf(get_lang('DefaultContent'),api_get_path(WEB_IMG_PATH)).$default_table_for_content_End;
$content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'),api_get_path(WEB_IMG_PATH)).$default_table_for_content_End;
$title=get_lang('DefaultTitle');
} else {
return self::setMessage(Display::display_normal_message(get_lang('WikiStandBy'), false, true));
}
} else {
$content = Security::remove_XSS(api_html_entity_decode($row['content']), COURSEMANAGERLOWSECURITY);
$title= api_html_entity_decode($row['title']);
$content = Security::remove_XSS($row['content']);
$title = Security::remove_XSS($row['title']);
}
//assignment mode: identify page type
@ -773,7 +793,11 @@ class Wiki
}
//Show page. Show page to all users if isn't hide page. Mode assignments: if student is the author, can view
if ($KeyVisibility=="1" || api_is_allowed_to_edit(false,true) || api_is_platform_admin() || ($row['assignment']==2 && $KeyVisibility=="0" && (api_get_user_id()==$row['user_id']))) {
if ($KeyVisibility == "1" ||
api_is_allowed_to_edit(false,true) ||
api_is_platform_admin() ||
($row['assignment']==2 && $KeyVisibility=="0" && (api_get_user_id()==$row['user_id']))
) {
echo '<div id="wikititle">';
$protect_page = null;
$lock_unlock_protect = null;
@ -797,17 +821,12 @@ class Wiki
$lock_unlock_visibility = null;
//page action: visibility
if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
if (self::check_visibility_page()==1) {
// TODO: FIX This hides the icon eye closed to users of work they can see yours
//if(($row['assignment']==2 && $KeyVisibility=="0" && (api_get_user_id()==$row['user_id']))==false)
//{
//
// }
$visibility_page= Display::return_icon('visible.png', get_lang('ShowPageExtra'),'',ICON_SIZE_SMALL);
if (self::check_visibility_page() == 1) {
$visibility_page= Display::return_icon('visible.png', get_lang('ShowPageExtra'),'', ICON_SIZE_SMALL);
$lock_unlock_visibility='invisible';
} else {
$visibility_page= Display::return_icon('invisible.png', get_lang('HidePageExtra'),'',ICON_SIZE_SMALL);
$visibility_page= Display::return_icon('invisible.png', get_lang('HidePageExtra'),'', ICON_SIZE_SMALL);
$lock_unlock_visibility='visible';
}
}
@ -997,11 +1016,15 @@ class Wiki
$groupfilter = $this->groupfilter;
$course_id = api_get_course_int_id();
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$status_addlock=$row['addlock'];
//change status
$sql = 'SELECT *
FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
ORDER BY id ASC';
$result = Database::query($sql);
$row = Database::fetch_array($result);
$status_addlock = $row['addlock'];
// Change status
if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockaddnew' && $status_addlock==1) {
$status_addlock=0;
@ -1010,11 +1033,15 @@ class Wiki
$status_addlock=1;
}
Database::query('UPDATE '.$tbl_wiki.' SET addlock="'.Database::escape_string($status_addlock).'" WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'');
Database::query('UPDATE '.$tbl_wiki.' SET addlock="'.Database::escape_string($status_addlock).'"
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'');
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$sql = 'SELECT *
FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
ORDER BY id ASC';
$result = Database::query($sql);
$row = Database::fetch_array($result);
}
return $row['addlock'];
@ -1042,7 +1069,7 @@ class Wiki
$result=Database::query($sql);
$row=Database::fetch_array($result);
$status_editlock=$row['editlock'];
$status_editlock = $row['editlock'];
$id = $row['id'];
///change status
@ -1053,8 +1080,11 @@ class Wiki
if (isset($_GET['actionpage']) && $_GET['actionpage']=='unlock' && $status_editlock==1) {
$status_editlock=0;
}
$sql='UPDATE '.$tbl_wiki.' SET editlock="'.Database::escape_string($status_editlock).'" WHERE c_id = '.$course_id.' AND id="'.$id.'"';
$sql = 'UPDATE '.$tbl_wiki.' SET editlock="'.Database::escape_string($status_editlock).'"
WHERE c_id = '.$course_id.' AND id="'.$id.'"';
Database::query($sql);
$sql='SELECT * FROM '.$tbl_wiki.'
WHERE
c_id = '.$course_id.' AND
@ -1062,8 +1092,9 @@ class Wiki
'.$groupfilter.$condition_session.'
ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$row = Database::fetch_array($result);
}
//show status
return $row['editlock'];
}
@ -1081,9 +1112,9 @@ class Wiki
$groupfilter = $this->groupfilter;
$course_id = api_get_course_int_id();
$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';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$status_visibility=$row['visibility'];
@ -1101,9 +1132,12 @@ class Wiki
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session;
Database::query($sql);
//Although the value now is assigned to all (not only the first), these three lines remain necessary. They do that by changing the page state is made when you press the button and not have to wait to change his page
// Although the value now is assigned to all (not only the first), these three lines remain necessary. They do that by changing the page state is made when you press the button and not have to wait to change his page
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.'
WHERE
c_id = '.$course_id.' AND
reflink="'.Database::escape_string($page).'" AND
'.$groupfilter.$condition_session.'
ORDER BY id ASC';
$result=Database::query($sql);
$row = Database::fetch_array($result);
@ -1132,12 +1166,15 @@ class Wiki
$course_id = api_get_course_int_id();
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.'
WHERE
c_id = '.$course_id.' AND
reflink="'.Database::escape_string($page).'" AND
'.$groupfilter.$condition_session.'
ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$status_visibility_disc=$row['visibility_disc'];
$status_visibility_disc = $row['visibility_disc'];
//change status
if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
@ -1149,7 +1186,10 @@ class Wiki
}
$sql = 'UPDATE '.$tbl_wiki.' SET visibility_disc="'.Database::escape_string($status_visibility_disc).'"
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session;
WHERE
c_id = '.$course_id.' AND
reflink="'.Database::escape_string($page).'" AND
'.$groupfilter.$condition_session;
Database::query($sql);
//Although the value now is assigned to all (not only the first), these three lines remain necessary. They do that by changing the page state is made when you press the button and not have to wait to change his page
@ -1159,8 +1199,8 @@ class Wiki
reflink="'.Database::escape_string($page).'" AND
'.$groupfilter.$condition_session.'
ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$result = Database::query($sql);
$row = Database::fetch_array($result);
}
return $row['visibility_disc'];
}
@ -1179,10 +1219,13 @@ class Wiki
$course_id = api_get_course_int_id();
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.'
WHERE
c_id = '.$course_id.' AND
reflink="'.Database::escape_string($page).'" AND
'.$groupfilter.$condition_session.'
ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$result = Database::query($sql);
$row = Database::fetch_array($result);
$status_addlock_disc=$row['addlock_disc'];
@ -1195,8 +1238,8 @@ class Wiki
$status_addlock_disc=0;
}
$sql='UPDATE '.$tbl_wiki.' SET addlock_disc="'.Database::escape_string($status_addlock_disc).'"
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session;
$sql = 'UPDATE '.$tbl_wiki.' SET addlock_disc="'.Database::escape_string($status_addlock_disc).'"
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session;
Database::query($sql);
//Although the value now is assigned to all (not only the first), these three lines remain necessary. They do that by changing the page state is made when you press the button and not have to wait to change his page
@ -1227,7 +1270,6 @@ class Wiki
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.' ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$status_ratinglock_disc=$row['ratinglock_disc'];
//change status
@ -1239,13 +1281,21 @@ class Wiki
$status_ratinglock_disc=0;
}
$sql='UPDATE '.$tbl_wiki.' SET ratinglock_disc="'.Database::escape_string($status_ratinglock_disc).'"
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session; //Visibility. Value to all,not only for the first
$sql = 'UPDATE '.$tbl_wiki.' SET ratinglock_disc="'.Database::escape_string($status_ratinglock_disc).'"
WHERE
c_id = '.$course_id.' AND
reflink="'.Database::escape_string($page).'" AND
'.$groupfilter.$condition_session;
//Visibility. Value to all,not only for the first
Database::query($sql);
//Although the value now is assigned to all (not only the first), these three lines remain necessary. They do that by changing the page state is made when you press the button and not have to wait to change his page
$sql='SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.' ORDER BY id ASC';
WHERE
c_id = '.$course_id.' AND
reflink="'.Database::escape_string($page).'" AND
'.$groupfilter.$condition_session.'
ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
}
@ -1289,7 +1339,8 @@ class Wiki
// Change status
if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotify' && $status_notify==0) {
$sql = "SELECT id FROM $tbl_wiki_mailcue WHERE c_id = $course_id AND id = $id AND user_id = $userId";
$sql = "SELECT id FROM $tbl_wiki_mailcue
WHERE c_id = $course_id AND id = $id AND user_id = $userId";
$result = Database::query($sql);
$exist = false;
if (Database::num_rows($result)) {
@ -1338,10 +1389,9 @@ class Wiki
$id=$row['id'];
$sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D"';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$idm=$row['id'];
$result = Database::query($sql);
$row = Database::fetch_array($result);
$idm = $row['id'];
if (empty($idm)) {
$status_notify_disc=0;
@ -1378,7 +1428,12 @@ class Wiki
$session_id=api_get_session_id();
$sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
WHERE c_id = '.$course_id.' AND user_id="'.api_get_user_id().'" AND type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"';
WHERE
c_id = '.$course_id.' AND
user_id="'.api_get_user_id().'" AND
type="F" AND
group_id="'.$groupId.'" AND
session_id="'.$session_id.'"';
$result=Database::query($sql);
$row=Database::fetch_array($result);
@ -1400,7 +1455,13 @@ class Wiki
if (isset($_GET['actionpage']) && isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotifyall' && $status_notify_all==1) {
$sql ='DELETE FROM '.$tbl_wiki_mailcue.'
WHERE c_id = '.$course_id.' AND user_id="'.api_get_user_id().'" AND type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'" AND c_id = '.$course_id;
WHERE
c_id = '.$course_id.' AND
user_id="'.api_get_user_id().'" AND
type="F" AND
group_id="'.$groupId.'" AND
session_id="'.$session_id.'" AND
c_id = '.$course_id;
Database::query($sql);
$status_notify_all=0;
}
@ -1455,7 +1516,14 @@ class Wiki
if ($row['visibility']==1) {
$allow_send_mail=true; //if visibility off - notify off
$sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
WHERE c_id = '.$course_id.' AND id="'.$id.'" AND type="'.$type.'" OR type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"'; //type: P=page, D=discuss, F=full.
WHERE
c_id = '.$course_id.' AND
id="'.$id.'" AND
type="'.$type.'" OR
type="F" AND
group_id="'.$groupId.'" AND
session_id="'.$session_id.'"';
//type: P=page, D=discuss, F=full.
$result=Database::query($sql);
$emailtext=get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
}
@ -1480,7 +1548,9 @@ class Wiki
$id=$id_or_ref; //$id_or_ref is id from tblwiki
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND id="'.$id.'" ORDER BY id ASC';
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND id="'.$id.'"
ORDER BY id ASC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
@ -1489,7 +1559,14 @@ class Wiki
if ($row['visibility_disc']==1) {
$allow_send_mail=true; //if visibility off - notify off
$sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
WHERE c_id = '.$course_id.' AND id="'.$id.'" AND type="'.$type.'" OR type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"'; //type: P=page, D=discuss, F=full
WHERE
c_id = '.$course_id.' AND
id="'.$id.'" AND
type="'.$type.'" OR
type="F" AND
group_id="'.$groupId.'" AND
session_id="'.$session_id.'"';
//type: P=page, D=discuss, F=full
$result=Database::query($sql);
$emailtext=get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
}
@ -1527,13 +1604,13 @@ class Wiki
}
$sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
WHERE c_id = '.$course_id.' AND id="'.$id.'" AND type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"'; //type: P=page, D=discuss, F=full
WHERE c_id = '.$course_id.' AND id="'.$id.'" AND type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"';
//type: P=page, D=discuss, F=full
$result=Database::query($sql);
$emailtext=get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '. get_lang('Wiki');
} elseif($type=='E') {
$emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '. get_lang('Wiki');
} elseif ($type=='E') {
$id=0;
$allow_send_mail=true;
//Who is the author?
@ -1589,8 +1666,8 @@ class Wiki
if (empty($data)) {
return false;
}
$wikiTitle = $data['title'];
$wikiContents = $data['content'];
$wikiTitle = $data['title'];
$wikiContents = $data['content'];
$template =
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@ -1813,8 +1890,9 @@ class Wiki
$name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname'])." . ".$username;
$photo= '<img src="'.$image_repository.$existing_image.'" alt="'.$name.'" width="40" height="50" align="bottom" title="'.$name.'" />';
$is_tutor_of_group = GroupManager :: is_tutor_of_group($assig_user_id,$groupId); //student is tutor
$is_tutor_and_member = (GroupManager :: is_tutor_of_group($assig_user_id,$groupId) && GroupManager :: is_subscribed($assig_user_id, $groupId)); //student is tutor and member
$is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id,$groupId); //student is tutor
$is_tutor_and_member = (GroupManager::is_tutor_of_group($assig_user_id,$groupId) && GroupManager::is_subscribed($assig_user_id, $groupId));
//student is tutor and member
if($is_tutor_and_member) {
$status_in_group=get_lang('GroupTutorAndMember');
@ -1858,7 +1936,14 @@ class Wiki
$values['title']= $title_orig;
$values['comment']=get_lang('AssignmentDesc');
sort($all_students_pages);
$values['content']=$content_orig_A.$content_orig_B.'<br/><div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">'.get_lang('AssignmentLinkstoStudentsPage').'</div><br/><div style="background-color: #F5F8FB; border:solid; border-color:#E6E6E6"><ol>'.implode($all_students_pages).'</ol></div><br/>';
$values['content']=$content_orig_A.$content_orig_B.'<br/>
<div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
'.get_lang('AssignmentLinkstoStudentsPage').'
</div><br/>
<div style="background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
<ol>'.implode($all_students_pages).'</ol>
</div>
<br/>';
$values['assignment']=1;
}
$this->assig_user_id = $assig_user_id;
@ -1888,41 +1973,98 @@ class Wiki
if ($all_vers=='1') {
if ($search_content=='1') {
$sql = "SELECT * FROM ".$tbl_wiki."
WHERE c_id = $course_id AND title LIKE '%".Database::escape_string($search_term)."%' OR content LIKE '%".Database::escape_string($search_term)."%' AND ".$groupfilter.$condition_session."";//search all pages and all versions
WHERE
c_id = $course_id AND
title LIKE '%".Database::escape_string($search_term)."%' OR
content LIKE '%".Database::escape_string($search_term)."%' AND
".$groupfilter.$condition_session."";
//search all pages and all versions
} else {
$sql = "SELECT * FROM ".$tbl_wiki."
WHERE c_id = $course_id AND title LIKE '%".Database::escape_string($search_term)."%' AND ".$groupfilter.$condition_session."";//search all pages and all versions
WHERE
c_id = $course_id AND
title LIKE '%".Database::escape_string($search_term)."%' AND
".$groupfilter.$condition_session."";
//search all pages and all versions
}
} else {
if ($search_content=='1') {
$sql = "SELECT * FROM ".$tbl_wiki." s1
WHERE s1.c_id = $course_id AND title LIKE '%".Database::escape_string($search_term)."%' OR content LIKE '%".Database::escape_string($search_term)."%' AND
id=(SELECT MAX(s2.id) FROM ".$tbl_wiki." s2 WHERE s2.c_id = $course_id AND s1.reflink = s2.reflink AND ".$groupfilter.$condition_session.")";// warning don't use group by reflink because don't return the last version
WHERE
s1.c_id = $course_id AND
title LIKE '%".Database::escape_string($search_term)."%' OR
content LIKE '%".Database::escape_string($search_term)."%' AND
id=(
SELECT MAX(s2.id)
FROM ".$tbl_wiki." s2
WHERE
s2.c_id = $course_id AND
s1.reflink = s2.reflink AND
".$groupfilter.$condition_session.")";
// warning don't use group by reflink because don't return the last version
}
else {
$sql = " SELECT * FROM ".$tbl_wiki." s1
WHERE s1.c_id = $course_id AND title LIKE '%".Database::escape_string($search_term)."%' AND
id=(SELECT MAX(s2.id) FROM ".$tbl_wiki." s2 WHERE s2.c_id = $course_id AND s1.reflink = s2.reflink AND ".$groupfilter.$condition_session.")";// warning don't use group by reflink because don't return the last version
WHERE
s1.c_id = $course_id AND
title LIKE '%".Database::escape_string($search_term)."%' AND
id=(
SELECT MAX(s2.id)
FROM ".$tbl_wiki." s2
WHERE
s2.c_id = $course_id AND
s1.reflink = s2.reflink AND
".$groupfilter.$condition_session.")";
// warning don't use group by reflink because don't return the last version
}
}
} else {
if($all_vers=='1') {
if ($search_content=='1') {
$sql = "SELECT * FROM ".$tbl_wiki."
WHERE c_id = $course_id AND visibility=1 AND title LIKE '%".Database::escape_string($search_term)."%' OR content LIKE '%".Database::escape_string($search_term)."%' AND ".$groupfilter.$condition_session."";//search all pages and all versions
WHERE
c_id = $course_id AND
visibility=1 AND
title LIKE '%".Database::escape_string($search_term)."%' OR
content LIKE '%".Database::escape_string($search_term)."%' AND
".$groupfilter.$condition_session."";
//search all pages and all versions
} else {
$sql = "SELECT * FROM ".$tbl_wiki."
WHERE c_id = $course_id AND visibility=1 AND title LIKE '%".Database::escape_string($search_term)."%' AND ".$groupfilter.$condition_session."";//search all pages and all versions
WHERE
c_id = $course_id AND
visibility=1 AND
title LIKE '%".Database::escape_string($search_term)."%' AND
".$groupfilter.$condition_session."";
//search all pages and all versions
}
} else {
if($search_content=='1') {
$sql = " SELECT * FROM ".$tbl_wiki." s1
WHERE s1.c_id = $course_id AND visibility=1 AND title LIKE '%".Database::escape_string($search_term)."%' OR content LIKE '%".Database::escape_string($search_term)."%' AND
id=(SELECT MAX(s2.id) FROM ".$tbl_wiki." s2 WHERE s2.c_id = $course_id AND s1.reflink = s2.reflink AND ".$groupfilter.$condition_session.")";// warning don't use group by reflink because don't return the last version
$sql = "SELECT * FROM ".$tbl_wiki." s1
WHERE
s1.c_id = $course_id AND
visibility=1 AND
title LIKE '%".Database::escape_string($search_term)."%' OR
content LIKE '%".Database::escape_string($search_term)."%' AND
id=(
SELECT MAX(s2.id)
FROM ".$tbl_wiki." s2
WHERE s2.c_id = $course_id AND
s1.reflink = s2.reflink AND
".$groupfilter.$condition_session.")";
// warning don't use group by reflink because don't return the last version
} else {
$sql = " SELECT * FROM ".$tbl_wiki." s1
WHERE s1.c_id = $course_id AND visibility=1 AND title LIKE '%".Database::escape_string($search_term)."%' AND
id=(SELECT MAX(s2.id) FROM ".$tbl_wiki." s2 WHERE s2.c_id = $course_id AND s1.reflink = s2.reflink AND ".$groupfilter.$condition_session.")";// warning don't use group by reflink because don't return the last version
$sql = "SELECT * FROM ".$tbl_wiki." s1
WHERE
s1.c_id = $course_id AND
visibility=1 AND
title LIKE '%".Database::escape_string($search_term)."%' AND
id=(
SELECT MAX(s2.id) FROM ".$tbl_wiki." s2
WHERE s2.c_id = $course_id AND
s1.reflink = s2.reflink AND
".$groupfilter.$condition_session.")";
// warning don't use group by reflink because don't return the last version
}
}
}
@ -1956,9 +2098,11 @@ class Wiki
$row[] =$ShowAssignment;
if($all_vers=='1') {
$row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&view='.$obj->id.'&session_id='.api_htmlentities(urlencode($_GET['$session_id'])).'&group_id='.api_htmlentities(urlencode($_GET['group_id'])).'">'.api_htmlentities($obj->title).'</a>';
$row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&view='.$obj->id.'&session_id='.api_htmlentities(urlencode($_GET['$session_id'])).'&group_id='.api_htmlentities(urlencode($_GET['group_id'])).'">'.
api_htmlentities($obj->title).'</a>';
} else {
$row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.$obj->title.'</a>';
$row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
$obj->title.'</a>';
}
$row[] = $obj->user_id <>0 ? '<a href="'.api_get_path(WEB_CODE_PATH).'user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.
@ -1969,7 +2113,8 @@ class Wiki
$row[] = $obj->version;
} else {
if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
$showdelete=' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
$showdelete=' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
}
$row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
Display::return_icon('edit.png', get_lang('EditPage'),'',ICON_SIZE_SMALL).'</a>
@ -1983,7 +2128,17 @@ class Wiki
}
$table = new SortableTableFromArrayConfig($rows, 1, 10,'SearchPages_table','','','ASC');
$table->set_additional_parameters(array('cidReq' => $_GET['cidReq'],'action'=> $_GET['action'], 'group_id'=>Security::remove_XSS($_GET['group_id']),'mode_table'=>'yes2','search_term'=>$search_term, 'search_content'=>$search_content, 'all_vers'=>$all_vers));
$table->set_additional_parameters(
array(
'cidReq' => $_GET['cidReq'],
'action'=> $_GET['action'],
'group_id'=>Security::remove_XSS($_GET['group_id']),
'mode_table'=>'yes2',
'search_term'=>$search_term,
'search_content'=>$search_content,
'all_vers'=>$all_vers
)
);
$table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
$table->set_header(1,get_lang('Title'), true);
if ($all_vers=='1') {
@ -2061,7 +2216,11 @@ class Wiki
*/
public function get_date_from_select($prefix)
{
return $_POST[$prefix.'_year'].'-'.self::two_digits($_POST[$prefix.'_month']).'-'.self::two_digits($_POST[$prefix.'_day']).' '.self::two_digits($_POST[$prefix.'_hour']).':'.self::two_digits($_POST[$prefix.'_minute']).':00';
return $_POST[$prefix.'_year'].'-'.
self::two_digits($_POST[$prefix.'_month']).'-'.
self::two_digits($_POST[$prefix.'_day']).' '.
self::two_digits($_POST[$prefix.'_hour']).':'.
self::two_digits($_POST[$prefix.'_minute']).':00';
}
/**
@ -2093,6 +2252,28 @@ class Wiki
return $data;
}
/**
* @param string $refLink
* @return array
*/
public function getLastWikiData($refLink)
{
$tbl_wiki = $this->tbl_wiki;
$groupfilter = $this->groupfilter;
$condition_session = $this->condition_session;
$course_id = api_get_course_int_id();
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE
c_id = '.$course_id.' AND
reflink="'.Database::escape_string($refLink).'" AND
'.$groupfilter.$condition_session.'
ORDER BY id DESC';
$result = Database::query($sql);
return Database::fetch_array($result);
}
/**
* Get wiki information
* @param string wiki id
@ -2113,7 +2294,8 @@ class Wiki
}
$title = Database::escape_string($title);
$sql = "SELECT * FROM $tbl_wiki WHERE c_id = $courseId AND reflink = '$title'";
$sql = "SELECT * FROM $tbl_wiki
WHERE c_id = $courseId AND reflink = '$title'";
$result = Database::query($sql);
$data = array();
if (Database::num_rows($result)) {
@ -2170,7 +2352,9 @@ class Wiki
$condition_session = $this->condition_session;
$sql = "SELECT * FROM $tbl_wiki
WHERE c_id = $course_id AND is_editing != '0' ".$condition_session;
WHERE
c_id = $course_id AND
is_editing != '0' ".$condition_session;
$result = Database::query($sql);
return Database::store_result($result, 'ASSOC');
}
@ -2185,8 +2369,13 @@ class Wiki
$condition_session = $this->condition_session;
$isEditing = Database::escape_string($isEditing);
$sql = 'UPDATE '.$tbl_wiki.' SET is_editing="0", time_edit="0000-00-00 00:00:00"
WHERE c_id = '.$course_id.' AND is_editing="'.$isEditing.'" '.$condition_session;
$sql = 'UPDATE '.$tbl_wiki.' SET
is_editing="0",
time_edit="0000-00-00 00:00:00"
WHERE
c_id = '.$course_id.' AND
is_editing="'.$isEditing.'" '.
$condition_session;
Database::query($sql);
}
@ -2280,7 +2469,8 @@ class Wiki
$total_wlinks = $total_wlinks+substr_count($row['content'], "[[");
$total_images = $total_images+substr_count($row['content'], "<img");
$clean_total_flash = preg_replace('/player.swf/', ' ', $row['content']);
$total_flash = $total_flash+substr_count($clean_total_flash, '.swf"');//.swf" end quotes prevent insert swf through flvplayer (is not counted)
$total_flash = $total_flash+substr_count($clean_total_flash, '.swf"');
//.swf" end quotes prevent insert swf through flvplayer (is not counted)
$total_mp3 = $total_mp3+substr_count($row['content'], ".mp3");
$total_flv_p = $total_flv_p+substr_count($row['content'], ".flv");
$total_flv = $total_flv_p/5;
@ -2291,12 +2481,16 @@ class Wiki
//check only last version of all pages (current page)
$sql =' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
$sql =' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
FROM '.$tbl_wiki.' s1
WHERE s1.c_id = '.$course_id.' AND id=(
SELECT MAX(s2.id)
FROM '.$tbl_wiki.' s2
WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
SELECT MAX(s2.id)
FROM '.$tbl_wiki.' s2
WHERE
s2.c_id = '.$course_id.' AND
s1.reflink = s2.reflink AND
'.$groupfilter.' AND
session_id='.$session_id.')';
$allpages = Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_pages = $row['TOTAL_PAGES'];
@ -2339,7 +2533,8 @@ class Wiki
$total_wlinks_lv = $total_wlinks_lv+substr_count($row['content'], "[[");
$total_images_lv = $total_images_lv+substr_count($row['content'], "<img");
$clean_total_flash_lv = preg_replace('/player.swf/', ' ', $row['content']);
$total_flash_lv = $total_flash_lv+substr_count($clean_total_flash_lv, '.swf"');//.swf" end quotes prevent insert swf through flvplayer (is not counted)
$total_flash_lv = $total_flash_lv+substr_count($clean_total_flash_lv, '.swf"');
//.swf" end quotes prevent insert swf through flvplayer (is not counted)
$total_mp3_lv = $total_mp3_lv+substr_count($row['content'], ".mp3");
$total_flv_p_lv = $total_flv_p_lv+substr_count($row['content'], ".flv");
$total_flv_lv = $total_flv_p_lv/5;
@ -2362,15 +2557,17 @@ class Wiki
'.$groupfilter.' AND
session_id='.$session_id.'
)';
//Can not use group by because the mark is set in the latest version
// Can not use group by because the mark is set in the latest version
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_editing_now = $row['TOTAL_EDITING_NOW'];
}
//Total hidden pages
// Total hidden pages
$total_hidden=0;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND visibility=0 AND '.$groupfilter.$condition_session.'
WHERE c_id = '.$course_id.' AND visibility=0 AND '.$groupfilter.$condition_session.'
GROUP BY reflink';
// or group by page_id. As the mark of hidden places it in all versions of the page, I can use group by to see the first
$allpages=Database::query($sql);
@ -2393,7 +2590,10 @@ class Wiki
// Total empty versions.
$total_empty_content=0;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND content="" AND '.$groupfilter.$condition_session.'';
WHERE
c_id = '.$course_id.' AND
content="" AND
'.$groupfilter.$condition_session.'';
$allpages = Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_empty_content = $total_empty_content+1;
@ -3018,16 +3218,14 @@ class Wiki
while ($row=Database::fetch_array($result)) {
$userinfo = api_get_user_info($row['userc_id']);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
if (($userinfo['status'])=="5") {
$author_status=get_lang('Student');
} else {
$author_status=get_lang('Teacher');
}
$user_id=$row['userc_id'];
$name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
$user_id = $row['userc_id'];
$name = $userinfo['complete_name'];
if ($user_id<>0) {
$image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true);
$image_repository = $image_path['dir'];
@ -3071,7 +3269,7 @@ class Wiki
$imagerating = Display::return_icon('rating/stars_45.gif');
break;
case 10:
$imagerating =Display::return_icon('rating/stars_50.gif');
$imagerating = Display::return_icon('rating/stars_50.gif');
break;
}
echo '<p><table>';
@ -3151,7 +3349,7 @@ class Wiki
}
$row = array();
$row[] =$ShowAssignment.$icon_task;
$row[] = $ShowAssignment.$icon_task;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&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>';
if ($obj->user_id <>0) {
@ -3373,7 +3571,6 @@ class Wiki
while ($obj = Database::fetch_object($allpages)) {
//get author
$userinfo = api_get_user_info($obj->user_id);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
//get time
$year = substr($obj->dtime, 0, 4);
@ -3431,9 +3628,9 @@ class Wiki
$_GET['all_vers'] = $_POST['all_vers'];
}
self::display_wiki_search_results(
api_htmlentities($_GET['search_term']),
api_htmlentities($_GET['search_content']),
api_htmlentities($_GET['all_vers'])
$_GET['search_term'],
$_GET['search_content'],
$_GET['all_vers']
);
} else {
@ -3625,24 +3822,29 @@ class Wiki
}
/**
* @param array $current_row
*/
public function restorePage()
{
$userId = api_get_user_id();
$_course = $this->courseInfo;
$current_row = $this->getWikiData();
$last_row = $this->getLastWikiData($this->page);
if (empty($last_row)) {
return false;
}
$PassEdit = false;
//Only teachers and platform admin can edit the index page. Only teachers and platform admin can edit an assignment teacher
if (($current_row['reflink']=='index' ||
$current_row['reflink']=='' ||
$current_row['assignment'] == 1
) &&
/* Only teachers and platform admin can edit the index page.
Only teachers and platform admin can edit an assignment teacher*/
if (($current_row['reflink']=='index' || $current_row['reflink']=='' || $current_row['assignment'] == 1) &&
(!api_is_allowed_to_edit(false,true) && $this->group_id == 0)
) {
self::setMessage(Display::display_normal_message(get_lang('OnlyEditPagesCourseManager'), false, true));
self::setMessage(
Display::display_normal_message(get_lang('OnlyEditPagesCourseManager'), false, true)
);
} else {
$PassEdit = false;
//check if is a wiki group
if ($current_row['group_id'] != 0) {
@ -3653,19 +3855,21 @@ class Wiki
) {
$PassEdit = true;
} else {
self::setMessage(Display::display_normal_message(get_lang('OnlyEditPagesGroupMembers'), false, true));
self::setMessage(
Display::display_normal_message(get_lang('OnlyEditPagesGroupMembers'), false, true)
);
}
} else {
$PassEdit = true;
}
// check if is an assignment
$icon_assignment = null;
if ($current_row['assignment']==1) {
//$icon_assignment = null;
if ($current_row['assignment'] == 1) {
self::setMessage(Display::display_normal_message(get_lang('EditAssignmentWarning'), false, true));
$icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
//$icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
} elseif($current_row['assignment']==2) {
$icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
//$icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
if (($userId == $current_row['user_id'])==false) {
if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
$PassEdit = true;
@ -3680,13 +3884,13 @@ class Wiki
//show editor if edit is allowed
if ($PassEdit) {
if ($row['editlock']==1 && (api_is_allowed_to_edit(false,true)==false || api_is_platform_admin()==false)) {
if ($current_row['editlock'] == 1 && (api_is_allowed_to_edit(false,true)==false || api_is_platform_admin()==false)) {
self::setMessage(Display::display_normal_message(get_lang('PageLockedExtra'), false, true));
} else {
if ($last_row['is_editing']!=0 && $last_row['is_editing'] != $userId) {
//checking for concurrent users
// Checking for concurrent users
$timestamp_edit = strtotime($last_row['time_edit']);
$time_editing = time()-$timestamp_edit;
$time_editing = time() - $timestamp_edit;
$max_edit_time = 1200; // 20 minutes
$rest_time = $max_edit_time - $time_editing;
$userinfo = api_get_user_info($last_row['is_editing']);
@ -3699,8 +3903,8 @@ class Wiki
self::restore_wikipage(
$current_row['page_id'],
$current_row['reflink'],
api_htmlentities($current_row['title']),
api_htmlentities($current_row['content']),
$current_row['title'],
$current_row['content'],
$current_row['group_id'],
$current_row['assignment'],
$current_row['progress'],
@ -3736,12 +3940,13 @@ class Wiki
/**
* Check last version
* @param int $view
*/
public function checkLastVersion($view)
{
$tbl_wiki = $this->tbl_wiki;
$course_id = $this->course_id;
$condition_session = $this->course_id;
$condition_session = $this->condition_session;
$groupfilter = $this->groupfilter;
$page = $this->page;
$_course = $this->courseInfo;
@ -3759,13 +3964,20 @@ class Wiki
'.$groupfilter.$condition_session.'
ORDER BY id DESC'; //last version
$result = Database::query($sql);
$last_row = Database::fetch_array($result);
if ($view < $last_row['id']) {
$message = '<center>'.get_lang('NoAreSeeingTheLastVersion').'<br />
'.get_lang("Version").' (
<a href="index.php?cidReq='.$_course['code'].'&action=showpage&amp;title='.api_htmlentities(urlencode($current_row['reflink'])).'&group_id='.$current_row['group_id'].'&session_id='.$current_row['session_id'].'&view='.api_htmlentities($_GET['view']).'" title="'.get_lang('CurrentVersion').'">
'.$current_row['version'].'</a> /
<a href="index.php?cidReq='.$_course['code'].'&action=showpage&amp;title='.api_htmlentities(urlencode($last_row['reflink'])).'&group_id='.$last_row['group_id'].'&session_id='.$last_row['session_id'].'" title="'.get_lang('LastVersion').'">'.$last_row['version'].'</a>) <br />'.get_lang("ConvertToLastVersion").': <a href="index.php?cidReq='.$_course['id'].'&action=restorepage&amp;title='.api_htmlentities(urlencode($last_row['reflink'])).'&group_id='.$last_row['group_id'].'&session_id='.$last_row['session_id'].'&view='.api_htmlentities($_GET['view']).'">'.
'.$current_row['version'].'
</a> /
<a href="index.php?cidReq='.$_course['code'].'&action=showpage&amp;title='.api_htmlentities(urlencode($last_row['reflink'])).'&group_id='.$last_row['group_id'].'&session_id='.$last_row['session_id'].'" title="'.get_lang('LastVersion').'">
'.$last_row['version'].'
</a>) <br />'.get_lang("ConvertToLastVersion").':
<a href="index.php?cidReq='.$_course['id'].'&action=restorepage&amp;title='.api_htmlentities(urlencode($last_row['reflink'])).'&group_id='.$last_row['group_id'].'&session_id='.$last_row['session_id'].'&view='.api_htmlentities($_GET['view']).'">'.
get_lang("Restore").'</a></center>';
self::setMessage(Display::display_warning_message($message, false, true));
}
@ -4568,7 +4780,7 @@ class Wiki
echo ' ( '.get_lang('Progress').': '.api_htmlentities($row['progress']).'%, ';
$comment = $row['comment'];
if (!empty($comment)) {
echo get_lang('Comments').': '.api_htmlentities(api_substr($row['comment'],0,100));
echo get_lang('Comments').': '.api_htmlentities(api_substr($row['comment'], 0, 100));
if (api_strlen($row['comment'])>100) {
echo '... ';
}

Loading…
Cancel
Save