Browse Source

Minor - format code

jmontoyaa 7 years ago
parent
commit
71921b33e2
2 changed files with 6 additions and 7 deletions
  1. 3 4
      main/work/download.php
  2. 3 3
      main/work/work.lib.php

+ 3 - 4
main/work/download.php

@@ -18,17 +18,16 @@ $this_section = SECTION_COURSES;
 // Course protection
 api_protect_course_script(true);
 
-$id = intval($_GET['id']);
-
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
 $courseInfo = api_get_course_info();
 
-if (empty($courseInfo)) {
+if (empty($courseInfo) || empty($id)) {
     api_not_allowed(true);
 }
 
 $correction = isset($_REQUEST['correction']) ? true : false;
 $result = downloadFile($id, $courseInfo, $correction);
-if ($result == false) {
+if ($result === false) {
     api_not_allowed(true);
 }
 

+ 3 - 3
main/work/work.lib.php

@@ -2008,10 +2008,10 @@ function get_work_user_list(
                 $work['type'] = DocumentManager::build_document_icon_tag('file', $work['url']);
 
                 // File name.
-                $link_to_download = null;
+                $linkToDownload = '';
                 // If URL is present then there's a file to download keep BC.
                 if ($work['contains_file'] || !empty($work['url'])) {
-                    $link_to_download = '<a href="'.$url.'download.php?id='.$item_id.'&'.api_get_cidreq().'">'.$saveIcon.'</a> ';
+                    $linkToDownload = '<a href="'.$url.'download.php?id='.$item_id.'&'.api_get_cidreq().'">'.$saveIcon.'</a> ';
                 }
 
                 $send_to = Portfolio::share(
@@ -2188,7 +2188,7 @@ function get_work_user_list(
                     $qualificator_id = Display::label(get_lang('Revised'), 'success');
                 }
                 $work['qualificator_id'] = $qualificator_id.' '.$hasCorrection;
-                $work['actions'] = '<div class="work-action">'.$send_to.$link_to_download.$action.'</div>';
+                $work['actions'] = '<div class="work-action">'.$send_to.$linkToDownload.$action.'</div>';
                 $work['correction'] = $correction;
                 $works[] = $work;
             }