add running state
parent
e41fe21c98
commit
dc40431e84
|
@ -1,14 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
$statement = $RUNTIME['PDO']->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', `running` INT(1) NOT NULL DEFAULT '0', PRIMARY KEY (`userID`) USING BTREE) COLLATE='utf8_unicode_ci' ENGINE=InnoDB;");
|
||||||
$statement = $RUNTIME['PDO']->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();
|
$statement->execute();
|
||||||
|
|
||||||
$statement = $RUNTIME['PDO']->prepare("SELECT * FROM iarstates");
|
$statement = $RUNTIME['PDO']->prepare("SELECT * FROM iarstates WHERE running = 1 LIMIT 1");
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
|
if($statement->rowCount() != 0)
|
||||||
|
{
|
||||||
while($row = $statement->fetch())
|
while($row = $statement->fetch())
|
||||||
{
|
{
|
||||||
$email = $RUNTIME['OPENSIM']->getUserMail($row['userID']);
|
$email = $RUNTIME['OPENSIM']->getUserMail($row['userID']);
|
||||||
|
|
||||||
|
if(file_exists("data/".$row['iarfilename']))
|
||||||
|
{
|
||||||
$filesize = filesize("data/".$row['iarfilename']);
|
$filesize = filesize("data/".$row['iarfilename']);
|
||||||
|
|
||||||
if($filesize != $row['filesize'])
|
if($filesize != $row['filesize'])
|
||||||
|
@ -50,6 +54,22 @@
|
||||||
$mail->SmtpClose();
|
$mail->SmtpClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$statement = $RUNTIME['PDO']->prepare("SELECT * FROM iarstates WHERE running = 0 LIMIT 1");
|
||||||
|
$statement->execute();
|
||||||
|
|
||||||
|
while($row = $statement->fetch())
|
||||||
|
{
|
||||||
|
$statementUpdate = $RUNTIME['PDO']->prepare('UPDATE iarstates SET running = :running WHERE userID = :userID');
|
||||||
|
$statementUpdate->execute(['running' => 1, 'userID' => $row['userID']]);
|
||||||
|
|
||||||
|
$iarname = md5(time().$row['userID'].rand()).".iar";
|
||||||
|
$name = explode(" ", $RUNTIME['OPENSIM']->getUserName($row['userID']));
|
||||||
|
|
||||||
|
$APIURL = $RUNTIME['SIDOMAN']['URL']."api.php?CONTAINER=".$RUNTIME['SIDOMAN']['CONTAINER']."&KEY=".$RUNTIME['SIDOMAN']['PASSWORD']."&METODE=COMMAND&COMMAND=".urlencode("save iar ".$name[0]." ".$name[1]." /* PASSWORD /downloads/".$iarname);
|
||||||
|
$APIResult = file_get_contents($APIURL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -98,7 +98,7 @@
|
||||||
<p class="lead"><b>IAR Sicherung</b></p>
|
<p class="lead"><b>IAR Sicherung</b></p>
|
||||||
<center>%%IARINFOMESSAGE%%</center>
|
<center>%%IARINFOMESSAGE%%</center>
|
||||||
Hier kannst du eine IAR deines Inventars erstellen.<br>
|
Hier kannst du eine IAR deines Inventars erstellen.<br>
|
||||||
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.
|
Dies wird einige Zeit dauern. Du bekommst eine E-Mail mit einem Downloadlink sobald deine IAR fertig erstellt wurde. Stelle also sicher das du Links eine gültige E-Mail Adresse eingetragen hast.
|
||||||
|
|
||||||
<form action="index.php?page=profile" method="post">
|
<form action="index.php?page=profile" method="post">
|
||||||
<div class="row" style="margin-top: 15px;">
|
<div class="row" style="margin-top: 15px;">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
$statement = $RUNTIME['PDO']->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 = $RUNTIME['PDO']->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', `running` INT(1) NOT NULL DEFAULT '0', PRIMARY KEY (`userID`) USING BTREE) COLLATE='utf8_unicode_ci' ENGINE=InnoDB;");
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$HTML->setHTMLTitle("Dein Profile");
|
$HTML->setHTMLTitle("Dein Profile");
|
||||||
|
@ -23,19 +23,10 @@
|
||||||
{
|
{
|
||||||
$iarname = md5(time().$_SESSION['UUID'] . rand()).".iar";
|
$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%%", '<div class="alert alert-danger" role="alert">Deine IAR wird jetzt erstellt und der Download Link wird dir per E-Mail zugesendet. '.$APIResult.'</div>');
|
$HTML->ReplaceSeitenInhalt("%%IARINFOMESSAGE%%", '<div class="alert alert-danger" role="alert">Deine IAR wird jetzt erstellt und der Download Link wird dir per E-Mail zugesendet. '.$APIResult.'</div>');
|
||||||
|
|
||||||
$statementIARSTART = $RUNTIME['PDO']->prepare('INSERT INTO iarstates (userID, filesize, iarfilename) VALUES (:userID, :filesize, :iarfilename)');
|
$statementIARSTART = $RUNTIME['PDO']->prepare('INSERT INTO iarstates (userID, filesize, iarfilename) VALUES (:userID, :filesize, :iarfilename)');
|
||||||
$statementIARSTART->execute(['userID' => $_SESSION['UUID'], 'filesize' => 0, 'iarfilename' => $iarname]);
|
$statementIARSTART->execute(['userID' => $_SESSION['UUID'], 'filesize' => 0, 'iarfilename' => $iarname]);
|
||||||
}else{
|
|
||||||
$HTML->ReplaceSeitenInhalt("%%IARINFOMESSAGE%%", '<div class="alert alert-danger" role="alert">Es ist etwas schiefgelaufen, bitte warte etwas und versuche es erneut. '.$APIURL.'</div>');
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue