55 lines
2.2 KiB
PHP
55 lines
2.2 KiB
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->execute();
|
|
|
|
$statement = $RUNTIME['PDO']->prepare("SELECT * FROM iarstates");
|
|
$statement->execute();
|
|
|
|
while($row = $statement->fetch())
|
|
{
|
|
$email = $RUNTIME['OPENSIM']->getUserMail($row['userID']);
|
|
$filesize = filesize("data/".$row['iarfilename']);
|
|
|
|
if($filesize != $row['filesize'])
|
|
{
|
|
$statementUpdate = $RUNTIME['PDO']->prepare('UPDATE iarstates SET filesize = :filesize WHERE userID = :userID');
|
|
$statementUpdate->execute(['filesize' => $filesize, 'userID' => $row['userID']]);
|
|
|
|
continue;
|
|
}else{
|
|
|
|
$statementUpdate = $RUNTIME['PDO']->prepare('DELETE FROM iarstates WHERE userID = :userID');
|
|
$statementUpdate->execute(['userID' => $row['userID']]);
|
|
|
|
$mail = new PHPMailer(true);
|
|
|
|
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
|
|
$mail->isSMTP();
|
|
$mail->Host = $RUNTIME['SMTP']['SERVER'];
|
|
$mail->Port = $RUNTIME['SMTP']['PORT'];
|
|
$mail->SMTPAuth = false;
|
|
|
|
|
|
$mail->setFrom($RUNTIME['SMTP']['ADRESS'], $RUNTIME['GRID']['NAME']);
|
|
$mail->addAddress($email, $RUNTIME['OPENSIM']->getUserName($row['userID']));
|
|
|
|
$HTMLMESSAGE = 'Deine IAR ist bereit zum Download! <br> Du kannst sie <a href="'.$RUNTIME['IAR']['BASEURL'].$row['iarfilename'].'">hier</a> downloaden.';
|
|
|
|
$HTML = new HTML();
|
|
$HTML->importHTML("style/mail.html");
|
|
$HTML->setSeitenInhalt($HTMLMESSAGE);
|
|
$HTML->build();
|
|
|
|
$mail->isHTML(true);
|
|
$mail->Subject = "Deine IAR steht nun bereit.";
|
|
$mail->Body = $HTML->ausgabe();
|
|
$mail->AltBody = strip_tags($HTMLMESSAGE);
|
|
|
|
$mail->send();
|
|
$mail->SmtpClose();
|
|
}
|
|
}
|
|
|
|
|
|
?>
|