diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 5c9d843dc1..979e296aff 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -524,9 +524,8 @@ class DocumentManager { //condition for the session $current_session_id = api_get_session_id(); - $condition_session = " AND (id_session = '$current_session_id' OR (id_session = '0' AND insert_date <= (SELECT creation_date FROM $TABLE_COURSE WHERE code = '{$_course[id]}')))"; - - $sql = "SELECT * + $condition_session = " AND (id_session = '$current_session_id' OR id_session = '0')"; + $sql = "SELECT docs.id, docs.filetype, docs.path, docs.title, docs.comment, docs.size, docs.readonly, last.visibility FROM ".$TABLE_ITEMPROPERTY." AS last, ".$TABLE_DOCUMENT." AS docs WHERE docs.id = last.ref AND docs.path LIKE '".$path.$added_slash."%' diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index 61b3f0099e..e06ba535e8 100755 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -1575,23 +1575,16 @@ function api_get_session_image($session_id, $status_id) { * @return string condition of the session */ function api_get_session_condition($session_id, $state = true, $both = false) { - $session_id = intval($session_id); - //condition to show resources by session $condition_session = ''; - $condition_add = $state == false ? " WHERE " : " AND "; - if ($session_id > 0) { - if (api_is_session_in_category($session_id,'20091U') || $both) { - $condition_session = $condition_add . " ( session_id = ".(int)$session_id." OR session_id = 0 ) "; - } else { - $condition_session = $condition_add . " session_id = ".(int)$session_id." "; - } + $condition_add = $state == false ? " WHERE " : " AND "; + if ($session_id > 0) { + $condition_session = $condition_add."(session_id = ".(int)$session_id." OR session_id = 0)"; } else { - $condition_session = $condition_add . " session_id = 0 "; + $condition_session = $condition_add."session_id = 0"; } return $condition_session; - } /**