Exemplo n.º 1
0
 public function __construct($aDropbox, $recipEmail, $qResult = FALSE)
 {
     $this->_dropbox = $aDropbox;
     if (!$qResult) {
         //  Try to create a new one from form data:
         $this->_formInitError = $this->initWithFormData($recipEmail);
     } else {
         NSSError("This form cannot be called like this, please return to the main menu.");
     }
 }
Exemplo n.º 2
0
 private function DBConnect($prefs)
 {
     $this->database = new mysqli($prefs['MySQLhost'], $prefs['MySQLuser'], $prefs['MySQLpassword'], $prefs['MySQLdb']);
     if (!$this->database) {
         NSSError("Could not open MySQL database on " . $prefs['MySQLhost'], "Database Error");
         return FALSE;
     }
     // Want to auto-commit except when I'm manually doing a transaction,
     // so don't set this after all.
     //// Switch off auto-commit and do transactions manually
     //mysqli_autocommit($this->database, FALSE);
     return TRUE;
 }
Exemplo n.º 3
0
            $outputDropoffs = array();
            $i = 0;
            foreach ($allDropoffs as $dropoff) {
                $outputDropoffs[$i] = array();
                $outputDropoffs[$i]['claimID'] = $dropoff->claimID();
                $outputDropoffs[$i]['senderName'] = $dropoff->senderName();
                $outputDropoffs[$i]['senderOrg'] = $dropoff->senderOrganization();
                $outputDropoffs[$i]['senderEmail'] = $dropoff->senderEmail();
                $outputDropoffs[$i]['createdDate'] = timeForDate($dropoff->created());
                $outputDropoffs[$i]['formattedBytes'] = $dropoff->formattedBytes();
                $outputDropoffs[$i]['Bytes'] = $dropoff->Bytes();
                $totalsize += $theDropbox->database()->DBBytesOfDropoff($dropoff->dropoffID());
                $recipients = $allDropoffs[$i]->recipients();
                $j = 0;
                $outputDropoffs[$i]['recipients'] = array();
                foreach ($dropoff->recipients() as $recipient) {
                    $outputDropoffs[$i]['recipients'][$j] = array();
                    $outputDropoffs[$i]['recipients'][$j]['name'] = htmlentities($recipient[0]);
                    $outputDropoffs[$i]['recipients'][$j]['email'] = htmlentities($recipient[1]);
                    $j++;
                }
                $i++;
            }
            $smarty->assignByRef('dropoffs', $outputDropoffs);
            $smarty->assign('formattedTotalBytes', NSSFormattedMemSize($totalsize));
        }
    } else {
        NSSError($smarty->getConfigVariable('ErrorNotLoggedIn'), "Access Denied");
    }
    $smarty->display('dropoff_list.tpl');
}
Exemplo n.º 4
0
        $names = array();
        $unlockMax = 0;
        $max = $theDropbox->loginFailMax();
        foreach ($all as $rec) {
            $failures[$rec['username']]++;
        }
        foreach ($failures as $user => $count) {
            if ($count >= $max) {
                $lockedout[] = $user;
                $props = array();
                $theDropbox->authenticator()->validUsername($user, $props);
                if ($props['displayName']) {
                    $names[] = $props['displayName'];
                } else {
                    $names[] = "Unknown user";
                }
                $unlockMax++;
            }
        }
        $smarty->assign('lockedout', $lockedout);
        $smarty->assign('lockednames', $names);
        $smarty->assign('unlockMax', $unlockMax);
        $smarty->display('unlock.tpl');
    } else {
        NSSError($smarty->getConfigVariable('ErrorAdminOnly'), "Administrators only");
        $smarty->display('error.tpl');
    }
} else {
    NSSError($smarty->getConfigVariable('ErrorAdminOnly'), "Administrators only");
    $smarty->display('error.tpl');
}
Exemplo n.º 5
0
 public function Tryauthenticate($uname, $password, &$response)
 {
     global $smarty;
     // The username should not be their email address.
     // So remove everything after any @ sign.
     $uname = preg_replace('/@.*$/', '', $uname);
     $uname = preg_replace('/^.*\\\\/', '', $uname);
     //  Bind to one of our LDAP servers:
     foreach ($this->_ldapServers as $ldapServer) {
         if ($this->_ldapUseSSL) {
             $ldapServer = "ldaps://" . $ldapServer;
         }
         if ($ldapConn = ldap_connect($ldapServer)) {
             // Unfortunately ldap_connect() doesn't actually send any packets,
             // so it will pretty much always succeed even if the server's not
             // there.
             // So if the ldap_bind() fails, I have to fail quietly. :-(
             // Set the protocol to 3 only:
             ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3);
             ldap_set_option($ldapConn, LDAP_OPT_REFERRALS, 0);
             //  Connection made, now attempt to bind:
             if ($ldapBind = @ldap_bind($ldapConn, $this->_ldapBindUser, $this->_ldapBindPass)) {
                 break;
             } else {
                 // Failed to bind. If the error was 'Can't contact LDAP server'
                 // then fail quietly and try the next server, else complain.
                 $ldaperror = ldap_error($ldapConn);
                 if (!preg_match('/can[not\']* *contact *ldap *server/i', $ldaperror)) {
                     NSSError("Connected to {$ldapServer} but could not bind, it said {$ldaperror}");
                 }
             }
         }
     }
     if ($ldapBind) {
         if (!is_array($this->_ldapBase)) {
             $this->_ldapBase = array($this->_ldapBase);
         }
         foreach ($this->_ldapBase as $ldapBase) {
             $ldapSearch = ldap_search($ldapConn, $ldapBase, "sAMAccountName={$uname}");
             if ($ldapSearch && ($ldapEntry = ldap_first_entry($ldapConn, $ldapSearch)) && ($ldapDN = ldap_get_dn($ldapConn, $ldapEntry))) {
                 //  We got a result and a DN for the user in question, so
                 //  try binding as the user now:
                 if ($result = @ldap_bind($ldapConn, $ldapDN, $password)) {
                     if ($responseArray = ldap_get_attributes($ldapConn, ldap_first_entry($ldapConn, $ldapSearch))) {
                         $response = array();
                         foreach ($responseArray as $key => $value) {
                             if (@$value['count'] >= 1) {
                                 $response[$key] = $value[0];
                             } else {
                                 $response[$key] = $value;
                             }
                             // Store the list of groups they are a member of
                             if (strtolower($key) == $this->_ldapMemberKey) {
                                 $groups = $value;
                             }
                         }
                         $response['organization'] = $this->_ldapOrg;
                         // Do the authorisation check. User must be a member of a group.
                         $authorisationPassed = TRUE;
                         if ($this->_ldapMemberKey != '' && $this->_ldapMemberRole != '') {
                             $authorisationPassed = FALSE;
                             foreach ($groups as $group) {
                                 if (strtolower($group) == $this->_ldapMemberRole) {
                                     $authorisationPassed = TRUE;
                                 }
                             }
                         }
                         if (!$authorisationPassed) {
                             NSSError($smarty->getConfigVariable('ErrorUnauthorizedUser'), 'Authorisation Failed');
                             $result = -69;
                             if ($ldapConn) {
                                 ldap_close($ldapConn);
                             }
                             return $result;
                         }
                         // Chain to the super class for any further properties to be added
                         // to the $response array:
                         parent::authenticate($uname, $password, $response);
                         if ($ldapConn) {
                             ldap_close($ldapConn);
                         }
                         return $result;
                     }
                 } else {
                     // We found a username matching but password didn't
                     if ($ldapConn) {
                         ldap_close($ldapConn);
                     }
                     return -69;
                 }
                 // } else {
                 //   if ( $ldapConn ) {
                 //     ldap_close($ldapConn);
                 //   }
                 //   return -69;
             }
         }
         // If we get to here, we managed to contact the server, but couldn't
         // find them in any of the BaseDNs we were told to search.
         if ($ldapConn) {
             ldap_close($ldapConn);
         }
         return -69;
     } else {
         NSSError('Check User: Unable to connect to any of the authentication servers; could not authenticate user.', 'LDAP Error');
         if ($ldapConn) {
             ldap_close($ldapConn);
         }
         return -70;
     }
     if ($ldapConn) {
         ldap_close($ldapConn);
     }
     return $result;
 }
Exemplo n.º 6
0
require "../config/preferences.php";
require_once NSSDROPBOX_LIB_DIR . "MyZendTo.Smartyconf.php";
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, TRUE)) {
    $theDropbox->SetupPage();
    if ($thePickup = new NSSDropoff($theDropbox)) {
        $claimID = $thePickup->claimID();
        $smarty->assign('claimID', $claimID);
        $success = $thePickup->removeDropoff();
        # If next=="index" then redirect them to the autoHome page without delay
        if ($success && $_POST['next'] == "index") {
            Header("HTTP/1.1 302 Moved Temporarily");
            Header("Location: " . $NSSDROPBOX_URL);
            exit;
        }
        $smarty->assign('success', $success);
        $smarty->assign('autoHome', TRUE);
        if (!$success) {
            NSSError("Unable to remove the dropoff.  Please contact the system administrator.", "Unable to remove " . $claimID);
        }
    }
}
$smarty->display('delete.tpl');
Exemplo n.º 7
0
 private function DBSetupDatabase($dropbox)
 {
     if ($this->database) {
         if (!$this->DBCreate()) {
             NSSError($errorMsg, "Database Error");
             return FALSE;
         }
         if (!$this->DBCreateReq()) {
             $dropbox->writeToLog("Failed to add reqtable to database");
             NSSError($errorMsg, "Database Error creating reqtable");
             return FALSE;
         }
         if (!$this->DBCreateAuth()) {
             $dropbox->writeToLog("Failed to add authtable to database");
             NSSError($errorMsg, "Database Error creating authtable");
             return FALSE;
         }
         if (!$this->DBCreateUser()) {
             $dropbox->writeToLog("Failed to add usertable to database");
             NSSError($errorMsg, "Database Error creating usertable");
             return FALSE;
         }
         if (!$this->DBCreateRegexps()) {
             $dropbox->writeToLog("Failed to add regexps to database");
             NSSError($errorMsg, "Database Error creating regexps table");
             return FALSE;
         }
         if (!$this->DBCreateLoginlog()) {
             $dropbox->writeToLog("Failed to add loginlog table to database");
             NSSError($errorMsg, "Database Error creating loginlog table");
             return FALSE;
         }
         if (!$this->DBCreateLibraryDesc()) {
             $dropbox->writeToLog("Failed to add librarydesc table to database");
             NSSError($errorMsg, "Database Error creating librarydesc table");
             return FALSE;
         }
         if (!$this->DBCreateAddressbook()) {
             $dropbox->writeToLog("Failed to add addressbook table to database");
             NSSError($errorMsg, "Database Error creating addressbook table");
             return FALSE;
         }
         $dropbox->writeToLog("initial setup of database complete");
         return TRUE;
     }
     return FALSE;
 }
Exemplo n.º 8
0
 public function authenticate(&$uname, $password, &$response)
 {
     global $smarty;
     $result = FALSE;
     //  Bind to one of our LDAP servers:
     foreach ($this->_ldapServers as $ldapServer) {
         //if($this->_ldapUseSSL){$ldapServer="ldaps://".$ldapServer;}
         if ($ldapConn = ldap_connect($ldapServer)) {
             //  Set the protocol to 3 only:
             ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3);
             //  Connection made, now attempt to start TLS and bind anonymously:
             //  Only do start_tls if ldapUseSSL is false
             if (!$this->_ldapUseSSL || ldap_start_tls($ldapConn)) {
                 if ($ldapBind = @ldap_bind($ldapConn, $this->_ldapDn, $this->_ldapPass)) {
                     break;
                 }
             }
         }
     }
     if ($ldapBind) {
         $ldapSearch = ldap_search($ldapConn, $this->_ldapBase, "uid={$uname}");
         if ($ldapSearch && ($ldapEntry = ldap_first_entry($ldapConn, $ldapSearch)) && ($ldapDN = ldap_get_dn($ldapConn, $ldapEntry))) {
             //  We got a result and a DN for the user in question, so
             //  try binding as the user now:
             if ($result = @ldap_bind($ldapConn, $ldapDN, $password)) {
                 if ($responseArray = ldap_get_attributes($ldapConn, ldap_first_entry($ldapConn, $ldapSearch))) {
                     $response = array();
                     foreach ($responseArray as $key => $value) {
                         if (is_array($value) && $value['count'] >= 1) {
                             $response[$key] = $value[0];
                         } else {
                             $response[$key] = $value;
                         }
                         // Store the list of groups they are a member of
                         if (strtolower($key) == $this->_ldapMemberKey) {
                             $groups = $value;
                         }
                     }
                     // Set displayName=cn if not already set
                     if ($this->_ldapFullName != "displayName") {
                         $nameKeys = explode(" ", $this->_ldapFullName);
                         $nameWords = array();
                         foreach ($nameKeys as $k) {
                             if ($k) {
                                 $nameWords[] = $response[$k];
                             }
                         }
                         $response['displayName'] = implode(' ', $nameWords);
                     }
                     if (!$response['cn']) {
                         $response['cn'] = $response['displayName'];
                     }
                     if (!$response['organization']) {
                         $response['organization'] = $this->_ldapOrg;
                     }
                     // Do the authorisation check. User must be a member of a group.
                     $authorisationPassed = TRUE;
                     if ($this->_ldapMemberKey != '' && $this->_ldapMemberRole != '') {
                         $authorisationPassed = FALSE;
                         foreach ($groups as $group) {
                             if (strtolower($group) == $this->_ldapMemberRole) {
                                 $authorisationPassed = TRUE;
                             }
                         }
                     }
                     if (!$authorisationPassed) {
                         NSSError($smarty->getConfigVariable('ErrorUnauthorizedUser'), 'Authorisation Failed');
                         $result = FALSE;
                     }
                     //  Chain to the super class for any further properties to be added
                     //  to the $response array:
                     parent::authenticate($uname, $password, $response);
                 }
             }
         }
     } else {
         NSSError('Unable to connect to any of the LDAP servers; could not authenticate user.', 'LDAP Error');
     }
     if ($ldapConn) {
         ldap_close($ldapConn);
     }
     return $result;
 }
Exemplo n.º 9
0
     // we need to make the resulting web page look pretty.
     $emailAddrs = preg_split('/[;, ]+/', paramPrepare(strtolower($_POST['recipEmail'])), NULL, PREG_SPLIT_NO_EMPTY);
     $wordList = array();
     $emailList = array();
     // This is the output list, separate for safety
     foreach ($emailAddrs as $re) {
         $req = new Req($theDropbox, $re);
         if ($req->formInitError() != "") {
             $theDropbox->SetupPage();
             NSSError($req->formInitError(), "Request error");
             $smarty->display('error.tpl');
             exit;
         }
         if (!$req->sendReqEmail()) {
             $theDropbox->SetupPage();
             NSSError("Sending the request email failed.", "Email error");
             $smarty->display('error.tpl');
             exit;
         }
         $wordList[] = $req->words();
         $emailList[] = $req->recipEmail();
     }
     // Set up the output page
     $theDropbox->SetupPage();
     //$smarty->assign('autoHome', TRUE);
     $smarty->assign('toEmail', implode(', ', $emailList));
     $smarty->assign('reqKey', implode(', ', $wordList));
     //$smarty->assign('reqKey', $req->words());
     $smarty->display('request_sent.tpl');
     exit;
 }
Exemplo n.º 10
0
        $allDropoffs = NSSDropoff::allDropoffs($theDropbox);
        //
        // Start the web page and add some Javascript to automatically
        // fill-in and submit a pickup form when a dropoff on the page
        // is clicked.
        //
        $iMax = count($allDropoffs);
        $totalsize = 0;
        $smarty->assign('countDropoffs', $iMax);
        if ($allDropoffs && $iMax > 0) {
            $outputDropoffs = array();
            $i = 0;
            foreach ($allDropoffs as $dropoff) {
                $outputDropoffs[$i] = array();
                $outputDropoffs[$i]['claimID'] = $dropoff->claimID();
                $outputDropoffs[$i]['senderName'] = $dropoff->senderName();
                $outputDropoffs[$i]['senderOrg'] = $dropoff->senderOrganization();
                $outputDropoffs[$i]['senderEmail'] = $dropoff->senderEmail();
                $outputDropoffs[$i]['createdDate'] = timeForDate($dropoff->created());
                $outputDropoffs[$i]['formattedBytes'] = $dropoff->formattedBytes();
                $totalsize += $theDropbox->database()->DBBytesOfDropoff($dropoff->dropoffID());
                $i++;
            }
            $smarty->assignByRef('dropoffs', $outputDropoffs);
            $smarty->assign('formattedTotalBytes', NSSFormattedMemSize($totalsize));
        }
    } else {
        NSSError("This feature is only available to administrators who have logged-in to the system.", "Access Denied");
    }
    $smarty->display('pickup_list_all.tpl');
}
Exemplo n.º 11
0
require_once NSSDROPBOX_LIB_DIR . "NSSDropoff.php";
if ($theDropbox = new NSSDropbox($NSSDROPBOX_PREFS)) {
    //
    // This page displays usage graphs for the system.
    //
    $theDropbox->SetupPage();
    if ($theDropbox->authorizedUser() && $theDropbox->authorizedUserData('grantStatsPriv')) {
        switch (isset($_GET['period']) ? $_GET['period'] : NULL) {
            case 'month':
                $period = 30;
                break;
            case '90days':
                $period = 90;
                break;
            case 'year':
                $period = 365;
                break;
            case 'decade':
                $period = 3650;
                break;
            case 'week':
            default:
                $period = 7;
                break;
        }
        $smarty->assign('period', $period);
    } else {
        NSSError($smarty->getConfigVariable('ErrorAdminOnly'), "Access Denied");
    }
}
$smarty->display('stats.tpl');
Exemplo n.º 12
0
 private function checkPrefs($prefs)
 {
     static $requiredKeys = array('dropboxDirectory', 'recaptchaPublicKey', 'recaptchaPrivateKey', 'emailDomainRegexp', 'defaultEmailDomain', 'logFilePath', 'cookieName', 'authenticator');
     foreach ($requiredKeys as $key) {
         if (!$prefs[$key] || $prefs[$key] == "") {
             NSSError("You must provide a value for the following preference key: '{$key}'", "Undefined Preference Key");
             return FALSE;
         }
     }
     return TRUE;
 }
Exemplo n.º 13
0
        $auth = $_POST['auth'] ? $_POST['auth'] : $_GET['auth'];
        $result = $theDropbox->ReadAuthData($auth, $authIP, $authEmail, $authOrganization, $authExpiry);
        if (!$result) {
            $theDropbox->SetupPage();
            NSSError($smarty->getConfigVariable('ErrorDownloadAuth'), "Authentication Failure");
            $smarty->display('no_download.tpl');
            exit;
        }
        if ($authExpiry < time()) {
            $theDropbox->SetupPage();
            NSSError($smarty->getConfigVariable('ErrorSessionExpired'), "Session Expired");
            $smarty->display('no_download.tpl');
            exit;
        }
        if ($authIP != $_SERVER["REMOTE_ADDR"]) {
            $theDropbox->SetupPage();
            NSSError($smarty->getConfigVariable('ErrorIPChanged'), "Session Error");
            $smarty->display('no_download.tpl');
            exit;
        }
        // Everything succeeded, so let them through.
    }
    if ($thePickup->dropoffID() > 0) {
        ($fid = $_POST['fid']) || ($fid = $_GET['fid']);
        $downloaded = $thePickup->downloadFile($fid);
    }
    $smarty->assign('wasDownloaded', $downloaded ? TRUE : FALSE);
    if (!$downloaded) {
        $smarty->display('no_download.tpl');
    }
}
Exemplo n.º 14
0
 public function sendVerifyEmail()
 {
     global $smarty;
     global $NSSDROPBOX_URL;
     if ($this->_dropbox->authorizedUser()) {
         // They are an authenticated user so try to get their name and email
         // from the authentication system.
         $senderName = $this->_dropbox->authorizedUserData("displayName");
         if (!$senderName) {
             $senderName = paramPrepare($_POST['senderName']);
         }
         $senderEmail = strtolower($this->_dropbox->authorizedUserData("mail"));
         if (!$senderEmail) {
             $senderEmail = paramPrepare($_POST['senderEmail']);
         }
     } else {
         // They are not an authenticated user so get their name and email
         // from the form.
         $senderName = paramPrepare($_POST['senderName']);
         $senderEmail = paramPrepare(strtolower($_POST['senderEmail']));
     }
     $senderOrganization = paramPrepare($_POST['senderOrganization']);
     // Sanitise the data
     // Still needs doing to save us from nasty crap in email!
     $senderName = preg_replace('/[^a-zA-Z0-9\\.\\-\\_\\+\\"\'\\@\\/\\:\\&\\,\\$ ]/', '', $senderName);
     $senderEmail = preg_replace('/[^a-zA-Z0-9\\.\\-\\_\\+\\"\'\\@\\/\\:\\&\\,\\$ ]/', '', $senderEmail);
     $senderOrganization = preg_replace('/[^a-zA-Z0-9\\.\\-\\_\\+\\"\'\\@\\/\\:\\&\\,\\$ ]/', '', $senderOrganization);
     if (!$senderName) {
         return FALSE;
     }
     if (!$senderEmail) {
         return FALSE;
     }
     if (!preg_match($this->_dropbox->validEmailRegexp(), $senderEmail, $emailParts)) {
         return FALSE;
     }
     // $senderEmail = $emailParts[1]."@".$emailParts[2];
     //  Insert into database:
     $auth = $this->_dropbox->WriteAuthData($senderName, $senderEmail, $senderOrganization);
     if ($auth == '') {
         NSSError("Database failure writing authentication key. Please contact your system administrator.");
         return FALSE;
     }
     $this->_senderName = $senderName;
     $this->_senderOrganization = $senderOrganization;
     $this->_senderEmail = $senderEmail;
     // If they are authenticated user, then generate a form containing
     // the data and auto-post it.
     if ($this->_dropbox->authorizedUser()) {
         Header("HTTP/1.1 302 Moved Temporarily");
         Header("Location: " . $NSSDROPBOX_URL . "dropoff.php?auth=" . $auth);
         $this->_dropbox->writeToLog(sprintf("auto-verification for logged in user %s", $senderEmail));
     } else {
         //  Construct the email notification and deliver:
         $smarty->assign('senderName', $senderName);
         $smarty->assign('senderOrg', $senderOrganization);
         $smarty->assign('senderEmail', $senderEmail);
         $smarty->assign('URL', $NSSDROPBOX_URL . "dropoff.php?auth={$auth}");
         $emailSubject = $smarty->getConfigVariable('VerifyEmailSubject');
         $success = $this->_dropbox->deliverEmail($senderEmail, $smarty->getConfigVariable('EmailSenderAddress'), $emailSubject, $smarty->fetch('verify_email.tpl'));
         if ($success) {
             $this->_dropbox->writeToLog(sprintf("address verification email delivered successfully to %s", $senderEmail));
         } else {
             $this->_dropbox->writeToLog(sprintf("address verification email not delivered successfully to %s", $senderEmail));
             return FALSE;
         }
     }
     // Everything worked and the mail was sent!
     return TRUE;
 }
Exemplo n.º 15
0
 }
 if ($authSuccess || $resp) {
     // They have passed the CAPTCHA so write an AuthData record for them.
     if (!$authSuccess) {
         // But only if they haven't already been auth-ed once.
         $auth = $theDropbox->WriteAuthData($_SERVER['REMOTE_ADDR'], '', '');
     }
     if ($auth == '') {
         // Write failed.
         NSSError("Database failure writing authentication key. Please contact your system administrator.", "Internal Error");
         displayPickupCheck($theDropbox, $smarty, $ayah, $auth);
         exit(0);
     }
 } else {
     // The CAPTCHA response was wrong, so re-present the page with an error
     NSSError($smarty->getConfigVariable('ErrorNotPerson'), "Test failed");
     displayPickupCheck($theDropbox, $smarty, $ayah, $auth);
     exit(0);
 }
 // They have passed the test and we have written their AuthData record.
 $theDropbox->SetupPage();
 $smarty->assign('auth', $auth);
 // And save their auth key!
 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());
     $smarty->display($thePickup->HTMLWrite());
Exemplo n.º 16
0
 $auth = $_GET['auth'];
 // Set default values for library. Only gets over-ridden in 1 case.
 $smarty->assign('usingLibrary', FALSE);
 $smarty->assign('library', '[]');
 $smarty->assign('addressbook', '[]');
 if (!$theDropbox->authorizedUser()) {
     $result = $theDropbox->ReadAuthData($auth, $authFullName, $authEmail, $authOrganization, $authExpiry);
     if (!$result) {
         $theDropbox->SetupPage();
         NSSError("Sender address verification subsystem failure.", "Authentication Failure");
         $smarty->display('new_dropoff.tpl');
         exit;
     }
     if ($authExpiry < time()) {
         $theDropbox->SetupPage();
         NSSError($smarty->getConfigVariable('ErrorSessionExpired'), "Session Expired");
         $smarty->display('new_dropoff.tpl');
         exit;
     }
 }
 $theDropbox->SetupPage();
 # Bug "dropoff.recipName_1");
 $smarty->assign('maxBytesForFileInt', $theDropbox->maxBytesForFile());
 $smarty->assign('maxBytesForDropoffInt', $theDropbox->maxBytesForDropoff());
 if ($theDropbox->authorizedUser()) {
     $authFullName = $theDropbox->authorizedUserData("displayName");
     $authOrganization = $theDropbox->authorizedUserData("organization");
     $authEmail = $theDropbox->authorizedUserData("mail");
     $smarty->assign('addressbook', $theDropbox->getAddressbook());
     if ($theDropbox->usingLibrary()) {
         // This is the only situation in which we allow the library to work
Exemplo n.º 17
0
         } else {
             if (!$theVerify->sendVerifyEmail()) {
                 NSSError("Sending the verification email failed.", "Email error");
             }
             $smarty->assign('autoHome', TRUE);
             $smarty->display('verify_sent.tpl');
         }
         exit;
     }
     // If they reached here, they failed the Captcha test
     $smarty->assign('verifyFailed', TRUE);
 } else {
     // They are an authorised user so don't need a Captcha
     if ($theVerify = new Verify($theDropbox)) {
         if ($theVerify->formInitError() != "") {
             NSSError($theVerify->formInitError(), "Verify error");
             $smarty->display('error.tpl');
         } else {
             // The for worked, go for it!
             $theDropbox->SetupPage();
             $authFullName = $theDropbox->authorizedUserData("displayName");
             $authEmail = $theDropbox->authorizedUserData("mail");
             $authOrganization = paramPrepare($_POST['senderOrganization']);
             $authOrganization = preg_replace('/[^a-zA-Z0-9\\.\\-\\_\\+\\"\'\\@\\/\\:\\&\\, ]/', '', $authOrganization);
             $smarty->assign('senderName', $authFullName);
             $smarty->assign('senderOrg', $authOrganization);
             $smarty->assign('senderEmail', strtolower($authEmail));
             $smarty->assign('recipEmailNum', 1);
             $smarty->assign('addressbook', $theDropbox->getAddressbook());
             # Generate unique ID required for progress bars status
             $smarty->assign('progress_id', uniqid(""));
Exemplo n.º 18
0
 private function initWithQueryResult($qResult)
 {
     $trimmed = trim($qResult['claimID']);
     $this->_dropoffID = $qResult['rowID'];
     $this->_claimID = trim($qResult['claimID']);
     $this->_claimPasscode = trim($qResult['claimPasscode']);
     $this->_authorizedUser = $qResult['authorizedUser'];
     $this->_emailAddr = $qResult['emailAddr'];
     $this->_senderName = $qResult['senderName'];
     $this->_senderOrganization = $qResult['senderOrganization'];
     $this->_senderEmail = $qResult['senderEmail'];
     $this->_note = $qResult['note'];
     $this->_subject = $qResult['subject'];
     $this->_senderIP = $qResult['senderIP'];
     $this->_confirmDelivery = preg_match('/[tT1]/', $qResult['confirmDelivery']) ? TRUE : FALSE;
     $this->_informRecipients = preg_match('/[tT1]/', $qResult['informRecipients']) ? TRUE : FALSE;
     $this->_created = dateForTimestamp($qResult['created']);
     $this->_recipients = $this->_dropbox->database->DBRecipientsForDropoff($qResult['rowID']);
     $this->_bytes = $this->_dropbox->database->DBBytesOfDropoff($qResult['rowID']);
     $this->_formattedBytes = NSSFormattedMemSize($this->_bytes);
     if (!$this->_dropbox->directoryForDropoff($trimmed, $this->_claimDir)) {
         NSSError("The directory containing this drop-off's file has gone missing, please notify the administrator.", "Drop-Off Directory Not Found");
         return FALSE;
     } else {
         return TRUE;
     }
 }