diff --git a/pages/HTML/profile.html b/pages/HTML/profile.html index f3d656e..8e354a9 100644 --- a/pages/HTML/profile.html +++ b/pages/HTML/profile.html @@ -81,20 +81,31 @@ - - +
-
+
- + + +
+
+
+
+
+ +

IAR Sicherung

+
%%IARINFOMESSAGE%%
+ Hier kannst du eine IAR deines Inventars erstellen.
+ Dies wird einige Zeit dauern. Deswegen bekommst du einen Downloadlink per E-Mail zugeschickt, sobald die IAR fertig gestellt wurde. Stelle also sicher das du links eine gültige E-Mail Adresse eingetragen hast. + +
- +
-
diff --git a/pages/profile.php b/pages/profile.php index 977b14e..4633895 100644 --- a/pages/profile.php +++ b/pages/profile.php @@ -1,7 +1,42 @@ prepare("CREATE TABLE IF NOT EXISTS `iarstates` (`userID` VARCHAR(36) NOT NULL COLLATE 'utf8_unicode_ci', `filesize` INT(11) NOT NULL, `iarfilename` VARCHAR(64) NOT NULL COLLATE 'utf8_unicode_ci', PRIMARY KEY (`userID`) USING BTREE) COLLATE='utf8_unicode_ci' ENGINE=InnoDB;"); + $statement->execute(); + $HTML->setHTMLTitle("Dein Profile"); $HTML->importSeitenInhalt("pages/HTML/profile.html"); + //Prüfe ob IAR grade erstellt wird. + $IARRUNNING = FALSE; + + $statementIARCheck = $RUNTIME['PDO']->prepare('SELECT * FROM iarstates WHERE userID =:userID'); + $statementIARCheck->execute(['userID' => $_SESSION['UUID']]); + if($statementIARCheck->rowCount() != 0) + { + $HTML->ReplaceSeitenInhalt("%%IARINFOMESSAGE%%", ''); + $HTML->ReplaceSeitenInhalt("%%IARBUTTONSTATE%%", 'disabled'); + $IARRUNNING = TRUE; + } + + if(isset($_REQUEST['createIAR'])) + { + + $iarname = md5(time().$_SESSION['UUID'] . rand()).".iar"; + + $APIURL = $RUNTIME['SIDOMAN']['URL']."api.php?CONTAINER=".$RUNTIME['SIDOMAN']['CONTAINER']."&KEY=".$RUNTIME['SIDOMAN']['PASSWORD']."&METODE=COMMAND&COMMAND=".urlencode("save iar ".$_SESSION['FIRSTNAME']." ".$_SESSION['LASTNAME']." /* PASSWORD /downloads/".$iarname); + $APIResult = file_get_contents($APIURL); + + if(trim($APIResult) == "DONE") + { + $HTML->ReplaceSeitenInhalt("%%IARINFOMESSAGE%%", ''); + + $statementIARSTART = $RUNTIME['PDO']->prepare('INSERT INTO iarstates (userID, filesize, iarfilename) VALUES (:userID, :filesize, :iarfilename)'); + $statementIARSTART->execute(['userID' => $_SESSION['UUID'], 'filesize' => 0, 'iarfilename' => $iarname]); + }else{ + $HTML->ReplaceSeitenInhalt("%%IARINFOMESSAGE%%", ''); + + } + } + if(isset($_REQUEST['formInputFeldVorname']) || @$_REQUEST['formInputFeldVorname'] != "") { $NewFirstName = trim($_REQUEST['formInputFeldVorname']); @@ -97,7 +132,6 @@ } } - $statementLocalUsers = $RUNTIME['PDO']->prepare("SELECT * FROM UserAccounts ORDER BY PrincipalID ASC"); $statementLocalUsers->execute(); @@ -130,7 +164,8 @@ $HTML->ReplaceSeitenInhalt("%%email%%", $RUNTIME['OPENSIM']->getUserMail($_SESSION['UUID'])); $HTML->ReplaceSeitenInhalt("%%listAllResidentsAsJSArray%%", ""); $HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", ' '); - $HTML->ReplaceSeitenInhalt("%%INFOMESSAGE%%", ' '); + $HTML->ReplaceSeitenInhalt("%%IARINFOMESSAGE%%", ' '); + $HTML->ReplaceSeitenInhalt("%%IARBUTTONSTATE%%", ''); $HTML->build(); echo $HTML->ausgabe(); diff --git a/style/default/dashboard-admin.html b/style/default/dashboard-admin.html index 722edd8..cfbb725 100644 --- a/style/default/dashboard-admin.html +++ b/style/default/dashboard-admin.html @@ -53,6 +53,12 @@ Profil + + + +