mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
- 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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 .= " <td><a href='".$_SERVER['PHP_SELF']."?id=".$row->paabgabe_id."&uid=$uid' target='_blank'><img src='../../../skin/images/pdf.ico' alt='PDF' title='".$p->t('abgabetool/abgegebeneDatei')."' border=0></a></td>";
|
||||
$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 .= " <td>
|
||||
<a href='".$_SERVER['PHP_SELF']."?id=".$row->paabgabe_id."&uid=$uid' target='_blank'>
|
||||
<img src='../../../skin/images/pdf.ico' alt='PDF' title='".$p->t('abgabetool/abgegebeneDatei')."' border=0>
|
||||
</a>
|
||||
".$uploadedDocumentSigned."
|
||||
</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -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 .= '<input type="hidden" name="betreuer" value="'.$db->convert_html_chars($betreuer).'">'."\n";
|
||||
$htmlstr .= '<input type="hidden" name="bid" value="'.$db->convert_html_chars($bid).'">'."\n";
|
||||
$htmlstr .= '<input type="hidden" name="command" value="add">'."\n";
|
||||
|
||||
// If there are info about the signed document
|
||||
if ($uploadedDocumentSigned != null)
|
||||
{
|
||||
$htmlstr .= "<tr>\n";
|
||||
$htmlstr .= "<td colspan='2'><b>".$uploadedDocumentSigned."</b></td>";
|
||||
$htmlstr .= "</tr>\n";
|
||||
}
|
||||
|
||||
$htmlstr .= "<tr>\n";
|
||||
$htmlstr .= "<td><b>".$p->t('abgabetool/spracheDerArbeit').":</b></td><td>";
|
||||
$sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache");
|
||||
|
||||
@@ -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';
|
||||
?>
|
||||
|
||||
@@ -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';
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user