From 2a8b61c07fe60d031d0af852c045b52dbbfbeac7 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 11 May 2022 18:29:10 +0200 Subject: [PATCH 01/10] - Added new library application/libraries/SignatureLib.php - Changed configs for the signature server in config/vilesci.config-default.inc.php - Changed include/dokument_export.class.php to make use of the new configs --- application/libraries/SignatureLib.php | 76 ++++++++++++++++++++++++++ config/vilesci.config-default.inc.php | 11 +++- include/dokument_export.class.php | 2 +- 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 application/libraries/SignatureLib.php diff --git a/application/libraries/SignatureLib.php b/application/libraries/SignatureLib.php new file mode 100644 index 000000000..b8c4374a3 --- /dev/null +++ b/application/libraries/SignatureLib.php @@ -0,0 +1,76 @@ +sendsJson() + ->authenticateWith(SIGNATUR_USER, SIGNATUR_PASSWORD) + ->body('{"filename": "'.basename($inputFileName).'", "content": "'.base64_encode($inputFileContent).'"}') + ->expectsJson() + ->send(); + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception + { + $resultList = $cee->getMessage(); + } + catch (Exception $e) // any other exception + { + $resultList = $e->getMessage(); + } + + // If the response is fine + if (isset($resultPost->body) && is_object($resultPost->body) && isset($resultPost->body->retval)) + { + return $resultPost->body->retval; + } + + return $resultList; + } +} + diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index 5285eef3b..a3e4cbece 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -186,11 +186,16 @@ define('FHC_REST_PASSWORD', 'password'); * Signatur * DEFAULT: https://signatur.example.com/api/sign */ -define('SIGNATUR_URL', 'https://signatur.example.com/api/sign'); +// Generic URL +define('SIGNATUR_URL', 'https://signatur.dev.technikum-wien.at/api'); +// Sign API +define('SIGNATUR_SIGN_API', 'sign'); +// List API +define('SIGNATUR_LIST_API', 'list'); // User für Zugriff auf Signaturserver -define('SIGNATUR_USER', 'username'); +define('SIGNATUR_USER', 'fhcomplete'); // Passwort für Zugriff auf Signaturserver -define('SIGNATUR_PASSWORD', 'password'); +define('SIGNATUR_PASSWORD', 'Fhcomplet3Signature!'); // Signaturprofil das verwendet werden soll define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 4f23a7dcd..3a6e57657 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -527,7 +527,7 @@ class dokument_export $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, SIGNATUR_URL); + curl_setopt($ch, CURLOPT_URL, SIGNATUR_URL.'/'.SIGNATUR_SIGN_API); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 7); curl_setopt($ch, CURLOPT_USERAGENT, "FH-Complete"); From d4042228d9114502fd0151510df15effa43b21e2 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 13 May 2022 20:11:31 +0200 Subject: [PATCH 02/10] - Better code and comments in application/libraries/SignatureLib->list - cis/private/lehre/abgabe_lektor_details.php and cis/private/lehre/abgabe_student_details.php check if the uploaded document contains digital signares and display a phrase - Added new phrase to locale/de-AT/abgabetool.php and locale/en-US/abgabetool.php --- application/libraries/SignatureLib.php | 15 +++--- cis/private/lehre/abgabe_lektor_details.php | 25 +++++++++- cis/private/lehre/abgabe_student_details.php | 49 ++++++++++++++++---- locale/de-AT/abgabetool.php | 1 + locale/en-US/abgabetool.php | 1 + 5 files changed, 73 insertions(+), 18 deletions(-) diff --git a/application/libraries/SignatureLib.php b/application/libraries/SignatureLib.php index b8c4374a3..132545219 100644 --- a/application/libraries/SignatureLib.php +++ b/application/libraries/SignatureLib.php @@ -33,16 +33,13 @@ class SignatureLib */ public static function list($inputFileName) { - // Generic error occurred - $resultList = 'Generic error occurred'; - try { // Get the content of the given file $inputFileContent = file_get_contents($inputFileName); if ($inputFileContent === false) // if failed { - $resultList = 'An error occurred while getting the content from: '.$inputFileName; + error_log('An error occurred while getting the content from: '.$inputFileName); } else { @@ -57,20 +54,22 @@ class SignatureLib } catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception { - $resultList = $cee->getMessage(); + error_log($cee->getMessage()); } catch (Exception $e) // any other exception { - $resultList = $e->getMessage(); + error_log($e->getMessage()); } // If the response is fine - if (isset($resultPost->body) && is_object($resultPost->body) && isset($resultPost->body->retval)) + if (isset($resultPost->body) && is_object($resultPost->body) + && isset($resultPost->body->retval) && is_array($resultPost->body->retval)) { return $resultPost->body->retval; } - return $resultList; + // Otherwise return a null as error + return null; } } diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index a508de098..e1b47369d 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -37,6 +37,7 @@ require_once('../../../include/phrasen.class.php'); require_once('../../../include/projektarbeit.class.php'); require_once('../../../include/projektbetreuer.class.php'); require_once('../../../include/sancho.inc.php'); +require_once('../../../application/libraries/SignatureLib.php'); if (!$db = new basis_db()) $db=false; @@ -642,7 +643,29 @@ $result=@$db->db_query($qry); } if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) { - $htmlstr .= " PDF"; + $uploadedDocumentSigned = null; + + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } + + $htmlstr .= " + + PDF + + ".$uploadedDocumentSigned." + "; } else { diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index 29d74ab66..b8a8f158e 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -36,6 +36,7 @@ require_once('../../../include/phrasen.class.php'); require_once('../../../include/projektarbeit.class.php'); require_once('../../../include/projektbetreuer.class.php'); require_once('../../../include/sancho.inc.php'); +require_once('../../../application/libraries/SignatureLib.php'); $anzeigesprache = getSprache(); $p = new phrasen($anzeigesprache); @@ -111,6 +112,7 @@ $titel = $projektarbeit_obj->titel; $person = new person(); $person->load($bid); $betreuer = $person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost; +$uploadedDocumentSigned = null; if($uid!=$user) { @@ -286,15 +288,20 @@ if($command=="update" && $error!=true) move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { - exec('chmod 640 "'.PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'.'"'); - - $qry="UPDATE campus.tbl_paabgabe SET - abgabedatum = now(), - updatevon = ".$db->db_add_param($user).", - updateamum = now() - WHERE paabgabe_id=".$db->db_add_param($paabgabe_id, FHC_INTEGER); - $result=$db->db_query($qry); - echo $p->t('global/dateiErfolgreichHochgeladen'); + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } } else { @@ -311,6 +318,21 @@ if($command=="update" && $error!=true) } if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } + /*$qry="UPDATE campus.tbl_paabgabe SET abgabedatum = now(), updatevon = '".$user."', @@ -339,6 +361,15 @@ if($command=="update" && $error!=true) $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; + + // If there are info about the signed document + if ($uploadedDocumentSigned != null) + { + $htmlstr .= "\n"; + $htmlstr .= "".$uploadedDocumentSigned.""; + $htmlstr .= "\n"; + } + $htmlstr .= "\n"; $htmlstr .= "".$p->t('abgabetool/spracheDerArbeit').":"; $sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache"); diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index c4b17318b..6d1eb923f 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,4 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed DE'; ?> diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php index b05456faa..c782dedcc 100644 --- a/locale/en-US/abgabetool.php +++ b/locale/en-US/abgabetool.php @@ -91,4 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment downl $this->phrasen['abgabetool/projektbeurteilungErstDownload']='First-/Assessor'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Second Assessor'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Error when getting endupload of project work'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed EN'; ?> From 22bba685ffcacdbb0ee1b2847cea3eab8b3c8a65 Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 16 May 2022 16:15:48 +0200 Subject: [PATCH 03/10] Added new style to the warning --- cis/private/lehre/abgabe_lektor_details.php | 27 ++++++++++++-------- cis/private/lehre/abgabe_student_details.php | 24 ++++++++++------- locale/de-AT/abgabetool.php | 2 +- locale/en-US/abgabetool.php | 2 +- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index e1b47369d..29a1221af 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -641,6 +641,14 @@ $result=@$db->db_query($qry); { $htmlstr .= "               "; } + if($row->abgabedatum && $row->paabgabetyp_kurzbz=="end") + { + $htmlstr .= " zusätzliche Daten"; + } + else + { + $htmlstr .= "     "; + } if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) { $uploadedDocumentSigned = null; @@ -663,17 +671,14 @@ $result=@$db->db_query($qry); $htmlstr .= " PDF - - ".$uploadedDocumentSigned." - "; - } - else - { - $htmlstr .= "     "; - } - if($row->abgabedatum && $row->paabgabetyp_kurzbz=="end") - { - $htmlstr .= " zusätzliche Daten"; + "; + if ($uploadedDocumentSigned != null) + { + $htmlstr .= '
+ '.$uploadedDocumentSigned.' +
'; + } + $htmlstr .= ""; } else { diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index b8a8f158e..949749a3b 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -361,15 +361,6 @@ if($command=="update" && $error!=true) $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; - - // If there are info about the signed document - if ($uploadedDocumentSigned != null) - { - $htmlstr .= "\n"; - $htmlstr .= "".$uploadedDocumentSigned.""; - $htmlstr .= "\n"; - } - $htmlstr .= "\n"; $htmlstr .= "".$p->t('abgabetool/spracheDerArbeit').":"; $sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache"); @@ -403,6 +394,21 @@ if($command=="update" && $error!=true) $htmlstr .= ''.$p->t('abgabetool/seitenanzahl').':* '."\n"; $htmlstr .=" \n"; + + // If there are info about the signed document + if ($uploadedDocumentSigned != null) + { + $htmlstr .= "\n"; + $htmlstr .= ""; + $htmlstr .= '
+ + '.$uploadedDocumentSigned.' +
'; + $htmlstr .= ""; + $htmlstr .= "\n"; + } + + $htmlstr .=" \n"; $htmlstr .="

".$p->t('abgabetool/eidesstattlicheErklaerung')."

\n"; $htmlstr .= "".$p->t('abgabetool/gelesenUndAkzeptiert').":* "; $htmlstr .=" * ".$p->t('abgabetool/pflichtfeld')." diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index 6d1eb923f..093b56255 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed DE'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed DE'; ?> diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php index c782dedcc..333e21272 100644 --- a/locale/en-US/abgabetool.php +++ b/locale/en-US/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment downl $this->phrasen['abgabetool/projektbeurteilungErstDownload']='First-/Assessor'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Second Assessor'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Error when getting endupload of project work'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed EN'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed'; ?> From 2d2383639617fe349f8263927d607556afb7d6e7 Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 16 May 2022 16:23:15 +0200 Subject: [PATCH 04/10] Translated german phrase --- locale/de-AT/abgabetool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index 093b56255..378544811 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed DE'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warnung! Das hochgeladene Dokument ist nicht signiert'; ?> From 94a1534c14e3ec3781adef1be5db921b0e29c68e Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 23 May 2022 14:42:59 +0200 Subject: [PATCH 05/10] - Warning Wrap on small Screens in Leturer side - Perform Signatur Check only on Files from Type Endupload --- cis/private/lehre/abgabe_lektor_details.php | 57 ++++++++++++-------- cis/private/lehre/abgabe_student_details.php | 28 +++------- 2 files changed, 40 insertions(+), 45 deletions(-) diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index 29a1221af..f0a19c89a 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -548,6 +548,8 @@ $htmlstr .= " $result=@$db->db_query($qry); while ($row=@$db->db_fetch_object($result)) { + $uploadedDocumentSigned = null; + $htmlstr .= "
\n"; $htmlstr .= "\n"; $htmlstr .= "\n"; @@ -649,43 +651,52 @@ $result=@$db->db_query($qry); { $htmlstr .= "     "; } - if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) - { - $uploadedDocumentSigned = null; - // Check if the document is signed - $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); - if (is_array($signList) && count($signList) > 0) + if (file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) + { + if ($row->paabgabetyp_kurzbz == 'end') { - // The document is signed - } - elseif ($signList === null) - { - $uploadedDocumentSigned = 'WARNING: signature server error'; - } - else - { - $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } } $htmlstr .= " PDF - "; - if ($uploadedDocumentSigned != null) - { - $htmlstr .= '
- '.$uploadedDocumentSigned.' -
'; - } - $htmlstr .= ""; + + "; } else { $htmlstr .= "     "; } + $htmlstr .= " \n"; + if ($uploadedDocumentSigned != null) + { + $htmlstr .= ' + + + +
+ '.$uploadedDocumentSigned.' +
+ + '; + } $htmlstr .= "
\n"; } diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index 949749a3b..ed29519ff 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -282,41 +282,25 @@ if($command=="update" && $error!=true) $extensions = explode(".", $_FILES['datei']['name']); if(strtoupper(end($extensions))=='PDF') { - if($paabgabetyp_kurzbz!='end') + if ($paabgabetyp_kurzbz != 'end') { //"normaler" Upload move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); - if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) - { - // Check if the document is signed - $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); - if (is_array($signList) && count($signList) > 0) - { - // The document is signed - } - elseif ($signList === null) - { - $uploadedDocumentSigned = 'WARNING: signature server error'; - } - else - { - $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); - } - } - else + if (!file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { echo $p->t('global/dateiNichtErfolgreichHochgeladen'); } } - else + else // endupload type { //Upload der Endabgabe - Eingabe der Zusatzdaten $command='add'; - if(!$error) + if (!$error) { move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); } - if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + + if (file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { // Check if the document is signed $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); From c354c69e212be33093bf27000ca9efa54a891e44 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 11:23:48 +0200 Subject: [PATCH 06/10] Fixed Zwischenabgabe file upload --- cis/private/lehre/abgabe_student_details.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index ed29519ff..f91f410ab 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -286,7 +286,19 @@ if($command=="update" && $error!=true) { //"normaler" Upload move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); - if (!file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + if (file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + { + exec('chmod 640 "'.PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'.'"'); + + $qry="UPDATE campus.tbl_paabgabe SET + abgabedatum = now(), + updatevon = ".$db->db_add_param($user).", + updateamum = now() + WHERE paabgabe_id=".$db->db_add_param($paabgabe_id, FHC_INTEGER); + $result=$db->db_query($qry); + echo $p->t('global/dateiErfolgreichHochgeladen'); + } + else { echo $p->t('global/dateiNichtErfolgreichHochgeladen'); } From 7f2025c41405f261fa103ea4a242730c056f1c0f Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 11:27:24 +0200 Subject: [PATCH 07/10] Added signature config entries to config/cis.config-default.inc.php --- config/cis.config-default.inc.php | 17 +++++++++++++++++ config/vilesci.config-default.inc.php | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/cis.config-default.inc.php b/config/cis.config-default.inc.php index 9d31548f6..d6f920259 100644 --- a/config/cis.config-default.inc.php +++ b/config/cis.config-default.inc.php @@ -204,6 +204,23 @@ define('TABLE_ID','_id'); define('TABLE_BEGIN','tbl_'); define('VIEW_BEGIN','vw_'); +/** + * Signatur + * DEFAULT: https://signatur.example.com/api/sign + */ +// Generic URL +define('SIGNATUR_URL', 'https://signatur.dev.technikum-wien.at/api'); +// Sign API +define('SIGNATUR_SIGN_API', 'sign'); +// List API +define('SIGNATUR_LIST_API', 'list'); +// User für Zugriff auf Signaturserver +define('SIGNATUR_USER', 'fhcomplete'); +// Passwort für Zugriff auf Signaturserver +define('SIGNATUR_PASSWORD', 'supersecretpassword'); +// Signaturprofil das verwendet werden soll +define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); + //Gibt an, ob das Studienbuchblatt im CIS gedruckt werden kann define('CIS_DOKUMENTE_STUDIENBUCHLBATT_DRUCKEN',true); diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index a3e4cbece..c4232b020 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -195,7 +195,7 @@ define('SIGNATUR_LIST_API', 'list'); // User für Zugriff auf Signaturserver define('SIGNATUR_USER', 'fhcomplete'); // Passwort für Zugriff auf Signaturserver -define('SIGNATUR_PASSWORD', 'Fhcomplet3Signature!'); +define('SIGNATUR_PASSWORD', 'supersecretpassword'); // Signaturprofil das verwendet werden soll define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); From 8880e07bf20d1332455a4a598e5cd44a4d42be8d Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 12:22:30 +0200 Subject: [PATCH 08/10] include/dokument_export.class.php now checks the new signature server response structure --- include/dokument_export.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 3a6e57657..7d797cb21 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -559,18 +559,19 @@ class dokument_export curl_close($ch); $resultdata = json_decode($result); - if (isset($resultdata->success) && $resultdata->success == 'true') + // If it is success + if (isset($resultdata->error) && $resultdata->error == 0) { $this->signed_filename = $this->temp_folder .'/signed.pdf'; - file_put_contents($this->signed_filename, base64_decode($resultdata->document)); + file_put_contents($this->signed_filename, base64_decode($resultdata->retval)); return true; } - else + else // otherwise if it is an error { - if(isset($resultdata->errormsg)) - $this->errormsg = $resultdata->errormsg; + if(isset($resultdata->retval)) + $this->errormsg = $resultdata->retval; else - $this->errormsg = 'Unknown Error:'.print_r($resultdata,true); + $this->errormsg = 'Unknown Error:'.print_r($resultdata, true); return false; } } From 9a4c61d1c359002f184dc89728e1cea4993f1964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Thu, 27 Apr 2023 17:50:03 +0200 Subject: [PATCH 09/10] Fixed Abgabetool Lecturer View --- cis/private/lehre/abgabe_lektor_details.php | 170 ++++++------------- cis/private/lehre/abgabe_student_details.php | 4 +- locale/de-AT/abgabetool.php | 4 +- locale/en-US/abgabetool.php | 4 +- 4 files changed, 58 insertions(+), 124 deletions(-) diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index 238046224..a40136868 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -592,18 +592,9 @@ while ($row=@$db->db_fetch_object($result)) $htmlstr .= "\n"; $htmlstr .= "\n"; + $uploadedDocumentSigned = null; if (!$row->abgabedatum) { - $uploadedDocumentSigned = null; - - $htmlstr .= "
\n"; - $htmlstr .= "\n"; - $htmlstr .= "\n"; - $htmlstr .= "\n"; - $htmlstr .= "\n"; - $htmlstr .= "\n"; - $htmlstr .= "\n"; - if ($row->datumdb_fetch_object($result)) $fcol='#000000'; } } - //$htmlstr .= "fixtermin=='t'?'checked=\"checked\"':'')." >"; - //$htmlstr .= "fixtermin=='t'?'checked="checked" style="background-color:#FF0000;"':'')." disabled>"; + if($row->fixtermin=='t') { $htmlstr .= "J"; @@ -684,113 +674,6 @@ while ($row=@$db->db_fetch_object($result)) { $htmlstr .= "        "; } - - //$htmlstr .= "fixtermin=='t'?'checked=\"checked\"':'')." >"; - //$htmlstr .= "fixtermin=='t'?'checked="checked" style="background-color:#FF0000;"':'')." disabled>"; - if($row->fixtermin=='t') - { - $htmlstr .= "J"; - } - else - { - $htmlstr .= "N"; - } - $htmlstr .= " \n"; - $htmlstr .= " \n"; - $htmlstr .= " \n"; - $htmlstr .= " \n"; - $htmlstr .= " ".($row->abgabedatum==''?' ':$datum_obj->formatDatum($row->abgabedatum,'d.m.Y'))."\n"; - if($user==$row->insertvon && $betreuerart!="Zweitbegutachter") - { - $htmlstr .= " "; - - if(!$row->abgabedatum) - { - $htmlstr .= " "; - } - else - { - $htmlstr .= "        "; - } - } - else - { - $htmlstr .= "               "; - } - if($row->abgabedatum && $row->paabgabetyp_kurzbz=="end") - { - $htmlstr .= " zusätzliche Daten"; - } - else - { - $htmlstr .= "     "; - } - - if (file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) - { - if ($row->paabgabetyp_kurzbz == 'end') - { - // Check if the document is signed - $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); - if (is_array($signList) && count($signList) > 0) - { - // The document is signed - } - elseif ($signList === null) - { - $uploadedDocumentSigned = 'WARNING: signature server error'; - } - else - { - $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); - } - } - - $htmlstr .= " - - PDF - - "; - } - else - { - $htmlstr .= "     "; - } - - $htmlstr .= " \n"; - - if ($uploadedDocumentSigned != null) - { - $htmlstr .= ' - - - -
- '.$uploadedDocumentSigned.' -
- - '; - } - - $htmlstr .= "\n"; } else { @@ -812,6 +695,53 @@ while ($row=@$db->db_fetch_object($result)) { $htmlstr .= "     "; } + + if (file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) + { + $signaturVorhanden = false; + if ($row->paabgabetyp_kurzbz == 'end') + { + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + $signaturVorhanden = true; + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } + } + if ($uploadedDocumentSigned != null) + { + $htmlstr .= ' + +
+ '.$uploadedDocumentSigned.' +
+ '; + } + elseif($signaturVorhanden) + { + $htmlstr .= ' + +
+ '.$p->t('abgabetool/uploadedDocumentSigned').' +
+ '; + } + } + else + { + $htmlstr .= "     "; + } + + $htmlstr .= " \n"; @@ -830,7 +760,7 @@ $htmlstr .= ''."\n"; //$htmlstr .= ""; $htmlstr .= "  "; -$htmlstr .= " \n"; +$htmlstr .= " \n"; $htmlstr .= " '."\n"; } else // endupload type { @@ -312,12 +342,14 @@ if($command=="update" && $error!=true) move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); } + $signaturVorhanden = true; + if (file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { // Check if the document is signed $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); if (is_array($signList) && count($signList) > 0) - { + {$htmlstr .= ''."\n"; // The document is signed } elseif ($signList === null) @@ -326,6 +358,7 @@ if($command=="update" && $error!=true) } else { + $signaturVorhanden = false; $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSignedStudent'); } @@ -357,6 +390,7 @@ if($command=="update" && $error!=true) $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; + $htmlstr .= ''."\n"; $htmlstr .= "\n"; $htmlstr .= "".$p->t('abgabetool/spracheDerArbeit').":"; $sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache"); diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index 831b60602..f3b2cfac5 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,7 +91,7 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; -$this->phrasen['abgabetool/uploadedDocumentNotSignedStudent']='Achtung - Das Dokument enthält keine elektronische Signatur. Bitte signieren Sie das Dokument.'; +$this->phrasen['abgabetool/uploadedDocumentNotSignedStudent']='Es konnte keine gültige digitale Signatur erkannt werden. Bitte wenden Sie sich an Ihren Studiengang ob Ihre Endabgabe erfolgreich war und die Arbeit zur Benotung vorgelegt werden kann.'; $this->phrasen['abgabetool/uploadedDocumentNotSigned']='Signatur fehlt'; $this->phrasen['abgabetool/uploadedDocumentSigned']='Signatur vorhanden'; $this->phrasen['abgabetool/senatsMitglied']='Mitglied Prüfungssenat'; diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php index 3b7e12a45..b77e25d92 100644 --- a/locale/en-US/abgabetool.php +++ b/locale/en-US/abgabetool.php @@ -91,7 +91,7 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment downl $this->phrasen['abgabetool/projektbeurteilungErstDownload']='First-/Assessor'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Second Assessor'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Error when getting endupload of project work'; -$this->phrasen['abgabetool/uploadedDocumentNotSignedStudent']='Warning - the document does not contain an electronic signature. Please sign the document.'; +$this->phrasen['abgabetool/uploadedDocumentNotSignedStudent']='The document does not contain an electronic signature. Please inform your Dregree Programm to verify the upload'; $this->phrasen['abgabetool/uploadedDocumentNotSigned']='Signature not found'; $this->phrasen['abgabetool/uploadedDocumentSigned']='Signature found'; $this->phrasen['abgabetool/senatsMitglied']='Examiner';