Example #1
0
// dropbox filepaths setup for us, beyond simply needing our
// configuration!
//
require "../config/preferences.php";
require_once NSSDROPBOX_LIB_DIR . "MyZendTo.Smartyconf.php";
require_once NSSDROPBOX_LIB_DIR . "NSSDropbox.php";
if ($theDropbox = new NSSDropbox($NSSDROPBOX_PREFS, TRUE)) {
    //
    // This page handles several actions.  By default, it simply
    // presents whatever "main menu" is appropriate.  This page also
    // handles the presentation of the login "dialog" and subsequently
    // the logout facility.
    //
    switch ($_GET['action'] ? $_GET['action'] : $_POST['action']) {
        case 'logout':
            $theDropbox->logout();
            $theDropbox->SetupPage();
            $smarty->assign('autoHome', TRUE);
            $smarty->display('logout.tpl');
            break;
        default:
            $aU = $theDropbox->authorizedUser();
            if ($aU) {
                // Show their list of dropoffs
                Header("HTTP/1.1 302 Moved Temporarily");
                Header("Location: " . $NSSDROPBOX_URL . "pickup_list.php");
            } else {
                $theDropbox->SetupPage("login.uname");
                $smarty->display('login.tpl');
            }
            break;