Exemple #1
0
    } else {
        $referer = SITEROOT . "/notificationsent/";
    }
    //pre($referer);
    if (is_dir($_SERVER['DOCUMENT_ROOT'] . '/' . $cref)) {
        $raw_data = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $cref . '/data.txt');
        $data = unserialize($raw_data);
        $unsigned_logs_raw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/logs/unsigned-' . $log_date . '.log');
        $unsigned_logs = unserialize($unsigned_logs_raw);
        foreach ($unsigned_logs as $k => $log) {
            if ($log['ref'] == $cref) {
                $unsigned_logs[$k]['sent'] = time();
                $data['sent'] = time();
            }
        }
        if (sendClientEmail($data)) {
            $new_logs = file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/logs/unsigned-' . $log_date . '.log', serialize($unsigned_logs));
            $new_data = file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $cref . '/data.txt', serialize($data));
            if ($new_logs) {
                header("Location: " . $referer . "?cref=" . $cref . "&sent=1");
            }
        } else {
            // Email not sent
            header("Location: " . $referer . "?cref=" . $cref . "&sent=0&error=email");
        }
    } else {
        header("Location: " . $referer . "?cref=" . $cref . "&sent=0&error=nodir");
    }
} else {
    header("Location: " . SITEROOT . "/");
}
Exemple #2
0
         $data['tkn'] = md5(uniqid(rand(), true));
         $data['sent'] = $date_sent;
         $files_added = false;
         $dir = mkdir($client_ref, 0755);
         if ($dir == 1) {
             //FILES CREATED
             $new_doc = file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $doc_dir . '/' . $doc_name, $contents);
             $new_html = file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $doc_dir . '/sign.php', $php_temp);
             $new_data = file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/' . $doc_dir . '/data.txt', serialize($data));
             if ($new_doc && $new_html && $new_data) {
                 $files_added = true;
             }
         }
         //pre($data);
         include_once $_SERVER['DOCUMENT_ROOT'] . '/inc/emails/send-client-email.php';
         if ($files_added && sendClientEmail($data)) {
             $unsigned_logs[] = $data;
             file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/logs/unsigned-' . $log_date . '.log', serialize($unsigned_logs));
             imap_delete($inbox, $overview[0]->msgno);
             echo "Client email was sent and files added to folder successfully!<br />\n";
         } else {
             echo "Could not create client folder and send client email!";
             imap_clearflag_full($inbox, $overview[0]->msgno, "\\Seen", ST_UID);
         }
     } else {
         // If Folder already exists delete email
         echo "A folder for client " . $client_ref . " already exists.";
         imap_delete($inbox, $overview[0]->msgno);
     }
 } else {
     // If no attachments delete email