public function insertRecord() { global $salt; global $use_shibboleth; $db = new Querier(); //////////////// // check and hash password //////////////// // only do if someone isn't using Shib if (isset($use_shibboleth) && $use_shibboleth === TRUE) { // set password to the salt; this shouldn't actually ever be used/accessed $this->_password = md5($salt); } else { if ($this->correctPassword($this->_password)) { $this->_password = md5($this->_password); } else { $this->_message = _("Pasword must have a special character, a letter, a number, and at least 6 characters. Insert was not executed."); return; } } //////////////// // check whether email is unique /////////////// if (!$this->isEmailUnique("insert")) { $this->_message = _("Email is not unique. Insert was not executed."); return; } $qInsertStaff = "INSERT INTO staff (fname, lname, title, tel, department_id, staff_sort, email, user_type_id, password, ptags, active, bio,\n position_number, job_classification, room_number, supervisor_id, emergency_contact_name,\n emergency_contact_relation, emergency_contact_phone, street_address, city, state, zip, home_phone, cell_phone, fax, intercom, lat_long, social_media) VALUES ( " . $db->quote(scrubData($this->_fname)) . "," . $db->quote(scrubData($this->_lname)) . "," . $db->quote(scrubData($this->_title)) . "," . $db->quote(scrubData($this->_tel)) . "," . $db->quote($this->_department_id[0]) . "," . $db->quote(scrubData($this->_staff_sort, "integer")) . "," . $db->quote(scrubData($this->_email, "email")) . "," . $db->quote(scrubData($this->_user_type_id, "integer")) . "," . $db->quote(scrubData($this->_password)) . "," . $db->quote(scrubData($this->_ptags)) . "," . $db->quote(scrubData($this->_active, "integer")) . "," . $db->quote(scrubData($this->_bio, "richtext")) . "," . $db->quote(scrubData($this->_position_number)) . "," . $db->quote(scrubData($this->_job_classification)) . "," . $db->quote(scrubData($this->_room_number)) . "," . $db->quote($this->_supervisor_id) . "," . $db->quote(scrubData($this->_emergency_contact_name)) . "," . $db->quote(scrubData($this->_emergency_contact_relation)) . "," . $db->quote(scrubData($this->_emergency_contact_phone)) . "," . $db->quote(scrubData($this->_street_address)) . "," . $db->quote(scrubData($this->_city)) . "," . $db->quote(scrubData($this->_state)) . "," . $db->quote(scrubData($this->_zip)) . "," . $db->quote(scrubData($this->_home_phone)) . "," . $db->quote(scrubData($this->_cell_phone)) . "," . $db->quote(scrubData($this->_fax)) . "," . $db->quote(scrubData($this->_intercom)) . "," . $db->quote(scrubData($this->_lat_long)) . "," . $db->quote(scrubData($this->_social_media)) . ")"; $rInsertStaff = $db->exec($qInsertStaff); $this->_debug .= "<p class=\"debug\">Insert query: {$qInsertStaff}</p>"; $this->_staff_id = $db->last_id(); ///////////////////// // insert into staff_department //////////////////// self::modifySD(); // create folder if ($this->_staff_id) { $user_folder = explode("@", $this->_email); $path = "../../assets/users/_" . $user_folder[0]; if (!@mkdir($path)) { // $mkdirErrorArray = error_get_last(); // throw new Exception('cant create directory ' .$mkdirErrorArray['message'], 1); // message $this->_message = _("Couldn't create directory in /assets/users/. Please check this folder's permissions. "); return; } else { // And copy over the generic headshot image and headshot_large image $nufile = $path . "/headshot.jpg"; $copier = copy("../../assets/images/headshot.jpg", $nufile); $copier = copy("../../assets/images/headshot.jpg", $path . "/headshot_large.jpg"); // message $this->_message = _("Thy Will Be Done. Added."); } } /////////////////////// // Alter chchchanges table // table, flag, item_id, title, staff_id //////////////////// //$updateChangeTable = changeMe("staff", "insert", $this->_staff_id, $this->_email, $_SESSION['staff_id']); }
public function load_libguides_links_xml($lib_guides_xml_path) { $db = new Querier(); $libguides_xml = new \SimpleXMLElement(file_get_contents($lib_guides_xml_path, 'r')); $link_values = $libguides_xml->xpath("//GUIDE[{$this->_guide_id}]//LINKS/LINK"); $db = new Querier(); foreach ($link_values as $link) { $record_check = $db->query("SELECT COUNT(*) FROM location WHERE location = " . $db->quote($link->URL)); //error_log ( $record_check) ; //error_log ("RECORD CHECK!!!!!!!!!!!!!!!!!!!!!!"); //error_log($record_check[0][0]); if ($record_check[0][0] == 0) { if ($db->exec("INSERT INTO location (location, format, access_restrictions, eres_display) VALUES (" . $db->quote($link->URL) . " , 1, 1, 'N' )")) { //error_log("Inserted location"); $location_id = $db->last_id(); } else { //error_log ("Error inserting location:"); // } // When inserting the titles into the databases, articles (a, an, the) should be removed and then stored in the prefix field $matches = array(); preg_match("/^\\b(the|a|an|la|les|el|las|los)\\b/i", $link->NAME, $matches); // If there isn't an article in the title if (empty($maches[0])) { if ($db->exec("INSERT INTO title (title, description) VALUES (" . $db->quote($link->NAME) . "," . $db->quote($link->DESCRIPTION_SHORT) . ")")) { //error_log( "Inserted title"); $title_id = $db->last_id(); } else { //error_log("Error inserting title:" ); //error_log( $db->errorInfo() ); } } // If there is an article in the title if (isset($matches[0])) { $clean_link_name = preg_replace("/^\\b(the|a|an|la|les|el|las|los)/i", " ", $link->NAME); if ($db->exec("INSERT INTO title (title, description, pre) VALUES (" . $db->quote($clean_link_name) . "," . $db->quote($link->DESCRIPTION_SHORT) . "," . $db->quote($matches[0]) . ")")) { //error_log( "Inserted title"); $title_id = $db->last_id(); } else { //error_log("Error inserting title:" ); //error_log( $db->errorInfo() ); } } if ($db->exec("INSERT INTO location_title (title_id, location_id) VALUES ({$title_id}, {$location_id} )")) { //error_log( "Inserted location_title"); } else { //error_log( "Error inserting location_title:"); //error_log( $db->errorInfo() ); //error_log( "INSERT INTO location_title (title_id, location_id) VALUES ($title_id, $location_id)"); } } } }
public function insertRecord() { ///////////////////// // update tb table ///////////////////// $db = new Querier(); $qInsert = "INSERT INTO faq (question, answer, keywords) VALUES (\n\t " . $db->quote(scrubData($this->_question, 'text')) . ",\n\t " . $db->quote(scrubData($this->_answer, 'richtext')) . ",\n " . $db->quote(scrubData($this->_keywords, 'text')) . "\n )"; $rInsert = $db->exec($qInsert); $this->_faq_id = $db->last_id(); ///////////////////// // insert into rank //////////////////// self::modifySubjects(); ///////////////////// // insert/update locations //////////////////// self::modifyCollections(); // ///////////////////// // Alter chchchanges table // table, flag, item_id, title, staff_id //////////////////// $updateChangeTable = changeMe("faq", "insert", $this->_faq_id, $this->_question, $_SESSION['staff_id']); // message $this->_message = _("Thy Will Be Done."); }
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."); }
public function insertRecord() { $db = new Querier(); // Make sure there isn't a guide with this title or shortform already $is_dupe = self::dupeCheck(); if ($is_dupe == TRUE) { $this->_message = _("There is already a guide with this SHORTFORM. The shortform must be unique."); return; } ////////////////// // Encode our extra as json ///////////////// $json_extra = json_encode($this->_extra); ///////////////////// // update subject table ///////////////////// $qInsertSubject = "INSERT INTO subject (subject, shortform, description, keywords, redirect_url, active, type, header, extra) VALUES (\n " . $db->quote(scrubData($this->_subject, "text")) . ",\n " . $db->quote(scrubData($this->_shortform, "text")) . ",\n " . $db->quote(scrubData($this->_description, "text")) . ",\n " . $db->quote(scrubData($this->_keywords, "text")) . ",\n " . $db->quote(scrubData($this->_redirect_url, "text")) . ",\n " . $db->quote(scrubData($this->_active, "integer")) . ",\n " . $db->quote(scrubData($this->_type, "text")) . ",\n " . $db->quote(scrubData($this->_header, "text")) . ",\n " . $db->quote($json_extra) . "\n )"; $db = new Querier(); $rInsertSubject = $db->exec($qInsertSubject); $this->_subject_id = $db->last_id(); $this->_debug = "<p>1. insert subject: {$qInsertSubject}</p>"; if (!$rInsertSubject) { echo blunDer("We have a problem with the title query: {$qInsertSubject}"); } ///////////////////// // insert into staff_subject //////////////////// self::modifySS(); ///////////////////// // insert into subject_discipline //////////////////// self::modifySD(); /////////////////// // create inital tab /////////////////// self::modifyTabs(); // ///////////////////// // Alter chchchanges table // table, flag, item_id, title, staff_id //////////////////// $updateChangeTable = changeMe("guide", "insert", $this->_subject_id, $this->_subject, $_SESSION['staff_id']); // Insert subject_department relationship $insert_department = new Querier(); $dept_query = "INSERT INTO subject_department (id_subject, id_department) VALUES ('{$this->_subject_id} ', '{$this->_department}')"; $insert_department->exec($dept_query); //print_r ($insert_department); ///////////////////// // insert into subject_subject for parent-child //////////////////// self::modifySubSub(); // message $this->_message = _("Thy Will Be Done.") . " <a href=\"guide.php?subject_id=" . $this->_subject_id . "\">" . _("Add Content To Your New Guide") . "</a>"; }