Exemple #1
0
                         bh_log(str_replace("#EMAIL#", $email, $bhlang['error:invalid_email_#EMAIL#']), "BH_ERROR");
                     } else {
                         if ($_POST['filemail']['notify'] == "on") {
                             $notify = 1;
                         } else {
                             $notify = 0;
                         }
                         $userobj = new bhuser($bhsession['username']);
                         $emailfrom = $userobj->userinfo['email'];
                         $filecode = bh_filelink_add($filepath, $expires, $bhsession['username'], $email, $notify);
                         $emailobj = new bhemail($email);
                         $emailobj->subject = $_POST['filemail']['subject'];
                         $fileobj = new bhfile($filepath);
                         $filesize = bh_humanise_filesize($fileobj->fileinfo['filesize']);
                         $findarr = array("#DATE#", "#LINK#", "#SYSTEMNAME#", "#FILENAME#", "#FILESIZE#", "#MD5#");
                         $replarr = array(date("l dS F Y g:i A", $expires), bh_filelink_uri($filecode), $bhconfig['sitename'], bh_get_filename($filepath), $filesize, $fileobj->md5());
                         $emailobj->message = $_POST['filemail']['message'] . "\n\n" . str_replace($findarr, $replarr, $bhlang['email:filemail_footer']);
                         if (!empty($emailfrom)) {
                             $emailobj->from = $emailfrom;
                         }
                         $emailobj->send();
                         bh_log(str_replace("#EMAIL#", $email, $bhlang['notice:email_sent_to_#EMAIL#']), "BH_NOTICE");
                     }
                 }
             }
         } else {
             bh_log($bhlang['error:expires_invalid'], "BH_ERROR");
         }
     }
 }
 # Open layout object
Exemple #2
0
    # Email it ##
    if (bh_filelink_get_notify($filecode) == 1) {
        $username = bh_filelink_get($filecode, "username");
        $userobj = new bhuser($username);
        $emailobj = new bhemail($userobj->userinfo['email']);
        $emailobj->subject = str_replace($replarray1, $replarray2, $bhlang['emailsubject:filemail_link_accessed']);
        $emailobj->message = str_replace($replarray1, $replarray2, $bhlang['email:filemail_link_accessed']);
        $emailobj->send();
    }
    #############
    header("Content-type: " . $fileobj->mimetype());
    header("Content-Disposition: attachment; filename=" . $filename);
    header("Content-length: " . $fileobj->fileinfo['filesize']);
    # IE SSL fix
    header("Pragma: ");
    header("Cache-Control: ");
    $fileobj->readfile();
    die;
} else {
    bh_add_logvars(array("filename" => $filename, "filepath" => $filepath));
    if (empty($fullname)) {
        $dstr = $emailfrom;
    } else {
        $dstr = $fullname . " [" . $emailfrom . "]";
    }
    # Display a page with information
    $str = "<head><title>" . $bhlang['title:file_download'] . "</title><meta http-equiv='refresh' content='5;url=" . bh_filelink_uri($filecode) . "&download=1'><style>body {font-family: sans-serif;}</style></head>\n\t<body><b>" . $bhlang['title:file_download'] . "</b><br><br><table><tr><td>" . $bhlang['label:from'] . "</td><td>" . $dstr . "</td></tr><tr><td>" . $bhlang['label:filename'] . "</td><td>" . $filename . "</td></tr><tr><td>" . $bhlang['label:filesize'] . "</td><td>" . bh_humanise_filesize($fileobj->fileinfo['filesize']) . "</td></tr><tr><td>" . $bhlang['label:md5'] . "</td><td>" . $fileobj->md5() . "</td></tr></table><br>" . $bhlang['explain:filelink_download'] . "<br><br><a href='" . bh_filelink_uri($filecode) . "&download=1'>" . bh_parse_logvars($bhlang['button:download_file']) . "</a></body></html>";
    die($str);
}
?>