$stop_to_read_update->name = $_POST['name']; $stop_to_read_update->location_latitude = $_POST['location_latitude']; $stop_to_read_update->location_longitude = $_POST['location_longitude']; if ($stop_to_read_update->update()) { $session->message("Success! The Bus Stop details were updated. "); redirect_to('admin-list-stops.php'); } else { $session->message("Error! The Bus Stop details could not be updated. "); } } if (isset($_POST['upload'])) { $photo_to_upload = new Photograph(); $photo_to_upload->related_object_type = '2'; $photo_to_upload->related_object_id = $_GET['stopid']; $photo_to_upload->photo_type = $_POST['photo_type']; $photo_to_upload->attach_file_bus_stop($_FILES['file_upload'], $photo_to_upload->stop_id, $photo_to_upload->photo_type); if ($photo_to_upload->save()) { $session->message("Success! The photo was uploaded successfully. "); redirect_to('admin-list-stops.php'); } else { $message = join("<br />", $photo_to_upload->errors); } } } else { if ($session->object_type == 4) { //bus personnel $user = $bus_personnel_object->find_by_id($_SESSION['id']); $profile_picture = $photo_object->get_profile_picture($session->object_type, $user->id); } else { //everyone else $session->message("Error! You do not have sufficient priviledges to view the requested page. ");