Send pdf invoce with confirmation

Change-Id: Ie5b7b20043d11879f758af6536b55961314188eb
diff --git a/index.php b/index.php
index 5ce87e6..47712cd 100755
--- a/index.php
+++ b/index.php
@@ -8,6 +8,7 @@
 include_once 'db_backend.php';
 include_once 'validators.php';
 include_once 'User.php';
+include_once 'invoice.php';
 require __DIR__ . '/vendor/autoload.php';
 use Monolog\Level;
 use Monolog\Logger as Logger;
@@ -50,7 +51,7 @@
         "subject" => $WELCOME_TEMPLATE->subject,
         "text"    => replace_all_user_variables($WELCOME_TEMPLATE->text, $user, $url),
         "html"    => replace_all_user_variables($WELCOME_TEMPLATE->html, $user, $url)
-    ]);
+    ], $user);
 }
 
 function send_confirmation_email(string $mail, object $smtp, string $url, User $user)
@@ -315,7 +316,7 @@
                         $pending = redis_get("pending");
                         if ($pending) {
                             $maillist = $pending->mails;
-                            if (in_array($user->email, $maillist)) {
+                            if (is_array($maillist) && in_array($user->email, $maillist)) {
                                 unset($maillist[array_search($user->email, $maillist)]);
                                 redis_set("pending", (object)["mails" => $maillist], $MAIL_CONFIRMATION_AWAIT_DELAY);
                             }