public static function validate_post_form($post_id, $post_title, $post_title, $post_content, $post_image, $post_date, $post_cat_id, $post_user_id, $post_venue, $post_time_stamp, $post_address_1, $post_address_2, $post_state, $post_city, $post_zip) { $create_post_ok = 'N'; if (isset($_POST['submit'])) { if (empty($post_title)) { echo 'post Name field must not be empty, please enter a name for your post'; } else { $create_post_ok = 'Y'; } if (empty($post_date)) { echo 'Please set a date for your post'; } else { $create_post_ok = 'Y'; } if (empty($post_venue)) { echo 'Please enter a venue for your post'; } else { $create_post_ok = 'Y'; } if ($create_post_ok == 'Y') { $post = new post(); $post->create_post($post_id, $post_title, $post_title, $post_content, $post_image, $post_date, $post_cat_id, $post_user_id, $post_venue, $post_time_stamp, $post_address_1, $post_address_2, $post_state, $post_city, $post_zip); } } else { echo 'Enter post info'; } }
} catch (Exception $e) { //put error message to the client } break; case 'registration': try { $register = new registration($_POST['name'], $_POST['email'], $_POST['last_name'], $_POST['first_name'], $_POST['password']); header("Location: index.php?p=login"); } catch (Exception $e) { //put error message to the client } break; case 'post': if (!$_POST["post_id"]) { $post = new post(); $post_id = $post->create_post($_POST["title"], $_POST["date"], htmlentities($_POST["content_code"]), $_POST["category"], $_POST["status"], $_POST["tag_list"], $_COOKIE['ea_user']); header('Location: index.php?p=edit_post&id=' . $post_id); } else { $post = new post(); post::update_post($_POST["title"], $_POST["date"], htmlentities($_POST["content_code"]), $_POST["category"], $_POST["status"], $_POST["tag_list"], $_POST["post_id"]); //itt lehet majd bővíteni, kész a többi opció header('Location: index.php?p=edit_post&id=' . $_POST["post_id"]); } break; case 'category': if (!isset($_POST['cat_name'])) { category::update_category_list($_POST); header('Location: index.php?p=category'); } else { $category = new category(); $category->create_category($_POST['cat_name']);