function modifyCollections() { $db = new Querier(); for ($i = 0; $i < $this->_collection_count; $i++) { $qUpColl = "INSERT INTO faq_faqpage (faq_id, faqpage_id) VALUES (\n " . scrubData($this->_faq_id, "integer") . ",\n " . scrubData($this->_collection[$i], "integer") . ")"; $rUpColl = $db->query($qUpColl); $this->_debug .= "<p>3. (update faq_faqpage loop) : {$qUpColl}</p>"; if ($rUpColl === FALSE) { echo blunDer("We have a problem with the faq_faqpage query: {$qUpColl}"); } } }
} return; // return early so we don't show the stuff that follows break; case "delete_discipline": // Make sure no one is associated with this discipline $qChecker = "SELECT * FROM subject, subject_discipline WHERE subject.subject_id = subject_discipline.subject_id\n AND subject_discipline.discipline_id = " . scrubData($_POST["delete_id"], "integer"); $rChecker = $db->query($qChecker); //print $qChecker; if (count($rChecker) != 0) { print _("Your request cannot be completed: There are one or more records linked to this source"); } else { $qDeleteD = "DELETE FROM discipline WHERE discipline_id = " . scrubData($_POST["delete_id"], "integer"); $rDeleteD = $db->exec($qDeleteD); if (!$rDeleteD) { echo blunDer("We have a problem with the delete source query: {$qDeleteD}"); } else { print _("Thy Will Be Done. Discipline list updated."); } } return; // return early so we don't show the stuff that follows break; case "address_lookup": //print urlencode($_REQUEST["address"]); $endpoint = "http://maps.googleapis.com/maps/api/geocode/json?address=" . urlencode($_REQUEST["address"]) . "&sensor=false"; $address = curl_get($endpoint); //print $address; $output = json_decode($address); //print $output->results[0]->geometry->location->lat; $lat = $output->results[0]->geometry->location->lat;
function modifyTabs() { $db = new Querier(); $lstrQuery = "INSERT INTO tab (subject_id, tab_index) VALUES ('" . scrubData($this->_subject_id, "integer") . "', '0')"; $rscResponse = $db->exec($lstrQuery); $this->_debug .= "<p>4. (insert new tab) : {$lstrQuery}</p>"; if (!$rscResponse) { echo blunDer("We have a problem with the new tab query: {$rscResponse}"); } }
function modifyLocation() { $db = new Querier(); foreach ($this->_location_id as $key => $value) { // wipe entry in location_title if ($value == "") { // Blank location, do an insert $qInsertLoc = "INSERT INTO location (format, call_number, location, access_restrictions, eres_display, display_note, ctags, helpguide) VALUES (\n\t\t\t\t'" . scrubData($this->_format[$key], "integer") . "',\n\t\t\t\t" . $db->quote(scrubData($this->_call_number[$key])) . ",\n\t\t\t\t" . $db->quote(scrubData($this->_location[$key])) . ",\n\t\t\t\t'" . scrubData($this->_access_restrictions[$key], "integer") . "',\n\t\t\t\t'" . scrubData($this->_eres_display[$key]) . "',\n\t\t\t\t" . $db->quote(scrubData($this->_display_note[$key], "richtext")) . ",\n\t\t\t\t" . $db->quote(scrubData($this->_ctags[$key])) . ",\n\t\t\t\t" . $db->quote(scrubData($this->_helpguide[$key])) . "\n\t\t\t\t)"; $rInsertLoc = $db->exec($qInsertLoc); $this->_debug .= "<p>5a. insert location loop: {$qInsertLoc}</p>"; if (!$rInsertLoc) { echo blunDer("We have a problem with the insert locations query: {$qInsertLoc}"); } $current_location_id = $db->last_id(); } else { // Existing location, do an update $qUpLoc = "UPDATE location SET format = '" . scrubData($this->_format[$key], "integer") . "', call_number = '" . scrubData($this->_call_number[$key]) . "', location = '" . scrubData($this->_location[$key]) . "', access_restrictions = '" . scrubData($this->_access_restrictions[$key], "integer") . "', eres_display = '" . scrubData($this->_eres_display[$key]) . "', display_note = '" . scrubData($this->_display_note[$key], "richtext") . "', ctags = " . $db->quote(scrubData($this->_ctags[$key])) . ", helpguide = " . $db->quote(scrubData($this->_helpguide[$key])) . " WHERE location_id = " . scrubData($this->_location_id[$key], "integer"); $rUpLoc = $db->exec($qUpLoc); $this->_debug .= "<p>5b. update location loop: {$qUpLoc}</p>"; if ($rUpLoc === FALSE) { echo blunDer("We have a problem with the update locations query: {$qUpLoc}"); } $current_location_id = scrubData($this->_location_id[$key]); $this->_debug .= "<p>current loc id = {$current_location_id}"; } // If/else over, now do an insert to location_title $qInsertLocTitle = "INSERT INTO location_title (title_id, location_id) VALUES (\n\t" . scrubData($this->_title_id, "integer") . ",\n\t{$current_location_id}\n\t)"; $this->_debug .= "<p>6. insert into location_title: {$qInsertLocTitle}</p>"; $rInsertLocTitle = $db->exec($qInsertLocTitle); if (!$rInsertLocTitle) { echo blunDer("We have a problem with the insert location_title query: {$qInsertLocTitle}"); } } }
public function insertRecord() { ///////////////////// // update tb table ///////////////////// $db = new Querier(); $qInsertTB = "INSERT INTO talkback (question, q_from, date_submitted, answer, a_from, display, tbtags, cattags) VALUES (\n\t " . $db->quote(scrubData($this->_question, "text")) . ",\n\t " . $db->quote(scrubData($this->_q_from, "text")) . ",\n NOW(),\n\t " . $db->quote(scrubData($this->_answer, "richtext")) . ",\n\t " . $db->quote(scrubData($this->_a_from, "text")) . ",\n " . $db->quote(scrubData($this->_display, "integer")) . ",\n " . $db->quote(scrubData($this->_tbtags, "text")) . ",\n " . $db->quote(scrubData($this->_cattags, "text")) . "\n )"; $rInsertTB = $db->exec($qInsertTB); $this->_talkback_id = $db->last_id(); $this->_debug = "<p>1. insert: {$qInsertTB}</p>"; if (!$rInsertTB) { echo blunDer("We have a problem with the tb query: {$qInsertTB}"); } // ///////////////////// // Alter chchchanges table // table, flag, item_id, title, staff_id //////////////////// $updateChangeTable = changeMe("talkback", "insert", $this->_talkback_id, $this->_question, $_SESSION['staff_id']); // message //$this->_message = _("Thy Will Be Done.") . " <a href=\"guide.php?talkback_id=" . $this->_talkback_id . "\">" . _("View Your Guide") . "</a>"; }
public function insertRecord() { ///////////////////// // update refstats table ///////////////////// $db = new Querier(); $qInsert = "INSERT INTO uml_refstats (type_id, location_id, mode_id, date, note) VALUES (\n\t " . $db->quote(scrubData($this->_type_id, "integer")) . ",\n\t " . $db->quote(scrubData($this->_location_id, "integer")) . ",\n " . $db->quote(scrubData($this->_mode_id, "integer")) . ",\n " . $db->quote(scrubData($this->_date, "text")) . ",\n " . $db->quote(scrubData($this->_note, "text")) . "\n )"; //print $qInsert; // if we're doing multiple identicals. we loop $x = 0; while ($x < $this->_submit_times_x) { $rInsert = $db->query($qInsert); $x++; } $this->_refstat_id = $db->last_id(); $this->_debug = "<p>1. insert: {$qInsert}</p>"; if (!$rInsert) { echo blunDer("We have a problem with the tb query: {$qInsert}"); } // message $this->_message = _("Thy Will Be Done."); }
public function insertRecord() { //////////////// // hash password //////////////// $db = new Querier(); $this->_password = md5($this->_password); //////////////// // Insert staff //////////////// $qInsertStaff = "INSERT INTO staff (fname, lname, title, tel, department_id, staff_sort, email, user_type_id, password, ptags, active, bio) VALUES (\n\t\t'" . $db->quote(scrubData($this->_fname)) . "',\n\t\t'" . $db->quote(scrubData($this->_lname)) . "',\n\t\t'" . $db->quote(scrubData($this->_title)) . "',\n\t\t'" . $db->quote(scrubData($this->_tel)) . "',\n\t\t'" . $db->quote(scrubData($this->_department_id, "integer")) . "',\n\t\t'" . $db->quote(scrubData($this->_staff_sort, "integer")) . "',\n\t\t'" . $db->quote(scrubData($this->_email, "email")) . "',\n\t\t'" . $db->quote(scrubData($this->_user_type_id, "integer")) . "',\n\t\t'" . $db->quote(scrubData($this->_password)) . "',\n\t\t'" . $db->quote(scrubData($this->_ptags)) . "',\n '" . $db->quote(scrubData($this->_active, "integer")) . "',\n '" . $db->quote(scrubData($this->_bio, "richtext")) . "'\n\t\t)"; $rInsertStaff = $db->query($qInsertStaff); $this->_debug .= "<p class=\"debug\">Insert query: {$qInsertStaff}</p>"; if (!$rInsertStaff) { echo blunDer("We have a problem with the insert staff query: {$qInsertStaff}"); } $this->_staff_id = $db->last_id(); // create folder if ($this->_staff_id) { $user_folder = explode("@", $this->_email); $path = "../../assets/users/_" . $user_folder[0]; mkdir($path); // And copy over the generic headshot image and headshot_large.jpg $nufile = $path . "/headshot.jpg"; $copier = copy("../../assets/images/headshot.jpg", $nufile); $copier = copy("../../assets/images/headshot.jpg", $path . "/headshot_large.jpg"); } // ///////////////////// // Alter chchchanges table // table, flag, item_id, title, staff_id //////////////////// $updateChangeTable = changeMe("staff", "insert", $this->_staff_id, $this->_email, $_SESSION['staff_id']); // message $this->_message = _("Thy Will Be Done. Added."); }
public function insertRecord() { ///////////////////// // add to vid table ///////////////////// $db = new Querier(); $qInsertVid = "INSERT INTO video (title, description, source, foreign_id, duration, date, display, vtags) VALUES (" . $db->quote(scrubData($this->_title, 'text')) . "," . $db->quote(scrubData($this->_description, 'richtext')) . "," . $db->quote(scrubData($this->_source, 'text')) . "," . $db->quote(scrubData($this->_foreign_id, 'text')) . "," . $db->quote(scrubData($this->_duration, 'text')) . "," . $db->quote(scrubData($this->_date, 'text')) . "," . $db->quote(scrubData($this->_display, 'integer')) . "," . $db->quote(scrubData($this->_vtags, 'text')) . ")"; $rInsertVid = $db->exec($qInsertVid); $this->_video_id = $db->last_id(); $this->_debug = "<p>1. insert: {$qInsertVid}</p>"; if (!$rInsertVid) { echo blunDer("We have a problem with the tb query: {$qInsertVid}"); } // ///////////////////// // Alter chchchanges table // table, flag, item_id, title, staff_id //////////////////// $updateChangeTable = changeMe("video", "insert", $this->_video_id, $this->_title, $_SESSION['staff_id']); // message $this->_message = _("Thy Will Be Done. Added."); }