public static function run() { $action = array_key_exists('action', $_SESSION) ? $_SESSION['action'] : ""; $arguments = array_key_exists('arguments', $_SESSION) ? $_SESSION['arguments'] : ""; switch ($action) { case "show": ProfileController::run(); break; case "update": // For an individual user, show their account edit page if (is_numeric($arguments)) { $targetUserId = $arguments; // Only allow updating if the user is logged in and the // loggedin user is the target user if (self::UserCanEditTargetAccount($targetUserId)) { self::updateUser($targetUserId); } else { HomeView::show(); } } break; default: } }
$_SESSION['authenticated'] = false; } switch ($control) { case "dataset": DatasetController::run(); break; case "login": LoginController::run(); break; case "logout": LogoutController::run(); break; case "measurement": MeasurementController::run(); break; case "profile": ProfileController::run(); break; case "sensor": SensorController::run(); break; case "signup": SignupController::run(); break; case "user": UserController::run(); break; default: HomeView::show(array(null)); } ob_end_flush();
$control = $urlPieces[2]; } ###(ENDSECTION) Parse URL ###(SECTION) Redirect switch ($control) { case "sign-up": SignUpController::run(null); break; case "log-in": LogInController::run(null); break; case "dashboard": DashboardController::run(null); break; case "profile": ProfileController::run(null); break; case "edit-profile": EditProfileController::run(null); break; case "build-map": MapController::run(null); break; case "log-out": LogOutController::run(null); break; default: if (array_key_exists("session", $_COOKIE)) { DashboardController::run(null); } else { LandingView::show(null);