示例#1
0
require_once NSSDROPBOX_LIB_DIR . "NSSDropoff.php";
//
// This is pretty straightforward; depending upon the form data coming
// into this PHP session, creating a new dropoff object will either
// display the claimID-and-claimPasscode "dialog" (no form data or
// missing/invalid passcode); display the selected dropoff if the
// claimID and claimPasscode are valid OR the recipient matches the
// authenticate user -- it's all built-into the NSSDropoff class.
//
if ($theDropbox = new NSSDropbox($NSSDROPBOX_PREFS)) {
    // If they are an authorised user, just display the normal pickup page.
    if ($theDropbox->authorizedUser() || !$theDropbox->humanDownloads() || ($theDropbox->captcha() == 'google' || $theDropbox->captcha() == '') && $theDropbox->recaptchaPrivateKey() == 'disabled' || $theDropbox->captcha() == 'disabled') {
        $theDropbox->SetupPage();
        // 2-line addition by Francois Conil to fix problems with no CAPTCHA
        // and anonymous users who don't have a link to click on.
        $auth = $theDropbox->WriteAuthData($_SERVER['REMOTE_ADDR'], '', '');
        $smarty->assign('auth', $auth);
        if ($thePickup = new NSSDropoff($theDropbox)) {
            //
            // Start the page and add some Javascript for automatically
            // filling-in the download form and submitting it when the
            // user clicks on a file in the displayed dropoff.
            //
            $theDropbox->SetupPage($thePickup->HTMLOnLoadJavascript());
            $output = $thePickup->HTMLWrite();
        }
        $smarty->display($output ? $output : 'error.tpl');
        exit(0);
    }
    //
    // They are not an authorised user.