diff --git a/main/document/document.php b/main/document/document.php index 46fadff62a..1c414a4e6c 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -38,7 +38,7 @@ $to_user_id = null; $parent_id = null; $lib_path = api_get_path(LIBRARY_PATH); $actionsRight = ''; -$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; +$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; $allowUseTool = false; if ($allowDownloadDocumentsByApiKey) { @@ -49,9 +49,7 @@ if ($allowDownloadDocumentsByApiKey) { $username = isset($_GET['username']) ? Security::remove_XSS($_GET['username']) : null; $apiKey = isset($_GET['api_key']) ? Security::remove_XSS($_GET['api_key']) : null; - $restApi = Rest::validate($username, $apiKey); - $allowUseTool = $restApi ? true : false; } catch (Exception $e) { $allowUseTool = false; @@ -74,12 +72,7 @@ $_user = api_get_user_info(); $courseInfo = api_get_course_info(); $courseId = $courseInfo['real_id']; $course_dir = $courseInfo['directory'].'/document'; -$sys_course_path = api_get_path(SYS_COURSE_PATH); -$base_work_dir = $sys_course_path.$course_dir; -$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/document'; -$document_path = $base_work_dir; $usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true'; -$course_dir = $courseInfo['directory'].'/document'; $sys_course_path = api_get_path(SYS_COURSE_PATH); $base_work_dir = $sys_course_path.$course_dir; $http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/document'; @@ -95,6 +88,11 @@ if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') { $is_certificate_mode = true; } +$certificateLink = ''; +if ($is_certificate_mode) { + $certificateLink = '&certificate=true'; +} + // Removing sessions Session::erase('draw_dir'); Session::erase('paint_dir'); @@ -130,7 +128,7 @@ $selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat'] $moveTo = isset($_POST['move_to']) ? Security::remove_XSS($_POST['move_to']) : null; $moveFile = isset($_POST['move_file']) && is_int($_POST['move_file']) ? $_POST['move_file'] : null; -/* Constants and variables */ +/* Constants and variables */ $userId = api_get_user_id(); $userInfo = api_get_user_info(); $sessionId = api_get_session_id(); @@ -164,7 +162,6 @@ if (!empty($groupId)) { // Let's assume the user cannot upload files for the group $group_member_with_upload_rights = false; - if ($group_properties['doc_state'] == 2) { // Documents are private if ($isAllowedToEdit || GroupManager::is_user_in_group($userId, $group_properties)) { @@ -202,7 +199,6 @@ if (!empty($groupId)) { $group_member_with_upload_rights = true; } } - Session::write('group_member_with_upload_rights', $group_member_with_upload_rights); } else { Session::write('group_member_with_upload_rights', false); @@ -211,11 +207,6 @@ if (!empty($groupId)) { // Actions. $document_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null; $currentUrl = api_get_self().'?'.api_get_cidreq().'&id='.$document_id; - -/*if (Portfolio::controller()->accept()) { - Portfolio::controller()->run(); -}*/ - $curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null; switch ($action) { @@ -748,17 +739,6 @@ if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && } } -// Is the document tool visible? -// Check whether the tool is actually visible -/*$table_course_tool = Database::get_course_table(TABLE_TOOL_LIST); -$course_id = api_get_course_int_id(); -$tool_sql = 'SELECT visibility FROM '.$table_course_tool.' - WHERE c_id = '.$course_id.' AND name = "'.TOOL_DOCUMENT.'" - LIMIT 1'; -$tool_result = Database::query($tool_sql); -$tool_row = Database::fetch_array($tool_result); -$tool_visibility = $tool_row['visibility'];*/ - $htmlHeadXtra[] = '