public function index() { \helpers\Session::init(); if (\helpers\Session::get('username')) { if (\helpers\Session::get('admin')) { \helpers\url::redirect('exec'); } else { \helpers\url::redirect('welcome'); } } if ($_POST['submit']) { $is_valid = \helpers\gump::is_valid($_POST, array('fname' => 'required|alpha', 'lname' => 'required|alpha', 'dob' => 'required', 'gender' => 'required', 'year' => 'required', 'email' => 'required|valid_email', 'phone' => 'required', 'stunum' => 'required|numeric', 'issue1' => 'required', 'issue2' => 'required', 'issue3' => 'required')); if ($is_valid === true) { $this->submit(); } else { $data['errors'] = $is_valid; } } $data['title'] = "Apply"; $data['questions'] = $this->apply_model->getAllQuestions(); $data['issues'] = $this->apply_model->getAllIssues(); $data['options'] = $this->apply_model->getAllQuestionOptions(); $data['colleges'] = $this->apply_model->getAllColleges(); View::rendertemplate('header', $data); View::render('apply/apply', $data, $error); View::rendertemplate('footer', $data); }
public function create() { Session::init(); if (Session::get('username')) { if (!Session::get('admin')) { Url::redirect('welcome'); } } else { Url::redirect(''); } $data['title'] = 'Register Site Leader'; $data['seasons'] = $this->mabTrip->get_seasons(); $data['season_names'] = array(); foreach ($data['seasons'] as $season) { array_push($data['season_names'], $season->name); } $first_name = htmlspecialchars($_POST['first_name']); $last_name = htmlspecialchars($_POST['last_name']); $gender = $_POST['gender']; $hometown = $_POST['hometown']; $schoolYear = $_POST['schoolYear']; $email = htmlspecialchars($_POST['email']); $phone_num = htmlspecialchars($_POST['phone_num']); $dob_arr = explode("/", $_POST['date_of_birth']); $birthday = $dob_arr[2] . "-" . $dob_arr[0] . "-" . $dob_arr[1]; $seasonId = $_POST['seasonId']; $is_valid = \helpers\gump::is_valid($_POST, array('first_name' => 'required|alpha', 'last_name' => 'required|alpha', 'gender' => 'required', 'email' => 'required|valid_email', 'phone_num' => 'required', 'date_of_birth' => 'required', 'seasonId' => 'required', 'hometown' => 'required', 'schoolYear' => 'required')); $site_leader_insert_error = ""; if ($is_valid === true) { if (isset($_POST['insert_site_leader'])) { $personId = $this->mab->insert_person($first_name, $last_name, $gender, $email, $phone_num, $birthday, $hometown, $schoolYear); if ($personId == 0) { $site_leader_insert_error = "Site leader's email address already exists."; } else { $this->mab->insert_is_a_site_leader($personId, $seasonId); } } } else { $data['errors'] = $is_valid; } View::rendertemplate('exec_header', $data); View::render('register/registerSiteLeader', $data, $error); View::rendertemplate('footer', $data); }
public function addmedia($parameter) { $media_type = $parameter[0]; $this->data['media_type'] = $media_type; $this->data['album_categories'] = $this->category_model->get(array('category_slug' => 'album')); $category = $this->category_model->getColRow('category_title', $media_type); $this->data['title'] = 'Add ' . ucfirst($media_type); if (isset($_POST['title']) && !empty($_POST['title'])) { $title = $_POST['title']; $artist = $_POST['artist']; $description = $_POST['description']; $youtubelink = $_POST['youtubelink']; $category_id = $_POST['category']; // $status_id = $status->status_id; $slug = \helpers\url::generateSafeSlug($title); if (isset($youtubelink) && $youtubelink != '') { $exp = explode('=', $youtubelink); if (count($exp) > 1) { $youtubelink = $exp[1]; } } $insert_array = array('album_item_album_id' => \helpers\session::get('user')->user_album_id, 'album_item_category_id' => $category->category_id, 'album_item_user_id' => \helpers\session::get('user')->user_id, 'album_item_title' => $title, 'album_item_artist' => $artist, 'album_item_description' => $description, 'album_item_youtubelink' => $youtubelink, 'album_item_created' => time(), 'album_item_alias' => $slug); $insert_array = \helpers\gump::xss_clean($insert_array); $insert_array = \helpers\gump::sanitize($insert_array); $insert_id = $this->albumitem_model->create($insert_array); if ($insert_id > 0) { $message = 'ok'; } else { $message = 'no'; } //check if item is a video // $category_type = $this->category_model->find($_POST['category']); if ($media_type == 'video' && isset($youtubelink) && $youtubelink != '') { $youtube_url = "https://i.ytimg.com/vi/" . $youtubelink . "/maxresdefault.jpg"; if (!file_exists($youtube_url)) { $youtube_url = "https://i.ytimg.com/vi/" . $youtubelink . "/hqdefault.jpg"; } //resize youtube image into uploads folder \helpers\upload::setName(time()); \helpers\upload::resizeUrl($youtube_url, UPLOAD_PATH, '480px'); $image_name = \helpers\upload::getFileName('images'); $update_data = array('album_item_file' => $image_name); $where_array = array('album_item_id' => $insert_id); $this->albumitem_model->update($update_data, $where_array); } //UPLOAD ATTACHMENT if ($_FILES["image"]["tmp_name"] != '') { //upload image into uploads folder \helpers\upload::setName(uniqid()); \helpers\upload::resizeUpload($_FILES["image"], UPLOAD_PATH, '480px'); $image_name = \helpers\upload::getFileName('images'); $update_data = array('album_item_file' => $image_name); $where_array = array('album_item_id' => $insert_id); $this->albumitem_model->update($update_data, $where_array); } } if ($message == 'ok') { \helpers\session::set('success', 'record edited'); $url = 'user/' . $media_type; \helpers\url::redirect($url); } else { if ($message == 'no') { $this->data['error'] = 'Operation Fails!'; } } View::rendertemplate('header', $this->data); View::rendertemplate('mobile-menu', $this->data); View::render('user/user.media', $this->data); View::rendertemplate('footer', $this->data); }
public function create() { Session::init(); if (Session::get('username')) { if (Session::get('admin')) { Url::redirect('exec'); } } else { Url::redirect(''); } $data['title'] = 'Trip Profile'; $tripId = \helpers\Session::get("tripId"); $data['location_info'] = $this->mab->location_info($tripId); $data['trip_profile'] = $this->mab->get_trip_information($tripId); $data['participant_roster'] = $this->mab->participant_information(); $data['site_leader_roster'] = $this->mab->site_leader_information(); $data['states'] = $this->locations->get_all_states(); $housing_site = htmlspecialchars($_POST['housing_site']); $contact_name = htmlspecialchars($_POST['contact_name']); $address = htmlspecialchars($_POST['address']); $city = htmlspecialchars($_POST['city']); $state = htmlspecialchars($_POST['state']); $zip = htmlspecialchars($_POST['zip']); $phone = htmlspecialchars($_POST['phone']); $email = htmlspecialchars($_POST['email']); $is_housing_valid = \helpers\gump::is_valid($_POST, array('housing_site' => 'required', 'contact_name' => 'required|alpha', 'address' => 'required', 'city' => 'required|alpha', 'state' => 'required|alpha', 'email' => 'required|valid_email', 'phone' => 'required')); if ($is_housing_valid == true) { if (isset($_POST['save_housing'])) { $this->mab->insert_housing($tripId, $housing_site, $address, $city, $state, $zip); $housingId = $this->mab->find_housingId($tripId, $housing_site); $this->mab->update_housingId($tripId, $housingId); $this->mab->insert_housing_contact($housingId, $contact_name, $email, $phone); } } $service_site = htmlspecialchars($_POST['service_site']); $website = htmlspecialchars($_POST['website']); $service_contact_name = htmlspecialchars($_POST['service_contact_name']); $service_address = htmlspecialchars($_POST['service_address']); $service_city = htmlspecialchars($_POST['service_city']); $service_state = htmlspecialchars($_POST['service_state']); $service_zip = htmlspecialchars($_POST['service_zip']); $service_phone = htmlspecialchars($_POST['service_phone']); $service_email = htmlspecialchars($_POST['service_email']); $is_service_valid = \helpers\gump::is_valid($_POST, array('service_site' => 'required', 'website' => 'required', 'service_contact_name' => 'required|alpha', 'service_address' => 'required', 'service_city' => 'required|alpha', 'service_state' => 'required|alpha', 'service_email' => 'required|valid_email', 'service_phone' => 'required')); if ($is_service_valid == true) { if (isset($_POST['save_service'])) { $this->mab->insert_service($tripId, $service_site, $service_address, $website, $service_city, $service_state, $service_zip); $serviceSiteId = $this->mab->find_serviceSiteId($tripId, $service_site); $this->mab->update_trip_sites($tripId, $serviceSiteId); $this->mab->insert_service_contact($serviceSiteId, $service_contact_name, $service_email, $service_phone); } } if (isset($_POST['delete_housing'])) { $this->mab->delete_housing($data['trip_profile']->housingId); } if (isset($_POST['deleteServiceSiteBtn'])) { $serviceSiteId = $_POST['deleteTrip']; $this->mab->delete_service_site($serviceSiteId); } $data['apps_by_gender'] = $this->analytics->get_gender_by_trip($tripId); $data['apps_by_grade'] = $this->analytics->get_school_year_by_trip($tripId); View::rendertemplate('header', $data); View::render('trip/trip', $data, $error); View::rendertemplate('footer', $data); }