function get($tourID) { if (is_numeric($tourID) && $tourID > 0) { $q = "select * from Tours where ID = " . $tourID; $db = new db(); $r = mysql_query($q); if (!$r) { return Error::MySQL(); } $row = mysql_fetch_assoc($r); if ($row['ID']) { $to = new Tour(); $to->ID = $row['ID']; $to->start_date = $row['start_date']; $to->end_date = $row['end_date']; $to->title = $db->sanitize_from_db($row['title']); $to->description = $db->sanitize_from_db($row['description']); $to->is_active = $row['is_active']; $to->av_area_id = $row['av_area_id']; $to->photo_area_id = $row['photo_area_id']; return $to; } } return Error::create("Invalid tour ID."); }
function get($diaryID) { if (!is_numeric($diaryID) && !$diaryID) { return Error::create("Invalid diary ID."); } $q = "select * from Band_Diaries where ID = " . $diaryID; $db = new db(); $r = mysql_query($q); if (!$r) { return Error::MySQL(); } $row = mysql_fetch_assoc($r); if (!$row['ID']) { return Error::create("Invalid diary ID."); } $bd = new BandMemberDiary(); $bd->ID = $row['ID']; $bd->title = $db->sanitize_from_db($row['title']); $bd->member_id = $row['member_id']; $bd->date_time = $row['date_time']; $bd->body = $db->sanitize_from_db($row['body']); $bd->is_active = $row['is_active']; return $bd; }
function get() { $q = "select * from Band_Information"; $db = new db(); $r = mysql_query($q); if ($r) { $result = mysql_num_rows($r); if ($result > 0) { $row = mysql_fetch_assoc($r); $bi = new BandInformation(); foreach ($row as $key => $value) { $bi->{$key} = $db->sanitize_from_db($value); } return $bi; } else { $bi = new BandInformation(); return $bi; } } else { return Error::MySQL(); } }
function get($showID) { if (is_numeric($showID) && $showID > 0) { $q = "select * from Shows where ID = " . $showID; $db = new db(); $r = mysql_query($q); if (!$r) { return Error::MySQL(); } $row = mysql_fetch_assoc($r); if ($row['ID']) { $sh = new Show(); $sh->ID = $row['ID']; $sh->date = $db->sanitize_from_db($row['date']); $sh->name = $db->sanitize_from_db($row['name']); $sh->time = $db->sanitize_from_db($row['time']); $sh->other_bands = $db->sanitize_from_db($row['other_bands']); $sh->cost = $db->sanitize_from_db($row['cost']); $sh->is_all_ages = $row['is_all_ages']; $sh->notes = $db->sanitize_from_db($row['notes']); $sh->user_id = $row['user_id']; $sh->is_active = $row['is_active']; $sh->venue_id = $row['venue_id']; $sh->av_area_id = $row['av_area_id']; $sh->photo_area_id = $row['photo_area_id']; return $sh; } } return Error::create("Invalid show ID."); }
function get($userID) { if ($userID > 0 && is_numeric($userID)) { $q = "select ID, firstname, lastname, birthdate, is_active, username, password, email, level from Users where ID = {$userID}"; $r = mysql_query($q); $row = mysql_fetch_assoc($r); if ($row['ID']) { $uo = new User(); $uo->ID = $row['ID']; $uo->username = $row['username']; $uo->lastname = db::sanitize_from_db($row['lastname']); $uo->password = $row['password']; $uo->firstname = db::sanitize_from_db($row['firstname']); $uo->birthdate = $row['birthdate']; $uo->is_active = $row['is_active']; $uo->email = $row['email']; $uo->level = $row['level']; return $uo; } } return Error::create("Invalid user ID."); }
function get($newsID) { if ($newsID > 0 && is_numeric($newsID)) { $q = "select * from Band_News where ID = " . $newsID; $r = mysql_query($q); $row = mysql_fetch_assoc($r); if ($row['ID']) { $no = new BandNews(); $no->ID = $row['ID']; $no->title = db::sanitize_from_db($row['title']); $no->user_id = $row['user_id']; $no->date_time = $row['date_time']; $no->description = db::sanitize_from_db($row['description']); $no->body = db::sanitize_from_db($row['body']); $no->is_active = $row['is_active']; return $no; } } return Error::create("Invalid News Posting ID."); }
function get($gpID) { if (is_numeric($gpID) && $gpID > 0) { $q = "select * from Band_Guest_Performers where ID = " . $gpID; $r = mysql_query($q); $row = mysql_fetch_assoc($r); if ($row['ID']) { $gp = new BandGuestPerformer(); $gp->ID = $row['ID']; $gp->firstname = db::sanitize_from_db($row['firstname']); $gp->lastname = db::sanitize_from_db($row['lastname']); $gp->function = db::sanitize_from_db($row['function']); $gp->description = db::sanitize_from_db($row['description']); $gp->website = db::sanitize_from_db($row['website']); $gp->is_active = $row['is_active']; return $gp; } } return Error::create("Invalid guest performer ID."); }
function get($instanceID) { if ($instanceID > 0 && is_numeric($instanceID)) { $q = "select DarkRoom_Media.date_time, DarkRoom_Media.filename, DarkRoom_Media.filename_original, DarkRoom_Media.type, "; $q .= "DarkRoom_Media_to_Areas.* from DarkRoom_Media_to_Areas inner join DarkRoom_Media on DarkRoom_Media_to_Areas.media_id = "; $q .= "DarkRoom_Media.ID where DarkRoom_Media_to_Areas.ID = {$instanceID}"; $r = mysql_query($q); $m = new MediaInstance(); if ($r) { $row = mysql_fetch_assoc($r); if ($row['ID']) { foreach ($row as $key => $value) { $m->{$key} = db::sanitize_from_db($value); } return $m; } } } $e = new Error(); $e->add('Invalid media instance ID.'); return $e; }
function get($linkID) { $q = "select ID, name, description, url, category_id, is_active from Links where ID = {$linkID}"; $r = mysql_query($q); if (!$r) { return Error::MySQL(); } $row = mysql_fetch_assoc($r); if (!$row['ID']) { return Error::create("Invalid Link ID."); } $l = new Link(); $l->ID = $row['ID']; $l->name = db::sanitize_from_db($row['name']); $l->description = db::sanitize_from_db($row['description']); $l->url = db::sanitize_from_db($row['url']); $l->category_id = $row['category_id']; $l->is_active = $row['is_active']; return $l; }
function get($venueID) { if (is_numeric($venueID) && $venueID > 0) { $q = "select * from Venues where ID = " . $venueID; $db = new db(); $r = mysql_query($q); if (!$r) { return Error::MySQL(); } $row = mysql_fetch_assoc($r); if ($row['ID']) { $ve = new Venue(); $ve->ID = $row['ID']; $ve->name = db::sanitize_from_db($row['name']); $ve->address1 = db::sanitize_from_db($row['address1']); $ve->address2 = db::sanitize_from_db($row['address2']); $ve->city = db::sanitize_from_db($row['city']); $ve->stateProvince = db::sanitize_from_db($row['stateProvince']); $ve->postalCode = $row['postalCode']; $ve->directions = db::sanitize_from_db($row['directions']); $ve->is_active = $row['is_active']; $ve->user_id = $row['user_id']; $ve->country = db::sanitize_from_db($row['country']); return $ve; } } return Error::create("Invalid venue ID."); }
function get($bmeID) { $db = new db(); if ($bmeID > 0) { $q = "select ID, role, equipment, influences, bio, av_area_id, photo_area_id, is_active, user_id from Band_Members where ID = {$bmeID}"; $r = mysql_query($q); $row = mysql_fetch_assoc($r); $bme = new BandMember(); if ($row['ID']) { $bme->ID = $row['ID']; $bme->role = $db->sanitize_from_db($row['role']); $bme->equipment = $db->sanitize_from_db($row['equipment']); $bme->influences = $db->sanitize_from_db($row['influences']); $bme->bio = $db->sanitize_from_db($row['bio']); $bme->av_area_id = $row['av_area_id']; $bme->photo_area_id = $row['photo_area_id']; $bme->is_active = $row['is_active']; $bme->user_id = $row['user_id']; return $bme; } } $e = new Error(); $e->add("Please specify a valid band member ID."); return $e; }
function get($trackID) { if (is_numeric($trackID) && $trackID > 0) { $q = "select * from Release_Tracks where ID = " . $trackID; $db = new db(); $r = mysql_query($q); if (!$r) { return Error::MySQL(); } $row = mysql_fetch_assoc($r); if ($row['ID']) { $re = new ReleaseTrack(); $re->ID = $row['ID']; $re->title = db::sanitize_from_db($row['title']); $re->meta_information = db::sanitize_from_db($row['meta_information']); $re->lyrics = db::sanitize_from_db($row['lyrics']); $re->length = $row['length']; $re->release_id = $row['release_id']; $re->number = $row['number']; $re->audio_file = $row['audio_file']; $re->av_area_id = $row['av_area_id']; return $re; } } return Error::create("Invalid track ID."); }
function get($releaseID) { if (is_numeric($releaseID) && $releaseID > 0) { $q = "select * from Releases where ID = " . $releaseID; $db = new db(); $r = mysql_query($q); if (!$r) { return Error::MySQL(); } $row = mysql_fetch_assoc($r); if ($row['ID']) { $re = new Release(); $re->ID = $row['ID']; $re->title = $db->sanitize_from_db($row['title']); $re->sub_title = $db->sanitize_from_db($row['sub_title']); $re->notes = $db->sanitize_from_db($row['notes']); $re->press_notes = $db->sanitize_from_db($row['press_notes']); $re->date = $row['date']; $re->is_active = $row['is_active']; $re->av_area_id = $row['av_area_id']; $re->photo_area_id = $row['photo_area_id']; return $re; } } return Error::create("Invalid release ID."); }