<?php define(MAIN_PATH, realpath('.')); include_once MAIN_PATH . '/init.php'; echo render_header(); $user = User::getLoggedIn(); if (!$user) { go_home(); } $params = parse_http_args($_POST, array('save')); if ($params['save']) { if ($user->disconnectFromFacebook()) { header('Location: account.php'); } else { $error = 'Could not disconnect from Facebook for an unknown reason.'; } } if ($error) { echo '<div class="error">' . $error . '</div>'; } ?> <h3>Are you sure you want to disconnect your Facebook account?</h3> <p> Your Facebook information and friend connections will be deleted. Any information you entered on this site will remain. </p> <form action="disconnect.php" method="post"> <input type="hidden" name="save" value="1" /> <input type="submit" class="inputsubmit" value="Disconnect From Facebook" />
<?php define(MAIN_PATH, realpath('.')); include_once MAIN_PATH . '/init.php'; echo render_header(); $user = User::getLoggedIn(); if (!$user) { echo render_logged_out_index(); echo render_footer(); exit; } $params = parse_http_args($_POST, array('time', 'miles', 'route', 'date_month', 'date_day', 'date_year', 'publish_to_facebook')); // If the user has added a run, then handle the form post if (!empty($params['miles'])) { $run = new Run($user, $params); if (!$run->save()) { echo render_error('Something went wrong while saving the run.'); } else { $success = 'Added a new run!'; // This will only be true if the checkbox on the previous page was checked // The feed_loading div will be killed by JS that runs once the feed form // is generated (since it can sometimes take a second or two) if ($params['publish_to_facebook']) { register_feed_form_js($run); $success .= '<div id="feed_loading">Publishing to Facebook... ' . '<img src="http://static.ak.fbcdn.net/images/upload_progress.gif?0:25923" /></div>'; } echo render_success($success); } } // Show the basic add run form on the home page echo '<div class="clearfix">';
<?php define(MAIN_PATH, realpath('.')); include_once MAIN_PATH . '/init.php'; echo render_header(); if ($user = User::getLoggedIn()) { // do nothing } else { if (!empty($_POST)) { $params = parse_http_args($_POST, array('save', 'username', 'name', 'email', 'password')); if ($params['save']) { $user_params = array('username' => $params['username'], 'name' => $params['name'], 'email' => $params['email'], 'password' => $params['password']); $user = new User($user_params); // Don't register with facebook in this case if (!$user->saveAndRegister()) { $user = null; $error = 'Error: Could not register account with Facebook.'; } } } } if ($user) { $user->logIn(); go_home(); } if ($error) { echo '<div class="error">' . $error . '</div>'; } ?>
<?php /* * Form handler for the login submission. */ define(MAIN_PATH, realpath('.')); include_once MAIN_PATH . '/init.php'; if (User::getLoggedIn()) { go_home(); } $error = ''; $params = parse_http_args($_POST, array('password', 'username')); /* * If user entered normal username/password, * then log them in via their normal account. */ if ($params['password'] && $params['username']) { $user = User::getByUsername($params['username']); if (!$user) { $error = 'Unknown username: <b>' . $params['username'] . '</b>'; } else { if (!$user->logIn($params['password'])) { $error = 'Bad password for <b>' . $params['username'] . '</b>.'; } else { // log in success! go_home(); } } } echo render_header(); if ($error) {