* @param mixed $index The index of the POST var to parse. * @return mixed String of value if value is set, null otherwise. */ function parseStringFromWebVar($index) { if (array_key_exists($index, $_POST) && isset($_POST[$index])) { return (string) $_POST[$index]; } return null; } $setup = new Setup(); $setup->setCreateDatabase(parseBoolFromWebVar('createdb')); $setup->setUseRealKrb(parseBoolFromWebVar('realKrb')); $setup->setSetupTempFolders(parseBoolFromWebVar('setuptmpfolders')); $setup->setUseDevelopmentEnvironment(parseBoolFromWebVar('usedevelopmentenv')); $setup->setUserInfo(parseStringFromWebVar('firstname'), parseStringFromWebVar('surname'), parseStringFromWebVar('username'), parseStringFromWebVar('email')); ?> <?php require './header.html'; ?> <p class="results"> <?php $setup->run(); ?> <ul class="actions"> <li> <a href="../../../" class="positive">Go to HMS</a> </li> <li>
return (string) $array[$index]; } return null; } $shortopts = ''; $shortopts .= 'd'; // If present, create the database $shortopts .= 'h:'; // Users handle $shortopts .= 'n:'; // Users firstname $shortopts .= 's:'; // Users surname $shortopts .= 'e:'; // Users e-mail $shortopts .= 'f'; // If present, set-up the tmp folders $shortopts .= 'v'; // If present, use development configs, settings and databases $options = getopt($shortopts); if (is_array($options)) { $setup = new Setup(); $setup->setCreateDatabase(parseBoolFromArray('d', $options)); $setup->setSetupTempFolders(parseBoolFromArray('f', $options)); $setup->setUseDevelopmentEnvironment(parseBoolFromArray('v', $options)); $setup->setUserInfo(parseStringFromArray('n', $options), parseStringFromArray('s', $options), parseStringFromArray('h', $options), parseStringFromArray('e', $options)); $setup->run(); } else { echo 'Unable to parse options\\n'; exit(1); }