} if (!class_exists('PDO')) { die('Frac requires the PHP Data Objects extension to be loaded.'); } // Find an action. if (!isset($_GET['do'])) { $_GET['do'] = 'step1'; } // Do the action. switch ($_GET['do']) { case 'step1': doCreateConfig(); die; case 'step2': if ($errors = doWriteConfig()) { doCreateConfig($errors); } die; case 'step3': doPopulateDatabase(); die; default: die; } function doCreateConfig($error = array()) { if (file_exists("config.php")) { header("Location: " . $_SERVER['SCRIPT_NAME'] . "?do=step3"); return; } $flash = '';
/** * Actually creates the new FTS configuration in the database */ function doSaveCreateConfig() { global $data, $lang, $_reload_browser; $err = ''; // Check that they've given a name if ($_POST['formName'] == '') { $err .= "{$lang['strftsconfigneedsname']}<br />"; } if ($_POST['formParser'] != '' && $_POST['formTemplate'] != '') { $err .= "{$lang['strftscantparsercopy']}<br />"; } if ($err != '') { return doCreateConfig($err); } if ($_POST['formParser'] != '') { $formParser = unserialize($_POST['formParser']); } else { $formParser = ''; } if ($_POST['formTemplate'] != '') { $formTemplate = unserialize($_POST['formTemplate']); } else { $formTemplate = ''; } $status = $data->createFtsConfiguration($_POST['formName'], $formParser, $formTemplate, $_POST['formComment']); if ($status == 0) { $_reload_browser = true; doDefault($lang['strftsconfigcreated']); } else { doCreateConfig($lang['strftsconfigcreatedbad']); } }