$semester = substr($term, 4, 2); $error = false; // check $term contents if (strlen($term) != 6) { $error = true; $_SESSION['errors'][] = 'Term must be a six-digit number'; } elseif (!is_numeric($term)) { $error = true; $_SESSION['errors'][] = 'Term must be a number.'; } elseif ((int) substr($term, 0, 4) < 2008) { $error = true; $_SESSION['errors'][] = 'Term cannot be less than 2008.'; } elseif ($semester != "10" && $semester != "30") { $error = true; $_SESSION['errors'][] = 'Please specify a fall or spring semester.'; } // check dinner date format if ($dinner === false) { $error = true; $_SESSION['errors'][] = 'Supplied dinner date cannot be parsed as a date string, please try again.'; } if ($error) { header('Location: ' . $GLOBALS['BASE_URL'] . '/config.html'); exit; } // passed the tests. save the data and update the config file AEAPI::option('term')->value($term)->save(); AEAPI::option('accepting')->value($accepting)->save(); AEAPI::option('dinner')->value(strftime('%Y-%m-%d', $dinner))->save(); $_SESSION['messages'][] = 'Your configuration changes were saved.'; header('Location: ' . $GLOBALS['BASE_URL'] . '/config.html');
require_once 'IDMObject.class.php'; require_once 'smarty/Smarty.class.php'; require_once 'BannerStudent.class.php'; require_once 'PSUDatabase.class.php'; /*****************[End Common Includes]********************/ /*******************[Local Includes]**********************/ require_once $GLOBALS['LOCAL_INCLUDES'] . '/AETemplate.class.php'; require_once $GLOBALS['LOCAL_INCLUDES'] . '/AEStudent.class.php'; require_once $GLOBALS['LOCAL_INCLUDES'] . '/utility.php'; /*****************[End Local Includes]********************/ /*******************[Database Connections]*****************/ $GLOBALS['BANNER'] = PSUDatabase::connect('oracle/psc1_psu/fixcase'); /*******************[End Database Connections]*****************/ /*******************[Authentication Stuff]*****************/ IDMObject::authN(); $GLOBALS['BannerStudent'] = new BannerStudent($GLOBALS['BANNER']); $GLOBALS['DBUTIL'] = new PSUDatabase(); /*******************[End Authentication Stuff]*****************/ /*******************[Application Configuration]*****************/ $GLOBALS['TITLE'] = 'Academic Excellence'; $GLOBALS['TEMPLATES'] = $GLOBALS['BASE_DIR'] . '/templates'; $GLOBALS['TERM'] = AEAPI::option('term')->value; $GLOBALS['ACCEPTING_DATA'] = AEAPI::option('accepting')->value; $GLOBALS['IS_SUMMER'] = substr($GLOBALS['TERM'], 4, 2) == '30' ? true : false; $GLOBALS['DINNER_DATE'] = strtotime(AEAPI::option('dinner')->value); $GLOBALS['SPECIAL_NEEDS_DEFAULT'] = 'Please use this space to let us know of any special needs you or your guests may have, ie. if wheelchair access is required.'; /*******************[End Application Configuration]*****************/ if (!isset($_SESSION['ae_init'])) { // must run after we have a term set initializeSession(); }