} if (!$e) { // WRITE THE CONFIG FILE, YAY! $cf = file_get_contents("inc/config.php"); $cf = configSetting($cf, "twitter_screenname", $_POST['twitter_screenname']); $cf = configSetting($cf, "timezone", $_POST['tz']); $cf = configSetting($cf, "path", $sPath); $cf = configSetting($cf, "hostname", $_POST['db_hostname']); $cf = configSetting($cf, "username", $_POST['db_username']); $cf = configSetting($cf, "password", $_POST['db_password']); $cf = configSetting($cf, "database", $_POST['db_database']); $cf = configSetting($cf, "table_prefix", $_POST['db_table_prefix']); $cf = configSetting($cf, "maintenance_http_password", $_POST['maintenance_http_password']); $cf = configSetting($cf, "anywhere_apikey", $_POST['anywhere_apikey']); $cf = configSetting($cf, "follow_me_button", !empty($_POST['follow_me_button'])); $cf = configSetting($cf, "smartypants", !empty($_POST['smartypants'])); $f = fopen("inc/config.php", "wt"); $fe = "Could not write configuration to <code>config.php</code>, please make sure that it is writable! Often, this is done through giving every system user the write privileges on that file through FTP."; if ($f) { if (fwrite($f, $cf)) { fclose($f); $success = true; } else { $e[] = $fe; } } else { $e[] = $fe; } } } }
if (isset($_SESSION['status']) && $_SESSION['status'] == 'not verified') { $e[] = '<strong>We could not verify you through Twitter.</strong> Please make sure you’ve entered the correct credentials on the Twitter authentication page.'; } // Message shown when people have actively tried to go through OAuth but there was an old key or other mechanical mishap if (isset($_SESSION['status']) && $_SESSION['status'] == 'try again') { $e[] = '<strong>Something broke during the verification through Twitter.</strong> Please try again.'; } // We have the access token! Everything should be good! if (isset($_SESSION['status']) && $_SESSION['status'] == 'verified' && isset($_SESSION['access_token'])) { // Time to write the config file with the information we now have. $cf = file_get_contents('inc/config.php'); $cf = configSetting($cf, 'consumer_key', $_SESSION['entered_consumer_key']); $cf = configSetting($cf, 'consumer_secret', $_SESSION['entered_consumer_secret']); $cf = configSetting($cf, 'your_tw_screenname', $_SESSION['access_token']['screen_name']); $cf = configSetting($cf, 'twitter_token', $_SESSION['access_token']['oauth_token']); $cf = configSetting($cf, 'twitter_token_secr', $_SESSION['access_token']['oauth_token_secret']); $f = fopen('inc/config.php', 'wt'); $fe = 'Could not write configuration to <code>config.php</code>, please make sure that it is writable! Often, ' . 'this is done through giving every system user the write privileges on that file through FTP.'; if ($f) { if (fwrite($f, $cf)) { fclose($f); $success = true; } else { $e[] = $fe; } } else { $e[] = $fe; } } // Someone's submitting! if ($post && !$success) {